ITK  6.0.0
Insight Toolkit
itkLabelMapFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18/*=========================================================================
19 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkLabelMapFilter_h
29#define itkLabelMapFilter_h
30
32#include <mutex>
33
34namespace itk
35{
56template <typename TInputImage, typename TOutputImage>
57class ITK_TEMPLATE_EXPORT LabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
58{
59public:
60 ITK_DISALLOW_COPY_AND_MOVE(LabelMapFilter);
61
67
69 itkOverrideGetNameOfClassMacro(LabelMapFilter);
70
72 itkNewMacro(Self);
73
75 using typename Superclass::InputImageType;
76 using typename Superclass::InputImagePointer;
77 using typename Superclass::InputImageConstPointer;
78 using typename Superclass::InputImageRegionType;
79 using typename Superclass::InputImagePixelType;
80 using LabelObjectType = typename InputImageType::LabelObjectType;
81
82 using OutputImageType = TOutputImage;
86 using OutputImagePixelType = typename OutputImageType::PixelType;
87
89 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
90 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
91
95 void
97
99 void
100 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
101
102protected:
104 ~LabelMapFilter() override = default;
105
106 void
108
109 void
111
112 void
113 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
114
115 // derived classes call this as inherited so we must delegate to DynamicThreadedGenerateData
116 void
117 ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType) override
118 {
119 Self::DynamicThreadedGenerateData(outputRegionForThread);
120 }
121
122 virtual void
124
129 virtual InputImageType *
131 {
132 return static_cast<InputImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(0)));
133 }
134
135 std::mutex m_LabelObjectContainerLock{};
136
137private:
138 typename InputImageType::Iterator m_LabelObjectIterator{};
139};
140} // end namespace itk
141
142#ifndef ITK_MANUAL_INSTANTIATION
143# include "itkLabelMapFilter.hxx"
144#endif
145
146#endif
Base class for all data objects in ITK.
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
Base class for filters that take an image as input and produce an image as output.
Base class for filters that take an image as input and overwrite that image as the output.
void GenerateInputRequestedRegion() override
void EnlargeOutputRequestedRegion(DataObject *) override
virtual InputImageType * GetLabelMap()
void AfterThreadedGenerateData() override
virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject)
~LabelMapFilter() override=default
void BeforeThreadedGenerateData() override
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType) override
typename InputImageType::LabelObjectType LabelObjectType
typename OutputImageType::ConstPointer OutputImageConstPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:102