ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkAreaClosingImageFilter.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 itkAreaClosingImageFilter_h
19 #define itkAreaClosingImageFilter_h
20 
22 
23 namespace itk
24 {
58 template< typename TInputImage, typename TOutputImage, typename TAttribute = typename TInputImage::SpacingType::ValueType >
60  public AttributeMorphologyBaseImageFilter< TInputImage, TOutputImage, TAttribute,
61  std::less< typename TInputImage::PixelType > >
62 
63 {
64 public:
66  typedef AttributeMorphologyBaseImageFilter< TInputImage, TOutputImage, TAttribute,
67  std::less< typename TInputImage::PixelType > >
69 
72 
77  typedef typename TOutputImage::PixelType OutputPixelType;
78  typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
79  typedef typename TInputImage::PixelType InputPixelType;
80  typedef typename TInputImage::InternalPixelType InputInternalPixelType;
81  typedef typename TInputImage::IndexType IndexType;
82  typedef typename TInputImage::OffsetType OffsetType;
83  typedef typename TInputImage::SizeType SizeType;
84  typedef TAttribute AttributeType;
85 
86  itkStaticConstMacro(ImageDimension, unsigned int,
87  TOutputImage::ImageDimension);
88 
90  itkNewMacro(Self);
91 
93  itkTypeMacro(AreaClosingImageFilter,
95 
99  itkSetMacro(UseImageSpacing, bool);
100  itkGetConstReferenceMacro(UseImageSpacing, bool);
101  itkBooleanMacro(UseImageSpacing);
103 
104 protected:
106  {
107  m_UseImageSpacing = true;
108  }
109 
111 
112  void GenerateData() ITK_OVERRIDE
113  {
114  this->m_AttributeValuePerPixel = 1;
115  if ( m_UseImageSpacing )
116  {
117  // compute pixel size
118  double psize = 1.0;
119  for ( unsigned i = 0; i < ImageDimension; i++ )
120  {
121  psize *= this->GetInput()->GetSpacing()[i];
122  }
123  this->m_AttributeValuePerPixel = static_cast< AttributeType >( psize );
124  // std::cout << "m_AttributeValuePerPixel: " <<
125  // this->m_AttributeValuePerPixel << std::endl;
126  // and call superclass implementation of GenerateData()
127  }
129  }
130 
131  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE
132  {
133  Superclass::PrintSelf(os, indent);
134  os << indent << "UseImageSpacing: " << m_UseImageSpacing << std::endl;
135  }
136 
137 private:
138 
139  AreaClosingImageFilter(const Self &) ITK_DELETE_FUNCTION;
140  void operator=(const Self &) ITK_DELETE_FUNCTION;
141 
143 };
144 } // namespace itk
145 #endif
TInputImage::PixelType InputPixelType
TOutputImage::InternalPixelType OutputInternalPixelType
TOutputImage::PixelType OutputPixelType
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
AttributeMorphologyBaseImageFilter< TInputImage, TOutputImage, TAttribute, std::less< typename TInputImage::PixelType > > Superclass
TInputImage::OffsetType OffsetType
Morphological closing by attributes.
void PrintSelf(std::ostream &os, Indent indent) const override
const InputImageType * GetInput() const
void PrintSelf(std::ostream &os, Indent indent) const override
static const unsigned int ImageDimension
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TInputImage::InternalPixelType InputInternalPixelType