]> Creatis software - gdcm.git/blob - vtk/vtkGdcmReader.h
Aware user (who *does* know all the files whose names
[gdcm.git] / vtk / vtkGdcmReader.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmReader.h,v $
5   Language:  C++
6   Date:      $Date: 2005/04/28 09:29:05 $
7   Version:   $Revision: 1.21 $
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 protected:
56    vtkGdcmReader();
57    ~vtkGdcmReader();
58
59    virtual void ExecuteInformation();
60    virtual void ExecuteData(vtkDataObject *output);
61    virtual void BuildFileListFromPattern();
62    virtual int CheckFileCoherence();
63    virtual int CheckFileCoherenceLight();
64
65 private:
66    void RemoveAllInternalFileName(void);
67    void AddInternalFileName(const char* name);
68
69    //BTX
70    size_t LoadImageInMemory(std::string FileName, unsigned char *Dest,
71                            const unsigned long UpdateProgressTarget,
72                            unsigned long & UpdateProgressCount);
73    //ETX
74
75 // Variables
76    vtkLookupTable *LookupTable;
77    vtkTimeStamp fileTime;
78    int AllowLookupTable;
79    bool LightChecking;
80
81    //BTX
82    // Number of columns of the image/volume to be loaded
83    int NumColumns;
84    // Number of lines of the image/volume to be loaded
85    int NumLines;
86    // Total number of planes (or images) of the stack to be build.
87    int TotalNumberOfPlanes;
88    // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
89    int NumComponents;
90    // Type of the image[s]: 8/16/32 bits, signed/unsigned:
91    std::string ImageType;
92    // Pixel size (in number of bytes):
93    size_t PixelSize;
94    // List of filenames to be read in order to build a stack of images
95    // or volume. The order in the list shall be the order of the images.
96    std::list<std::string> FileNameList;
97
98    // List of filenames created in ExecuteInformation and used in
99    // ExecuteData.
100    // If FileNameList isn't empty, InternalFileNameList is a copy of
101    //    FileNameList
102    // Otherwise, InternalFileNameList correspond to the list of 
103    //    files patterned
104    std::list<std::string> InternalFileNameList;
105    //ETX
106 };
107
108 //-----------------------------------------------------------------------------
109 #endif
110