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