ITK  4.3.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<class TInputImage, class TOutputImage=TInputImage,
73  class 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 >
79 class ITK_EXPORT ObjectByObjectLabelMapFilter :
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);
142  InputFilterType * GetFilter()
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  itkGetObjectMacro( InputFilter, InputFilterType );
154 
155  void SetOutputFilter( OutputFilterType * filter );
156  itkGetObjectMacro( OutputFilter, OutputFilterType );
157 
158 
166  itkSetMacro(KeepLabels, bool);
167  itkGetMacro(KeepLabels, bool);
168  itkBooleanMacro(KeepLabels);
170 
174  itkSetMacro(PadSize, SizeType);
175  itkGetMacro(PadSize, SizeType);
177 
182  itkSetMacro(ConstrainPaddingToImage, bool);
183  itkGetMacro(ConstrainPaddingToImage, bool);
184  itkBooleanMacro(ConstrainPaddingToImage);
186 
192  itkSetMacro(BinaryInternalOutput, bool);
193  itkGetMacro(BinaryInternalOutput, bool);
194  itkBooleanMacro(BinaryInternalOutput);
196 
201  itkSetMacro(InternalForegroundValue, InternalOutputPixelType);
202  itkGetMacro(InternalForegroundValue, InternalOutputPixelType);
204 
209  itkGetMacro(Label, InputImagePixelType);
210 
211 protected:
214  void PrintSelf(std::ostream& os, Indent indent) const;
215 
216  virtual void GenerateData();
217 
218 private:
219  ObjectByObjectLabelMapFilter(const Self&); //purposely not implemented
220  void operator=(const Self&); //purposely not implemented
221 
225 
227 
229 
230 
231  typename InputFilterType::Pointer m_InputFilter;
232  typename OutputFilterType::Pointer m_OutputFilter;
233 
240 
242 
243 }; // end of class
244 
245 } // end namespace itk
246 
247 #ifndef ITK_MANUAL_INSTANTIATION
248 #include "itkObjectByObjectLabelMapFilter.hxx"
249 #endif
250 
251 #endif
252