ITK  6.0.0
Insight Toolkit
itkAreaClosingImageFilter.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 itkAreaClosingImageFilter_h
19#define itkAreaClosingImageFilter_h
20
22
23namespace itk
24{
45template <typename TInputImage,
46 typename TOutputImage,
47 typename TAttribute = typename TInputImage::SpacingType::ValueType>
49 : public AttributeMorphologyBaseImageFilter<TInputImage,
50 TOutputImage,
51 TAttribute,
52 std::less<typename TInputImage::PixelType>>
53
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(AreaClosingImageFilter);
57
60 TOutputImage,
61 TAttribute,
62 std::less<typename TInputImage::PixelType>>;
63
66
71 using OutputPixelType = typename TOutputImage::PixelType;
72 using OutputInternalPixelType = typename TOutputImage::InternalPixelType;
73 using InputPixelType = typename TInputImage::PixelType;
74 using InputInternalPixelType = typename TInputImage::InternalPixelType;
76 using OffsetType = typename TInputImage::OffsetType;
78 using AttributeType = TAttribute;
79
80 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
81
83 itkNewMacro(Self);
84
86 itkOverrideGetNameOfClassMacro(AreaClosingImageFilter);
87
91 itkSetMacro(UseImageSpacing, bool);
92 itkGetConstReferenceMacro(UseImageSpacing, bool);
93 itkBooleanMacro(UseImageSpacing);
96protected:
98
99 ~AreaClosingImageFilter() override = default;
100
101 void
102 GenerateData() override
103 {
104 this->m_AttributeValuePerPixel = 1;
106 {
107 const auto & spacing = this->GetInput()->GetSpacing();
108
109 // compute pixel size
110 double psize = 1.0;
111 for (unsigned int i = 0; i < ImageDimension; ++i)
112 {
113 psize *= spacing[i];
114 }
115 this->m_AttributeValuePerPixel = static_cast<AttributeType>(psize);
116 // std::cout << "m_AttributeValuePerPixel: " <<
117 // this->m_AttributeValuePerPixel << std::endl;
118 // and call superclass implementation of GenerateData()
119 }
121 }
122
123 void
124 PrintSelf(std::ostream & os, Indent indent) const override
125 {
126 Superclass::PrintSelf(os, indent);
127 itkPrintSelfBooleanMacro(UseImageSpacing);
128 }
129
130private:
132};
133} // namespace itk
134#endif
Morphological closing by attributes.
~AreaClosingImageFilter() override=default
typename TInputImage::IndexType IndexType
typename TInputImage::InternalPixelType InputInternalPixelType
typename TInputImage::SizeType SizeType
static constexpr unsigned int ImageDimension
typename TOutputImage::PixelType OutputPixelType
typename TInputImage::OffsetType OffsetType
typename TOutputImage::InternalPixelType OutputInternalPixelType
typename TInputImage::PixelType InputPixelType
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....