ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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;
75 using IndexType = typename TInputImage::IndexType;
76 using OffsetType = typename TInputImage::OffsetType;
77 using SizeType = typename TInputImage::SizeType;
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);
94
95protected:
99
100 ~AreaClosingImageFilter() override = default;
101
102 void
103 GenerateData() override
104 {
105 this->m_AttributeValuePerPixel = 1;
107 {
108 const auto & spacing = this->GetInput()->GetSpacing();
109
110 // compute pixel size
111 double psize = 1.0;
112 for (unsigned int i = 0; i < ImageDimension; ++i)
113 {
114 psize *= spacing[i];
115 }
116 this->m_AttributeValuePerPixel = static_cast<AttributeType>(psize);
117 // std::cout << "m_AttributeValuePerPixel: " <<
118 // this->m_AttributeValuePerPixel << std::endl;
119 // and call superclass implementation of GenerateData()
120 }
122 }
123
124 void
125 PrintSelf(std::ostream & os, Indent indent) const override
126 {
127 Superclass::PrintSelf(os, indent);
128 itkPrintSelfBooleanMacro(UseImageSpacing);
129 }
130
131private:
133};
134} // namespace itk
135#endif
~AreaClosingImageFilter() override=default
typename TInputImage::IndexType IndexType
typename TInputImage::InternalPixelType InputInternalPixelType
typename TInputImage::SizeType SizeType
static constexpr unsigned int ImageDimension
typename TOutputImage::PixelType OutputPixelType
SmartPointer< const Self > ConstPointer
AttributeMorphologyBaseImageFilter< TInputImage, TOutputImage, TAttribute, std::less< typename TInputImage::PixelType > > Superclass
typename TInputImage::OffsetType OffsetType
typename TOutputImage::InternalPixelType OutputInternalPixelType
typename TInputImage::PixelType InputPixelType
void PrintSelf(std::ostream &os, Indent indent) const override
const InputImageType * GetInput() const
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....