19 #ifndef __itkFEMRegistrationFilter_h
20 #define __itkFEMRegistrationFilter_h
45 #include "vnl/vnl_vector.h"
46 #include "vnl/vnl_math.h"
47 #include "vnl/vnl_vector_fixed.h"
117 template <
class TMovingImage,
class TFixedImage,
class TFemObjectType>
140 itkStaticConstMacro(ImageDimension,
unsigned int,
141 FixedImageType::ImageDimension);
147 enum Sign { positive = 1, negative = -1 };
202 return m_MovingImage;
208 return m_OriginalMovingImage;
212 void SetFixedImage(FixedImageType* T);
224 void SetInputFEMObject(FEMObjectType* F,
unsigned int level = 0);
226 FEMObjectType * GetInputFEMObject(
unsigned int level = 0);
229 void RunRegistration(
void);
232 void IterativeSolve(SolverType *S);
235 void MultiResSolve();
238 void WarpImage(
const MovingImageType * R);
244 return m_WarpedImage;
248 void ComputeJacobian( );
271 void AddLandmark(PointType source, PointType target);
273 void InsertLandmark(
unsigned int i, PointType source, PointType target);
275 void DeleteLandmark(
unsigned int i);
277 void ClearLandmarks();
279 void GetLandmark(
unsigned int i, PointType& source, PointType& target);
288 void EnforceDiffeomorphism(
float thresh, SolverType *S,
bool onlywriteimages);
296 void SetMeshPixelsPerElementAtEachResolution(
unsigned int i,
unsigned int which = 0)
298 m_MeshPixelsPerElementAtEachResolution[which] = i;
305 void SetNumberOfIntegrationPoints(
unsigned int i,
unsigned int which = 0)
307 m_NumberOfIntegrationPoints[which] = i;
315 void SetWidthOfMetricRegion(
unsigned int i,
unsigned int which = 0)
317 m_MetricWidth[which] = i;
320 unsigned int GetWidthOfMetricRegion(
unsigned int which = 0)
322 return m_MetricWidth[which];
329 void SetMaximumIterations(
unsigned int i,
unsigned int which)
331 m_Maxiters[which] = i;
339 itkSetMacro(TimeStep, Float);
340 itkGetMacro(TimeStep, Float);
347 itkSetMacro(Alpha, Float);
348 itkGetMacro(Alpha, Float);
354 itkSetMacro(UseLandmarks,
bool);
355 itkGetMacro(UseLandmarks,
bool);
356 void SetUseLandmarksOff()
358 SetUseLandmarks(
false);
362 void SetUseLandmarksOn()
364 SetUseLandmarks(
true);
370 itkSetMacro(UseMassMatrix,
bool);
371 itkGetMacro(UseMassMatrix,
bool);
377 itkSetMacro(EnergyReductionFactor, Float);
378 itkGetMacro(EnergyReductionFactor, Float);
382 void SetElasticity(
Float i,
unsigned int which = 0)
388 Float GetElasticity(
unsigned int which = 0)
394 void SetRho(
Float r,
unsigned int which = 0)
400 void SetGamma(
Float r,
unsigned int which = 0)
406 void SetDescentDirectionMinimize()
408 m_DescentDirection = positive;
412 void SetDescentDirectionMaximize()
414 m_DescentDirection = negative;
421 itkSetMacro(DoLineSearchOnImageEnergy,
unsigned int);
422 itkGetMacro(DoLineSearchOnImageEnergy,
unsigned int);
430 itkSetMacro(UseNormalizedGradient,
bool);
431 itkGetMacro(UseNormalizedGradient,
bool);
432 void SetUseNormalizedGradientOff()
434 SetUseNormalizedGradient(
false);
438 void SetUseNormalizedGradientOn()
440 SetUseNormalizedGradient(
true);
446 itkSetMacro(EmployRegridding,
unsigned int);
447 itkGetMacro(EmployRegridding,
unsigned int);
454 itkSetMacro(LineSearchMaximumIterations,
unsigned int);
455 itkGetMacro(LineSearchMaximumIterations,
unsigned int);
463 return m_FullImageSize;
488 void ChooseMetric(
unsigned int whichmetric);
493 unsigned int GetMetricType()
495 return m_WhichMetric;
511 void PrintVectorField(
unsigned int modnum = 1000);
516 void SetMaxLevel(
unsigned int level);
517 itkGetMacro(MaxLevel,
unsigned int);
524 itkSetMacro(CreateMeshFromImage,
bool);
525 void SetCreateMeshFromImageOn()
527 SetCreateMeshFromImage(
true);
529 void SetCreateMeshFromImageOff()
531 SetCreateMeshFromImage(
false);
533 itkGetMacro(CreateMeshFromImage,
bool);
537 itkSetObjectMacro( Interpolator, InterpolatorType );
540 itkGetObjectMacro( Interpolator, InterpolatorType );
545 itkSetMacro(StandardDeviations, StandardDeviationsType);
546 virtual void SetStandardDeviations(
double value);
551 itkGetConstReferenceMacro(StandardDeviations, StandardDeviationsType);
555 itkSetMacro(MaximumKernelWidth,
unsigned int);
556 itkGetConstMacro(MaximumKernelWidth,
unsigned int);
561 itkSetMacro(MaximumError,
double);
562 itkGetConstMacro(MaximumError,
double);
572 void PrintSelf(std::ostream & os,
Indent indent)
const;
575 void CreateMesh(
unsigned int ElementsPerSide, SolverType *solver);
578 void ApplyLoads(ImageSizeType Isz,
double* spacing =
NULL);
581 void ApplyImageLoads(MovingImageType* i1, FixedImageType* i2);
586 void CreateLinearSystemSolver();
590 Float EvaluateEnergy();
596 void InterpolateVectorField(SolverType *S);
601 FloatImageType * GetMetricImage(FieldType* F);
604 FieldPointer ExpandVectorField(ExpandFactorsType* expandFactors, FieldType* f);
607 void SampleVectorFieldAtNodes(SolverType *S);
610 Float EvaluateResidual(SolverType *mySolver, Float t);
615 void FindBracketingTriplet(SolverType *mySolver, Float* a, Float* b, Float* c);
621 Float GoldenSection(SolverType *mySolver, Float tol = 0.01,
unsigned int MaxIters = 25);
624 itkGetConstObjectMacro(
Load, ImageMetricLoadType );
625 itkSetObjectMacro(
Load, ImageMetricLoadType );
629 void SmoothDisplacementField();
633 void InitializeField();
636 void operator=(
const Self &);
728 #ifndef ITK_MANUAL_INSTANTIATION
729 #include "itkFEMRegistrationFilter.hxx"