VTK  9.3.20240329
vtkThreadedImageAlgorithm.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkThreadedImageAlgorithm_h
23 #define vtkThreadedImageAlgorithm_h
24 
25 #include "vtkCommonExecutionModelModule.h" // For export macro
26 #include "vtkImageAlgorithm.h"
27 #include "vtkThreads.h" // for VTK_MAX_THREADS
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkImageData;
31 class vtkMultiThreader;
32 
33 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
34 {
35 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
45  virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
46  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
47  int extent[6], int threadId);
48 
49  // also support the old signature
50  virtual void ThreadedExecute(
51  vtkImageData* inData, vtkImageData* outData, int extent[6], int threadId);
52 
54 
57  vtkGetMacro(EnableSMP, bool);
58  vtkSetMacro(EnableSMP, bool);
60 
62 
65  static void SetGlobalDefaultEnableSMP(bool enable);
68 
70 
74  vtkSetVector3Macro(MinimumPieceSize, int);
75  vtkGetVector3Macro(MinimumPieceSize, int);
77 
79 
85  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
86  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
88 
90 
97  vtkSetClampMacro(SplitMode, int, 0, 2);
98  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
99  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
100  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
101  vtkGetMacro(SplitMode, int);
103 
105 
109  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
110  vtkGetMacro(NumberOfThreads, int);
112 
116  virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
117 
118 protected:
121 
124 
125  bool EnableSMP;
127 
129  {
130  SLAB = 0,
131  BEAM = 1,
132  BLOCK = 2
133  };
134 
136  int SplitPath[3];
138  int MinimumPieceSize[3];
140 
145  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
146  vtkInformationVector* outputVector) override;
147 
154  virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
155  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
156  vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
157 
164  virtual void PrepareImageData(vtkInformationVector** inputVector,
165  vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
166  vtkImageData** outDataObjects = nullptr);
167 
168 private:
170  void operator=(const vtkThreadedImageAlgorithm&) = delete;
171 
172  friend class vtkThreadedImageAlgorithmFunctor;
173 };
174 
175 VTK_ABI_NAMESPACE_END
176 #endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A class for performing multithreaded execution.
Generic filter that has one input.
void SetSplitModeToBlock()
Set the method used to divide the volume into pieces.
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
void SetSplitModeToBeam()
Set the method used to divide the volume into pieces.
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 PrepareImageData(vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inDataObjects=nullptr, vtkImageData **outDataObjects=nullptr)
Allocate space for output data and copy attributes from first input.
void SetSplitModeToSlab()
Set the method used to divide the volume into pieces.
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()
Global Disable SMP for all derived Imaging filters.
static void SetGlobalDefaultEnableSMP(bool enable)
Global Disable SMP for all derived Imaging filters.
@ extent
Definition: vtkX3D.h:345
int vtkIdType
Definition: vtkType.h:315