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 =========================================================================*/
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 
138  {
139  SLAB = 0,
140  BEAM = 1,
141  BLOCK = 2
142  };
143 
145  int SplitPath[3];
147  int MinimumPieceSize[3];
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
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:345
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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.