18#ifndef itkRegionBasedLevelSetFunction_h
19#define itkRegionBasedLevelSetFunction_h
23#include "vnl/vnl_matrix_fixed.h"
61template <
typename TInput,
75 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
101 m_MaxCurvatureChange = null_value;
102 m_MaxAdvectionChange = null_value;
103 m_MaxGlobalChange = null_value;
108 vnl_matrix_fixed<ScalarValueType, Self::ImageDimension, Self::ImageDimension>
m_dxy;
150 this->m_DomainFunction = f;
163 m_Center = it.
Size() / 2;
166 for (
unsigned int i = 0; i < ImageDimension; ++i)
172#if !defined(ITK_WRAPPING_PARSER)
176 this->m_SharedData = sharedDataIn;
204 virtual const FeatureImageType *
207 return m_FeatureImage.GetPointer();
215 for (
unsigned int i = 0; i < ImageDimension; ++i)
217 this->m_InvSpacing[i] = 1 / spacing[i];
225 return this->m_ZeroVectorConstant;
232 this->m_AreaWeight = nu;
237 return this->m_AreaWeight;
245 this->m_Lambda1 = lambda1;
250 return this->m_Lambda1;
258 this->m_Lambda2 = lambda2;
263 return this->m_Lambda2;
271 this->m_OverlapPenaltyWeight = gamma;
276 return this->m_OverlapPenaltyWeight;
284 m_CurvatureWeight = c;
289 return m_CurvatureWeight;
296 this->m_AdvectionWeight = iA;
301 return this->m_AdvectionWeight;
308 m_ReinitializationSmoothingWeight = c;
313 return m_ReinitializationSmoothingWeight;
321 this->m_VolumeMatchingWeight = tau;
326 return this->m_VolumeMatchingWeight;
334 this->m_Volume = volume;
339 return this->m_Volume;
347 this->m_FunctionId = iFid;
356 virtual ScalarValueType
369 virtual ScalarValueType
423 unsigned int m_FunctionId{};
425 std::slice x_slice[Self::ImageDimension];
428 double m_InvSpacing[Self::ImageDimension]{};
508#ifndef ITK_MANUAL_INSTANTIATION
509# include "itkRegionBasedLevelSetFunction.hxx"
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename ImageType::PixelType PixelType
typename ConstNeighborhoodIterator< TInput >::RadiusType RadiusType
Simulate a standard C array with copy semantics.
Base class of the Heaviside function.
Light weight base class for most itk classes.
void SetRadius(const SizeType &)
NeighborIndexType Size() const
OffsetValueType GetStride(DimensionValueType axis) const
LevelSet function that computes a speed image based on regional integrals.
void SetInitialImage(InputImageType *f)
void SetSharedData(SharedDataPointer sharedDataIn)
virtual void CalculateAdvectionImage()
typename InputImageType::SizeType InputSizeType
typename FeatureImageType::SpacingType FeatureSpacingType
virtual ScalarValueType ComputeInternalTerm(const FeaturePixelType &iValue, const FeatureIndexType &iIdx)=0
Compute the internal term.
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::PixelType InputPixelType
~RegionBasedLevelSetFunction() override=default
virtual void SetFeatureImage(const FeatureImageType *f)
void SetOverlapPenaltyWeight(const ScalarValueType &gamma)
RegionBasedLevelSetFunction()
typename InputImageType::RegionType InputRegionType
TSharedData SharedDataType
virtual ScalarValueType LaplacianSmoothingSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
Laplacian smoothing speed can be used to spatially modify the effects of laplacian smoothing of the l...
ScalarValueType ComputeVolumeRegularizationTerm()
Compute the overlap term.
TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override
typename InputImageType::Pointer InputImagePointer
typename FeatureImageType::PixelType FeaturePixelType
typename FeatureImageType::IndexType FeatureIndexType
typename InputImageType::SizeValueType InputSizeValueType
void ReleaseGlobalDataPointer(void *GlobalData) const override
typename SharedDataType::Pointer SharedDataPointer
ScalarValueType GetVolumeMatchingWeight() const
virtual const FeatureImageType * GetFeatureImage() const
ScalarValueType GetLambda1() const
ScalarValueType GetLambda2() const
ScalarValueType ComputeGlobalTerm(const ScalarValueType &imagePixel, const InputIndexType &inputIndex)
Compute the global term as a combination of the internal, external, overlapping and volume regulariza...
typename InputImageType::IndexType InputIndexType
virtual ScalarValueType ComputeExternalTerm(const FeaturePixelType &iValue, const FeatureIndexType &iIdx)=0
Compute the external term.
virtual ScalarValueType CurvatureSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
Curvature speed can be used to spatially modify the effects of curvature . The default implementation...
void SetLambda2(const ScalarValueType &lambda2)
void SetVolumeMatchingWeight(const ScalarValueType &tau)
typename FeatureImageType::ConstPointer FeatureImageConstPointer
ScalarValueType GetReinitializationSmoothingWeight() const
virtual VectorType AdvectionField(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &=FloatOffsetType(0.0)) override
void SetLambda1(const ScalarValueType &lambda1)
ScalarValueType GetCurvatureWeight() const
void SetFunctionId(const unsigned int iFid)
virtual ScalarValueType ComputeCurvature(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd)
void UpdateSharedData(bool forceUpdate)
ScalarValueType GetVolume() const
void * GetGlobalDataPointer() const override
ScalarValueType GetAdvectionWeight() const
ScalarValueType GetAreaWeight() const
void SetReinitializationSmoothingWeight(const ScalarValueType c)
void SetAdvectionWeight(const ScalarValueType &iA)
typename HeavisideFunctionType::ConstPointer HeavisideFunctionConstPointer
virtual void Initialize(const RadiusType &r)
typename InputImageType::IndexValueType InputIndexValueType
ScalarValueType GetOverlapPenaltyWeight() const
virtual void ComputeParameters()=0
Compute Parameters for the inner and outer parts.
PixelType ScalarValueType
void SetVolume(const ScalarValueType &volume)
void SetAreaWeight(const ScalarValueType &nu)
static VectorType InitializeZeroVectorConstant()
virtual void SetCurvatureWeight(const ScalarValueType c)
typename InputImageType::PointType InputPointType
static VectorType m_ZeroVectorConstant
virtual void UpdateSharedDataParameters()=0
Update and save the inner and outer parameters in the shared data structure.
void SetDomainFunction(const HeavisideFunctionType *f)
typename FeatureImageType::OffsetType FeatureOffsetType
TFeature FeatureImageType
virtual ScalarValueType ComputeOverlapParameters(const FeatureIndexType &featIndex, ScalarValueType &pr)=0
Compute the overlap term.
void ComputeHessian(const NeighborhoodType &it, GlobalDataStruct *globalData)
Compute Hessian Matrix.
ScalarValueType ComputeLaplacian(GlobalDataStruct *gd)
Compute the laplacian term.
A templated class holding a n-Dimensional vector.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
ImageBaseType::RegionType RegionType
ImageBaseType::IndexType IndexType
ImageBaseType::PointType PointType
ImageBaseType::SizeType SizeType
ImageBaseType::SpacingType VectorType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
vnl_matrix_fixed< ScalarValueType, Self::ImageDimension, Self::ImageDimension > m_dxy
ScalarValueType m_MaxCurvatureChange
ScalarValueType m_MaxGlobalChange
~GlobalDataStruct()=default
ScalarValueType m_MaxAdvectionChange
ScalarValueType m_GradMag
ScalarValueType m_GradMagSqr