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  itkOverrideGetNameOfClassMacro(WeidingerForwardModelImageFilter);
62 
64  static constexpr unsigned int nBins = TPhotonCounts::PixelType::Dimension;
65  static constexpr unsigned int nMaterials = TMaterialProjections::PixelType::Dimension;
66 
68  using dataType = typename TMaterialProjections::PixelType::ValueType;
69 
74  using TOutputImage1 = TMaterialProjections;
76 #ifdef RTK_USE_CUDA
77  using TOutputImage2 = itk::CudaImage<TPixelOutput2, TMaterialProjections::ImageDimension>;
78 #else
80 #endif
81 
84  GetOutput1();
86  GetOutput2();
88 
90  void
91  SetInputMaterialProjections(const TMaterialProjections * materialProjections);
92  void
93  SetInputPhotonCounts(const TPhotonCounts * photonCounts);
94  void
95  SetInputSpectrum(const TSpectrum * spectrum);
96  void
97  SetInputProjectionsOfOnes(const TProjections * projectionsOfOnes);
99 
101  using BinnedDetectorResponseType = vnl_matrix<dataType>;
102  using MaterialAttenuationsType = vnl_matrix<dataType>;
103 
105  itkGetConstReferenceMacro(BinnedDetectorResponse, BinnedDetectorResponseType);
106  itkGetConstReferenceMacro(MaterialAttenuations, MaterialAttenuationsType);
107  virtual void
108  SetBinnedDetectorResponse(const BinnedDetectorResponseType & detResp);
109  virtual void
110  SetMaterialAttenuations(const MaterialAttenuationsType & matAtt);
112 
113 protected:
115  ~WeidingerForwardModelImageFilter() override = default;
116 
117  void
118  GenerateInputRequestedRegion() override;
119  void
120  VerifyInputInformation() const override
121  {}
122 
124  void
125  DynamicThreadedGenerateData(const typename TOutputImage1::RegionType & outputRegionForThread) override;
126 
131  MakeOutput(const itk::ProcessObject::DataObjectIdentifierType &) override;
133 
135  typename TMaterialProjections::ConstPointer
136  GetInputMaterialProjections();
137  typename TPhotonCounts::ConstPointer
138  GetInputPhotonCounts();
139  typename TSpectrum::ConstPointer
140  GetInputSpectrum();
141  typename TProjections::ConstPointer
142  GetInputProjectionsOfOnes();
144 
149 };
150 } // namespace rtk
151 
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 # include "rtkWeidingerForwardModelImageFilter.hxx"
155 #endif
156 
157 #endif
DataObject::DataObjectIdentifierType DataObjectIdentifierType
typename TMaterialProjections::PixelType::ValueType dataType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
unsigned long SizeValueType
Performs intermediate computations in Weidinger2016.