RTK  1.4.0
Reconstruction Toolkit
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  * http://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 
23 #include <itkConceptChecking.h>
24 #include <itkNumericTraits.h>
25 
26 #include "rtkMacro.h"
27 
28 namespace rtk
29 {
30 
31 namespace Function {
32 
43 template< class TInput, class TOutput>
45 {
46 public:
49  bool operator!=( const ObiAttenuation & ) const
50  {
51  return false;
52  }
53  bool operator==( const ObiAttenuation & other ) const
54  {
55  return !(*this != other);
56  }
57  inline TOutput operator()( const TInput & A ) const
58  {
59  return (!A)?0.:TOutput( vcl_log(m_I0-m_IDark) - vcl_log( A-m_IDark ) );
60  }
61  void SetI0(double i0) {m_I0 = i0;}
62  void SetIDark(double idark) {m_IDark = idark;}
63 
64 private:
65  double m_I0;
66  double m_IDark;
67 };
68 }
69 
79 template <class TInputImage, class TOutputImage>
80 class ITK_EXPORT VarianObiRawImageFilter :
81  public
82 itk::UnaryFunctorImageFilter<TInputImage,TOutputImage,
83  Function::ObiAttenuation<
84  typename TInputImage::PixelType,
85  typename TOutputImage::PixelType> >
86 {
87 public:
90  typedef itk::UnaryFunctorImageFilter<TInputImage,TOutputImage,
91  Function::ObiAttenuation< typename TInputImage::PixelType,
92  typename TOutputImage::PixelType> > Superclass;
95 
97  itkNewMacro(Self);
98 
100  itkTypeMacro(VarianObiRawImageFilter,
102 
103  itkGetMacro(I0, double);
104  itkSetMacro(I0, double);
105 
106  itkGetMacro(IDark, double);
107  itkSetMacro(IDark, double);
108 
109  void BeforeThreadedGenerateData() ITK_OVERRIDE;
110 
111 protected:
113  virtual ~VarianObiRawImageFilter() ITK_OVERRIDE {}
114 
115 private:
116  VarianObiRawImageFilter(const Self&); //purposely not implemented
117  void operator=(const Self&); //purposely not implemented
118 
119  double m_I0;
120  double m_IDark;
121 };
122 
123 } // end namespace rtk
124 
125 #ifndef ITK_MANUAL_INSTANTIATION
126 #include "rtkVarianObiRawImageFilter.hxx"
127 #endif
128 
129 #endif
Converts a raw value measured by the Varian OBI system to attenuation.
TOutput operator()(const TInput &A) const
itk::SmartPointer< const Self > ConstPointer
Converts raw images measured by the Varian OBI system to attenuation.
bool operator==(const ObiAttenuation &other) const
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Function::ObiAttenuation< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
#define itkSetMacro(name, type)
bool operator!=(const ObiAttenuation &) const