ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLabelImageToLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 #ifndef itkLabelImageToLabelMapFilter_h
19 #define itkLabelImageToLabelMapFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkLabelMap.h"
23 #include "itkLabelObject.h"
24 
25 namespace itk
26 {
47 template< typename TInputImage, typename TOutputImage =
48  LabelMap< LabelObject< typename TInputImage::PixelType,
49  TInputImage::ImageDimension > > >
50 class ITK_TEMPLATE_EXPORT LabelImageToLabelMapFilter:
51  public ImageToImageFilter< TInputImage, TOutputImage >
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(LabelImageToLabelMapFilter);
55 
61 
63  using InputImageType = TInputImage;
64  using OutputImageType = TOutputImage;
65  using InputImagePointer = typename InputImageType::Pointer;
66  using InputImageConstPointer = typename InputImageType::ConstPointer;
68  using InputImagePixelType = typename InputImageType::PixelType;
70 
71  using OutputImagePointer = typename OutputImageType::Pointer;
72  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
74  using OutputImagePixelType = typename OutputImageType::PixelType;
75  using LabelObjectType = typename OutputImageType::LabelObjectType;
76  using LengthType = typename LabelObjectType::LengthType;
77 
79  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
80  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
81 
83  itkNewMacro(Self);
84 
86  itkTypeMacro(LabelImageToLabelMapFilter,
88 
93  itkSetMacro(BackgroundValue, OutputImagePixelType);
94  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
96 
97 #ifdef ITK_USE_CONCEPT_CHECKING
98  itkConceptMacro( SameDimensionCheck,
100 #endif
101 
102 protected:
104  ~LabelImageToLabelMapFilter() override = default;
105  void PrintSelf(std::ostream & os, Indent indent) const override;
106 
110  void GenerateInputRequestedRegion() override;
111 
113  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
114 
115  void BeforeThreadedGenerateData() override;
116 
117  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) override;
118 
120  {
121  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
122  }
123 
124  void AfterThreadedGenerateData() override;
125 
126 private:
128 
129  typename std::vector< OutputImagePointer > m_TemporaryImages;
130 }; // end of class
131 } // end namespace itk
132 
133 #ifndef ITK_MANUAL_INSTANTIATION
134 #include "itkLabelImageToLabelMapFilter.hxx"
135 #endif
136 
137 #endif
std::vector< OutputImagePointer > m_TemporaryImages
convert a labeled image to a label collection image
typename OutputImageType::Pointer OutputImagePointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::LabelObjectType LabelObjectType
typename LabelObjectType::LengthType LengthType
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::IndexType IndexType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename OutputImageType::ConstPointer OutputImageConstPointer
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
Base class for all data objects in ITK.