ITK  4.9.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< typename TInputImage, typename TFeatureImage, typename 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  // Begin concept checking
93  itkConceptMacro( InputEqualityComparableCheck,
95  itkConceptMacro( IntConvertibleToInputCheck,
97  itkConceptMacro( InputOStreamWritableCheck,
99  // End concept checking
100 #endif
101 
106  itkSetMacro(BackgroundValue, OutputImagePixelType);
107  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
109 
114  itkSetMacro(ComputeFeretDiameter, bool);
115  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
116  itkBooleanMacro(ComputeFeretDiameter);
118 
123  itkSetMacro(ComputePerimeter, bool);
124  itkGetConstReferenceMacro(ComputePerimeter, bool);
125  itkBooleanMacro(ComputePerimeter);
127 
129  void SetFeatureImage(const TFeatureImage *input)
130  {
131  // Process object is not const-correct so the const casting is required.
132  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
133  }
134 
137  {
138  return static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) );
139  }
140 
142  void SetInput1(const InputImageType *input)
143  {
144  this->SetInput(input);
145  }
146 
148  void SetInput2(const FeatureImageType *input)
149  {
150  this->SetFeatureImage(input);
151  }
152 
159  itkSetMacro(ComputeHistogram, bool);
160  itkGetConstReferenceMacro(ComputeHistogram, bool);
161  itkBooleanMacro(ComputeHistogram);
163 
169  itkSetMacro(NumberOfBins, unsigned int);
170  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
172 
173 protected:
176  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
177 
181  void GenerateInputRequestedRegion() ITK_OVERRIDE;
182 
184  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
185 
188  void GenerateData() ITK_OVERRIDE;
189 
190 private:
191  LabelImageToStatisticsLabelMapFilter(const Self &) ITK_DELETE_FUNCTION;
192  void operator=(const Self &) ITK_DELETE_FUNCTION;
193 
197  unsigned int m_NumberOfBins;
199 }; // end of class
200 } // end namespace itk
201 
202 #ifndef ITK_MANUAL_INSTANTIATION
203 #include "itkLabelImageToStatisticsLabelMapFilter.hxx"
204 #endif
205 
206 #endif
void EnlargeOutputRequestedRegion(DataObject *) override
convert a labeled image to a label collection image
LabelImageToLabelMapFilter< InputImageType, OutputImageType > LabelizerType
a convenient class to convert a label image to a label map and valuate the statistics attributes at o...
Base class for all process objects that output image data.
void PrintSelf(std::ostream &os, Indent indent) const override
ImageToImageFilter< TInputImage, TOutputImage > Superclass
virtual void SetInput(const InputImageType *image)
OutputImageType::PixelType OutputImagePixelType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
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
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
StatisticsLabelMapFilter< OutputImageType, FeatureImageType > LabelObjectValuatorType