VTK
vtkThreadedImageAlgorithm.h
Go to the documentation of this file.
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 =========================================================================*/
34 #ifndef vtkThreadedImageAlgorithm_h
35 #define vtkThreadedImageAlgorithm_h
36 
37 #include "vtkCommonExecutionModelModule.h" // For export macro
38 #include "vtkImageAlgorithm.h"
39 
40 class vtkImageData;
41 class vtkMultiThreader;
42 
43 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
44 {
45 public:
47  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
48 
55  virtual void ThreadedRequestData(vtkInformation *request,
56  vtkInformationVector **inputVector,
57  vtkInformationVector *outputVector,
58  vtkImageData ***inData,
59  vtkImageData **outData,
60  int extent[6], int threadId);
61 
62  // also support the old signature
63  virtual void ThreadedExecute(vtkImageData *inData,
64  vtkImageData *outData,
65  int extent[6], int threadId);
66 
68 
71  vtkGetMacro(EnableSMP, bool);
72  vtkSetMacro(EnableSMP, bool);
74 
76 
79  static void SetGlobalDefaultEnableSMP(bool enable);
80  static bool GetGlobalDefaultEnableSMP();
82 
84 
88  vtkSetVector3Macro(MinimumPieceSize, int);
89  vtkGetVector3Macro(MinimumPieceSize, int);
91 
93 
99  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
100  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
102 
104 
111  vtkSetClampMacro(SplitMode, int, 0, 2);
112  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
113  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
114  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
115  vtkGetMacro(SplitMode, int);
117 
119 
123  vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
124  vtkGetMacro( NumberOfThreads, int );
126 
130  virtual int SplitExtent(int splitExt[6], int startExt[6],
131  int num, int total);
132 
133 protected:
135  ~vtkThreadedImageAlgorithm() VTK_OVERRIDE;
136 
137  vtkMultiThreader *Threader;
138  int NumberOfThreads;
139 
140  bool EnableSMP;
141  static bool GlobalDefaultEnableSMP;
142 
144  {
145  SLAB = 0,
146  BEAM = 1,
147  BLOCK = 2
148  };
149 
151  int SplitPath[3];
153  int MinimumPieceSize[3];
155 
160  int RequestData(vtkInformation* request,
161  vtkInformationVector** inputVector,
162  vtkInformationVector* outputVector) VTK_OVERRIDE;
163 
170  virtual void SMPRequestData(vtkInformation *request,
171  vtkInformationVector **inputVector,
172  vtkInformationVector *outputVector,
173  vtkImageData ***inData,
174  vtkImageData **outData,
175  vtkIdType begin, vtkIdType end,
176  vtkIdType pieces, int extent[6]);
177 
184  virtual void PrepareImageData(vtkInformationVector **inputVector,
185  vtkInformationVector *outputVector,
186  vtkImageData ***inDataObjects=0,
187  vtkImageData **outDataObjects=0);
188 
189 private:
190  vtkThreadedImageAlgorithm(const vtkThreadedImageAlgorithm&) VTK_DELETE_FUNCTION;
191  void operator=(const vtkThreadedImageAlgorithm&) VTK_DELETE_FUNCTION;
192 
193  friend class vtkThreadedImageAlgorithmFunctor;
194 };
195 
196 #endif
void SetSplitModeToSlab()
Set the method used to divide the volume into pieces.
Store vtkAlgorithm input/output information.
A class for performing multithreaded execution.
int vtkIdType
Definition: vtkType.h:287
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void SetSplitModeToBlock()
Set the method used to divide the volume into pieces.
void SetSplitModeToBeam()
Set the method used to divide the volume into pieces.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.