ITK  4.6.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 
72 template<typename TInputImage, typename TOutputImage=TInputImage,
73  typename TInputFilter=ImageToImageFilter<
74  Image< unsigned char, TInputImage::ImageDimension >,
75  Image< unsigned char, TOutputImage::ImageDimension > >,
76  class TOutputFilter=typename TInputFilter::Superclass,
77  class TInternalInputImage=typename TInputFilter::InputImageType,
78  class TInternalOutputImage=typename TOutputFilter::OutputImageType >
80  public LabelMapFilter<TInputImage, TOutputImage>
81 {
82 public:
88 
90  typedef TInputImage InputImageType;
91  typedef TOutputImage OutputImageType;
92  typedef typename InputImageType::Pointer InputImagePointer;
93  typedef typename InputImageType::ConstPointer InputImageConstPointer;
94  typedef typename InputImageType::RegionType InputImageRegionType;
95  typedef typename InputImageType::PixelType InputImagePixelType;
96  typedef typename OutputImageType::Pointer OutputImagePointer;
97  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
98  typedef typename OutputImageType::RegionType OutputImageRegionType;
99  typedef typename OutputImageType::PixelType OutputImagePixelType;
100  typedef typename OutputImageType::SizeType SizeType;
102  typedef typename LabelMapType::LabelObjectType LabelObjectType;
103 
104  typedef TInputFilter InputFilterType;
105  typedef TOutputFilter OutputFilterType;
106 
107  typedef TInternalInputImage InternalInputImageType;
108  typedef typename InternalInputImageType::RegionType InternalRegionType;
109  typedef typename InternalInputImageType::SizeType InternalSizeType;
110  typedef typename InternalInputImageType::IndexType InternalIndexType;
111  typedef typename InternalInputImageType::OffsetType InternalOffsetType;
112  typedef typename InternalInputImageType::PixelType InternalInputPixelType;
113 
114  typedef TInternalOutputImage InternalOutputImageType;
115  typedef typename InternalOutputImageType::PixelType InternalOutputPixelType;
116 
118  itkStaticConstMacro(InputImageDimension, unsigned int,
119  TInputImage::ImageDimension);
120  itkStaticConstMacro(OutputImageDimension, unsigned int,
121  TOutputImage::ImageDimension);
122  itkStaticConstMacro(ImageDimension, unsigned int,
123  TOutputImage::ImageDimension);
125 
126  // filter types used internally
133 
135  itkNewMacro(Self);
136 
138  itkTypeMacro(ObjectByObjectLabelMapFilter,
140 
141  void SetFilter(InputFilterType * filter);
143  {
144  return this->m_InputFilter;
145  }
146 
147  const InputFilterType * GetFilter() const
148  {
149  return this->m_InputFilter;
150  }
151 
152  void SetInputFilter( InputFilterType * filter );
153  itkGetModifiableObjectMacro(InputFilter, InputFilterType );
154 
155  void SetOutputFilter( OutputFilterType * filter );
156  itkGetModifiableObjectMacro(OutputFilter, OutputFilterType );
157 
165  itkSetMacro(KeepLabels, bool);
166  itkGetMacro(KeepLabels, bool);
167  itkBooleanMacro(KeepLabels);
169 
173  itkSetMacro(PadSize, SizeType);
174  itkGetMacro(PadSize, SizeType);
176 
181  itkSetMacro(ConstrainPaddingToImage, bool);
182  itkGetMacro(ConstrainPaddingToImage, bool);
183  itkBooleanMacro(ConstrainPaddingToImage);
185 
191  itkSetMacro(BinaryInternalOutput, bool);
192  itkGetMacro(BinaryInternalOutput, bool);
193  itkBooleanMacro(BinaryInternalOutput);
195 
200  itkSetMacro(InternalForegroundValue, InternalOutputPixelType);
201  itkGetMacro(InternalForegroundValue, InternalOutputPixelType);
203 
208  itkGetMacro(Label, InputImagePixelType);
209 
210 protected:
213  void PrintSelf(std::ostream& os, Indent indent) const;
214 
215  virtual void GenerateData();
216 
217 private:
218  ObjectByObjectLabelMapFilter(const Self&); //purposely not implemented
219  void operator=(const Self&); //purposely not implemented
220 
224 
226 
228 
229 
230  typename InputFilterType::Pointer m_InputFilter;
231  typename OutputFilterType::Pointer m_OutputFilter;
232 
239 
241 
242 }; // end of class
243 
244 } // end namespace itk
245 
246 #ifndef ITK_MANUAL_INSTANTIATION
247 #include "itkObjectByObjectLabelMapFilter.hxx"
248 #endif
249 
250 #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
itk::LabelMapToBinaryImageFilter< LabelMapType, InternalInputImageType > LM2BIType
itk::BinaryImageToLabelMapFilter< InternalOutputImageType, LabelMapType > BI2LMType
itk::PadLabelMapFilter< LabelMapType > PadType
Base class for all process objects that output image data.
void SetInputFilter(InputFilterType *filter)
InternalInputImageType::OffsetType InternalOffsetType
InternalInputImageType::PixelType InternalInputPixelType
itk::AutoCropLabelMapFilter< LabelMapType > CropType
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
itk::LabelImageToLabelMapFilter< InternalOutputImageType, LabelMapType > LI2LMType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void PrintSelf(std::ostream &os, Indent indent) const
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
itk::LabelSelectionLabelMapFilter< LabelMapType > SelectType
Convert a LabelMap to a binary image.