VTK  9.5.20250917
vtkThreadedImageAlgorithm.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
22#ifndef vtkThreadedImageAlgorithm_h
23#define vtkThreadedImageAlgorithm_h
24
25#include "vtkCommonExecutionModelModule.h" // For export macro
26#include "vtkImageAlgorithm.h"
27#include "vtkThreads.h" // for VTK_MAX_THREADS
28#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29
30VTK_ABI_NAMESPACE_BEGIN
31class vtkImageData;
33
34class VTKCOMMONEXECUTIONMODEL_EXPORT VTK_MARSHALAUTO vtkThreadedImageAlgorithm
35 : public vtkImageAlgorithm
36{
37public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
47 virtual void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
48 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
49 int extent[6], int threadId);
50
51 // also support the old signature
52 virtual void ThreadedExecute(
53 vtkImageData* inData, vtkImageData* outData, int extent[6], int threadId);
54
56
59 vtkGetMacro(EnableSMP, bool);
60 vtkSetMacro(EnableSMP, bool);
62
64
67 static void SetGlobalDefaultEnableSMP(bool enable);
70
72
76 vtkSetVector3Macro(MinimumPieceSize, int);
77 vtkGetVector3Macro(MinimumPieceSize, int);
79
81
87 vtkSetMacro(DesiredBytesPerPiece, vtkIdType);
88 vtkGetMacro(DesiredBytesPerPiece, vtkIdType);
90
92
99 vtkSetClampMacro(SplitMode, int, 0, 2);
100 void SetSplitModeToSlab() { this->SetSplitMode(SLAB); }
101 void SetSplitModeToBeam() { this->SetSplitMode(BEAM); }
102 void SetSplitModeToBlock() { this->SetSplitMode(BLOCK); }
103 vtkGetMacro(SplitMode, int);
105
107
111 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
112 vtkGetMacro(NumberOfThreads, int);
114
118 virtual int SplitExtent(int splitExt[6], int startExt[6], int num, int total);
119
120protected:
123
126
129
131 {
132 SLAB = 0,
133 BEAM = 1,
134 BLOCK = 2
135 };
136
138 int SplitPath[3];
140 int MinimumPieceSize[3];
142
148 vtkInformationVector* outputVector) override;
149
156 virtual void SMPRequestData(vtkInformation* request, vtkInformationVector** inputVector,
157 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
158 vtkIdType begin, vtkIdType end, vtkIdType pieces, int extent[6]);
159
166 virtual void PrepareImageData(vtkInformationVector** inputVector,
167 vtkInformationVector* outputVector, vtkImageData*** inDataObjects = nullptr,
168 vtkImageData** outDataObjects = nullptr);
169
170private:
172 void operator=(const vtkThreadedImageAlgorithm&) = delete;
173
174 friend class vtkThreadedImageAlgorithmFunctor;
175};
176
177VTK_ABI_NAMESPACE_END
178#endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
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:333
#define VTK_MARSHALAUTO