VTK  9.2.6
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 #include "vtkThreads.h" // for VTK_MAX_THREADS
40 
41 class vtkImageData;
42 class vtkMultiThreader;
43 
44 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
45 {
46 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
56  virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
57  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
58  int extent[6], int threadId);
59 
60  // also support the old signature
61  virtual void ThreadedExecute(
62  vtkImageData* inData, vtkImageData* outData, int extent[6], int threadId);
63 
65 
68  vtkGetMacro(EnableSMP, bool);
69  vtkSetMacro(EnableSMP, bool);
71 
73 
76  static void SetGlobalDefaultEnableSMP(bool enable);
77  static bool GetGlobalDefaultEnableSMP();
79 
81 
85  vtkSetVector3Macro(MinimumPieceSize, int);
86  vtkGetVector3Macro(MinimumPieceSize, int);
88 
90 
96  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
97  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
99 
101 
108  vtkSetClampMacro(SplitMode, int, 0, 2);
109  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
110  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
111  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
112  vtkGetMacro(SplitMode, int);
114 
116 
120  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
121  vtkGetMacro(NumberOfThreads, int);
123 
127  virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
128 
129 protected:
131  ~vtkThreadedImageAlgorithm() override;
132 
135 
136  bool EnableSMP;
138 
140  {
141  SLAB = 0,
142  BEAM = 1,
143  BLOCK = 2
144  };
145 
147  int SplitPath[3];
149  int MinimumPieceSize[3];
151 
156  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
157  vtkInformationVector* outputVector) override;
158 
165  virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
166  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
167  vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
168 
175  virtual void PrepareImageData(vtkInformationVector** inputVector,
176  vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
177  vtkImageData** outDataObjects = nullptr);
178 
179 private:
181  void operator=(const vtkThreadedImageAlgorithm&) = delete;
182 
183  friend class vtkThreadedImageAlgorithmFunctor;
184 };
185 
186 #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:332
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
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.