ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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:
38 : m_Maximum(NumericTraits<TInput>::max())
39 {}
41
42 void
43 SetMaximum(TOutput max)
44 {
45 m_Maximum = max;
46 }
47
48
49 bool
51 {
52 return m_Maximum == other.m_Maximum;
53 }
54
56
57 inline TOutput
58 operator()(const TInput & x) const
59 {
60 auto result = static_cast<TOutput>(m_Maximum - x);
61
62 return result;
63 }
64
65private:
66 TInput m_Maximum;
67};
68} // end namespace Functor
69
90template <typename TInputImage, typename TOutputImage = TInputImage>
91class ITK_TEMPLATE_EXPORT InvertIntensityImageFilter
93 TInputImage,
94 TOutputImage,
95 Functor::InvertIntensityTransform<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
96{
97public:
98 ITK_DISALLOW_COPY_AND_MOVE(InvertIntensityImageFilter);
99
103 TInputImage,
104 TOutputImage,
108
109 using OutputPixelType = typename TOutputImage::PixelType;
110 using InputPixelType = typename TInputImage::PixelType;
112
114 itkNewMacro(Self);
115
117 itkOverrideGetNameOfClassMacro(InvertIntensityImageFilter);
118
121 itkSetMacro(Maximum, InputPixelType);
122 itkGetConstReferenceMacro(Maximum, InputPixelType);
124 void
125 PrintSelf(std::ostream & os, Indent indent) const override;
126
128 void
130
131 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
132
133protected:
135 ~InvertIntensityImageFilter() override = default;
136
137private:
139};
140} // end namespace itk
141
142#ifndef ITK_MANUAL_INSTANTIATION
143# include "itkInvertIntensityImageFilter.hxx"
144#endif
145
146#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
typename TInputImage::PixelType InputPixelType
~InvertIntensityImageFilter() override=default
typename NumericTraits< InputPixelType >::RealType RealType
void BeforeThreadedGenerateData() override
typename TOutputImage::PixelType OutputPixelType
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::InvertIntensityTransform< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
void PrintSelf(std::ostream &os, Indent indent) const override
Define additional traits for native types such as int or float.
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....