1 /*=========================================================================
4 Module: $RCSfile: vtkGdcmReader.h,v $
6 Date: $Date: 2006/03/29 11:23:43 $
7 Version: $Revision: 1.31 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef __vtkGdcmReader_h
20 #define __vtkGdcmReader_h
22 #include "gdcmCommon.h" // To avoid warnings concerning the std
25 #include <vtkImageReader.h>
30 typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, gdcm::File *);
32 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
36 class VTK_EXPORT vtkGdcmReader : public vtkImageReader
39 static vtkGdcmReader *New();
40 vtkTypeRevisionMacro(vtkGdcmReader, vtkImageReader);
41 void PrintSelf(ostream& os, vtkIndent indent);
43 virtual void RemoveAllFileName(void);
44 virtual void AddFileName(const char *name);
45 virtual void SetFileName(const char *name);
48 void SetCoherentFileList( std::vector<gdcm::File* > *cfl) {
49 CoherentFileList = cfl; }
52 vtkSetMacro(AllowLightChecking, bool);
53 vtkGetMacro(AllowLightChecking, bool);
54 vtkBooleanMacro(AllowLightChecking, bool);
57 void SetUserFunction (VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
58 { UserFunction = userFunc; }
62 // If this flag is set and the DICOM reader encounters a dicom file with
63 // lookup table the data will be kept as unsigned chars and a lookuptable
64 // will be exported and accessible through GetLookupTable()
65 vtkSetMacro(AllowLookupTable, bool);
66 vtkGetMacro(AllowLookupTable, bool);
67 vtkBooleanMacro(AllowLookupTable, bool);
69 vtkGetObjectMacro(LookupTable, vtkLookupTable);
71 // FIXME : HOW to doxygen a VTK macro?
73 * \ brief Sets the LoadMode as a boolean string.
74 * gdcm.LD_NOSEQ, gdcm.LD_NOSHADOW, gdcm.LD_NOSHADOWSEQ...
75 * (nothing more, right now)
76 * WARNING : before using NO_SHADOW, be sure *all* your files
77 * contain accurate values in the 0x0000 element (if any)
78 * of *each* Shadow Group. The parser will fail if the size is wrong !
79 * @param mode Load mode to be used
81 vtkSetMacro(LoadMode, int);
82 vtkGetMacro(LoadMode, int);
83 vtkBooleanMacro(LoadMode, int);
89 virtual void ExecuteInformation();
90 virtual void ExecuteData(vtkDataObject *output);
92 //virtual void BuildData(vtkDataObject *output); // for VTK5.0
93 virtual void BuildFileListFromPattern();
94 virtual void LoadFileInformation();
95 virtual void UpdateFileInformation();
97 virtual void GetFileInformation(gdcm::File *file);
98 virtual bool TestFileInformation(gdcm::File *file);
102 void RemoveAllInternalFileName(void);
103 void AddInternalFileName(const char *name);
104 void RemoveAllInternalFile(void);
107 void IncrementProgress(const unsigned long updateProgressTarget,
108 unsigned long &updateProgressCount);
109 /*void LoadImageInMemory(std::string fileName, unsigned char *dest,
110 const unsigned long updateProgressTarget,
111 unsigned long &updateProgressCount);*/
113 void LoadImageInMemory(gdcm::File *f, unsigned char *dest,
114 const unsigned long updateProgressTarget,
115 unsigned long &updateProgressCount);
120 typedef std::vector<gdcm::File *> gdcmFileList;
123 vtkLookupTable *LookupTable;
124 vtkTimeStamp fileTime;
126 bool AllowLookupTable;
127 bool AllowLightChecking;
130 // Number of columns of the image/volume to be loaded
132 // Number of lines of the image/volume to be loaded
134 // Number of lines of the image/volume to be loaded
136 // Total number of planes (or images) of the stack to be build.
137 int TotalNumberOfPlanes;
138 // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
140 // Type of the image[s]: 8/16/32 bits, signed/unsigned:
141 std::string ImageType;
142 // Pixel size (in number of bytes):
144 // List of filenames to be read in order to build a stack of images
145 // or volume. The order in the list shall be the order of the images.
146 std::list<std::string> FileNameList;
147 gdcmFileList *CoherentFileList;
150 // List of filenames created in ExecuteInformation and used in
152 // If FileNameList isn't empty, InternalFileNameList is a copy of
154 // Otherwise, InternalFileNameList correspond to the list of
156 std::list<std::string> InternalFileNameList;
157 gdcmFileList InternalFileList;
158 //bool Execution; // For VTK5.0
162 /// \brief Bit string integer (each one considered as a boolean)
163 /// Bit 0 : Skip Sequences, if possible
164 /// Bit 1 : Skip Shadow Groups if possible
165 /// Bit 2 : Skip Sequences inside a Shadow Group, if possible
166 /// Probabely (?), some more to add
169 /// Pointer to a user suplied function to allow modification of pixel order
170 VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
174 //-----------------------------------------------------------------------------