ITK  4.9.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< typename TInputImage, typename TFeatureImage, typename 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  // Begin concept checking
103  itkConceptMacro( InputEqualityComparableCheck,
105  itkConceptMacro( IntConvertibleToInputCheck,
107  itkConceptMacro( InputOStreamWritableCheck,
109  // End concept checking
110 #endif
111 
116  itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
117  itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
119 
124  itkSetMacro(InputForegroundValue, InputImagePixelType);
125  itkGetConstMacro(InputForegroundValue, InputImagePixelType);
127 
132  itkSetMacro(ComputeFeretDiameter, bool);
133  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
134  itkBooleanMacro(ComputeFeretDiameter);
136 
141  itkSetMacro(ComputePerimeter, bool);
142  itkGetConstReferenceMacro(ComputePerimeter, bool);
143  itkBooleanMacro(ComputePerimeter);
145 
147  void SetFeatureImage(const TFeatureImage *input)
148  {
149  // Process object is not const-correct so the const casting is required.
150  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
151  }
152 
155  {
156  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
157  }
158 
160  void SetInput1(const InputImageType *input)
161  {
162  this->SetInput(input);
163  }
164 
166  void SetInput2(const FeatureImageType *input)
167  {
168  this->SetFeatureImage(input);
169  }
170 
177  itkSetMacro(ComputeHistogram, bool);
178  itkGetConstReferenceMacro(ComputeHistogram, bool);
179  itkBooleanMacro(ComputeHistogram);
181 
187  itkSetMacro(NumberOfBins, unsigned int);
188  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
190 
191 protected:
194  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
195 
199  void GenerateInputRequestedRegion() ITK_OVERRIDE;
200 
202  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
203 
206  void GenerateData() ITK_OVERRIDE;
207 
208 private:
209  BinaryImageToStatisticsLabelMapFilter(const Self &) ITK_DELETE_FUNCTION;
210  void operator=(const Self &) ITK_DELETE_FUNCTION;
211 
217  unsigned int m_NumberOfBins;
219 }; // end of class
220 } // end namespace itk
221 
222 #ifndef ITK_MANUAL_INSTANTIATION
223 #include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
224 #endif
225 
226 #endif
Base class for all process objects that output image data.
BinaryImageToLabelMapFilter< InputImageType, OutputImageType > LabelizerType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetInput(const InputImageType *image)
OutputImageType::PixelType OutputImagePixelType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
StatisticsLabelMapFilter< OutputImageType, FeatureImageType > LabelObjectValuatorType
InputImageType::PixelType InputImagePixelType
Label the connected components in a binary image and produce a collection of label objects...
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
a convenient class to convert a binary image to a label map and valuate the statistics attributes at ...
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
void EnlargeOutputRequestedRegion(DataObject *) override
Base class for all data objects in ITK.