VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkImageData;
32 class vtkMultiThreader;
33 
34 class VTKCOMMONEXECUTIONMODEL_EXPORT VTK_MARSHALAUTO vtkThreadedImageAlgorithm
35  : public vtkImageAlgorithm
36 {
37 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
47  virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
48  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
49  VTK_FUTURE_CONST int extent[6], int threadId);
50 
51  // also support the old signature
52  virtual void ThreadedExecute(
53  vtkImageData* inData, vtkImageData* outData, VTK_FUTURE_CONST int extent[6], int threadId);
54 
56 
59  vtkGetMacro(EnableSMP, bool);
60  vtkSetMacro(EnableSMP, bool);
62 
64 
67  static void SetGlobalDefaultEnableSMP(bool enable);
68  static bool GetGlobalDefaultEnableSMP();
70 
72 
76  vtkSetVector3Macro(MinimumPieceSize, int);
77  vtkGetVector3Macro(MinimumPieceSize, int);
79 
81 
87  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
88  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
90 
92 
99  vtkSetClampMacro(SplitMode, int, 0, 2);
100  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
101  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
102  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
103  vtkGetMacro(SplitMode, int);
105 
107 
111  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
112  vtkGetMacro(NumberOfThreads, int);
114 
118  virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
119 
120 protected:
122  ~vtkThreadedImageAlgorithm() override;
123 
126 
127  bool EnableSMP;
129 
131  {
132  SLAB = 0,
133  BEAM = 1,
134  BLOCK = 2
135  };
136 
138  int SplitPath[3];
140  int MinimumPieceSize[3];
142 
147  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
148  vtkInformationVector* outputVector) override;
149 
156  virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
157  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
158  vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
159 
166  virtual void PrepareImageData(vtkInformationVector** inputVector,
167  vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
168  vtkImageData** outDataObjects = nullptr);
169 
170 private:
172  void operator=(const vtkThreadedImageAlgorithm&) = delete;
173 
174  friend class vtkThreadedImageAlgorithmFunctor;
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 #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:363
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: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.
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.
#define VTK_MARSHALAUTO
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.