ITK  4.13.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:
93 
95  typedef TInputImage InputImageType;
96  typedef TOutputImage OutputImageType;
97  typedef typename InputImageType::Pointer InputImagePointer;
98  typedef typename InputImageType::ConstPointer InputImageConstPointer;
99  typedef typename InputImageType::RegionType InputImageRegionType;
100  typedef typename InputImageType::PixelType InputImagePixelType;
101  typedef typename OutputImageType::Pointer OutputImagePointer;
102  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
103  typedef typename OutputImageType::RegionType OutputImageRegionType;
104  typedef typename OutputImageType::PixelType OutputImagePixelType;
107  typedef typename LabelMapType::LabelObjectType LabelObjectType;
108 
109  typedef TInputFilter InputFilterType;
110  typedef TOutputFilter OutputFilterType;
111 
112  typedef TInternalInputImage InternalInputImageType;
113  typedef typename InternalInputImageType::RegionType InternalRegionType;
116  typedef typename InternalInputImageType::OffsetType InternalOffsetType;
117  typedef typename InternalInputImageType::PixelType InternalInputPixelType;
118 
119  typedef TInternalOutputImage InternalOutputImageType;
120  typedef typename InternalOutputImageType::PixelType InternalOutputPixelType;
121 
123  itkStaticConstMacro(InputImageDimension, unsigned int,
124  TInputImage::ImageDimension);
125  itkStaticConstMacro(OutputImageDimension, unsigned int,
126  TOutputImage::ImageDimension);
127  itkStaticConstMacro(ImageDimension, unsigned int,
128  TOutputImage::ImageDimension);
130 
132  itkNewMacro(Self);
133 
135  itkTypeMacro(ObjectByObjectLabelMapFilter,
137 
138  void SetFilter(InputFilterType * filter);
140  {
141  return this->m_InputFilter;
142  }
143 
144  const InputFilterType * GetFilter() const
145  {
146  return this->m_InputFilter;
147  }
148 
149  void SetInputFilter( InputFilterType * filter );
150  itkGetModifiableObjectMacro(InputFilter, InputFilterType );
151 
152  void SetOutputFilter( OutputFilterType * filter );
153  itkGetModifiableObjectMacro(OutputFilter, OutputFilterType );
154 
162  itkSetMacro(KeepLabels, bool);
163  itkGetMacro(KeepLabels, bool);
164  itkBooleanMacro(KeepLabels);
166 
170  itkSetMacro(PadSize, SizeType);
171  itkGetMacro(PadSize, SizeType);
173 
178  itkSetMacro(ConstrainPaddingToImage, bool);
179  itkGetMacro(ConstrainPaddingToImage, bool);
180  itkBooleanMacro(ConstrainPaddingToImage);
182 
188  itkSetMacro(BinaryInternalOutput, bool);
189  itkGetMacro(BinaryInternalOutput, bool);
190  itkBooleanMacro(BinaryInternalOutput);
192 
197  itkSetMacro(InternalForegroundValue, InternalOutputPixelType);
198  itkGetMacro(InternalForegroundValue, InternalOutputPixelType);
200 
205  itkGetMacro(Label, InputImagePixelType);
206 
207 protected:
209  ~ObjectByObjectLabelMapFilter() ITK_OVERRIDE {};
210  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
211 
212  virtual void GenerateData() ITK_OVERRIDE;
213 
214 private:
215  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectByObjectLabelMapFilter);
216 
217  bool m_ConstrainPaddingToImage;
218  SizeType m_PadSize;
219  bool m_BinaryInternalOutput;
220 
221  bool m_KeepLabels;
222 
223  InternalOutputPixelType m_InternalForegroundValue;
224 
226  typename SelectType::Pointer m_Select;
227 
229  typename CropType::Pointer m_Crop;
230 
232  typename PadType::Pointer m_Pad;
233 
235  typename LM2BIType::Pointer m_LM2BI;
236 
238  typename LI2LMType::Pointer m_LI2LM;
239 
240  typedef itk::BinaryImageToLabelMapFilter< InternalOutputImageType, LabelMapType> BI2LMType;
241  typename BI2LMType::Pointer m_BI2LM;
242 
243  typename InputFilterType::Pointer m_InputFilter;
244  typename OutputFilterType::Pointer m_OutputFilter;
245 
246 
248 
249 }; // end of class
250 
251 } // end namespace itk
252 
253 #ifndef ITK_MANUAL_INSTANTIATION
254 #include "itkObjectByObjectLabelMapFilter.hxx"
255 #endif
256 
257 #endif
const InputFilterType * GetFilter() const
Pad a LabelMap image.
InternalInputImageType::RegionType InternalRegionType
convert a labeled image to a label collection image
Base class for all process objects that output image data.
InternalInputImageType::OffsetType InternalOffsetType
InternalInputImageType::PixelType InternalInputPixelType
InternalInputImageType::SizeType InternalSizeType
InputImageType::ConstPointer InputImageConstPointer
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
OutputImageType::ConstPointer OutputImageConstPointer
InputImageType::PixelType InputImagePixelType
Label the connected components in a binary image and produce a collection of label objects...
LabelMapFilter< TInputImage, TOutputImage > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutputImage OutputImageType
InternalOutputImageType::PixelType InternalOutputPixelType
ObjectByObjectLabelMapFilter applies an image pipeline to all the objects of a label map and produce ...
InternalInputImageType::IndexType InternalIndexType
Convert a LabelMap to a binary image.