ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkBinaryImageToStatisticsLabelMapFilter.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 __itkBinaryImageToStatisticsLabelMapFilter_h
19 #define __itkBinaryImageToStatisticsLabelMapFilter_h
20 
24 
25 namespace itk
26 {
40 template< class TInputImage, class TFeatureImage, class TOutputImage =
41  LabelMap< StatisticsLabelObject< SizeValueType, TInputImage::ImageDimension > > >
43  public ImageToImageFilter< TInputImage, TOutputImage >
44 {
45 public:
51 
53  typedef TInputImage InputImageType;
54  typedef typename InputImageType::Pointer InputImagePointer;
55  typedef typename InputImageType::ConstPointer InputImageConstPointer;
56  typedef typename InputImageType::RegionType InputImageRegionType;
57  typedef typename InputImageType::PixelType InputImagePixelType;
58 
59  typedef TOutputImage OutputImageType;
60  typedef typename OutputImageType::Pointer OutputImagePointer;
61  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
62  typedef typename OutputImageType::RegionType OutputImageRegionType;
63  typedef typename OutputImageType::PixelType OutputImagePixelType;
64  typedef typename OutputImageType::LabelObjectType LabelObjectType;
65 
66  typedef TFeatureImage FeatureImageType;
67  typedef typename FeatureImageType::Pointer FeatureImagePointer;
68  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
69  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
70 
72  itkStaticConstMacro(InputImageDimension, unsigned int,
73  TInputImage::ImageDimension);
74  itkStaticConstMacro(OutputImageDimension, unsigned int,
75  TInputImage::ImageDimension);
76  itkStaticConstMacro(ImageDimension, unsigned int,
77  TInputImage::ImageDimension);
79 
82 
84  itkNewMacro(Self);
85 
89 
96  itkSetMacro(FullyConnected, bool);
97  itkGetConstReferenceMacro(FullyConnected, bool);
98  itkBooleanMacro(FullyConnected);
100 
101 #ifdef ITK_USE_CONCEPT_CHECKING
102 
103  itkConceptMacro( InputEqualityComparableCheck,
105  itkConceptMacro( IntConvertibleToInputCheck,
107  itkConceptMacro( InputOStreamWritableCheck,
109 
111 #endif
112 
117  itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
118  itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
120 
125  itkSetMacro(InputForegroundValue, InputImagePixelType);
126  itkGetConstMacro(InputForegroundValue, InputImagePixelType);
128 
133  itkSetMacro(ComputeFeretDiameter, bool);
134  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
135  itkBooleanMacro(ComputeFeretDiameter);
137 
142  itkSetMacro(ComputePerimeter, bool);
143  itkGetConstReferenceMacro(ComputePerimeter, bool);
144  itkBooleanMacro(ComputePerimeter);
146 
148  void SetFeatureImage(const TFeatureImage *input)
149  {
150  // Process object is not const-correct so the const casting is required.
151  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
152  }
153 
155  const FeatureImageType * GetFeatureImage()
156  {
157  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
158  }
159 
161  void SetInput1(const InputImageType *input)
162  {
163  this->SetInput(input);
164  }
165 
167  void SetInput2(const FeatureImageType *input)
168  {
169  this->SetFeatureImage(input);
170  }
171 
178  itkSetMacro(ComputeHistogram, bool);
179  itkGetConstReferenceMacro(ComputeHistogram, bool);
180  itkBooleanMacro(ComputeHistogram);
182 
188  itkSetMacro(NumberOfBins, unsigned int);
189  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
191 
192 protected:
195  void PrintSelf(std::ostream & os, Indent indent) const;
196 
200  void GenerateInputRequestedRegion();
201 
203  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
204 
207  void GenerateData();
208 
209 private:
210  BinaryImageToStatisticsLabelMapFilter(const Self &); //purposely not
211  // implemented
212  void operator=(const Self &); //purposely not
213  // implemented
214 
220  unsigned int m_NumberOfBins;
222 }; // end of class
223 } // end namespace itk
224 
225 #ifndef ITK_MANUAL_INSTANTIATION
226 #include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
227 #endif
228 
229 #endif
230