]> Creatis software - gdcm.git/blob - vtk/vtkGdcmReader.h
ENH: Add a new flag to vtkGdcmReader: AllowLookupTable, user can now select if he...
[gdcm.git] / vtk / vtkGdcmReader.h
1 // vtkGdcmReader.h
2 //-----------------------------------------------------------------------------
3 #ifndef __vtkGdcmReader_h
4 #define __vtkGdcmReader_h
5
6 #include <vtkImageReader.h>
7 #include <list>
8 #include <string>
9
10 //-----------------------------------------------------------------------------
11 class vtkLookupTable;
12
13 //-----------------------------------------------------------------------------
14 class VTK_EXPORT vtkGdcmReader : public vtkImageReader
15 {
16 public:
17    static vtkGdcmReader *New() {return new vtkGdcmReader;};
18    vtkTypeMacro(vtkGdcmReader, vtkImageReader);
19    void PrintSelf(ostream& os, vtkIndent indent);
20
21    virtual void RemoveAllFileName(void);
22    virtual void AddFileName(const char* name);
23    virtual void SetFileName(const char *name);
24    
25    // Description:
26    // If this flag is set and the DICOM reader encounters a dicom file with 
27    // lookup table the data will be kept as unsigned chars and a lookuptable 
28    // will be exported and accessible through GetLookupTable() 
29    vtkSetMacro(AllowLookupTable,int);
30    vtkGetMacro(AllowLookupTable,int);
31    vtkBooleanMacro(AllowLookupTable,int);
32
33    vtkGetObjectMacro(LookupTable,vtkLookupTable);
34
35 protected:
36    vtkGdcmReader();
37    ~vtkGdcmReader();
38
39    virtual void ExecuteInformation();
40    virtual void ExecuteData(vtkDataObject *output);
41    virtual void BuildFileListFromPattern();
42    virtual int CheckFileCoherence();
43
44 private:
45    void RemoveAllInternalFileName(void);
46    void AddInternalFileName(const char* name);
47
48    //BTX
49    size_t LoadImageInMemory(std::string FileName, unsigned char * Dest,
50                            const unsigned long UpdateProgressTarget,
51                            unsigned long & UpdateProgressCount);
52    //ETX
53
54 // Variables
55    vtkLookupTable *LookupTable;
56    vtkTimeStamp fileTime;
57    int AllowLookupTable;
58
59    //BTX
60    // Number of columns of the image/volume to be loaded
61    int NumColumns;
62    // Number of lines of the image/volume to be loaded
63    int NumLines;
64    // Total number of planes (or images) of the stack to be build.
65    int TotalNumberOfPlanes;
66    // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
67    int NumComponents;
68    // Type of the image[s]: 8/16/32 bits, signed/unsigned:
69    std::string ImageType;
70    // Pixel size (in number of bytes):
71    size_t PixelSize;
72    // List of filenames to be read in order to build a stack of images
73    // or volume. The order in the list shall be the order of the images.
74    std::list<std::string> FileNameList;
75
76    // List of filenames created in ExecuteInformation and used in
77    // ExecuteData.
78    // If FileNameList isn't empty, InternalFileNameList is a copy of
79    //    FileNameList
80    // Otherwise, InternalFileNameList correspond to the list of 
81    //    files patterned
82    std::list<std::string> InternalFileNameList;
83    //ETX
84 };
85
86 //-----------------------------------------------------------------------------
87 #endif
88