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 =========================================================================*/
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,
50  vtkInformationVector **inputVector,
51  vtkInformationVector *outputVector,
52  vtkImageData ***inData,
53  vtkImageData **outData,
54  int extent[6], int threadId);
55 
56  // also support the old signature
57  virtual void ThreadedExecute(vtkImageData *inData,
58  vtkImageData *outData,
59  int extent[6], int threadId);
60 
62 
65  vtkGetMacro(EnableSMP, bool);
66  vtkSetMacro(EnableSMP, bool);
68 
70 
73  static void SetGlobalDefaultEnableSMP(bool enable);
74  static bool GetGlobalDefaultEnableSMP();
76 
78 
82  vtkSetVector3Macro(MinimumPieceSize, int);
83  vtkGetVector3Macro(MinimumPieceSize, int);
85 
87 
93  vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
94  vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
96 
98 
105  vtkSetClampMacro(SplitMode, int, 0, 2);
106  void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
107  void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
108  void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
109  vtkGetMacro(SplitMode, int);
111 
113 
117  vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
118  vtkGetMacro( NumberOfThreads, int );
120 
124  virtual int SplitExtent(int splitExt[6], int startExt[6],
125  int num, int total);
126 
127 protected:
129  ~vtkThreadedImageAlgorithm() override;
130 
133 
134  bool EnableSMP;
136 
138  {
139  SLAB = 0,
140  BEAM = 1,
141  BLOCK = 2
142  };
143 
145  int SplitPath[3];
147  int MinimumPieceSize[3];
149 
154  int RequestData(vtkInformation* request,
155  vtkInformationVector** inputVector,
156  vtkInformationVector* outputVector) override;
157 
164  virtual void SMPRequestData(vtkInformation *request,
165  vtkInformationVector **inputVector,
166  vtkInformationVector *outputVector,
167  vtkImageData ***inData,
168  vtkImageData **outData,
169  vtkIdType begin, vtkIdType end,
170  vtkIdType pieces, int extent[6]);
171 
178  virtual void PrepareImageData(vtkInformationVector **inputVector,
179  vtkInformationVector *outputVector,
180  vtkImageData ***inDataObjects=nullptr,
181  vtkImageData **outDataObjects=nullptr);
182 
183 private:
185  void operator=(const vtkThreadedImageAlgorithm&) = delete;
186 
187  friend class vtkThreadedImageAlgorithmFunctor;
188 };
189 
190 #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:137
vtkThreadedImageAlgorithm::SetSplitModeToSlab
void SetSplitModeToSlab()
Definition: vtkThreadedImageAlgorithm.h:106
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkThreadedImageAlgorithm::SplitPathLength
int SplitPathLength
Definition: vtkThreadedImageAlgorithm.h:146
vtkImageAlgorithm.h
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:37
vtkThreadedImageAlgorithm::Threader
vtkMultiThreader * Threader
Definition: vtkThreadedImageAlgorithm.h:131
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:37
vtkThreadedImageAlgorithm::NumberOfThreads
int NumberOfThreads
Definition: vtkThreadedImageAlgorithm.h:132
vtkThreadedImageAlgorithm::DesiredBytesPerPiece
vtkIdType DesiredBytesPerPiece
Definition: vtkThreadedImageAlgorithm.h:148
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:77
vtkThreadedImageAlgorithm::GlobalDefaultEnableSMP
static bool GlobalDefaultEnableSMP
Definition: vtkThreadedImageAlgorithm.h:135
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkThreadedImageAlgorithm::SetSplitModeToBlock
void SetSplitModeToBlock()
Definition: vtkThreadedImageAlgorithm.h:108
vtkThreadedImageAlgorithm::SetSplitModeToBeam
void SetSplitModeToBeam()
Definition: vtkThreadedImageAlgorithm.h:107
vtkThreadedImageAlgorithm::SplitMode
int SplitMode
Definition: vtkThreadedImageAlgorithm.h:144
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
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:134
vtkX3D::extent
Definition: vtkX3D.h:345