RTK  2.6.0
Reconstruction Toolkit
rtkSimplexSpectralProjectionsDecompositionImageFilter.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 rtkSimplexSpectralProjectionsDecompositionImageFilter_h
20 #define rtkSimplexSpectralProjectionsDecompositionImageFilter_h
21 
22 #include <itkImageToImageFilter.h>
23 #include <itkAmoebaOptimizer.h>
26 
27 namespace rtk
28 {
40 template <typename DecomposedProjectionsType,
41  typename MeasuredProjectionsType,
42  typename IncidentSpectrumImageType = itk::VectorImage<float, 2>,
43  typename DetectorResponseImageType = itk::Image<float, 2>,
44  typename MaterialAttenuationsImageType = itk::Image<float, 2>>
46  : public itk::ImageToImageFilter<DecomposedProjectionsType, DecomposedProjectionsType>
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_MOVE(SimplexSpectralProjectionsDecompositionImageFilter);
50 
56 
58  using InputImageType = DecomposedProjectionsType;
59  using OutputImageType = DecomposedProjectionsType;
60 
64  using DetectorResponseType = vnl_matrix<double>;
65  using MaterialAttenuationsType = vnl_matrix<double>;
67 
69  itkNewMacro(Self);
70 
72 #ifdef itkOverrideGetNameOfClassMacro
73  itkOverrideGetNameOfClassMacro(SimplexSpectralProjectionsDecompositionImageFilter);
74 #else
76 #endif
77 
78 
80  void
81  SetInputDecomposedProjections(const DecomposedProjectionsType * DecomposedProjections);
82  typename DecomposedProjectionsType::ConstPointer
83  GetInputDecomposedProjections();
85 
87  void
88  SetInputMeasuredProjections(const MeasuredProjectionsType * SpectralProjections);
89  typename MeasuredProjectionsType::ConstPointer
90  GetInputMeasuredProjections();
92 
94  void
95  SetDetectorResponse(const DetectorResponseImageType * DetectorResponse);
96  typename DetectorResponseImageType::ConstPointer
97  GetDetectorResponse();
99 
101  void
102  SetMaterialAttenuations(const MaterialAttenuationsImageType * MaterialAttenuations);
103  typename MaterialAttenuationsImageType::ConstPointer
104  GetMaterialAttenuations();
106 
108  void
109  SetInputIncidentSpectrum(const IncidentSpectrumImageType * IncidentSpectrum);
110  void
111  SetInputSecondIncidentSpectrum(const IncidentSpectrumImageType * SecondIncidentSpectrum);
112  typename IncidentSpectrumImageType::ConstPointer
113  GetInputIncidentSpectrum();
114  typename IncidentSpectrumImageType::ConstPointer
115  GetInputSecondIncidentSpectrum();
117 
119  itkGetMacro(NumberOfIterations, unsigned int);
120  itkSetMacro(NumberOfIterations, unsigned int);
122 
123  itkSetMacro(NumberOfEnergies, unsigned int);
124  itkGetMacro(NumberOfEnergies, unsigned int);
125 
126  itkSetMacro(NumberOfMaterials, unsigned int);
127  itkGetMacro(NumberOfMaterials, unsigned int);
128 
129  itkSetMacro(OptimizeWithRestarts, bool);
130  itkGetMacro(OptimizeWithRestarts, bool);
131 
132  itkSetMacro(Thresholds, ThresholdsType);
133  itkGetMacro(Thresholds, ThresholdsType);
134 
135  itkSetMacro(NumberOfSpectralBins, unsigned int);
136  itkGetMacro(NumberOfSpectralBins, unsigned int);
137 
138  itkSetMacro(OutputInverseCramerRaoLowerBound, bool);
139  itkGetMacro(OutputInverseCramerRaoLowerBound, bool);
140 
141  itkSetMacro(OutputFischerMatrix, bool);
142  itkGetMacro(OutputFischerMatrix, bool);
143 
144  itkSetMacro(LogTransformEachBin, bool);
145  itkGetMacro(LogTransformEachBin, bool);
146 
147  itkSetMacro(GuessInitialization, bool);
148  itkGetMacro(GuessInitialization, bool);
149 
150  itkSetMacro(IsSpectralCT, bool);
151  itkGetMacro(IsSpectralCT, bool);
152 
153 protected:
156 
157  void
158  GenerateOutputInformation() override;
159 
160  void
161  GenerateInputRequestedRegion() override;
162 
163  void
164  BeforeThreadedGenerateData() override;
165  void
166  DynamicThreadedGenerateData(const typename DecomposedProjectionsType::RegionType & outputRegionForThread) override;
167 
170  using Superclass::MakeOutput;
172  MakeOutput(DataObjectPointerArraySizeType idx) override;
173 
176  void
177  VerifyInputInformation() const override
178  {}
179 
189  bool m_IsSpectralCT; // If not, it is dual energy CT
191  unsigned int m_NumberOfIterations;
192  unsigned int m_NumberOfMaterials;
193  unsigned int m_NumberOfEnergies;
195 
196 }; // end of class
197 
198 } // end namespace rtk
199 
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 # include "rtkSimplexSpectralProjectionsDecompositionImageFilter.hxx"
203 #endif
204 
205 #endif
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Decomposition of spectral projection images into material projections.
#define itkSetMacro(name, type)
TOutputImage OutputImageType