-
Notifications
You must be signed in to change notification settings - Fork 20
/
itkBlockMatchingMetricImageFilter.h
152 lines (127 loc) · 5.27 KB
/
itkBlockMatchingMetricImageFilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkBlockMatchingMetricImageFilter_h
#define itkBlockMatchingMetricImageFilter_h
#include "itkImageToImageFilter.h"
namespace itk
{
namespace BlockMatching
{
/** \class MetricImageFilter
*
* \brief Create a metric image by applying a metric to a kernel over a search
* region.
*
* This class is intended to be used internally by
* itk::BlockMatching::ImageRegistrationMethod and its ilk.
*
* There are two inputs to this image, the Fixed Image, and the Moving Image.
* A block or kernel from the FixedImage is specified with SetFixedRegion().
* A metric is evaluted by comparing the kernel to the search area specified by
* SetMovingRegion(). The fixed image region should always be smaller than the
* moving image region. The metric is evaluated multiple times with different
* translations applied such that a metric image is created. The output of this
* filter is the metric image.
*
* By default, the metric image spacing is the same as the moving
* image's spacing. The origin of the metric image is the same as the fixed image.
*
* Only derived classes of this class are intended to be instantiated.
*
*
* \sa ImageRegistrationMethod
*
* \ingroup Ultrasound
*/
template <typename TFixedImage, typename TMovingImage, typename TMetricImage>
class ITK_TEMPLATE_EXPORT MetricImageFilter : public ImageToImageFilter<TFixedImage, TMetricImage>
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(MetricImageFilter);
/** Standard class type alias. */
using Self = MetricImageFilter;
using Superclass = ImageToImageFilter<TFixedImage, TMetricImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
/** Run-time type information (and related methods). */
itkTypeMacro(MetricImageFilter, ImageToImageFilter);
/** ImageDimension enumeration. */
itkStaticConstMacro(ImageDimension, unsigned int, TFixedImage::ImageDimension);
/** Type of the Fixed image. */
using FixedImageType = TFixedImage;
using FixedImageRegionType = typename FixedImageType::RegionType;
/** Type of the Moving image. */
using MovingImageType = TMovingImage;
using MovingImageRegionType = typename MovingImageType::RegionType;
/** Type of the Metric image. */
using MetricImageType = TMetricImage;
using MetricImageSpacingType = typename MetricImageType::SpacingType;
using MetricImageRegionType = typename MetricImageType::RegionType;
/** Type of the block radius. */
using RadiusType = typename FixedImageType::SizeType;
/** Set the fixed image. */
void
SetFixedImage(FixedImageType * fixedImage);
/** Set the moving image. */
void
SetMovingImage(MovingImageType * movingImage);
/** Set/Get the fixed image region. This will defined the kernel in the fixed
* image to be compared against the moving. Every pixel in this region will
* be compared against the moving image region to generate a pixel in the
* output metric image. */
void
SetFixedImageRegion(const FixedImageRegionType & region);
itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
/** Set/Get the moving image region. This will defined the search region over
* which the FixedImageRegion will be iteratively translated over to create
* the metric image. */
void
SetMovingImageRegion(const MovingImageRegionType & region);
itkGetConstReferenceMacro(MovingImageRegion, MovingImageRegionType);
protected:
MetricImageFilter();
~MetricImageFilter() override = default;
void
GenerateOutputInformation() override;
/** We set the fixed and moving image's requested region. The fixed image's
* requested region is equal to FixedImageRegion and the moving image's requested region is equal to the
* MovingImageRegion dilated by a radius related to the FixedImageRegion's size. */
void
GenerateInputRequestedRegion() override;
/** This filter produces the LargestPossibleRegion. */
void
EnlargeOutputRequestedRegion(DataObject * data) override;
FixedImageRegionType m_FixedImageRegion;
MovingImageRegionType m_MovingImageRegion;
bool m_FixedImageRegionDefined;
bool m_MovingImageRegionDefined;
// This is closely tied to m_FixedImageRegion. It gets set when setting
// FixedImageRegion.
RadiusType m_FixedRadius;
// This is again determined by m_FixedImageRegion, but it is the radius of the
// block in the moving image, which may be different if the spacing is
// different.
RadiusType m_MovingRadius;
private:
};
} // end namespace BlockMatching
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkBlockMatchingMetricImageFilter.hxx"
#endif
#endif