23 Superclass::SetNumberOfRequiredOutputs(1);
24 Superclass::SetNthOutput(0, output.GetPointer());
34 itkDebugMacro(
"MakeOutput(" << name <<
")");
35 if (this->IsIndexedOutputName(name))
37 return this->
MakeOutput(this->MakeIndexFromOutputName(name));
57 splitIndex = splitRegion.GetIndex();
58 splitSize = splitRegion.GetSize();
62 while (requestedRegionSize[splitAxis] == 1)
67 itkDebugMacro(
" Cannot Split");
73 SlicedData::SizeType::SizeValueType range = requestedRegionSize[splitAxis];
74 auto valuesPerThread = itk::Math::Ceil<unsigned int>(range / (double)num);
75 unsigned int maxThreadIdUsed = itk::Math::Ceil<unsigned int>(range / (double)valuesPerThread) - 1;
78 if (i < maxThreadIdUsed)
80 splitIndex[splitAxis] += i * valuesPerThread;
81 splitSize[splitAxis] = valuesPerThread;
83 if (i == maxThreadIdUsed)
85 splitIndex[splitAxis] += i * valuesPerThread;
87 splitSize[splitAxis] = splitSize[splitAxis] - i * valuesPerThread;
91 splitRegion.SetIndex(splitIndex);
92 splitRegion.SetSize(splitSize);
94 itkDebugMacro(
" Split Piece: " << splitRegion);
96 return maxThreadIdUsed + 1;
106 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); i++)
131 this->GetMultiThreader()->SetNumberOfThreads(this->GetNumberOfThreads());
135 this->GetMultiThreader()->SingleMethodExecute();
147 itkExceptionMacro(
"subclass should override this method!!!");
157 itk::ThreadIdType total, threadId, threadCount;
159 threadId = ((itk::MultiThreader::ThreadInfoStruct *)(arg))->ThreadID;
160 threadCount = ((itk::MultiThreader::ThreadInfoStruct *)(arg))->NumberOfThreads;
162 str = (
ThreadStruct *)(((itk::MultiThreader::ThreadInfoStruct *)(arg))->UserData);
167 total = str->
Filter->SplitRequestedRegion(threadId, threadCount, splitRegion);
169 if (threadId < total)
171 str->
Filter->ThreadedGenerateData(splitRegion, threadId);
180 return ITK_THREAD_RETURN_VALUE;
185 Superclass::PrepareOutputs();
Superclass of all classes generating Images (instances of class Image) as output. ...
itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg)
Static function used as a "callback" by the MultiThreader.
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
virtual vtkImageData * GetVtkImageData()
static void Update(vtkPolyData *)
void PrepareOutputs() override
This method is intentionally left blank.
virtual vtkImageData * GetVtkImageData(int t=0, int n=0)
Get a volume at a specific time t of channel n as a vtkImageData.
SlicedData::RegionType OutputImageRegionType
virtual void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId)
If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an impl...
void GenerateData() override
A version of GenerateData() specific for image processing filters.
itk::Size< RegionDimension > SizeType
virtual unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType &splitRegion)
Split the output's RequestedRegion into "num" pieces, returning region "i" as "splitRegion".
virtual void BeforeThreadedGenerateData()
If an imaging filter needs to perform processing after the buffer has been allocated but before threa...
Internal structure used for passing image data into the threading library.
unsigned int GetDimension() const
Get dimension of the image.
itk::ImageRegion< RegionDimension > RegionType
Image class for storing images.
virtual const RegionType & GetRequestedRegion() const
virtual void AfterThreadedGenerateData()
If an imaging filter needs to perform processing after all processing threads have completed...
virtual void AllocateOutputs()
The GenerateData method normally allocates the buffers for all of the outputs of a filter...
OutputType * GetOutput()
Get the output data of this image source object.
#define mitkBaseDataSourceGetOutputDefinitions(className)