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
41class vtkImageData;
43
44class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedImageAlgorithm : public vtkImageAlgorithm
45{
46public:
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);
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
129protected:
132
135
138
140 {
141 SLAB = 0,
142 BEAM = 1,
143 BLOCK = 2
144 };
145
147 int SplitPath[3];
149 int MinimumPieceSize[3];
151
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
179private:
181 void operator=(const vtkThreadedImageAlgorithm&) = delete;
182
183 friend class vtkThreadedImageAlgorithmFunctor;
184};
185
186#endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:40
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