VTK
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 
40 class vtkImageData;
41 class vtkMultiThreader;
42 
43 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
44 {
45 public:
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
55  virtual void ThreadedRequestData(vtkInformation *request,
56  vtkInformationVector **inputVector,
57  vtkInformationVector *outputVector,
58  vtkImageData ***inData,
59  vtkImageData **outData,
60  int extent[6], int threadId);
61 
62  // also support the old signature
63  virtual void ThreadedExecute(vtkImageData *inData,
64  vtkImageData *outData,
65  int extent[6], int threadId);
66 
68 
71  vtkGetMacro(EnableSMP, bool);
72  vtkSetMacro(EnableSMP, bool);
74 
76 
79  static void SetGlobalDefaultEnableSMP(bool enable);
80  static bool GetGlobalDefaultEnableSMP();
82 
84 
88  vtkSetVector3Macro(MinimumPieceSize, int);
89  vtkGetVector3Macro(MinimumPieceSize, int);
91 
93 
99  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
100  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
102 
104 
111  vtkSetClampMacro(SplitMode, int, 0, 2);
112  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
113  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
114  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
115  vtkGetMacro(SplitMode, int);
117 
119 
123  vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
124  vtkGetMacro( NumberOfThreads, int );
126 
130  virtual int SplitExtent(int splitExt[6], int startExt[6],
131  int num, int total);
132 
133 protected:
135  ~vtkThreadedImageAlgorithm() override;
136 
139 
140  bool EnableSMP;
142 
144  {
145  SLAB = 0,
146  BEAM = 1,
147  BLOCK = 2
148  };
149 
151  int SplitPath[3];
153  int MinimumPieceSize[3];
155 
160  int RequestData(vtkInformation* request,
161  vtkInformationVector** inputVector,
162  vtkInformationVector* outputVector) override;
163 
170  virtual void SMPRequestData(vtkInformation *request,
171  vtkInformationVector **inputVector,
172  vtkInformationVector *outputVector,
173  vtkImageData ***inData,
174  vtkImageData **outData,
175  vtkIdType begin, vtkIdType end,
176  vtkIdType pieces, int extent[6]);
177 
184  virtual void PrepareImageData(vtkInformationVector **inputVector,
185  vtkInformationVector *outputVector,
186  vtkImageData ***inDataObjects=nullptr,
187  vtkImageData **outDataObjects=nullptr);
188 
189 private:
191  void operator=(const vtkThreadedImageAlgorithm&) = delete;
192 
193  friend class vtkThreadedImageAlgorithmFunctor;
194 };
195 
196 #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:143
vtkThreadedImageAlgorithm::SetSplitModeToSlab
void SetSplitModeToSlab()
Definition: vtkThreadedImageAlgorithm.h:112
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkThreadedImageAlgorithm::SplitPathLength
int SplitPathLength
Definition: vtkThreadedImageAlgorithm.h:152
vtkImageAlgorithm.h
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:43
vtkThreadedImageAlgorithm::Threader
vtkMultiThreader * Threader
Definition: vtkThreadedImageAlgorithm.h:137
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkThreadedImageAlgorithm::NumberOfThreads
int NumberOfThreads
Definition: vtkThreadedImageAlgorithm.h:138
vtkThreadedImageAlgorithm::DesiredBytesPerPiece
vtkIdType DesiredBytesPerPiece
Definition: vtkThreadedImageAlgorithm.h:154
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:83
vtkThreadedImageAlgorithm::GlobalDefaultEnableSMP
static bool GlobalDefaultEnableSMP
Definition: vtkThreadedImageAlgorithm.h:141
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkThreadedImageAlgorithm::SetSplitModeToBlock
void SetSplitModeToBlock()
Definition: vtkThreadedImageAlgorithm.h:114
vtkThreadedImageAlgorithm::SetSplitModeToBeam
void SetSplitModeToBeam()
Definition: vtkThreadedImageAlgorithm.h:113
vtkThreadedImageAlgorithm::SplitMode
int SplitMode
Definition: vtkThreadedImageAlgorithm.h:150
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
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:140
vtkX3D::extent
Definition: vtkX3D.h:345