GDCM 3.0.24
vtkGDCMThreadedImageReader2.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14// .NAME vtkGDCMThreadedImageReader2 - read DICOM files with multiple threads
15// .SECTION Description
16// vtkGDCMThreadedImageReader2 is a source object that reads some DICOM files
17// This reader is threaded. Meaning that on a multiple core CPU with N cpu, it will
18// read approx N times faster than when reading in a single thread assuming the IO is
19// not a bottleneck operation.
20// If looking for a single threaded class see: vtkGDCMImageReader
21//
22// .SECTION Warning: Advanced users only. Do not use this class in the general case,
23// you have to understand how physically medium works first (sequential reading for
24// instance) before playing with this class
25//
26// .SECTION Implementation note: when FileLowerLeft is set to on the image is not flipped
27// upside down as VTK would expect, use this option only if you know what you are doing
28//
29// .SECTION FIXME: need to implement the other mode where FileLowerLeft is set to OFF
30//
31// .SECTION FIXME: need to implement reading of series of 3D files
32//
33// .SECTION Implementation note: this class is meant to supersede vtkGDCMThreadedImageReader
34// because it had support for ProgressEvent support even from python layer. There is a
35// subtle trick down in the threading mechanism in VTK were the main thread (talking to the
36// python interpreter) is also part of the execution process (and the N-1 other thread
37// are just there to execute the remaining of ThreadedRequestData), this separation into
38// two types of thread is necessary to achieve a working implementation of UpdateProgress
39
40// .SECTION See Also
41// vtkMedicalImageReader2 vtkMedicalImageProperties vtkGDCMImageReader
42
43#ifndef VTKGDCMTHREADEDIMAGEREADER2_H
44#define VTKGDCMTHREADEDIMAGEREADER2_H
45
46#include "vtkgdcmModule.h"
47#include "vtkThreadedImageAlgorithm.h"
48
49class vtkStringArray;
50class VTKGDCM_EXPORT vtkGDCMThreadedImageReader2 : public vtkThreadedImageAlgorithm
51{
52public:
54 vtkTypeMacro(vtkGDCMThreadedImageReader2,vtkThreadedImageAlgorithm);
55 virtual void PrintSelf(ostream& os, vtkIndent indent);
56
57 vtkGetMacro(FileLowerLeft,int);
58 vtkSetMacro(FileLowerLeft,int);
59 vtkBooleanMacro(FileLowerLeft,int);
60
61 vtkGetMacro(NumberOfOverlays,int);
62
63 vtkSetMacro(DataScalarType,int);
64 vtkGetMacro(DataScalarType,int);
65
66 vtkSetMacro(NumberOfScalarComponents,int);
67 vtkGetMacro(NumberOfScalarComponents,int);
68
69 vtkGetMacro(LoadOverlays,int);
70 vtkSetMacro(LoadOverlays,int);
71 vtkBooleanMacro(LoadOverlays,int);
72
73 vtkSetVector6Macro(DataExtent,int);
74 vtkGetVector6Macro(DataExtent,int);
75
76 vtkSetVector3Macro(DataOrigin,double);
77 vtkGetVector3Macro(DataOrigin,double);
78
79 vtkSetVector3Macro(DataSpacing,double);
80 vtkGetVector3Macro(DataSpacing,double);
81
82 //vtkGetStringMacro(FileName);
83 //vtkSetStringMacro(FileName);
84 virtual const char *GetFileName(int i = 0);
85 virtual void SetFileName(const char *filename);
86
87 virtual void SetFileNames(vtkStringArray*);
88 vtkGetObjectMacro(FileNames, vtkStringArray);
89
90 int SplitExtent(int splitExt[6], int startExt[6],
91 int num, int total);
92
93 // Description:
94 // Explicitly set the Rescale Intercept (0028,1052)
95 vtkSetMacro(Shift,double);
96 vtkGetMacro(Shift,double);
97
98 // Description:
99 // Explicitly get/set the Rescale Slope (0028,1053)
100 vtkSetMacro(Scale,double);
101 vtkGetMacro(Scale,double);
102
103 // Description:
104 // Determine whether or not reader should use value from Shift/Scale
105 // Default is 1
106 vtkSetMacro(UseShiftScale,int);
107 vtkGetMacro(UseShiftScale,int);
108 vtkBooleanMacro(UseShiftScale,int);
109
110protected:
113
114 int RequestInformation(vtkInformation *request,
115 vtkInformationVector **inputVector,
116 vtkInformationVector *outputVector);
117
118protected:
120 vtkInformation * request,
121 vtkInformationVector** inputVector,
122 vtkInformationVector * outputVector,
123 vtkImageData ***inData,
124 vtkImageData **outData,
125 int outExt[6], int id);
126
127private:
128 int FileLowerLeft;
129 char *FileName;
130 vtkStringArray *FileNames;
131 int LoadIconImage;
132 int DataExtent[6];
133 int LoadOverlays;
134 int NumberOfOverlays;
135 int DataScalarType;
136
137 int NumberOfScalarComponents;
138 double DataSpacing[3];
139 double DataOrigin[3];
140 int IconImageDataExtent[6];
141
142 double Shift;
143 double Scale;
144 int UseShiftScale;
145
146private:
148 void operator=(const vtkGDCMThreadedImageReader2&); // Not implemented.
149};
150
151#endif
Definition vtkGDCMThreadedImageReader2.h:51
vtkGetVector3Macro(DataOrigin, double)
vtkSetVector3Macro(DataOrigin, double)
vtkGetVector3Macro(DataSpacing, double)
vtkGetVector6Macro(DataExtent, int)
vtkGetMacro(NumberOfOverlays, int)
int SplitExtent(int splitExt[6], int startExt[6], int num, int total)
vtkGetMacro(UseShiftScale, int)
vtkGetMacro(DataScalarType, int)
vtkBooleanMacro(FileLowerLeft, int)
vtkSetMacro(LoadOverlays, int)
static vtkGDCMThreadedImageReader2 * New()
vtkGetMacro(NumberOfScalarComponents, int)
vtkSetMacro(DataScalarType, int)
vtkGetObjectMacro(FileNames, vtkStringArray)
vtkGetMacro(LoadOverlays, int)
vtkSetVector6Macro(DataExtent, int)
vtkSetMacro(FileLowerLeft, int)
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkSetMacro(UseShiftScale, int)
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int outExt[6], int id)
vtkTypeMacro(vtkGDCMThreadedImageReader2, vtkThreadedImageAlgorithm)
vtkGetMacro(FileLowerLeft, int)
vtkSetMacro(NumberOfScalarComponents, int)
virtual void SetFileName(const char *filename)
vtkSetVector3Macro(DataSpacing, double)
virtual const char * GetFileName(int i=0)
virtual void SetFileNames(vtkStringArray *)
vtkBooleanMacro(UseShiftScale, int)
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkBooleanMacro(LoadOverlays, int)