GDCM 3.2.1

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
49 class vtkStringArray;
50 class VTKGDCM_EXPORT vtkGDCMThreadedImageReader2 : public vtkThreadedImageAlgorithm
51{
52 public:
53 static vtkGDCMThreadedImageReader2 *New();
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
110 protected:
111 vtkGDCMThreadedImageReader2();
112 ~vtkGDCMThreadedImageReader2();
113
114 int RequestInformation(vtkInformation *request,
115 vtkInformationVector **inputVector,
116 vtkInformationVector *outputVector);
117
118 protected:
119 void ThreadedRequestData (
120 vtkInformation * request,
121 vtkInformationVector** inputVector,
122 vtkInformationVector * outputVector,
123 vtkImageData ***inData,
124 vtkImageData **outData,
125 int outExt[6], int id);
126
127 private:
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
146 private:
147 vtkGDCMThreadedImageReader2(const vtkGDCMThreadedImageReader2&); // Not implemented.
148 void operator=(const vtkGDCMThreadedImageReader2&); // Not implemented.
149};
150
151#endif
vtkGDCMThreadedImageReader2::vtkGetVector3Macro
vtkGetVector3Macro(DataOrigin, double)
vtkGDCMThreadedImageReader2::vtkSetVector3Macro
vtkSetVector3Macro(DataOrigin, double)
vtkGDCMThreadedImageReader2::vtkGetVector3Macro
vtkGetVector3Macro(DataSpacing, double)
vtkGDCMThreadedImageReader2::vtkGetVector6Macro
vtkGetVector6Macro(DataExtent, int)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(NumberOfOverlays, int)
vtkGDCMThreadedImageReader2::SplitExtent
int SplitExtent(int splitExt[6], int startExt[6], int num, int total)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(Scale, double)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(UseShiftScale, int)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(DataScalarType, int)
vtkGDCMThreadedImageReader2::vtkBooleanMacro
vtkBooleanMacro(FileLowerLeft, int)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(Shift, double)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(LoadOverlays, int)
vtkGDCMThreadedImageReader2::New
static vtkGDCMThreadedImageReader2 * New()
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(NumberOfScalarComponents, int)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(DataScalarType, int)
vtkGDCMThreadedImageReader2::vtkGDCMThreadedImageReader2
vtkGDCMThreadedImageReader2()
vtkGDCMThreadedImageReader2::~vtkGDCMThreadedImageReader2
~vtkGDCMThreadedImageReader2()
vtkGDCMThreadedImageReader2::vtkGetObjectMacro
vtkGetObjectMacro(FileNames, vtkStringArray)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(LoadOverlays, int)
vtkGDCMThreadedImageReader2::vtkSetVector6Macro
vtkSetVector6Macro(DataExtent, int)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(FileLowerLeft, int)
vtkGDCMThreadedImageReader2::RequestInformation
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(Scale, double)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(UseShiftScale, int)
vtkGDCMThreadedImageReader2::ThreadedRequestData
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int outExt[6], int id)
vtkGDCMThreadedImageReader2::vtkTypeMacro
vtkTypeMacro(vtkGDCMThreadedImageReader2, vtkThreadedImageAlgorithm)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(FileLowerLeft, int)
vtkGDCMThreadedImageReader2::vtkSetMacro
vtkSetMacro(NumberOfScalarComponents, int)
vtkGDCMThreadedImageReader2::SetFileName
virtual void SetFileName(const char *filename)
vtkGDCMThreadedImageReader2::vtkSetVector3Macro
vtkSetVector3Macro(DataSpacing, double)
vtkGDCMThreadedImageReader2::GetFileName
virtual const char * GetFileName(int i=0)
vtkGDCMThreadedImageReader2::SetFileNames
virtual void SetFileNames(vtkStringArray *)
vtkGDCMThreadedImageReader2::vtkGetMacro
vtkGetMacro(Shift, double)
vtkGDCMThreadedImageReader2::vtkBooleanMacro
vtkBooleanMacro(UseShiftScale, int)
vtkGDCMThreadedImageReader2::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkGDCMThreadedImageReader2::vtkBooleanMacro
vtkBooleanMacro(LoadOverlays, int)