ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkObjectByObjectLabelMapFilter.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 itkObjectByObjectLabelMapFilter_h
19 #define itkObjectByObjectLabelMapFilter_h
20 
21 #include "itkLabelMapFilter.h"
27 #include "itkPadLabelMapFilter.h"
28 
29 
30 namespace itk {
31 
77 template<typename TInputImage, typename TOutputImage=TInputImage,
78  typename TInputFilter=ImageToImageFilter<
79  Image< unsigned char, TInputImage::ImageDimension >,
80  Image< unsigned char, TOutputImage::ImageDimension > >,
81  class TOutputFilter=typename TInputFilter::Superclass,
82  class TInternalInputImage=typename TInputFilter::InputImageType,
83  class TInternalOutputImage=typename TOutputFilter::OutputImageType >
84 class ITK_TEMPLATE_EXPORT ObjectByObjectLabelMapFilter :
85  public LabelMapFilter<TInputImage, TOutputImage>
86 {
87 public:
88  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectByObjectLabelMapFilter);
89 
95 
97  using InputImageType = TInputImage;
98  using OutputImageType = TOutputImage;
99  using InputImagePointer = typename InputImageType::Pointer;
100  using InputImageConstPointer = typename InputImageType::ConstPointer;
102  using InputImagePixelType = typename InputImageType::PixelType;
103  using OutputImagePointer = typename OutputImageType::Pointer;
104  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
106  using OutputImagePixelType = typename OutputImageType::PixelType;
109  using LabelObjectType = typename LabelMapType::LabelObjectType;
110 
111  using InputFilterType = TInputFilter;
112  using OutputFilterType = TOutputFilter;
113 
114  using InternalInputImageType = TInternalInputImage;
118  using InternalOffsetType = typename InternalInputImageType::OffsetType;
119  using InternalInputPixelType = typename InternalInputImageType::PixelType;
120 
121  using InternalOutputImageType = TInternalOutputImage;
122  using InternalOutputPixelType = typename InternalOutputImageType::PixelType;
123 
125  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
126  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
127  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
128 
130  itkNewMacro(Self);
131 
133  itkTypeMacro(ObjectByObjectLabelMapFilter,
135 
136  void SetFilter(InputFilterType * filter);
138  {
139  return this->m_InputFilter;
140  }
141 
142  const InputFilterType * GetFilter() const
143  {
144  return this->m_InputFilter;
145  }
146 
147  void SetInputFilter( InputFilterType * filter );
148  itkGetModifiableObjectMacro(InputFilter, InputFilterType );
149 
150  void SetOutputFilter( OutputFilterType * filter );
151  itkGetModifiableObjectMacro(OutputFilter, OutputFilterType );
152 
160  itkSetMacro(KeepLabels, bool);
161  itkGetMacro(KeepLabels, bool);
162  itkBooleanMacro(KeepLabels);
164 
168  itkSetMacro(PadSize, SizeType);
169  itkGetMacro(PadSize, SizeType);
171 
176  itkSetMacro(ConstrainPaddingToImage, bool);
177  itkGetMacro(ConstrainPaddingToImage, bool);
178  itkBooleanMacro(ConstrainPaddingToImage);
180 
186  itkSetMacro(BinaryInternalOutput, bool);
187  itkGetMacro(BinaryInternalOutput, bool);
188  itkBooleanMacro(BinaryInternalOutput);
190 
195  itkSetMacro(InternalForegroundValue, InternalOutputPixelType);
196  itkGetMacro(InternalForegroundValue, InternalOutputPixelType);
198 
203  itkGetMacro(Label, InputImagePixelType);
204 
205 protected:
207  ~ObjectByObjectLabelMapFilter() override = default;
208  void PrintSelf(std::ostream& os, Indent indent) const override;
209 
210  void GenerateData() override;
211 
212 private:
216 
218 
220 
223 
226 
229 
232 
235 
238 
239  typename InputFilterType::Pointer m_InputFilter;
240  typename OutputFilterType::Pointer m_OutputFilter;
241 
242 
244 
245 }; // end of class
246 
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 #include "itkObjectByObjectLabelMapFilter.hxx"
251 #endif
252 
253 #endif
const InputFilterType * GetFilter() const
Pad a LabelMap image.
convert a labeled image to a label collection image
typename OutputImageType::Pointer OutputImagePointer
typename InternalInputImageType::SizeType InternalSizeType
typename InputImageType::LabelObjectType LabelObjectType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename InternalInputImageType::RegionType InternalRegionType
typename InternalInputImageType::PixelType InternalInputPixelType
Base class for all process objects that output image data.
typename OutputImageType::ConstPointer OutputImageConstPointer
typename InternalInputImageType::IndexType InternalIndexType
typename InternalInputImageType::OffsetType InternalOffsetType
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Crop a LabelMap image to fit exactly the objects in the LabelMap.
Base class for filters that take an image as input and overwrite that image as the output...
remove the objects according to the value of their attribute
typename OutputImageType::SizeType SizeType
typename InputImageType::RegionType InputImageRegionType
Label the connected components in a binary image and produce a collection of label objects...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename InputImageType::ConstPointer InputImageConstPointer
ObjectByObjectLabelMapFilter applies an image pipeline to all the objects of a label map and produce ...
Convert a LabelMap to a binary image.
typename InternalOutputImageType::PixelType InternalOutputPixelType