ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkI0EstimationProjectionFilter.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 rtkI0EstimationProjectionFilter_h
20#define rtkI0EstimationProjectionFilter_h
21
22#include "rtkConfiguration.h"
25
26#include <mutex>
27#include <string>
28#include <vector>
29
30namespace rtk
31{
42
43template <class TInputImage = itk::Image<unsigned short, 3>,
44 class TOutputImage = TInputImage,
45 unsigned char bitShift = 2>
46class ITK_TEMPLATE_EXPORT I0EstimationProjectionFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
47{
48public:
49 ITK_DISALLOW_COPY_AND_MOVE(I0EstimationProjectionFilter);
50
56
58 itkNewMacro(Self);
59
61 itkOverrideGetNameOfClassMacro(I0EstimationProjectionFilter);
62
64 using InputImageType = TInputImage;
65 using ImagePointer = typename InputImageType::Pointer;
66 using ImageConstPointer = typename InputImageType::ConstPointer;
68 using InputImagePixelType = typename InputImageType::PixelType;
69
71
73 itkGetMacro(I0, InputImagePixelType);
74 itkGetMacro(I0fwhm, InputImagePixelType);
75 itkGetMacro(I0rls, InputImagePixelType);
76
81 itkGetMacro(MaxPixelValue, InputImagePixelType);
82
85 itkGetMacro(ExpectedI0, InputImagePixelType);
86
88 itkSetMacro(Lambda, float);
89 itkGetMacro(Lambda, float);
90
93 itkSetMacro(Reset, bool);
94 itkGetConstMacro(Reset, bool);
95 itkBooleanMacro(Reset);
96
99 itkSetMacro(SaveHistograms, bool);
100 itkGetConstMacro(SaveHistograms, bool);
101 itkBooleanMacro(SaveHistograms);
102
103protected:
105 ~I0EstimationProjectionFilter() override = default;
106
107 void
109
110 void
111 ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) override;
112
113 void
115
116private:
117 // Input variables
118 InputImagePixelType m_ExpectedI0; // Expected I0 value (as a result of a
119 // detector calibration)
120 InputImagePixelType m_MaxPixelValue; // Maximum encodable detector value if
121 // different from (2^16-1)
122 float m_Lambda; // RLS coefficient
123 bool m_SaveHistograms; // Save histograms in a output file
124 bool m_Reset; // Reset counters
125
126 // Secondary inputs
127 std::vector<unsigned int>::size_type m_NBins; // Histogram size, computed
128 // from m_MaxPixelValue and bitshift
129
130 // Main variables
131 std::vector<unsigned int> m_Histogram; // compressed (bitshifted) histogram
132 InputImagePixelType m_I0; // I0 estimate with no a priori for
133 // each new image
134 InputImagePixelType m_I0rls; // Updated RLS estimate
135 InputImagePixelType m_I0fwhm; // FWHM of the I0 mode
136
137 // Secondary variables
138 unsigned int m_Np; // Number of previously analyzed
139 // images
140 InputImagePixelType m_Imin, m_Imax; // Define the range of consistent
141 // pixels in histogram
142 unsigned int m_DynThreshold; // Detector values with a frequency of
143 // less than dynThreshold outside
144 // min/max are discarded
145 unsigned int m_LowBound, m_HighBound; // Lower/Upper bounds of the I0 mode
146 // at half width
147
148 std::mutex m_Mutex;
149};
150} // end namespace rtk
151
152#ifndef ITK_MANUAL_INSTANTIATION
153# include "rtkI0EstimationProjectionFilter.hxx"
154#endif
155
156#endif
Base class for filters that take an image as input and overwrite that image as the output.
typename OutputImageType::RegionType OutputImageRegionType
Implements transparent reference counting.
void AfterThreadedGenerateData() override
~I0EstimationProjectionFilter() override=default
void BeforeThreadedGenerateData() override
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
I0EstimationProjectionFilter< TInputImage, TOutputImage, bitShift > Self
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
unsigned int ThreadIdType
Definition itkIntTypes.h:98
#define itkSetMacro(name, type)