RTK  1.4.0
Reconstruction Toolkit
rtkWeidingerForwardModelImageFilter.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 #ifndef rtkWeidingerForwardModelImageFilter_h
19 #define rtkWeidingerForwardModelImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "rtkMacro.h"
23 
24 #ifdef RTK_USE_CUDA
25  #include <itkCudaImage.h>
26 #endif
27 
28 namespace rtk
29 {
41 template< class TMaterialProjections,
42  class TPhotonCounts,
43  class TSpectrum,
45 class WeidingerForwardModelImageFilter : public itk::ImageToImageFilter<TMaterialProjections, TMaterialProjections>
46 {
47 public:
52 
54  itkNewMacro(Self)
55 
56 
58 
60  itkStaticConstMacro(nBins, unsigned int, TPhotonCounts::PixelType::Dimension);
61  itkStaticConstMacro(nMaterials, unsigned int, TMaterialProjections::PixelType::Dimension);
63 
65  typedef typename TMaterialProjections::PixelType::ValueType dataType;
66 
71  typedef TMaterialProjections TOutputImage1;
72  typedef itk::Vector<dataType, nMaterials * nMaterials> TPixelOutput2;
73 #ifdef RTK_USE_CUDA
74  typedef itk::CudaImage<TPixelOutput2, TMaterialProjections::ImageDimension > TOutputImage2;
75 #else
77 #endif
78 
80  TOutputImage1* GetOutput1();
81  TOutputImage2* GetOutput2();
83 
85  void SetInputMaterialProjections(const TMaterialProjections* materialProjections);
86  void SetInputPhotonCounts(const TPhotonCounts* photonCounts);
87  void SetInputSpectrum(const TSpectrum* spectrum);
88  void SetInputProjectionsOfOnes(const TProjections* projectionsOfOnes);
90 
92  typedef vnl_matrix<dataType> BinnedDetectorResponseType;
93  typedef vnl_matrix<dataType> MaterialAttenuationsType;
94 
96  itkGetConstReferenceMacro(BinnedDetectorResponse, BinnedDetectorResponseType)
97  itkGetConstReferenceMacro(MaterialAttenuations, MaterialAttenuationsType)
98  virtual void SetBinnedDetectorResponse(const BinnedDetectorResponseType & detResp);
99  virtual void SetMaterialAttenuations(const MaterialAttenuationsType & matAtt);
101 
102 protected:
103  WeidingerForwardModelImageFilter();
104  ~WeidingerForwardModelImageFilter() {}
105 
106  void GenerateInputRequestedRegion() ITK_OVERRIDE;
107 #if ITK_VERSION_MAJOR<5
108  void VerifyInputInformation() ITK_OVERRIDE {}
109 #else
110  void VerifyInputInformation() const ITK_OVERRIDE {}
111 #endif
112 
114 #if ITK_VERSION_MAJOR<5
115  void ThreadedGenerateData(const typename TOutputImage1::RegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) ITK_OVERRIDE;
116 #else
117  void DynamicThreadedGenerateData(const typename TOutputImage1::RegionType& outputRegionForThread) ITK_OVERRIDE;
118 #endif
119 
120 
122  itk::DataObject::Pointer MakeOutput(itk::ProcessObject::DataObjectPointerArraySizeType idx) override;
123 
125  typename TMaterialProjections::ConstPointer GetInputMaterialProjections();
126  typename TPhotonCounts::ConstPointer GetInputPhotonCounts();
127  typename TSpectrum::ConstPointer GetInputSpectrum();
128  typename TProjections::ConstPointer GetInputProjectionsOfOnes();
130 
132  BinnedDetectorResponseType m_BinnedDetectorResponse;
133  MaterialAttenuationsType m_MaterialAttenuations;
134 
135 private:
136  WeidingerForwardModelImageFilter(const Self &); //purposely not implemented
137  void operator=(const Self &); //purposely not implemented
138 
139 };
140 } //namespace RTK
141 
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "rtkWeidingerForwardModelImageFilter.hxx"
145 #endif
146 
147 #endif
void SetInputSpectrum(const TSpectrum *spectrum)
TPhotonCounts::ConstPointer GetInputPhotonCounts()
TMaterialProjections::ConstPointer GetInputMaterialProjections()
void SetInputPhotonCounts(const TPhotonCounts *photonCounts)
TSpectrum::ConstPointer GetInputSpectrum()
itk::ImageToImageFilter< TMaterialProjections, TMaterialProjections > Superclass
itk::Image< TPixelOutput2, TMaterialProjections::ImageDimension > TOutputImage2
virtual void SetMaterialAttenuations(const MaterialAttenuationsType &matAtt)
void ThreadedGenerateData(const typename TOutputImage1::RegionType &outputRegionForThread, itk::ThreadIdType) override
void SetInputMaterialProjections(const TMaterialProjections *materialProjections)
virtual void SetBinnedDetectorResponse(const BinnedDetectorResponseType &detResp)
itk::DataObject::Pointer MakeOutput(itk::ProcessObject::DataObjectPointerArraySizeType idx) override
TMaterialProjections::PixelType::ValueType dataType
unsigned int ThreadIdType
Performs intermediate computations in Weidinger2016.
TProjections::ConstPointer GetInputProjectionsOfOnes()
void SetInputProjectionsOfOnes(const TProjections *projectionsOfOnes)