ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkStatisticsRelabelImageFilter.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 __itkStatisticsRelabelImageFilter_h
19 #define __itkStatisticsRelabelImageFilter_h
20 
25 
26 namespace itk
27 {
44 template< class TInputImage, class TFeatureImage >
46  public ImageToImageFilter< TInputImage, TInputImage >
47 {
48 public:
54 
56  typedef TInputImage InputImageType;
57  typedef TInputImage OutputImageType;
58  typedef typename InputImageType::Pointer InputImagePointer;
59  typedef typename InputImageType::ConstPointer InputImageConstPointer;
60  typedef typename InputImageType::RegionType InputImageRegionType;
61  typedef typename InputImageType::PixelType InputImagePixelType;
62  typedef typename OutputImageType::Pointer OutputImagePointer;
63  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
64  typedef typename OutputImageType::RegionType OutputImageRegionType;
65  typedef typename OutputImageType::PixelType OutputImagePixelType;
66 
67  typedef TFeatureImage FeatureImageType;
68  typedef typename FeatureImageType::Pointer FeatureImagePointer;
69  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
70  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
71 
73  itkStaticConstMacro(InputImageDimension, unsigned int,
74  TInputImage::ImageDimension);
75  itkStaticConstMacro(OutputImageDimension, unsigned int,
76  TInputImage::ImageDimension);
77  itkStaticConstMacro(ImageDimension, unsigned int,
78  TInputImage::ImageDimension);
80 
88 
90  itkNewMacro(Self);
91 
93  itkTypeMacro(StatisticsRelabelImageFilter,
95 
96 #ifdef ITK_USE_CONCEPT_CHECKING
97 
98  itkConceptMacro( InputEqualityComparableCheck,
100  itkConceptMacro( IntConvertibleToInputCheck,
102  itkConceptMacro( InputOStreamWritableCheck,
104 
106 #endif
107 
112  itkSetMacro(BackgroundValue, OutputImagePixelType);
113  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
115 
121  itkGetConstMacro(ReverseOrdering, bool);
122  itkSetMacro(ReverseOrdering, bool);
123  itkBooleanMacro(ReverseOrdering);
125 
129  itkGetConstMacro(Attribute, AttributeType);
130  itkSetMacro(Attribute, AttributeType);
131  void SetAttribute(const std::string & s)
132  {
133  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
134  }
136 
138  void SetFeatureImage(TFeatureImage *input)
139  {
140  // Process object is not const-correct so the const casting is required.
141  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
142  }
143 
145  FeatureImageType * GetFeatureImage()
146  {
147  return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
148  }
149 
151  void SetInput1(InputImageType *input)
152  {
153  this->SetInput(input);
154  }
155 
157  void SetInput2(FeatureImageType *input)
158  {
159  this->SetFeatureImage(input);
160  }
161 
162 protected:
165  void PrintSelf(std::ostream & os, Indent indent) const;
166 
170  void GenerateInputRequestedRegion();
171 
173  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
174 
177  void GenerateData();
178 
179 private:
180  StatisticsRelabelImageFilter(const Self &); //purposely not implemented
181  void operator=(const Self &); //purposely not implemented
182 
186 }; // end of class
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkStatisticsRelabelImageFilter.hxx"
191 #endif
192 
193 #endif
194