VTK  9.1.0
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#include "vtkThreads.h" // for VTK_MAX_THREADS
34
35class vtkImageData;
37
38class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
39{
40public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
50 virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
51 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
52 int extent[6], int threadId);
53
54 // also support the old signature
55 virtual void ThreadedExecute(
56 vtkImageData* inData, vtkImageData* outData, int extent[6], int threadId);
57
59
62 vtkGetMacro(EnableSMP, bool);
63 vtkSetMacro(EnableSMP, bool);
65
67
70 static void SetGlobalDefaultEnableSMP(bool enable);
73
75
79 vtkSetVector3Macro(MinimumPieceSize, int);
80 vtkGetVector3Macro(MinimumPieceSize, int);
82
84
90 vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
91 vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
93
95
102 vtkSetClampMacro(SplitMode, int, 0, 2);
103 void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
104 void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
105 void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
106 vtkGetMacro(SplitMode, int);
108
110
114 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
115 vtkGetMacro(NumberOfThreads, int);
117
121 virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
122
123protected:
126
129
132
134 {
135 SLAB = 0,
136 BEAM = 1,
137 BLOCK = 2
138 };
139
141 int SplitPath[3];
143 int MinimumPieceSize[3];
145
151 vtkInformationVector* outputVector) override;
152
159 virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
160 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
161 vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
162
169 virtual void PrepareImageData(vtkInformationVector** inputVector,
170 vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
171 vtkImageData** outDataObjects = nullptr);
172
173private:
175 void operator=(const vtkThreadedImageAlgorithm&) = delete;
176
177 friend class vtkThreadedImageAlgorithmFunctor;
178};
179
180#endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A class for performing multithreaded execution.
Generic filter that has one input.
void SetSplitModeToBlock()
Set the method used to divide the volume into pieces.
virtual void SMPRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6])
Execute ThreadedRequestData for the given set of pieces.
~vtkThreadedImageAlgorithm() override
void SetSplitModeToBeam()
Set the method used to divide the volume into pieces.
virtual void ThreadedExecute(vtkImageData *inData, vtkImageData *outData, int extent[6], int threadId)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total)
Putting this here until I merge graphics and imaging streaming.
virtual void PrepareImageData(vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inDataObjects=nullptr, vtkImageData **outDataObjects=nullptr)
Allocate space for output data and copy attributes from first input.
void SetSplitModeToSlab()
Set the method used to divide the volume into pieces.
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up,...
static bool GetGlobalDefaultEnableSMP()
Global Disable SMP for all derived Imaging filters.
static void SetGlobalDefaultEnableSMP(bool enable)
Global Disable SMP for all derived Imaging filters.
int vtkIdType
Definition: vtkType.h:332