1 /*=========================================================================
4 Module: $RCSfile: vtkGdcmReader.h,v $
6 Date: $Date: 2009/04/18 14:42:51 $
7 Version: $Revision: 1.36 $
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_NAME_SPACE::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_NAME_SPACE::File* > *cfl) {
49 CoherentFileList = cfl; }
52 //vtkSetMacro(AllowLightChecking, bool);
53 //vtkGetMacro(AllowLightChecking, bool);
54 //vtkBooleanMacro(AllowLightChecking, bool);
58 /// \todo fix possible problems around VTK pipelining
60 void SetUserFunction (VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
61 { UserFunction = userFunc; }
65 // If this flag is set and the DICOM reader encounters a dicom file with
66 // lookup table the data will be kept as unsigned chars and a lookuptable
67 // will be exported and accessible through GetLookupTable()
69 vtkSetMacro(AllowLookupTable, bool);
70 vtkGetMacro(AllowLookupTable, bool);
71 vtkBooleanMacro(AllowLookupTable, bool);
73 vtkSetMacro(KeepOverlays, bool);
74 vtkGetMacro(KeepOverlays, bool);
75 vtkBooleanMacro(KeepOverlays, bool);
77 vtkSetMacro(FlipY, bool);
78 vtkGetMacro(FlipY, bool);
79 vtkBooleanMacro(FlipY, bool);
81 vtkGetObjectMacro(LookupTable, vtkLookupTable);
83 // FIXME : HOW to doxygen a VTK macro?
85 * \ brief Sets the LoadMode as a boolean string.
86 * gdcm.LD_NOSEQ, gdcm.LD_NOSHADOW, gdcm.LD_NOSHADOWSEQ...
87 * (nothing more, right now)
88 * WARNING : before using NO_SHADOW, be sure *all* your files
89 * contain accurate values in the 0x0000 element (if any)
90 * of *each* Shadow Group. The parser will fail if the size is wrong !
91 * @param mode Load mode to be used
93 vtkSetMacro(LoadMode, int);
94 vtkGetMacro(LoadMode, int);
95 vtkBooleanMacro(LoadMode, int);
98 * \ brief drop images with duplicate position
99 * and therefore calculate ZSpacing for the whole file set
100 * @param mode user wants to drop images with duplicate position
102 vtkSetMacro(DropDuplicatePositions, bool);
103 vtkGetMacro(DropDuplicatePositions, bool);
104 vtkBooleanMacro(DropDuplicatePositions, bool);
110 virtual void ExecuteInformation();
111 virtual void ExecuteData(vtkDataObject *output);
113 //virtual void BuildData(vtkDataObject *output); // for VTK5.0
114 virtual void BuildFileListFromPattern();
115 virtual void LoadFileInformation();
116 virtual void UpdateFileInformation();
118 virtual void GetFileInformation(GDCM_NAME_SPACE::File *file);
119 virtual bool TestFileInformation(GDCM_NAME_SPACE::File *file);
123 void RemoveAllInternalFileName(void);
124 void AddInternalFileName(const char *name);
125 void RemoveAllInternalFile(void);
128 void IncrementProgress(const unsigned long updateProgressTarget,
129 unsigned long &updateProgressCount);
130 /*void LoadImageInMemory(std::string fileName, unsigned char *dest,
131 const unsigned long updateProgressTarget,
132 unsigned long &updateProgressCount);*/
134 void LoadImageInMemory(GDCM_NAME_SPACE::File *f, unsigned char *dest,
135 const unsigned long updateProgressTarget,
136 unsigned long &updateProgressCount);
141 typedef std::vector<GDCM_NAME_SPACE::File *> gdcmFileList;
144 vtkLookupTable *LookupTable;
145 vtkTimeStamp fileTime;
147 bool AllowLookupTable;
148 bool AllowLightChecking;
151 // Number of columns of the image/volume to be loaded
153 // Number of lines of the image/volume to be loaded
155 // Number of lines of the image/volume to be loaded
157 // Total number of planes (or images) of the stack to be build.
158 int TotalNumberOfPlanes;
159 // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
161 // Type of the image[s]: 8/16/32 bits, signed/unsigned:
162 std::string ImageType;
163 // Pixel size (in number of bytes):
165 // List of filenames to be read in order to build a stack of images
166 // or volume. The order in the list shall be the order of the images.
167 std::list<std::string> FileNameList;
168 gdcmFileList *CoherentFileList;
171 // List of filenames created in ExecuteInformation and used in
173 // If FileNameList isn't empty, InternalFileNameList is a copy of
175 // Otherwise, InternalFileNameList correspond to the list of
177 std::list<std::string> InternalFileNameList;
178 gdcmFileList InternalFileList;
179 //bool Execution; // For VTK5.0
183 /// \brief Bit string integer (each one considered as a boolean)
184 /// Bit 0 : Skip Sequences, if possible
185 /// Bit 1 : Skip Shadow Groups if possible
186 /// Bit 2 : Skip Sequences inside a Shadow Group, if possible
187 /// Probabely (?), some more to add
190 bool DropDuplicatePositions;
196 /// Pointer to a user suplied function to allow modification of pixel order
197 VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
201 //-----------------------------------------------------------------------------