Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vtkGdcmReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: vtkGdcmReader.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/08/31 15:54:51 $
00007   Version:   $Revision: 1.29 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018                                                                                 
00019 #ifndef __vtkGdcmReader_h
00020 #define __vtkGdcmReader_h
00021 
00022 #include "gdcmCommon.h" // To avoid warnings concerning the std
00023 #include "gdcmFile.h"
00024 
00025 #include <vtkImageReader.h>
00026 #include <list>
00027 #include <string>
00028 #include <vector>
00029 
00030 typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, gdcm::File *);
00031 
00032 //-----------------------------------------------------------------------------
00033 class vtkLookupTable;
00034 
00035 //-----------------------------------------------------------------------------
00036 class VTK_EXPORT vtkGdcmReader : public vtkImageReader
00037 {
00038 public:
00039    static vtkGdcmReader *New();
00040    vtkTypeRevisionMacro(vtkGdcmReader, vtkImageReader);
00041    void PrintSelf(ostream& os, vtkIndent indent);
00042 
00043    virtual void RemoveAllFileName(void);
00044    virtual void AddFileName(const char *name);
00045    virtual void SetFileName(const char *name);
00046 
00047    //BTX
00048    void SetCoherentFileList( std::vector<gdcm::File* > *cfl) {
00049                                                       CoherentFileList = cfl; }    
00050    //ETX
00051 
00052    vtkSetMacro(AllowLightChecking, bool);
00053    vtkGetMacro(AllowLightChecking, bool);
00054    vtkBooleanMacro(AllowLightChecking, bool);
00055 
00056    //BTX
00057    void SetUserFunction (VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
00058                         { UserFunction = userFunc; } 
00059    //ETX
00060   
00061    // Description:
00062    // If this flag is set and the DICOM reader encounters a dicom file with 
00063    // lookup table the data will be kept as unsigned chars and a lookuptable 
00064    // will be exported and accessible through GetLookupTable() 
00065    vtkSetMacro(AllowLookupTable, bool);
00066    vtkGetMacro(AllowLookupTable, bool);
00067    vtkBooleanMacro(AllowLookupTable, bool);
00068 
00069    vtkGetObjectMacro(LookupTable, vtkLookupTable);
00070 
00071 // FIXME : HOW to doxygen a VTM macro?
00072 /*
00073  * \ brief Sets the LoadMode as a boolean string. 
00074  *        gdcm.LD_NOSEQ, gdcm.LD_NOSHADOW, gdcm.LD_NOSHADOWSEQ... 
00075  *        (nothing more, right now)
00076  *        WARNING : before using NO_SHADOW, be sure *all* your files
00077  *        contain accurate values in the 0x0000 element (if any) 
00078  *        of *each* Shadow Group. The parser will fail if the size is wrong !
00079  * @param   mode Load mode to be used    
00080  */
00081    vtkSetMacro(LoadMode, int);
00082    vtkGetMacro(LoadMode, int);
00083    vtkBooleanMacro(LoadMode, int);
00084 
00085 protected:
00086    vtkGdcmReader();
00087    ~vtkGdcmReader();
00088 
00089    virtual void ExecuteInformation();
00090    virtual void ExecuteData(vtkDataObject *output);
00091 
00092    virtual void BuildData(vtkDataObject *output);
00093    virtual void BuildFileListFromPattern();
00094    virtual void LoadFileInformation();
00095    virtual void UpdateFileInformation();
00096    //BTX
00097    virtual void GetFileInformation(gdcm::File *file);
00098    virtual bool TestFileInformation(gdcm::File *file);
00099    //ETX
00100 
00101 private:
00102    void RemoveAllInternalFileName(void);
00103    void AddInternalFileName(const char *name);
00104    void RemoveAllInternalFile(void);
00105 
00106    //BTX
00107    void IncrementProgress(const unsigned long updateProgressTarget,
00108                           unsigned long &updateProgressCount);
00109    /*void LoadImageInMemory(std::string fileName, unsigned char *dest,
00110                           const unsigned long updateProgressTarget,
00111                           unsigned long &updateProgressCount);*/
00112 
00113    void LoadImageInMemory(gdcm::File *f, unsigned char *dest,
00114                           const unsigned long updateProgressTarget,
00115                           unsigned long &updateProgressCount);
00116    //ETX
00117 
00118 // Variables
00119    //BTX
00120    typedef std::vector<gdcm::File *> gdcmFileList;
00121    //ETX
00122 
00123    vtkLookupTable *LookupTable;
00124    vtkTimeStamp fileTime;
00125 
00126    bool AllowLookupTable;
00127    bool AllowLightChecking;
00128 
00129    //BTX
00130    // Number of columns of the image/volume to be loaded
00131    int NumColumns;
00132    // Number of lines of the image/volume to be loaded
00133    int NumLines;
00134    // Number of lines of the image/volume to be loaded
00135    int NumPlanes;
00136    // Total number of planes (or images) of the stack to be build.
00137    int TotalNumberOfPlanes;
00138    // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
00139    int NumComponents;
00140    // Type of the image[s]: 8/16/32 bits, signed/unsigned:
00141    std::string ImageType;
00142    // Pixel size (in number of bytes):
00143    size_t PixelSize;
00144    // List of filenames to be read in order to build a stack of images
00145    // or volume. The order in the list shall be the order of the images.
00146    std::list<std::string> FileNameList;
00147    gdcmFileList *CoherentFileList;
00148    bool OwnFile;
00149 
00150    // List of filenames created in ExecuteInformation and used in
00151    // ExecuteData.
00152    // If FileNameList isn't empty, InternalFileNameList is a copy of
00153    //    FileNameList
00154    // Otherwise, InternalFileNameList correspond to the list of 
00155    //    files patterned
00156    std::list<std::string> InternalFileNameList;
00157    gdcmFileList InternalFileList;
00158    bool Execution;
00159   
00160    //ETX
00161 
00167    int LoadMode;
00168 
00170    VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
00171 
00172 };
00173 
00174 //-----------------------------------------------------------------------------
00175 #endif
00176 

Generated on Fri Jan 20 10:14:26 2006 for gdcm by  doxygen 1.4.4