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 TDecomposedProjections,
42  class TMeasuredProjections,
43  class TIncidentSpectrum,
44  class TProjections =
46 class ITK_TEMPLATE_EXPORT WeidingerForwardModelImageFilter
47  : public itk::ImageToImageFilter<TDecomposedProjections, TDecomposedProjections>
48 {
49 public:
50  ITK_DISALLOW_COPY_AND_MOVE(WeidingerForwardModelImageFilter);
51 
56 
58  itkNewMacro(Self);
59 
61  itkOverrideGetNameOfClassMacro(WeidingerForwardModelImageFilter);
62 
64  static constexpr unsigned int nBins = TMeasuredProjections::PixelType::Dimension;
65  static constexpr unsigned int nMaterials = TDecomposedProjections::PixelType::Dimension;
66 
68  using dataType = typename TDecomposedProjections::PixelType::ValueType;
69 
74  using TOutputImage1 = TDecomposedProjections;
76 #ifdef RTK_USE_CUDA
77  using TOutputImage2 = itk::CudaImage<TPixelOutput2, TDecomposedProjections::ImageDimension>;
78 #else
80 #endif
81 
84  GetOutput1();
86  GetOutput2();
88 
90  void
91  SetInputDecomposedProjections(const TDecomposedProjections * decomposedProjections);
92  void
93  SetInputMeasuredProjections(const TMeasuredProjections * measuredProjections);
94  void
95  SetInputIncidentSpectrum(const TIncidentSpectrum * incidentSpectrum);
96 #ifndef ITK_FUTURE_LEGACY_REMOVE
97  void
98  SetInputMaterialProjections(const TDecomposedProjections * decomposedProjections);
99  void
100  SetInputPhotonCounts(const TMeasuredProjections * measuredProjections);
101  void
102  SetInputSpectrum(const TIncidentSpectrum * incidentSpectrum);
103 #endif
104  void
105  SetInputProjectionsOfOnes(const TProjections * projectionsOfOnes);
107 
109  using BinnedDetectorResponseType = vnl_matrix<dataType>;
110  using MaterialAttenuationsType = vnl_matrix<dataType>;
111 
113  itkGetConstReferenceMacro(BinnedDetectorResponse, BinnedDetectorResponseType);
114  itkGetConstReferenceMacro(MaterialAttenuations, MaterialAttenuationsType);
115  virtual void
116  SetBinnedDetectorResponse(const BinnedDetectorResponseType & detResp);
117  virtual void
118  SetMaterialAttenuations(const MaterialAttenuationsType & matAtt);
120 
121 protected:
123  ~WeidingerForwardModelImageFilter() override = default;
124 
125  void
126  GenerateInputRequestedRegion() override;
127  void
128  VerifyInputInformation() const override
129  {}
130 
132  void
133  DynamicThreadedGenerateData(const typename TOutputImage1::RegionType & outputRegionForThread) override;
134 
139  MakeOutput(const itk::ProcessObject::DataObjectIdentifierType &) override;
141 
143  typename TDecomposedProjections::ConstPointer
144  GetInputDecomposedProjections();
145  typename TMeasuredProjections::ConstPointer
146  GetInputMeasuredProjections();
147  typename TIncidentSpectrum::ConstPointer
148  GetInputIncidentSpectrum();
149 #ifndef ITK_FUTURE_LEGACY_REMOVE
150  typename TDecomposedProjections::ConstPointer
151  GetInputMaterialProjections();
152  typename TMeasuredProjections::ConstPointer
153  GetInputPhotonCounts();
154  typename TIncidentSpectrum::ConstPointer
155  GetInputSpectrum();
156 #endif
157  typename TProjections::ConstPointer
158  GetInputProjectionsOfOnes();
160 
165 };
166 } // namespace rtk
167 
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 # include "rtkWeidingerForwardModelImageFilter.hxx"
171 #endif
172 
173 #endif
DataObject::DataObjectIdentifierType DataObjectIdentifierType
unsigned long SizeValueType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
typename TDecomposedProjections::PixelType::ValueType dataType
Performs intermediate computations in Weidinger2016.