ITK  4.8.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 >
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;
105  typedef typename OutputImageType::SizeType SizeType;
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;
114  typedef typename InternalInputImageType::SizeType InternalSizeType;
115  typedef typename InternalInputImageType::IndexType InternalIndexType;
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:
210  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
211 
212  virtual void GenerateData() ITK_OVERRIDE;
213 
214 private:
215  ObjectByObjectLabelMapFilter(const Self&); //purposely not implemented
216  void operator=(const Self&); //purposely not implemented
217 
221 
223 
225 
227  typename SelectType::Pointer m_Select;
228 
230  typename CropType::Pointer m_Crop;
231 
233  typename PadType::Pointer m_Pad;
234 
236  typename LM2BIType::Pointer m_LM2BI;
237 
239  typename LI2LMType::Pointer m_LI2LM;
240 
241  typedef itk::BinaryImageToLabelMapFilter< InternalOutputImageType, LabelMapType> BI2LMType;
242  typename BI2LMType::Pointer m_BI2LM;
243 
246 
247 
249 
250 }; // end of class
251 
252 } // end namespace itk
253 
254 #ifndef ITK_MANUAL_INSTANTIATION
255 #include "itkObjectByObjectLabelMapFilter.hxx"
256 #endif
257 
258 #endif
const InputFilterType * GetFilter() const
Pad a LabelMap image.
InternalInputImageType::RegionType InternalRegionType
void SetOutputFilter(OutputFilterType *filter)
convert a labeled image to a label collection image
virtual void GenerateData() override
Base class for all process objects that output image data.
void SetInputFilter(InputFilterType *filter)
void PrintSelf(std::ostream &os, Indent indent) const override
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
void SetFilter(InputFilterType *filter)
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.