VTK  9.3.1
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);
66  static bool GetGlobalDefaultEnableSMP();
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:
120  ~vtkThreadedImageAlgorithm() override;
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
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:315
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
void SetSplitModeToBlock()
Set the method used to divide the volume into pieces.
void SetSplitModeToBeam()
Set the method used to divide the volume into pieces.
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.