MeVisLab Toolbox Reference
DCMTree_IOParameter.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef DCM_TREE_IOPARAMETER_H
14#define DCM_TREE_IOPARAMETER_H
15
16#include "DCMTree_Defines.h"
17#include "DCMTree_Lib.h"
18
19#ifdef _MSC_VER
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22#endif
23
24namespace DCMTree
25{
26 class IOParameter;
27 typedef boost::shared_ptr<IOParameter> IOParameterPtr;
28 typedef boost::shared_ptr<const IOParameter> Const_IOParameterPtr;
29
44 {
45 public:
48
50 explicit IOParameter(const IOParameter &other);
51
53 enum Flags
54 {
55 ReadPixelData = 1,
56 ReadPixelDataLazily = 2,
57 ReadPrivateTags = 4,
58 ConvertToUTF8 = 8
59 };
60
69 static IOParameterPtr create(const std::string& filename, bool readImage = true,
70 bool readPrivateTags = true, bool convertToUTF8 = true, const std::string& pixelBufferFilename = std::string() );
71
78 static IOParameterPtr create(const std::string& filename, int flags, const std::string& pixelBufferFilename = std::string());
79
84 virtual void setDicomContent(const std::string& content) = 0;
85
87 virtual std::string filename() const = 0;
88
90 virtual const std::string& dicomContent() const = 0;
91
93 virtual std::string pixelBufferFilename() const = 0;
94
96 virtual int getFlags() const = 0;
97
99 virtual bool readPixelData() const = 0;
100
102 virtual bool readPrivateTags() const = 0;
103
105 virtual bool convertToUTF8() const = 0;
106
108 virtual ~IOParameter();
109
112
114 virtual void setNumberOfToleratedBadTags(unsigned int numBadTags=5);
115
117 virtual unsigned int getNumberOfToleratedBadTags() const;
118
119 protected:
122
124 static void setPrototype(Const_IOParameterPtr prototype);
125
132 virtual IOParameterPtr createConcrete(const std::string& filename, int flags, const std::string& pixelBufferFilename) const = 0;
133
134 private:
136 static Const_IOParameterPtr _prototype;
137
138 unsigned int _numberOfToleratedBadTags;
139 };
140
141}
142
143#ifdef _MSC_VER
144 #pragma warning (pop)
145#endif
146
147#endif
148
149
#define DCMTREE_EXPORT
Base class to wrap parameters to be used for reading/writing messages.
static Const_IOParameterPtr prototype()
Returns the current concrete prototype.
virtual int getFlags() const =0
Returns the flags passed to the constructor.
virtual const std::string & dicomContent() const =0
Returns the content of a (virtual) DICOM file.
static IOParameterPtr create(const std::string &filename, bool readImage=true, bool readPrivateTags=true, bool convertToUTF8=true, const std::string &pixelBufferFilename=std::string())
Abstract factory create method.
static void setPrototype(Const_IOParameterPtr prototype)
The concrete prototype is set by the implementing DLL.
IOParameter & operator=(const IOParameter &other)
Assignment operator that makes a deep copy.
virtual std::string filename() const =0
Returns the name of the file to be read or written.
virtual bool readPixelData() const =0
Returns true if the reader should read the binary pixel data.
IOParameter()
Constructor.
IOParameter(const IOParameter &other)
Copy constructor.
static IOParameterPtr create(const std::string &filename, int flags, const std::string &pixelBufferFilename=std::string())
Abstract factory create method.
virtual ~IOParameter()
Destructor.
Flags
Flags to be OR'd together for create().
virtual void setDicomContent(const std::string &content)=0
If a DICOM content is set, any further read operation will use this content instead of a filename (wh...
virtual unsigned int getNumberOfToleratedBadTags() const
Returns the number of tolerated bad tags that are found in a file before skipping it as bad.
virtual std::string pixelBufferFilename() const =0
Returns the name of the optional pixel buffer file containing the image data to be written.
virtual bool convertToUTF8() const =0
Returns true if character should be converted to UTF-8.
virtual bool readPrivateTags() const =0
Returns true if private tags should be read.
virtual void setNumberOfToleratedBadTags(unsigned int numBadTags=5)
Sets the number of tolerated bad tags that are found in a file before skipping it as bad.
virtual IOParameterPtr createConcrete(const std::string &filename, int flags, const std::string &pixelBufferFilename) const =0
Concrete factory create method of the implementing prototype, called by the abstract one.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
Class to dump a DCMTree DICOM message into a human-readable file.
boost::shared_ptr< IOParameter > IOParameterPtr
boost::shared_ptr< const IOParameter > Const_IOParameterPtr