GDCM 2.2.1

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

- File List
- File Members

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 physicaly medium works first (sequencial 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 superseed 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 acheive 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 "vtkThreadedImageAlgorithm.h"
47
48 class vtkStringArray;
49 class VTK_EXPORT vtkGDCMThreadedImageReader2 : public vtkThreadedImageAlgorithm
50 {
51 public:
52 static vtkGDCMThreadedImageReader2 *New();
53 vtkTypeRevisionMacro(vtkGDCMThreadedImageReader2,vtkThreadedImageAlgorithm);
54 virtual void PrintSelf(ostream& os, vtkIndent indent);
55
56 vtkGetMacro(FileLowerLeft,int);
57 vtkSetMacro(FileLowerLeft,int);
58 vtkBooleanMacro(FileLowerLeft,int);
59
60 vtkGetMacro(NumberOfOverlays,int);
61
62 vtkSetMacro(DataScalarType,int);
63 vtkGetMacro(DataScalarType,int);
64
65 vtkSetMacro(NumberOfScalarComponents,int);
66 vtkGetMacro(NumberOfScalarComponents,int);
67
68 vtkGetMacro(LoadOverlays,int);
69 vtkSetMacro(LoadOverlays,int);
70 vtkBooleanMacro(LoadOverlays,int);
71
72 vtkSetVector6Macro(DataExtent,int);
73 vtkGetVector6Macro(DataExtent,int);
74
75 vtkSetVector3Macro(DataOrigin,double);
76 vtkGetVector3Macro(DataOrigin,double);
77
78 vtkSetVector3Macro(DataSpacing,double);
79 vtkGetVector3Macro(DataSpacing,double);
80
81 //vtkGetStringMacro(FileName);
82 //vtkSetStringMacro(FileName);
83 virtual const char *GetFileName(int i = 0);
84 virtual void SetFileName(const char *filename);
85
86 virtual void SetFileNames(vtkStringArray*);
87 vtkGetObjectMacro(FileNames, vtkStringArray);
88
89 int SplitExtent(int splitExt[6], int startExt[6],
90 int num, int total);
91
92 // Description:
93 // Explicitely set the Rescale Intercept (0028,1052)
94 vtkSetMacro(Shift,double);
95 vtkGetMacro(Shift,double);
96
97 // Description:
98 // Explicitely get/set the Rescale Slope (0028,1053)
99 vtkSetMacro(Scale,double);
100 vtkGetMacro(Scale,double);
101
102 // Description:
103 // Determine whether or not reader should use value from Shift/Scale
104 // Default is 1
105 vtkSetMacro(UseShiftScale,int);
106 vtkGetMacro(UseShiftScale,int);
107 vtkBooleanMacro(UseShiftScale,int);
108
109 protected:
110 vtkGDCMThreadedImageReader2();
111 ~vtkGDCMThreadedImageReader2();
112
113 int RequestInformation(vtkInformation *request,
114 vtkInformationVector **inputVector,
115 vtkInformationVector *outputVector);
116
117 protected:
118 void ThreadedRequestData (
119 vtkInformation * request,
120 vtkInformationVector** inputVector,
121 vtkInformationVector * outputVector,
122 vtkImageData ***inData,
123 vtkImageData **outData,
124 int outExt[6], int id);
125
126 private:
127 int FileLowerLeft;
128 char *FileName;
129 vtkStringArray *FileNames;
130 int LoadIconImage;
131 int DataExtent[6];
132 int LoadOverlays;
133 int NumberOfOverlays;
134 int DataScalarType;
135
136 int NumberOfScalarComponents;
137 double DataSpacing[3];
138 double DataOrigin[3];
139 int IconImageDataExtent[6];
140
141 double Shift;
142 double Scale;
143 int UseShiftScale;
144
145 private:
146 vtkGDCMThreadedImageReader2(const vtkGDCMThreadedImageReader2&); // Not implemented.
147 void operator=(const vtkGDCMThreadedImageReader2&); // Not implemented.
148 };
149
150 #endif