vtk-dicom  0.8.17
vtkThreadedImageAlgorithm.h
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkThreadedImageAlgorithm.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkThreadedImageAlgorithm_h
29 #define vtkThreadedImageAlgorithm_h
30 
31 #include "vtkCommonExecutionModelModule.h" // For export macro
32 #include "vtkImageAlgorithm.h"
33 
34 class vtkImageData;
35 class vtkMultiThreader;
36 
37 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
42 
49  virtual void ThreadedRequestData(vtkInformation *request,
50  vtkInformationVector **inputVector,
51  vtkInformationVector *outputVector,
52  vtkImageData ***inData,
53  vtkImageData **outData,
54  int extent[6], int threadId);
55 
56  // also support the old signature
57  virtual void ThreadedExecute(vtkImageData *inData,
58  vtkImageData *outData,
59  int extent[6], int threadId);
60 
62 
65  vtkGetMacro(EnableSMP, bool);
66  vtkSetMacro(EnableSMP, bool);
68 
70 
73  static void SetGlobalDefaultEnableSMP(bool enable);
74  static bool GetGlobalDefaultEnableSMP();
76 
78 
82  vtkSetVector3Macro(MinimumPieceSize, int);
83  vtkGetVector3Macro(MinimumPieceSize, int);
85 
87 
93  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
94  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
96 
98 
105  vtkSetClampMacro(SplitMode, int, 0, 2);
106  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
107  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
108  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
109  vtkGetMacro(SplitMode, int);
111 
113 
117  vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
118  vtkGetMacro( NumberOfThreads, int );
120 
124  virtual int SplitExtent(int splitExt[6], int startExt[6],
125  int num, int total);
126 
127 protected:
129  ~vtkThreadedImageAlgorithm() VTK_OVERRIDE;
130 
131  vtkMultiThreader *Threader;
132  int NumberOfThreads;
133 
134  bool EnableSMP;
135  static bool GlobalDefaultEnableSMP;
136 
137  enum SplitModeEnum
138  {
139  SLAB = 0,
140  BEAM = 1,
141  BLOCK = 2
142  };
143 
144  int SplitMode;
145  int SplitPath[3];
146  int SplitPathLength;
147  int MinimumPieceSize[3];
148  vtkIdType DesiredBytesPerPiece;
149 
154  int RequestData(vtkInformation* request,
155  vtkInformationVector** inputVector,
156  vtkInformationVector* outputVector) VTK_OVERRIDE;
157 
164  virtual void SMPRequestData(vtkInformation *request,
165  vtkInformationVector **inputVector,
166  vtkInformationVector *outputVector,
167  vtkImageData ***inData,
168  vtkImageData **outData,
169  vtkIdType begin, vtkIdType end,
170  vtkIdType pieces, int extent[6]);
171 
178  virtual void PrepareImageData(vtkInformationVector **inputVector,
179  vtkInformationVector *outputVector,
180  vtkImageData ***inDataObjects=0,
181  vtkImageData **outDataObjects=0);
182 
183 private:
184  vtkThreadedImageAlgorithm(const vtkThreadedImageAlgorithm&) VTK_DELETE_FUNCTION;
185  void operator=(const vtkThreadedImageAlgorithm&) VTK_DELETE_FUNCTION;
186 
187  friend class vtkThreadedImageAlgorithmFunctor;
188 };
189 
190 #endif
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:38
Generic filter that has one input..
Definition: vtkThreadedImageAlgorithm.h:38
virtual void PrepareImageData(vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inDataObjects=0, vtkImageData **outDataObjects=0)
virtual void SMPRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6])
virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total)
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) VTK_OVERRIDE
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
static void SetGlobalDefaultEnableSMP(bool enable)