forked from InsightSoftwareConsortium/ITK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
itkVectorThresholdSegmentationLevelSetImageFilter.h
170 lines (146 loc) · 6.5 KB
/
itkVectorThresholdSegmentationLevelSetImageFilter.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkVectorThresholdSegmentationLevelSetImageFilter.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkVectorThresholdSegmentationLevelSetImageFilter_h_
#define __itkVectorThresholdSegmentationLevelSetImageFilter_h_
#include "itkSegmentationLevelSetImageFilter.h"
#include "itkVectorThresholdSegmentationLevelSetFunction.h"
namespace itk {
/** \class VectorThresholdSegmentationLevelSetImageFilter
* \brief Segments structures in images based on intensity values.
*
* \par IMPORTANT
* The SegmentationLevelSetImageFilter class and the
* VectorThresholdSegmentationLevelSetFunction class contain additional information necessary
* to the full understanding of how to use this filter.
*
* \par CREDITS
* This class was contributed to ITK by Stefan Lindenau
* http://www.itk.org/pipermail/insight-users/2003-December/005969.html
*
* \par OVERVIEW
* This class is a level set method segmentation filter. It constructs a
* speed function which is close to zero where the Mahalabonian Distance
* exceeds a certain threshold, effectively locking the propagating front onto those
* edges. Elsewhere, the front will propagate quickly.
*
* \par INPUTS
* This filter requires two inputs. The first input is a seed
* image. This seed image must contain an isosurface that you want to use as the
* seed for your segmentation. It can be a binary, graylevel, or floating
* point image. The only requirement is that it contain a closed isosurface
* that you will identify as the seed by setting the IsosurfaceValue parameter
* of the filter. For a binary image you will want to set your isosurface
* value halfway between your on and off values (i.e. for 0's and 1's, use an
* isosurface value of 0.5).
*
* \par
* The second input is the feature image. This is the image from which the
* speed function will be calculated the feature image has to be a Vector Image.
* For most applications, this is the
* image that you want to segment. The desired isosurface in your seed image
* should lie within the region of your feature image that you are trying to
* segment. Note that this filter does no preprocessing of the feature image
* before thresholding.
*
* \par
* See SegmentationLevelSetImageFilter for more information on Inputs.
*
* \par OUTPUTS
* The filter outputs a single, scalar, real-valued image.
* Positive values in the output image are inside the segmentated region
* and negative values in the image are outside of the inside region. The
* zero crossings of the image correspond to the position of the level set
* front.
*
* \par
* See SparseFieldLevelSetImageFilter and
* SegmentationLevelSetImageFilter for more information.
*
* \par PARAMETERS
* In addition to parameters described in SegmentationLevelSetImageFilter,
* this filter adds the Threshold, the Mean and the Covariance. See
* VectorThresholdSegmentationLevelSetFunction for a description of how this value
* affect the segmentation.
*
* \sa SegmentationLevelSetImageFilter
* \sa ThresholdSegmentationLevelSetFunction,
* \sa SparseFieldLevelSetImageFilter */
template <class TInputImage,
class TFeatureImage,
class TOutputPixelType = float >
class ITK_EXPORT VectorThresholdSegmentationLevelSetImageFilter
: public SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType >
{
public:
/** Standard class typedefs */
typedef VectorThresholdSegmentationLevelSetImageFilter Self;
typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Inherited typedef from the superclass. */
typedef typename Superclass::ValueType ValueType;
typedef typename Superclass::OutputImageType OutputImageType;
typedef typename Superclass::FeatureImageType FeatureImageType;
/** Type of the segmentation function */
typedef VectorThresholdSegmentationLevelSetFunction<OutputImageType,FeatureImageType> ThresholdFunctionType;
typedef typename ThresholdFunctionType::Pointer ThresholdFunctionPointer;
typedef typename ThresholdFunctionType::MeanVectorType MeanVectorType;
typedef typename ThresholdFunctionType::CovarianceMatrixType CovarianceMatrixType;
typedef typename ThresholdFunctionType::ScalarValueType ScalarValueType;
/** Run-time type information (and related methods). */
itkTypeMacro(VectorThresholdSegmentationLevelSetImageFilter, SegmentationLevelSetImageFilter);
/** Method for creation through the object factory */
itkNewMacro(Self);
/** Set/Get mean and covariance that will be used to calculate the speed function */
void SetMean(const MeanVectorType &mean)
{
m_ThresholdFunction->SetMean(mean);
this->Modified();
}
const MeanVectorType & GetMean() const
{
return m_ThresholdFunction->GetMean();
}
void SetCovariance(const CovarianceMatrixType &cov)
{
m_ThresholdFunction->SetCovariance(cov);
this->Modified();
}
const CovarianceMatrixType & GetCovariance() const
{
return m_ThresholdFunction->GetCovariance();
}
/** Set/Get the threshold for the Mahanalobis Distance */
void SetThreshold(ScalarValueType thr)
{
m_ThresholdFunction->SetThreshold(thr);
this->Modified();
}
ScalarValueType GetThreshold ()
{
return m_ThresholdFunction->GetThreshold();
}
protected:
~VectorThresholdSegmentationLevelSetImageFilter() {}
VectorThresholdSegmentationLevelSetImageFilter();
virtual void PrintSelf(std::ostream &os, Indent indent) const;
VectorThresholdSegmentationLevelSetImageFilter(const Self &); // purposely not impl.
void operator=(const Self&); //purposely not implemented
private:
ThresholdFunctionPointer m_ThresholdFunction;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkVectorThresholdSegmentationLevelSetImageFilter.txx"
#endif
#endif