ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkSpectra1DAveragingImageFilter.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 itkSpectra1DAveragingImageFilter_h
19#define itkSpectra1DAveragingImageFilter_h
20
23#include "itkVectorImage.h"
24
25#include <type_traits>
26
27namespace itk
28{
29
36template <typename TInputImage, typename TOutputImage = TInputImage>
37class ITK_TEMPLATE_EXPORT Spectra1DAveragingImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
38{
39public:
40 ITK_DISALLOW_COPY_AND_MOVE(Spectra1DAveragingImageFilter);
41
42 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
43 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
44
45 using InputImageType = TInputImage;
46 using OutputImageType = TOutputImage;
47
48 using InputPixelType = typename InputImageType::PixelType;
49 using OutputPixelType = typename OutputImageType::PixelType;
50
53
59
60 itkOverrideGetNameOfClassMacro(Spectra1DAveragingImageFilter);
61 itkNewMacro(Self);
62
63#ifdef ITK_USE_CONCEPT_CHECKING
64 // Begin concept checking
65 itkConceptMacro(FloatConvertibleToInputScalarTypeCheck, (Concept::Convertible<float, InputScalarType>));
66 itkConceptMacro(FloatConvertibleToOutputScalarTypeCheck, (Concept::Convertible<float, OutputScalarType>));
67 itkConceptMacro(InputScalarTypeConvertibleToFloatCheck, (Concept::Convertible<InputScalarType, float>));
68 itkConceptMacro(OutputScalarTypeConvertibleToFloatCheck, (Concept::Convertible<OutputScalarType, float>));
69 // End concept checking
70#endif
71
72protected:
74 ~Spectra1DAveragingImageFilter() override = default;
75
76 void
78
79 void
80 GenerateData() override;
81
82 void
83 VerifyInputInformation() const override
84 {}
85
86
89
90 // sets the vector length if output is a VectorImage
91 template <typename TIn, typename TOut>
92 std::enable_if_t<!std::is_same<OutputImageType, VectorImage<OutputScalarType, TOut::ImageDimension>>::value>
93 PrepareOutput(TIn *, TOut *)
94 {
95 // nothing to do if output is not a VectorImage
96 }
97 template <typename TIn, typename TOut>
98 std::enable_if_t<!std::is_same<InputImageType, VectorImage<InputScalarType, TIn::ImageDimension>>::value &&
99 std::is_same<OutputImageType, VectorImage<OutputScalarType, TOut::ImageDimension>>::value>
100 PrepareOutput(TIn * itkNotUsed(in), TOut * itkNotUsed(out))
101 {
102 this->GetOutput()->SetVectorLength(TIn::PixelType::Dimension);
103 }
104 template <typename TIn, typename TOut>
105 std::enable_if_t<std::is_same<InputImageType, VectorImage<InputScalarType, TIn::ImageDimension>>::value &&
106 std::is_same<OutputImageType, VectorImage<OutputScalarType, TOut::ImageDimension>>::value>
107 PrepareOutput(TIn * in, TOut * itkNotUsed(out))
108 {
109 this->GetOutput()->SetVectorLength(in->GetVectorLength());
110 }
111
112 using IndexType = typename InputImageType::IndexType;
113};
114
115} // end namespace itk
116
117#ifndef ITK_MANUAL_INSTANTIATION
118# include "itkSpectra1DAveragingImageFilter.hxx"
119#endif
120
121#endif // itkSpectra1DAveragingImageFilter_h
typename PixelType::ComponentType ComponentType
OutputImageType * GetOutput()
Implements transparent reference counting.
~Spectra1DAveragingImageFilter() override=default
std::enable_if_t< std::is_same< InputImageType, VectorImage< InputScalarType, TIn::ImageDimension > >::value &&std::is_same< OutputImageType, VectorImage< OutputScalarType, TOut::ImageDimension > >::value > PrepareOutput(TIn *in, TOut *out)
VectorImage< OutputScalarType, OutputImageDimension > OutputVectorImage
ImageToImageFilter< InputImageType, OutputImageType > Superclass
void GenerateOutputInformation() override
void VerifyInputInformation() const override
Verifies that the input images occupy the same physical space and the each index is at the same physi...
typename DefaultConvertPixelTraits< typename InputImageType::PixelType >::ComponentType InputScalarType
std::enable_if_t<!std::is_same< InputImageType, VectorImage< InputScalarType, TIn::ImageDimension > >::value &&std::is_same< OutputImageType, VectorImage< OutputScalarType, TOut::ImageDimension > >::value > PrepareOutput(TIn *in, TOut *out)
typename OutputImageType::PixelType OutputPixelType
VectorImage< InputScalarType, InputImageDimension > InputVectorImage
typename DefaultConvertPixelTraits< typename OutputImageType::PixelType >::ComponentType OutputScalarType
typename InputImageType::PixelType InputPixelType
std::enable_if_t<!std::is_same< OutputImageType, VectorImage< OutputScalarType, TOut::ImageDimension > >::value > PrepareOutput(TIn *, TOut *)
Templated n-dimensional vector image class.
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....