ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkStructuralSimilarityImageFilter.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 itkStructuralSimilarityImageFilter_h
19#define itkStructuralSimilarityImageFilter_h
20
21#include "itkArray.h"
22#include "itkImage.h"
24#include "itkNumericTraits.h"
25
26#include <type_traits>
27
28namespace itk
29{
111template <typename TInputImage, typename TOutputImage = Image<float, TInputImage::ImageDimension>>
112class ITK_TEMPLATE_EXPORT StructuralSimilarityImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
113{
114public:
115 ITK_DISALLOW_COPY_AND_MOVE(StructuralSimilarityImageFilter);
116
122
124 itkNewMacro(Self);
125
127 itkOverrideGetNameOfClassMacro(StructuralSimilarityImageFilter);
128
130 using InputImageType = TInputImage;
131 using OutputImageType = TOutputImage;
132 using InputPixelType = typename InputImageType::PixelType;
133 using OutputPixelType = typename OutputImageType::PixelType;
134 using InputImageRegionType = typename InputImageType::RegionType;
135 using OutputImageRegionType = typename OutputImageType::RegionType;
136 using SizeType = typename InputImageType::SizeType;
137 using IndexType = typename InputImageType::IndexType;
138
139 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
140
143
146
149 void
151 {
152 this->SetInput(image);
153 }
154 const InputImageType *
155 GetInput1() const
156 {
157 return this->GetInput(0);
158 }
159
160
163 void
164 SetInput2(const InputImageType * image);
165 const InputImageType *
166 GetInput2() const;
168
172 itkSetMacro(GaussianSigma, double);
173 itkGetConstMacro(GaussianSigma, double);
175
179 itkSetMacro(MaximumKernelWidth, unsigned int);
180 itkGetConstMacro(MaximumKernelWidth, unsigned int);
182
185 itkSetMacro(K1, double);
186 itkGetConstMacro(K1, double);
188
191 itkSetMacro(K2, double);
192 itkGetConstMacro(K2, double);
194
200 itkSetMacro(DynamicRange, double);
201 itkGetConstMacro(DynamicRange, double);
203
206 itkSetMacro(LuminanceExponent, double);
207 itkGetConstMacro(LuminanceExponent, double);
209
212 itkSetMacro(ContrastExponent, double);
213 itkGetConstMacro(ContrastExponent, double);
215
218 itkSetMacro(StructureExponent, double);
219 itkGetConstMacro(StructureExponent, double);
221
227 void
229 itkGetConstReferenceMacro(ScaleWeights, ScaleWeightsType);
231
234 itkGetConstMacro(MeanSSIM, double);
235
236 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
237
238protected:
241
242 void
243 PrintSelf(std::ostream & os, Indent indent) const override;
244
246 void
247 VerifyPreconditions() const override;
248
250 void
252
255 void
256 GenerateData() override;
257
258private:
259 double m_GaussianSigma{ 1.5 };
260 unsigned int m_MaximumKernelWidth{ 11 };
261 double m_K1{ 0.01 };
262 double m_K2{ 0.03 };
263
267 static constexpr double
269 {
270 if constexpr (std::is_floating_point_v<InputPixelType>)
271 {
272 return 1.0;
273 }
274 else
275 {
276 return static_cast<double>(NumericTraits<InputPixelType>::max()) -
277 static_cast<double>(NumericTraits<InputPixelType>::min());
278 }
279 }
281 double m_LuminanceExponent{ 1.0 };
282 double m_ContrastExponent{ 1.0 };
283 double m_StructureExponent{ 1.0 };
284
285 ScaleWeightsType m_ScaleWeights{ 1, static_cast<RealType>(1.0) };
286
287 double m_MeanSSIM{ 0.0 };
288};
289} // end namespace itk
290
291#ifndef ITK_MANUAL_INSTANTIATION
292# include "itkStructuralSimilarityImageFilter.hxx"
293#endif
294
295#endif
Array class with size defined at construction time.
Definition itkArray.h:48
Base class for all data objects in ITK.
virtual void SetInput(const InputImageType *input)
const InputImageType * GetInput() const
Control indentation during Print() invocation.
Definition itkIndent.h:50
static constexpr T max(const T &)
static constexpr T min(const T &)
Implements transparent reference counting.
void EnlargeOutputRequestedRegion(DataObject *data) override
~StructuralSimilarityImageFilter() override=default
typename InputImageType::RegionType InputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
void VerifyPreconditions() const override
void SetInput2(const InputImageType *image)
void SetScaleWeights(const ScaleWeightsType &weights)
void PrintSelf(std::ostream &os, Indent indent) const override
typename NumericTraits< InputPixelType >::RealType RealType
const InputImageType * GetInput2() const
typename OutputImageType::PixelType OutputPixelType
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....