ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkLabelImageToStatisticsLabelMapFilter.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 __itkLabelImageToStatisticsLabelMapFilter_h
19 #define __itkLabelImageToStatisticsLabelMapFilter_h
20 
24 
25 namespace itk
26 {
40 template< class TInputImage, class TFeatureImage, class TOutputImage =
41  LabelMap< StatisticsLabelObject< typename TInputImage::PixelType,
42  TInputImage::ImageDimension > > >
44  public ImageToImageFilter< TInputImage, TOutputImage >
45 {
46 public:
52 
54  typedef TInputImage InputImageType;
55  typedef typename InputImageType::Pointer InputImagePointer;
56  typedef typename InputImageType::ConstPointer InputImageConstPointer;
57  typedef typename InputImageType::RegionType InputImageRegionType;
58  typedef typename InputImageType::PixelType InputImagePixelType;
59 
60  typedef TOutputImage OutputImageType;
61  typedef typename OutputImageType::Pointer OutputImagePointer;
62  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
63  typedef typename OutputImageType::RegionType OutputImageRegionType;
64  typedef typename OutputImageType::PixelType OutputImagePixelType;
65  typedef typename OutputImageType::LabelObjectType LabelObjectType;
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 
83 
85  itkNewMacro(Self);
86 
90 
91 #ifdef ITK_USE_CONCEPT_CHECKING
92 
93  itkConceptMacro( InputEqualityComparableCheck,
95  itkConceptMacro( IntConvertibleToInputCheck,
97  itkConceptMacro( InputOStreamWritableCheck,
99 
101 #endif
102 
107  itkSetMacro(BackgroundValue, OutputImagePixelType);
108  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
110 
115  itkSetMacro(ComputeFeretDiameter, bool);
116  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
117  itkBooleanMacro(ComputeFeretDiameter);
119 
124  itkSetMacro(ComputePerimeter, bool);
125  itkGetConstReferenceMacro(ComputePerimeter, bool);
126  itkBooleanMacro(ComputePerimeter);
128 
130  void SetFeatureImage(const TFeatureImage *input)
131  {
132  // Process object is not const-correct so the const casting is required.
133  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
134  }
135 
137  const FeatureImageType * GetFeatureImage()
138  {
139  return static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) );
140  }
141 
143  void SetInput1(const InputImageType *input)
144  {
145  this->SetInput(input);
146  }
147 
149  void SetInput2(const FeatureImageType *input)
150  {
151  this->SetFeatureImage(input);
152  }
153 
160  itkSetMacro(ComputeHistogram, bool);
161  itkGetConstReferenceMacro(ComputeHistogram, bool);
162  itkBooleanMacro(ComputeHistogram);
164 
170  itkSetMacro(NumberOfBins, unsigned int);
171  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
173 
174 protected:
177  void PrintSelf(std::ostream & os, Indent indent) const;
178 
182  void GenerateInputRequestedRegion();
183 
185  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
186 
189  void GenerateData();
190 
191 private:
192  LabelImageToStatisticsLabelMapFilter(const Self &); //purposely not
193  // implemented
194  void operator=(const Self &); //purposely not
195  // implemented
196 
200  unsigned int m_NumberOfBins;
202 }; // end of class
203 } // end namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 #include "itkLabelImageToStatisticsLabelMapFilter.hxx"
207 #endif
208 
209 #endif
210