GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

vtkGDCMThreadedImageReader2.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004
    00005   Copyright (c) 2006-2011 Mathieu Malaterre
    00006   All rights reserved.
    00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00008
    00009      This software is distributed WITHOUT ANY WARRANTY; without even
    00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00011      PURPOSE.  See the above copyright notice for more information.
    00012
    00013 =========================================================================*/
    00014 // .NAME vtkGDCMThreadedImageReader2 - read DICOM files with multiple threads
    00015 // .SECTION Description
    00016 // vtkGDCMThreadedImageReader2 is a source object that reads some DICOM files
    00017 // This reader is threaded. Meaning that on a multiple core CPU with N cpu, it will
    00018 // read approx N times faster than when reading in a single thread assuming the IO is
    00019 // not a bottleneck operation.
    00020 // If looking for a single threaded class see: vtkGDCMImageReader
    00021 //
    00022 // .SECTION Warning: Advanced users only. Do not use this class in the general case,
    00023 // you have to understand how physicaly medium works first (sequencial reading for
    00024 // instance) before playing with this class
    00025 //
    00026 // .SECTION Implementation note: when FileLowerLeft is set to on the image is not flipped
    00027 // upside down as VTK would expect, use this option only if you know what you are doing
    00028 //
    00029 // .SECTION FIXME: need to implement the other mode where FileLowerLeft is set to OFF
    00030 //
    00031 // .SECTION FIXME: need to implement reading of series of 3D files
    00032 //
    00033 // .SECTION Implementation note: this class is meant to superseed vtkGDCMThreadedImageReader
    00034 // because it had support for ProgressEvent support even from python layer. There is a
    00035 // subtle trick down in the threading mechanism in VTK were the main thread (talking to the
    00036 // python interpreter) is also part of the execution process (and the N-1 other thread
    00037 // are just there to execute the remaining of ThreadedRequestData), this separation into
    00038 // two types of thread is necessary to acheive a working implementation of UpdateProgress
    00039
    00040 // .SECTION See Also
    00041 // vtkMedicalImageReader2 vtkMedicalImageProperties vtkGDCMImageReader
    00042
    00043 #ifndef VTKGDCMTHREADEDIMAGEREADER2_H
    00044 #define VTKGDCMTHREADEDIMAGEREADER2_H
    00045
    00046 #include "vtkThreadedImageAlgorithm.h"
    00047
    00048 class vtkStringArray;
    00049 class VTK_EXPORT vtkGDCMThreadedImageReader2 : public vtkThreadedImageAlgorithm
    00050 {
    00051 public:
    00052   static vtkGDCMThreadedImageReader2 *New();
    00053   vtkTypeRevisionMacro(vtkGDCMThreadedImageReader2,vtkThreadedImageAlgorithm);
    00054   virtual void PrintSelf(ostream& os, vtkIndent indent);
    00055
    00056   vtkGetMacro(FileLowerLeft,int);
    00057   vtkSetMacro(FileLowerLeft,int);
    00058   vtkBooleanMacro(FileLowerLeft,int);
    00059
    00060   vtkGetMacro(NumberOfOverlays,int);
    00061
    00062   vtkSetMacro(DataScalarType,int);
    00063   vtkGetMacro(DataScalarType,int);
    00064
    00065   vtkSetMacro(NumberOfScalarComponents,int);
    00066   vtkGetMacro(NumberOfScalarComponents,int);
    00067
    00068   vtkGetMacro(LoadOverlays,int);
    00069   vtkSetMacro(LoadOverlays,int);
    00070   vtkBooleanMacro(LoadOverlays,int);
    00071
    00072   vtkSetVector6Macro(DataExtent,int);
    00073   vtkGetVector6Macro(DataExtent,int);
    00074
    00075   vtkSetVector3Macro(DataOrigin,double);
    00076   vtkGetVector3Macro(DataOrigin,double);
    00077
    00078   vtkSetVector3Macro(DataSpacing,double);
    00079   vtkGetVector3Macro(DataSpacing,double);
    00080
    00081   //vtkGetStringMacro(FileName);
    00082   //vtkSetStringMacro(FileName);
    00083   virtual const char *GetFileName(int i = 0);
    00084   virtual void SetFileName(const char *filename);
    00085
    00086   virtual void SetFileNames(vtkStringArray*);
    00087   vtkGetObjectMacro(FileNames, vtkStringArray);
    00088
    00089   int SplitExtent(int splitExt[6], int startExt[6],
    00090                   int num, int total);
    00091
    00092   // Description:
    00093   // Explicitely set the Rescale Intercept (0028,1052)
    00094   vtkSetMacro(Shift,double);
    00095   vtkGetMacro(Shift,double);
    00096
    00097   // Description:
    00098   // Explicitely get/set the Rescale Slope (0028,1053)
    00099   vtkSetMacro(Scale,double);
    00100   vtkGetMacro(Scale,double);
    00101
    00102   // Description:
    00103   // Determine whether or not reader should use value from Shift/Scale
    00104   // Default is 1
    00105   vtkSetMacro(UseShiftScale,int);
    00106   vtkGetMacro(UseShiftScale,int);
    00107   vtkBooleanMacro(UseShiftScale,int);
    00108
    00109 protected:
    00110   vtkGDCMThreadedImageReader2();
    00111   ~vtkGDCMThreadedImageReader2();
    00112
    00113   int RequestInformation(vtkInformation *request,
    00114                          vtkInformationVector **inputVector,
    00115                          vtkInformationVector *outputVector);
    00116
    00117 protected:
    00118   void ThreadedRequestData (
    00119     vtkInformation * request,
    00120     vtkInformationVector** inputVector,
    00121     vtkInformationVector * outputVector,
    00122     vtkImageData ***inData,
    00123     vtkImageData **outData,
    00124     int outExt[6], int id);
    00125
    00126 private:
    00127   int FileLowerLeft;
    00128   char *FileName;
    00129   vtkStringArray *FileNames;
    00130   int LoadIconImage;
    00131   int DataExtent[6];
    00132   int LoadOverlays;
    00133   int NumberOfOverlays;
    00134   int DataScalarType;
    00135
    00136   int NumberOfScalarComponents;
    00137   double DataSpacing[3];
    00138   double DataOrigin[3];
    00139   int IconImageDataExtent[6];
    00140
    00141   double Shift;
    00142   double Scale;
    00143   int UseShiftScale;
    00144
    00145 private:
    00146   vtkGDCMThreadedImageReader2(const vtkGDCMThreadedImageReader2&);  // Not implemented.
    00147   void operator=(const vtkGDCMThreadedImageReader2&);  // Not implemented.
    00148 };
    00149
    00150 #endif