ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkVarianObiRawImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright RTK Consortium
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
19#ifndef rtkVarianObiRawImageFilter_h
20#define rtkVarianObiRawImageFilter_h
21
22#include <itkConceptChecking.h>
23#include <itkNumericTraits.h>
25
26#include "rtkMacro.h"
27
28namespace rtk
29{
30
31namespace Function
32{
33
44template <class TInput, class TOutput>
45class ITK_TEMPLATE_EXPORT ObiAttenuation
46{
47public:
48 ObiAttenuation() = default;
49 ~ObiAttenuation() = default;
50 bool
52 {
53 return false;
54 }
55 bool
56 operator==(const ObiAttenuation & other) const
57 {
58 return !(*this != other);
59 }
60 TOutput
61 operator()(const TInput & A) const
62 {
63 return (!A) ? 0. : TOutput(std::log((m_I0 - m_IDark) / (A - m_IDark)));
64 }
65 void
66 SetI0(double i0)
67 {
68 m_I0 = i0;
69 }
70 void
71 SetIDark(double idark)
72 {
73 m_IDark = idark;
74 }
75
76private:
77 double m_I0;
78 double m_IDark;
79};
80} // namespace Function
81
91template <class TInputImage, class TOutputImage>
92class ITK_TEMPLATE_EXPORT VarianObiRawImageFilter
94 TInputImage,
95 TOutputImage,
96 Function::ObiAttenuation<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
97{
98public:
99 ITK_DISALLOW_COPY_AND_MOVE(VarianObiRawImageFilter);
100
104 TInputImage,
105 TOutputImage,
109
111 itkNewMacro(Self);
112
114 itkOverrideGetNameOfClassMacro(VarianObiRawImageFilter);
115
116 itkGetMacro(I0, double);
117 itkSetMacro(I0, double);
118
119 itkGetMacro(IDark, double);
120 itkSetMacro(IDark, double);
121
122 void
124
125protected:
127 ~VarianObiRawImageFilter() override = default;
128
129private:
130 double m_I0{ 139000. };
131 double m_IDark{ 0. };
132};
133
134} // end namespace rtk
135
136#ifndef ITK_MANUAL_INSTANTIATION
137# include "rtkVarianObiRawImageFilter.hxx"
138#endif
139
140#endif
Implements transparent reference counting.
Implements pixel-wise generic operation on one image.
Converts a raw value measured by the Varian OBI system to attenuation.
TOutput operator()(const TInput &A) const
bool operator==(const ObiAttenuation &other) const
bool operator!=(const ObiAttenuation &) const
~VarianObiRawImageFilter() override=default
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Function::ObiAttenuation< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
itk::SmartPointer< const Self > ConstPointer
void BeforeThreadedGenerateData() override
#define itkSetMacro(name, type)