RTK  2.6.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  * 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 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,
44  class TProjections =
46 class ITK_TEMPLATE_EXPORT WeidingerForwardModelImageFilter
47  : public itk::ImageToImageFilter<TMaterialProjections, TMaterialProjections>
48 {
49 public:
50  ITK_DISALLOW_COPY_AND_MOVE(WeidingerForwardModelImageFilter);
51 
56 
58  itkNewMacro(Self);
59 
61 #ifdef itkOverrideGetNameOfClassMacro
62  itkOverrideGetNameOfClassMacro(WeidingerForwardModelImageFilter);
63 #else
65 #endif
66 
67 
69  static constexpr unsigned int nBins = TPhotonCounts::PixelType::Dimension;
70  static constexpr unsigned int nMaterials = TMaterialProjections::PixelType::Dimension;
71 
73  using dataType = typename TMaterialProjections::PixelType::ValueType;
74 
79  using TOutputImage1 = TMaterialProjections;
81 #ifdef RTK_USE_CUDA
82  using TOutputImage2 = itk::CudaImage<TPixelOutput2, TMaterialProjections::ImageDimension>;
83 #else
85 #endif
86 
89  GetOutput1();
91  GetOutput2();
93 
95  void
96  SetInputMaterialProjections(const TMaterialProjections * materialProjections);
97  void
98  SetInputPhotonCounts(const TPhotonCounts * photonCounts);
99  void
100  SetInputSpectrum(const TSpectrum * spectrum);
101  void
102  SetInputProjectionsOfOnes(const TProjections * projectionsOfOnes);
104 
106  using BinnedDetectorResponseType = vnl_matrix<dataType>;
107  using MaterialAttenuationsType = vnl_matrix<dataType>;
108 
110  itkGetConstReferenceMacro(BinnedDetectorResponse, BinnedDetectorResponseType);
111  itkGetConstReferenceMacro(MaterialAttenuations, MaterialAttenuationsType);
112  virtual void
113  SetBinnedDetectorResponse(const BinnedDetectorResponseType & detResp);
114  virtual void
115  SetMaterialAttenuations(const MaterialAttenuationsType & matAtt);
117 
118 protected:
120  ~WeidingerForwardModelImageFilter() override = default;
121 
122  void
123  GenerateInputRequestedRegion() override;
124  void
125  VerifyInputInformation() const override
126  {}
127 
129  void
130  DynamicThreadedGenerateData(const typename TOutputImage1::RegionType & outputRegionForThread) override;
131 
136  MakeOutput(const itk::ProcessObject::DataObjectIdentifierType &) override;
138 
140  typename TMaterialProjections::ConstPointer
141  GetInputMaterialProjections();
142  typename TPhotonCounts::ConstPointer
143  GetInputPhotonCounts();
144  typename TSpectrum::ConstPointer
145  GetInputSpectrum();
146  typename TProjections::ConstPointer
147  GetInputProjectionsOfOnes();
149 
154 };
155 } // namespace rtk
156 
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 # include "rtkWeidingerForwardModelImageFilter.hxx"
160 #endif
161 
162 #endif
DataObject::DataObjectIdentifierType DataObjectIdentifierType
typename TMaterialProjections::PixelType::ValueType dataType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
unsigned long SizeValueType
Performs intermediate computations in Weidinger2016.