]> Creatis software - gdcm.git/blob - vtk/vtkGdcmReader.h
vtkGdcmReader has now a new method SetLoadMode, to allow user to specify what he
[gdcm.git] / vtk / vtkGdcmReader.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmReader.h,v $
5   Language:  C++
6   Date:      $Date: 2005/06/29 16:12:43 $
7   Version:   $Revision: 1.22 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18                                                                                 
19 #ifndef __vtkGdcmReader_h
20 #define __vtkGdcmReader_h
21
22 #include "gdcmCommon.h" // To avoid warnings concerning the std
23
24 #include <vtkImageReader.h>
25 #include <list>
26 #include <string>
27
28 //-----------------------------------------------------------------------------
29 class vtkLookupTable;
30
31 //-----------------------------------------------------------------------------
32 class VTK_EXPORT vtkGdcmReader : public vtkImageReader
33 {
34 public:
35    static vtkGdcmReader *New();
36    vtkTypeRevisionMacro(vtkGdcmReader, vtkImageReader);
37    void PrintSelf(ostream& os, vtkIndent indent);
38
39    virtual void RemoveAllFileName(void);
40    virtual void AddFileName(const char *name);
41    virtual void SetFileName(const char *name);
42
43    void SetCheckFileCoherenceLight();
44    
45    // Description:
46    // If this flag is set and the DICOM reader encounters a dicom file with 
47    // lookup table the data will be kept as unsigned chars and a lookuptable 
48    // will be exported and accessible through GetLookupTable() 
49    vtkSetMacro(AllowLookupTable, int);
50    vtkGetMacro(AllowLookupTable, int);
51    vtkBooleanMacro(AllowLookupTable, int);
52
53    vtkGetObjectMacro(LookupTable, vtkLookupTable);
54
55 /**
56  * \brief Sets the LoadMode as a boolean string. 
57  *        NO_SEQ, NO_SHADOW, ... (nothing more, right now)
58  *        WARNING : before using NO_SHADOW, be sure *all* your files
59  *        contain accurate values in the 0x0000 element (if any) 
60  *        of *each* Shadow Group. The parser will fail if the size is wrong !
61  * @param   mode Load mode to be used    
62  */
63    void SetLoadMode (int mode) { LoadMode = mode; }
64
65 protected:
66    vtkGdcmReader();
67    ~vtkGdcmReader();
68
69    virtual void ExecuteInformation();
70    virtual void ExecuteData(vtkDataObject *output);
71    virtual void BuildFileListFromPattern();
72    virtual int CheckFileCoherence();
73    virtual int CheckFileCoherenceLight();
74
75 private:
76    void RemoveAllInternalFileName(void);
77    void AddInternalFileName(const char* name);
78
79    //BTX
80    size_t LoadImageInMemory(std::string FileName, unsigned char *Dest,
81                            const unsigned long UpdateProgressTarget,
82                            unsigned long & UpdateProgressCount);
83    //ETX
84
85 // Variables
86    vtkLookupTable *LookupTable;
87    vtkTimeStamp fileTime;
88    int AllowLookupTable;
89    bool LightChecking;
90
91    //BTX
92    // Number of columns of the image/volume to be loaded
93    int NumColumns;
94    // Number of lines of the image/volume to be loaded
95    int NumLines;
96    // Total number of planes (or images) of the stack to be build.
97    int TotalNumberOfPlanes;
98    // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
99    int NumComponents;
100    // Type of the image[s]: 8/16/32 bits, signed/unsigned:
101    std::string ImageType;
102    // Pixel size (in number of bytes):
103    size_t PixelSize;
104    // List of filenames to be read in order to build a stack of images
105    // or volume. The order in the list shall be the order of the images.
106    std::list<std::string> FileNameList;
107
108    // List of filenames created in ExecuteInformation and used in
109    // ExecuteData.
110    // If FileNameList isn't empty, InternalFileNameList is a copy of
111    //    FileNameList
112    // Otherwise, InternalFileNameList correspond to the list of 
113    //    files patterned
114    std::list<std::string> InternalFileNameList;
115    //ETX
116
117    /// \brief Bit string integer (each one considered as a boolean)
118    ///        Bit 0 : Skip Sequences,    if possible
119    ///        Bit 1 : Skip Shadow Groups if possible
120    ///        Probabely, some more to add
121    int LoadMode;
122 };
123
124 //-----------------------------------------------------------------------------
125 #endif
126