ITK  6.0.0
Insight Toolkit
itkInvertIntensityImageFilter.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 itkInvertIntensityImageFilter_h
19#define itkInvertIntensityImageFilter_h
20
22
23namespace itk
24{
25namespace Functor
26{
32template <typename TInput, typename TOutput>
33class ITK_TEMPLATE_EXPORT InvertIntensityTransform
34{
35public:
41 void
42 SetMaximum(TOutput max)
43 {
44 m_Maximum = max;
45 }
46
47
48 bool
50 {
51 return m_Maximum == other.m_Maximum;
52 }
53
55
56 inline TOutput
57 operator()(const TInput & x) const
58 {
59 auto result = static_cast<TOutput>(m_Maximum - x);
60
61 return result;
62 }
63
64private:
65 TInput m_Maximum;
66};
67} // end namespace Functor
68
89template <typename TInputImage, typename TOutputImage = TInputImage>
90class ITK_TEMPLATE_EXPORT InvertIntensityImageFilter
92 TInputImage,
93 TOutputImage,
94 Functor::InvertIntensityTransform<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
95{
96public:
97 ITK_DISALLOW_COPY_AND_MOVE(InvertIntensityImageFilter);
98
102 TInputImage,
103 TOutputImage,
107
108 using OutputPixelType = typename TOutputImage::PixelType;
109 using InputPixelType = typename TInputImage::PixelType;
111
113 itkNewMacro(Self);
114
116 itkOverrideGetNameOfClassMacro(InvertIntensityImageFilter);
117
119 itkSetMacro(Maximum, InputPixelType);
120 itkGetConstReferenceMacro(Maximum, InputPixelType);
123 void
124 PrintSelf(std::ostream & os, Indent indent) const override;
125
127 void
129
130#ifdef ITK_USE_CONCEPT_CHECKING
131 // Begin concept checking
132 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
133 // End concept checking
134#endif
135
136protected:
138 ~InvertIntensityImageFilter() override = default;
139
140private:
141 InputPixelType m_Maximum{};
142};
143} // end namespace itk
144
145#ifndef ITK_MANUAL_INSTANTIATION
146# include "itkInvertIntensityImageFilter.hxx"
147#endif
148
149#endif
typename NumericTraits< TInput >::RealType RealType
bool operator==(const InvertIntensityTransform &other) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(InvertIntensityTransform)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Invert the intensity of an image.
typename TInputImage::PixelType InputPixelType
~InvertIntensityImageFilter() override=default
typename NumericTraits< InputPixelType >::RealType RealType
void BeforeThreadedGenerateData() override
typename TOutputImage::PixelType OutputPixelType
void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
Define additional traits for native types such as int or float.
static constexpr T max(const T &)
Implements pixel-wise generic operation on one image.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....