ITK  5.4.0
Insight Toolkit
itkAreaOpeningImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkAreaOpeningImageFilter_h
19#define itkAreaOpeningImageFilter_h
20
22#include <functional>
23
24namespace itk
25{
47template <typename TInputImage,
48 typename TOutputImage,
49 typename TAttribute = typename TInputImage::SpacingType::ValueType>
51 : public AttributeMorphologyBaseImageFilter<TInputImage,
52 TOutputImage,
53 TAttribute,
54 std::greater<typename TInputImage::PixelType>>
55
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(AreaOpeningImageFilter);
59
62 TOutputImage,
63 TAttribute,
64 std::greater<typename TInputImage::PixelType>>;
65
68
73 using OutputPixelType = typename TOutputImage::PixelType;
74 using OutputInternalPixelType = typename TOutputImage::InternalPixelType;
75 using InputPixelType = typename TInputImage::PixelType;
76 using InputInternalPixelType = typename TInputImage::InternalPixelType;
78 using OffsetType = typename TInputImage::OffsetType;
80 using AttributeType = TAttribute;
81
82 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
83
85 itkNewMacro(Self);
86
88 itkOverrideGetNameOfClassMacro(AreaOpeningImageFilter);
89
93 itkSetMacro(UseImageSpacing, bool);
94 itkGetConstReferenceMacro(UseImageSpacing, bool);
95 itkBooleanMacro(UseImageSpacing);
98protected:
100
101 ~AreaOpeningImageFilter() override = default;
102
103 void
104 GenerateData() override
105 {
106 this->m_AttributeValuePerPixel = 1;
108 {
109 const auto & spacing = this->GetInput()->GetSpacing();
110
111 // compute pixel size
112 double psize = 1.0;
113 for (unsigned int i = 0; i < ImageDimension; ++i)
114 {
115 psize *= spacing[i];
116 }
117 this->m_AttributeValuePerPixel = static_cast<AttributeType>(psize);
118 // std::cout << "m_AttributeValuePerPixel: " <<
119 // this->m_AttributeValuePerPixel << std::endl;
120 // and call superclass implementation of GenerateData()
121 }
123 }
124
125 void
126 PrintSelf(std::ostream & os, Indent indent) const override
127 {
128 Superclass::PrintSelf(os, indent);
129 os << indent << "UseImageSpacing: " << (m_UseImageSpacing ? "On" : "Off") << std::endl;
130 }
131
132private:
134};
135} // namespace itk
136#endif
Morphological opening by attributes.
typename TInputImage::InternalPixelType InputInternalPixelType
typename TInputImage::IndexType IndexType
typename TInputImage::OffsetType OffsetType
typename TInputImage::PixelType InputPixelType
static constexpr unsigned int ImageDimension
~AreaOpeningImageFilter() override=default
typename TInputImage::SizeType SizeType
typename TOutputImage::InternalPixelType OutputInternalPixelType
typename TOutputImage::PixelType OutputPixelType
void PrintSelf(std::ostream &os, Indent indent) const override
void PrintSelf(std::ostream &os, Indent indent) const override
Base class for all process objects that output image data.
const InputImageType * GetInput() const
Control indentation during Print() invocation.
Definition: itkIndent.h:50
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....