17 #ifndef __itkLiveWireImageFunction_h
18 #define __itkLiveWireImageFunction_h
20 #include "itkImageFunction.h"
22 #include "itkGradientImageFilter.h"
23 #include "itkPolyLineParametricPath.h"
24 #include "itkPriorityQueueContainer.h"
45 template <
class TInputImage>
47 :
public ImageFunction<TInputImage, typename itk::PolyLineParametricPath< TInputImage::ImageDimension >::Pointer >
52 itkStaticConstMacro( ImageDimension,
unsigned int,
53 TInputImage::ImageDimension );
58 typedef PolyLineParametricPath<
59 itkGetStaticConstMacro( ImageDimension )> OutputType;
60 typedef ImageFunction<TInputImage,
61 typename OutputType::Pointer> Superclass;
62 typedef SmartPointer<Self> Pointer;
63 typedef SmartPointer<const Self> ConstPointer;
73 typedef typename InputImageType::Pointer InputImagePointer;
74 typedef typename InputImageType::ConstPointer InputImageConstPointer;
75 typedef typename InputImageType::RegionType InputImageRegionType;
76 typedef typename InputImageType::PixelType InputImagePixelType;
78 typedef typename Superclass::IndexType IndexType;
79 typedef typename Superclass::PointType PointType;
80 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
82 typedef typename OutputType::VertexType VertexType;
84 typedef float RealType;
85 typedef Image<RealType,
86 itkGetStaticConstMacro( ImageDimension )> RealImageType;
87 typedef GradientImageFilter<InputImageType, RealType,
88 RealType> GradientFilterType;
89 typedef typename GradientFilterType::OutputImageType GradientImageType;
90 typedef Image<
typename InputImageType::OffsetType,
91 itkGetStaticConstMacro( ImageDimension )> OffsetImageType;
93 itkGetStaticConstMacro( ImageDimension )> MaskImageType;
94 typedef typename MaskImageType::PixelType MaskPixelType;
100 typedef MinPriorityQueueElementWrapper
102 typedef PriorityQueueContainer<
103 PriorityQueueElementType,
104 PriorityQueueElementType,
105 RealType,
long> PriorityQueueType;
112 virtual void SetInputImage(
const InputImageType * ptr );
115 virtual typename OutputType::Pointer
Evaluate(
const PointType &point )
const
118 this->ConvertPointToNearestIndex( point, index );
119 return this->EvaluateAtIndex( index );
124 virtual typename OutputType::Pointer
128 this->ConvertContinuousIndexToNearestIndex( cindex, index );
129 return this->EvaluateAtIndex( index );
134 virtual typename OutputType::Pointer
135 EvaluateAtIndex(
const IndexType &index )
const;
137 itkSetClampMacro( GradientMagnitudeWeight, RealType,
138 0, NumericTraits<RealType>::max() );
139 itkGetConstMacro( GradientMagnitudeWeight, RealType );
141 itkSetClampMacro( GradientDirectionWeight, RealType,
142 0, NumericTraits<RealType>::max() );
143 itkGetConstMacro( GradientDirectionWeight, RealType );
145 itkSetClampMacro( ZeroCrossingWeight, RealType, 0,
146 NumericTraits<RealType>::max() );
147 itkGetConstMacro( ZeroCrossingWeight, RealType );
149 itkSetMacro( ZeroCrossingImage,
typename RealImageType::Pointer );
150 itkGetConstMacro( ZeroCrossingImage,
typename RealImageType::Pointer );
152 itkSetMacro( MaskImage,
typename MaskImageType::Pointer );
153 itkGetConstMacro( MaskImage,
typename MaskImageType::Pointer );
155 itkSetMacro( InsidePixelValue, MaskPixelType );
156 itkGetConstMacro( InsidePixelValue, MaskPixelType );
158 virtual void SetAnchorSeed( IndexType index )
160 itkDebugMacro(
"setting AnchorSeed to " << index );
161 if ( this->m_AnchorSeed != index )
163 this->m_AnchorSeed = index;
164 if ( this->GetInputImage() !=
nullptr )
166 this->GeneratePathDirectionImage();
171 itkGetConstMacro( AnchorSeed, IndexType );
173 itkSetMacro( UseFaceConnectedness,
bool );
174 itkGetConstMacro( UseFaceConnectedness,
bool );
175 itkBooleanMacro( UseFaceConnectedness );
177 itkSetMacro( UseImageSpacing,
bool );
178 itkGetConstMacro( UseImageSpacing,
bool );
179 itkBooleanMacro( UseImageSpacing );
183 LiveWireImageFunction();
184 virtual ~LiveWireImageFunction();
185 void PrintSelf(std::ostream& os, Indent indent)
const;
188 LiveWireImageFunction(
const Self&);
189 void operator=(
const Self&);
191 void GeneratePathDirectionImage();
193 RealType m_GradientMagnitudeWeight;
194 RealType m_ZeroCrossingWeight;
195 RealType m_GradientDirectionWeight;
197 typename GradientImageType::Pointer m_GradientImage;
198 typename RealImageType::Pointer m_GradientMagnitudeImage;
199 typename RealImageType::Pointer m_RescaledGradientMagnitudeImage;
200 typename RealImageType::Pointer m_ZeroCrossingImage;
202 typename OffsetImageType::Pointer m_PathDirectionImage;
204 typename MaskImageType::Pointer m_MaskImage;
205 MaskPixelType m_InsidePixelValue;
207 IndexType m_AnchorSeed;
209 bool m_UseFaceConnectedness;
210 bool m_UseImageSpacing;
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkLiveWireImageFunction.hxx"
MinPriorityQueueElementWrapper< IndexType, RealType > PriorityQueueElementType
Definition: itkLiveWireImageFunction.h:101
Implements livewire image segmentation of Barret and Mortensen.
Definition: itkLiveWireImageFunction.h:46
TInputImage InputImageType
Definition: itkLiveWireImageFunction.h:72
Definition: itkNormalizeImageFilterWithMask.h:48
LiveWireImageFunction Self
Definition: itkLiveWireImageFunction.h:56
virtual OutputType::Pointer Evaluate(const PointType &point) const
Definition: itkLiveWireImageFunction.h:115
virtual OutputType::Pointer EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const
Definition: itkLiveWireImageFunction.h:125