ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkHistogramMatchingImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 itkHistogramMatchingImageFilter_h
19#define itkHistogramMatchingImageFilter_h
20
22#include "itkHistogram.h"
23#include "vnl/vnl_matrix.h"
24
25namespace itk
26{
69/* THistogramMeasurement -- The precision level for which to do
70 HistogramMeasurements */
71template <typename TInputImage, typename TOutputImage, typename THistogramMeasurement = typename TInputImage::PixelType>
72class ITK_TEMPLATE_EXPORT HistogramMatchingImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
73{
74public:
75 ITK_DISALLOW_COPY_AND_MOVE(HistogramMatchingImageFilter);
76
82
84 itkNewMacro(Self);
85
87 itkOverrideGetNameOfClassMacro(HistogramMatchingImageFilter);
88
90 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
91 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
92
94 using OutputImageRegionType = typename TOutputImage::RegionType;
95
97 using typename Superclass::InputImageType;
98 using typename Superclass::InputImagePointer;
100 using typename Superclass::OutputImageType;
101 using typename Superclass::OutputImagePointer;
102
104 using InputPixelType = typename InputImageType::PixelType;
105 using OutputPixelType = typename OutputImageType::PixelType;
106
110
115
120
129 itkSetInputMacro(ReferenceHistogram, HistogramType);
130 itkGetInputMacro(ReferenceHistogram, HistogramType);
132
134 itkSetMacro(NumberOfHistogramLevels, SizeValueType);
135 itkGetConstMacro(NumberOfHistogramLevels, SizeValueType);
137
139 itkSetMacro(NumberOfMatchPoints, SizeValueType);
140 itkGetConstMacro(NumberOfMatchPoints, SizeValueType);
142
148 itkSetMacro(ThresholdAtMeanIntensity, bool);
149 itkGetConstMacro(ThresholdAtMeanIntensity, bool);
150 itkBooleanMacro(ThresholdAtMeanIntensity);
152
162 itkSetMacro(GenerateReferenceHistogramFromImage, bool);
163 itkGetConstMacro(GenerateReferenceHistogramFromImage, bool);
164 itkBooleanMacro(GenerateReferenceHistogramFromImage);
166
168 void
170
174 itkGetModifiableObjectMacro(SourceHistogram, HistogramType);
175 itkGetModifiableObjectMacro(OutputHistogram, HistogramType);
177
178 itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible<int, InputPixelType>));
180 itkConceptMacro(DoubleConvertibleToInputCheck, (Concept::Convertible<double, InputPixelType>));
181 itkConceptMacro(DoubleConvertibleToOutputCheck, (Concept::Convertible<double, OutputPixelType>));
182 itkConceptMacro(InputConvertibleToDoubleCheck, (Concept::Convertible<InputPixelType, double>));
183 itkConceptMacro(OutputConvertibleToDoubleCheck, (Concept::Convertible<OutputPixelType, double>));
185
186protected:
188 ~HistogramMatchingImageFilter() override = default;
189 void
190 PrintSelf(std::ostream & os, Indent indent) const override;
191
192 void
194
195 void
197
198 void
199 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
200
201
207 void
208 VerifyInputInformation() const override
209 {}
210
211 void
212 VerifyPreconditions() const override;
213
215 void
217 THistogramMeasurement & minValue,
218 THistogramMeasurement & maxValue,
219 THistogramMeasurement & meanValue);
220
225 void
227 HistogramType * histogram,
228 const THistogramMeasurement minHistogramValidValue,
229 const THistogramMeasurement maxHistogramValidValue,
230 const THistogramMeasurement imageTrueMinValue,
231 const THistogramMeasurement imageTrueMaxValue);
232
233private:
237
238 THistogramMeasurement m_SourceMinValue{};
239 THistogramMeasurement m_SourceMaxValue{};
240
241 THistogramMeasurement m_ReferenceMinValue{};
242 THistogramMeasurement m_ReferenceMaxValue{};
243
246
247 using TableType = vnl_matrix<double>;
249
250 using GradientArrayType = vnl_vector<double>;
252 double m_LowerGradient{ 0.0 };
253 double m_UpperGradient{ 0.0 };
255};
256} // end namespace itk
257
258#ifndef ITK_MANUAL_INSTANTIATION
259# include "itkHistogramMatchingImageFilter.hxx"
260#endif
261
262#endif
Statistics::Histogram< THistogramMeasurement > HistogramType
typename HistogramType::Pointer HistogramPointer
~HistogramMatchingImageFilter() override=default
void GenerateInputRequestedRegion() override
itkSetInputMacro(ReferenceHistogram, HistogramType)
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
void ConstructHistogramFromIntensityRange(const InputImageType *image, HistogramType *histogram, const THistogramMeasurement minHistogramValidValue, const THistogramMeasurement maxHistogramValidValue, const THistogramMeasurement imageTrueMinValue, const THistogramMeasurement imageTrueMaxValue)
typename OutputImageType::PixelType OutputPixelType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
typename TOutputImage::RegionType OutputImageRegionType
itkSetInputMacro(SourceImage, InputImageType)
void ComputeMinMaxMean(const InputImageType *image, THistogramMeasurement &minValue, THistogramMeasurement &maxValue, THistogramMeasurement &meanValue)
static constexpr unsigned int OutputImageDimension
void PrintSelf(std::ostream &os, Indent indent) const override
itkGetInputMacro(SourceImage, InputImageType)
typename InputImageType::PixelType InputPixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
itkGetInputMacro(ReferenceImage, InputImageType)
itkSetInputMacro(ReferenceImage, InputImageType)
void AfterThreadedGenerateData() override
void BeforeThreadedGenerateData() override
itkGetInputMacro(ReferenceHistogram, HistogramType)
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::Pointer InputImagePointer
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
This class stores measurement vectors in the context of n-dimensional histogram.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86