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);
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:
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 
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
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A class for performing multithreaded execution.
Generic filter that has one input.
virtual void PrepareImageData(vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inDataObjects=0, vtkImageData **outDataObjects=0)
Allocate space for output data and copy attributes from first input.
virtual void SMPRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6])
Execute ThreadedRequestData for the given set of pieces.
~vtkThreadedImageAlgorithm() override
virtual void ThreadedExecute(vtkImageData *inData, vtkImageData *outData, int extent[6], int threadId)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total)
Putting this here until I merge graphics and imaging streaming.
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up,...
static bool GetGlobalDefaultEnableSMP()
static void SetGlobalDefaultEnableSMP(bool enable)
Global Disable SMP for all derived Imaging filters.
@ extent
Definition: vtkX3D.h:345
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287