RTK  2.0.1
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:
48  ITK_DISALLOW_COPY_AND_ASSIGN(WeidingerForwardModelImageFilter);
49 
54 
56  itkNewMacro(Self)
57 
58 
60 
62  static constexpr unsigned int nBins = TPhotonCounts::PixelType::Dimension;
63  static constexpr unsigned int nMaterials = TMaterialProjections::PixelType::Dimension;
64 
66  using dataType = typename TMaterialProjections::PixelType::ValueType;
67 
72  using TOutputImage1 = TMaterialProjections;
74 #ifdef RTK_USE_CUDA
75  using TOutputImage2 = itk::CudaImage<TPixelOutput2, TMaterialProjections::ImageDimension >;
76 #else
78 #endif
79 
84 
86  void SetInputMaterialProjections(const TMaterialProjections* materialProjections);
87  void SetInputPhotonCounts(const TPhotonCounts* photonCounts);
88  void SetInputSpectrum(const TSpectrum* spectrum);
89  void SetInputProjectionsOfOnes(const TProjections* projectionsOfOnes);
91 
93  using BinnedDetectorResponseType = vnl_matrix<dataType>;
94  using MaterialAttenuationsType = vnl_matrix<dataType>;
95 
97  itkGetConstReferenceMacro(BinnedDetectorResponse, BinnedDetectorResponseType)
98  itkGetConstReferenceMacro(MaterialAttenuations, MaterialAttenuationsType)
99  virtual void SetBinnedDetectorResponse(const BinnedDetectorResponseType & detResp);
100  virtual void SetMaterialAttenuations(const MaterialAttenuationsType & matAtt);
102 
103 protected:
104  WeidingerForwardModelImageFilter();
105  ~WeidingerForwardModelImageFilter() override = default;
106 
107  void GenerateInputRequestedRegion() override;
108 #if ITK_VERSION_MAJOR<5
109  void VerifyInputInformation() override {}
110 #else
111  void VerifyInputInformation() const override {}
112 #endif
113 
115 #if ITK_VERSION_MAJOR<5
116  void ThreadedGenerateData(const typename TOutputImage1::RegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) override;
117 #else
118  void DynamicThreadedGenerateData(const typename TOutputImage1::RegionType& outputRegionForThread) override;
119 #endif
120 
121 
123  itk::ProcessObject::DataObjectPointer MakeOutput(itk::ProcessObject::DataObjectPointerArraySizeType idx) override;
124  itk::ProcessObject::DataObjectPointer MakeOutput(const itk::ProcessObject::DataObjectIdentifierType &) override;
126 
128  typename TMaterialProjections::ConstPointer GetInputMaterialProjections();
129  typename TPhotonCounts::ConstPointer GetInputPhotonCounts();
130  typename TSpectrum::ConstPointer GetInputSpectrum();
131  typename TProjections::ConstPointer GetInputProjectionsOfOnes();
133 
137 
138 };
139 } //namespace RTK
140 
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "rtkWeidingerForwardModelImageFilter.hxx"
144 #endif
145 
146 #endif
typename TMaterialProjections::PixelType::ValueType dataType
void SetInputSpectrum(const TSpectrum *spectrum)
TPhotonCounts::ConstPointer GetInputPhotonCounts()
TMaterialProjections::ConstPointer GetInputMaterialProjections()
void SetInputPhotonCounts(const TPhotonCounts *photonCounts)
TSpectrum::ConstPointer GetInputSpectrum()
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)
unsigned int ThreadIdType
Performs intermediate computations in Weidinger2016.
TProjections::ConstPointer GetInputProjectionsOfOnes()
itk::ProcessObject::DataObjectPointer MakeOutput(itk::ProcessObject::DataObjectPointerArraySizeType idx) override
void SetInputProjectionsOfOnes(const TProjections *projectionsOfOnes)