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 
37 namespace DCMTree
38 {
39  class IOParameter;
40  typedef boost::shared_ptr<IOParameter> IOParameterPtr;
41  typedef boost::shared_ptr<const IOParameter> Const_IOParameterPtr;
42 
57  {
58  public:
61 
63  explicit IOParameter(const IOParameter &other);
64 
66  enum Flags
67  {
68  ReadPixelData = 1,
69  ReadPixelDataLazily = 2,
70  ReadPrivateTags = 4,
71  ConvertToUTF8 = 8
72  };
73 
82  static IOParameterPtr create(const std::string& filename, bool readImage = true,
83  bool readPrivateTags = true, bool convertToUTF8 = true, const std::string& pixelBufferFilename = std::string() );
84 
91  static IOParameterPtr create(const std::string& filename, int flags, const std::string& pixelBufferFilename = std::string());
92 
94  virtual std::string filename() const = 0;
95 
97  virtual std::string pixelBufferFilename() const = 0;
98 
100  virtual int getFlags() const = 0;
101 
103  virtual bool readPixelData() const = 0;
104 
106  virtual bool readPrivateTags() const = 0;
107 
109  virtual bool convertToUTF8() const = 0;
110 
112  virtual ~IOParameter();
113 
116 
118  virtual void setNumberOfToleratedBadTags(unsigned int numBadTags=5);
119 
121  virtual unsigned int getNumberOfToleratedBadTags() const;
122 
123  protected:
126 
128  static void setPrototype(Const_IOParameterPtr prototype);
129 
136  virtual IOParameterPtr createConcrete(const std::string& filename, int flags, const std::string& pixelBufferFilename) const = 0;
137 
138  private:
140  static Const_IOParameterPtr _prototype;
141 
142  unsigned int _numberOfToleratedBadTags;
143  };
144 
145 }
146 
147 #ifdef _MSC_VER
148  #pragma warning (pop)
149 #endif
150 
151 #endif
152 
153 
#define DCMTREE_EXPORT
base class to wrap parameters to be used for reading/writing messages this is needed because the tool...
static Const_IOParameterPtr prototype()
the current concrete prototype
virtual int getFlags() const =0
Returns the flags passed to the constructor.
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.
virtual std::string filename() const =0
name of the file to be read or written
virtual bool readPixelData() const =0
true if the reader should read the binary pixel data
IOParameter(const IOParameter &other)
copy - ctor
static IOParameterPtr create(const std::string &filename, int flags, const std::string &pixelBufferFilename=std::string())
abstract factory create method
virtual ~IOParameter()
dtor
Flags
Flags to be or'ed together for create().
virtual unsigned int getNumberOfToleratedBadTags() const
returns number of tolerated bad tags which are found in a file before skipping it as bad
IOParameter & operator=(const IOParameter &other)
assignment operator (makes deep copy)
virtual std::string pixelBufferFilename() const =0
name of the optional pixel buffer file containing the image data to be written
virtual bool convertToUTF8() const =0
true if character should be converted to UTF8
virtual bool readPrivateTags() const =0
true if private tags should be read
virtual void setNumberOfToleratedBadTags(unsigned int numBadTags=5)
set number of tolerated bad tags which 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
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...
boost::shared_ptr< IOParameter > IOParameterPtr
boost::shared_ptr< const IOParameter > Const_IOParameterPtr