ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkSpectralForwardModelImageFilter.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
19#ifndef rtkSpectralForwardModelImageFilter_h
20#define rtkSpectralForwardModelImageFilter_h
21
24
25#include <itkCastImageFilter.h>
28
29namespace rtk
30{
43
44template <typename DecomposedProjectionsType,
45 typename MeasuredProjectionsType,
46 typename IncidentSpectrumImageType = itk::Image<float, 3>,
47 typename DetectorResponseImageType = itk::Image<float, 2>,
48 typename MaterialAttenuationsImageType = itk::Image<float, 2>>
49class ITK_TEMPLATE_EXPORT SpectralForwardModelImageFilter
50 : public itk::InPlaceImageFilter<MeasuredProjectionsType, MeasuredProjectionsType>
51{
52public:
53 ITK_DISALLOW_COPY_AND_MOVE(SpectralForwardModelImageFilter);
54
60
62 using InputImageType = MeasuredProjectionsType;
63 using OutputImageType = MeasuredProjectionsType;
64
67 using DetectorResponseType = vnl_matrix<double>;
68 using MaterialAttenuationsType = vnl_matrix<double>;
69 using DecomposedProjectionsDataType = typename DecomposedProjectionsType::PixelType::ValueType;
70 using MeasuredProjectionsDataType = typename MeasuredProjectionsType::PixelType::ValueType;
71
72#ifndef ITK_FUTURE_LEGACY_REMOVE
74 using VectorSpectrumImageType = itk::VectorImage<float, 2>;
77#endif
78
80 itkNewMacro(Self);
81
83 itkOverrideGetNameOfClassMacro(SpectralForwardModelImageFilter);
84
86 void
87 SetInputIncidentSpectrum(const IncidentSpectrumImageType * IncidentSpectrum);
88#ifndef ITK_FUTURE_LEGACY_REMOVE
89 void
90 SetInputIncidentSpectrum(const VectorSpectrumImageType * IncidentSpectrum);
91#endif
92 typename IncidentSpectrumImageType::ConstPointer
94
96 void
98 const typename itk::ImageBase<DecomposedProjectionsType::ImageDimension> * DecomposedProjections);
99 template <unsigned int VNumberOfMaterials>
100 void
103 DecomposedProjectionsType::ImageDimension> * DecomposedProjections);
104 typename DecomposedProjectionsType::ConstPointer
106
108 void
110 const typename itk::ImageBase<MeasuredProjectionsType::ImageDimension> * MeasuredProjections);
111 template <unsigned int VNumberOfSpectralBins>
112 void
115 MeasuredProjectionsType::ImageDimension> * MeasuredProjections);
116 typename MeasuredProjectionsType::ConstPointer
118
120 void
121 SetDetectorResponse(const DetectorResponseImageType * DetectorResponse);
122 typename DetectorResponseImageType::ConstPointer
124
126 void
127 SetMaterialAttenuations(const MaterialAttenuationsImageType * MaterialAttenuations);
128 typename MaterialAttenuationsImageType::ConstPointer
130
131 typename DecomposedProjectionsType::ConstPointer
133
134 typename MeasuredProjectionsType::ConstPointer
136
138 itkGetMacro(Thresholds, ThresholdsType);
139
140 itkSetMacro(NumberOfSpectralBins, unsigned int);
141 itkGetMacro(NumberOfSpectralBins, unsigned int);
142
143 itkSetMacro(NumberOfMaterials, unsigned int);
144 itkGetMacro(NumberOfMaterials, unsigned int);
145
146 itkSetMacro(NumberOfEnergies, unsigned int);
147 itkGetMacro(NumberOfEnergies, unsigned int);
148
149 itkSetMacro(ComputeVariances, bool);
150 itkGetMacro(ComputeVariances, bool);
151
152 itkSetMacro(ComputeCramerRaoLowerBound, bool);
153 itkGetMacro(ComputeCramerRaoLowerBound, bool);
154
155protected:
158
164
165 void
167
168 void
170
171 void
173 void
174 DynamicThreadedGenerateData(const typename OutputImageType::RegionType & outputRegionForThread) override;
175
178 void
179 VerifyInputInformation() const override
180 {}
181
184
187 unsigned int m_NumberOfEnergies;
188
193 bool m_ComputeVariances; // Only implemented for dual energy CT
194 bool m_ComputeCramerRaoLowerBound; // Only implemented for spectral CT
195
202
203#ifndef ITK_FUTURE_LEGACY_REMOVE
205 typename FlattenVectorFilterType::Pointer m_FlattenFilter;
206 typename PermuteFilterType::Pointer m_PermuteFilter;
207#endif
208}; // end of class
209
210// Function to bin a detector response matrix according to given energy thresholds
211template <typename OutputElementType, typename DetectorResponseImageType, typename ThresholdsType>
212vnl_matrix<OutputElementType>
213SpectralBinDetectorResponse(const DetectorResponseImageType * drm,
214 const ThresholdsType & thresholds,
215 unsigned int numberOfEnergies);
216
217} // end namespace rtk
218
219
220#ifndef ITK_MANUAL_INSTANTIATION
221# include "rtkSpectralForwardModelImageFilter.hxx"
222#endif
223
224#endif
SmartPointer< Self > Pointer
Base class for templated image classes.
SmartPointer< Self > Pointer
Base class for filters that take an image as input and produce an image as output.
Templated n-dimensional image class.
Definition itkImage.h:89
Base class for filters that take an image as input and overwrite that image as the output.
Permutes the image axes according to a user specified order.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx)
Make a DataObject of the correct type to used as the specified output.
Implements transparent reference counting.
Templated n-dimensional vector image class.
A templated class holding a n-Dimensional vector.
Definition itkVector.h:63
IncidentSpectrumImageType::ConstPointer GetInputIncidentSpectrum()
itk::ImageToImageFilter< MeasuredProjectionsType, MeasuredProjectionsType > Superclass
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
MeasuredProjectionsType::ConstPointer GetInputMeasuredProjections()
DecomposedProjectionsType::ConstPointer GetInputDecomposedProjections()
~SpectralForwardModelImageFilter() override=default
void SetInputIncidentSpectrum(const IncidentSpectrumImageType *IncidentSpectrum)
DecomposedProjectionsType::ConstPointer GetOutputCramerRaoLowerBound()
void SetInputDecomposedProjections(const typename itk::ImageBase< DecomposedProjectionsType::ImageDimension > *DecomposedProjections)
itk::ImageSource< DecomposedProjectionsType >::Pointer m_CastDecomposedProjectionsPointer
DetectorResponseImageType::ConstPointer GetDetectorResponse()
void SetInputMeasuredProjections(const typename itk::ImageBase< MeasuredProjectionsType::ImageDimension > *MeasuredProjections)
void SetInputFixedVectorLengthDecomposedProjections(const itk::Image< itk::Vector< DecomposedProjectionsDataType, VNumberOfMaterials >, DecomposedProjectionsType::ImageDimension > *DecomposedProjections)
itk::ImageSource< MeasuredProjectionsType >::Pointer m_CastMeasuredProjectionsPointer
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
typename MeasuredProjectionsType::PixelType::ValueType MeasuredProjectionsDataType
void SetMaterialAttenuations(const MaterialAttenuationsImageType *MaterialAttenuations)
itk::VariableLengthVector< double > ThresholdsType
void SetDetectorResponse(const DetectorResponseImageType *DetectorResponse)
void GenerateInputRequestedRegion() override
void SetInputFixedVectorLengthMeasuredProjections(const itk::Image< itk::Vector< MeasuredProjectionsDataType, VNumberOfSpectralBins >, MeasuredProjectionsType::ImageDimension > *MeasuredProjections)
typename DecomposedProjectionsType::PixelType::ValueType DecomposedProjectionsDataType
void DynamicThreadedGenerateData(const typename OutputImageType::RegionType &outputRegionForThread) override
MeasuredProjectionsType::ConstPointer GetOutputVariances()
MaterialAttenuationsImageType::ConstPointer GetMaterialAttenuations()
Re-writes a vector image as an image.
vnl_matrix< OutputElementType > SpectralBinDetectorResponse(const DetectorResponseImageType *drm, const ThresholdsType &thresholds, unsigned int numberOfEnergies)
#define itkSetMacro(name, type)