VTK  9.0.1
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 =========================================================================*/
28 #ifndef vtkThreadedImageAlgorithm_h
29 #define vtkThreadedImageAlgorithm_h
30 
31 #include "vtkCommonExecutionModelModule.h" // For export macro
32 #include "vtkImageAlgorithm.h"
33 
34 class vtkImageData;
35 class vtkMultiThreader;
36 
37 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
49  virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
50  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
51  int extent[6], int threadId);
52 
53  // also support the old signature
54  virtual void ThreadedExecute(
55  vtkImageData* inData, vtkImageData* outData, int extent[6], int threadId);
56 
58 
61  vtkGetMacro(EnableSMP, bool);
62  vtkSetMacro(EnableSMP, bool);
64 
66 
69  static void SetGlobalDefaultEnableSMP(bool enable);
70  static bool GetGlobalDefaultEnableSMP();
72 
74 
78  vtkSetVector3Macro(MinimumPieceSize, int);
79  vtkGetVector3Macro(MinimumPieceSize, int);
81 
83 
89  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
90  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
92 
94 
101  vtkSetClampMacro(SplitMode, int, 0, 2);
102  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
103  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
104  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
105  vtkGetMacro(SplitMode, int);
107 
109 
113  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
114  vtkGetMacro(NumberOfThreads, int);
116 
120  virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
121 
122 protected:
124  ~vtkThreadedImageAlgorithm() override;
125 
128 
129  bool EnableSMP;
131 
133  {
134  SLAB = 0,
135  BEAM = 1,
136  BLOCK = 2
137  };
138 
140  int SplitPath[3];
142  int MinimumPieceSize[3];
144 
149  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
150  vtkInformationVector* outputVector) override;
151 
158  virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
159  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
160  vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
161 
168  virtual void PrepareImageData(vtkInformationVector** inputVector,
169  vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
170  vtkImageData** outDataObjects = nullptr);
171 
172 private:
174  void operator=(const vtkThreadedImageAlgorithm&) = delete;
175 
176  friend class vtkThreadedImageAlgorithmFunctor;
177 };
178 
179 #endif
vtkImageAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
vtkThreadedImageAlgorithm::SplitModeEnum
SplitModeEnum
Definition: vtkThreadedImageAlgorithm.h:132
vtkThreadedImageAlgorithm::SetSplitModeToSlab
void SetSplitModeToSlab()
Definition: vtkThreadedImageAlgorithm.h:102
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkThreadedImageAlgorithm::SplitPathLength
int SplitPathLength
Definition: vtkThreadedImageAlgorithm.h:141
vtkImageAlgorithm.h
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:37
vtkThreadedImageAlgorithm::Threader
vtkMultiThreader * Threader
Definition: vtkThreadedImageAlgorithm.h:126
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:37
vtkThreadedImageAlgorithm::NumberOfThreads
int NumberOfThreads
Definition: vtkThreadedImageAlgorithm.h:127
vtkThreadedImageAlgorithm::DesiredBytesPerPiece
vtkIdType DesiredBytesPerPiece
Definition: vtkThreadedImageAlgorithm.h:143
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:77
vtkThreadedImageAlgorithm::GlobalDefaultEnableSMP
static bool GlobalDefaultEnableSMP
Definition: vtkThreadedImageAlgorithm.h:130
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkThreadedImageAlgorithm::SetSplitModeToBlock
void SetSplitModeToBlock()
Definition: vtkThreadedImageAlgorithm.h:104
vtkThreadedImageAlgorithm::SetSplitModeToBeam
void SetSplitModeToBeam()
Definition: vtkThreadedImageAlgorithm.h:103
vtkThreadedImageAlgorithm::SplitMode
int SplitMode
Definition: vtkThreadedImageAlgorithm.h:139
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkThreadedImageAlgorithm::EnableSMP
bool EnableSMP
Definition: vtkThreadedImageAlgorithm.h:129
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351