-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
865 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
Components/Metrics/PointToSurfaceDistance/elxPointToSurfaceDistanceMetric.cxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/*====================================================================== | ||
This file is part of the elastix software. | ||
Copyright (c) University Medical Center Utrecht. All rights reserved. | ||
See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php 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. | ||
======================================================================*/ | ||
|
||
#include "elxPointToSurfaceDistanceMetric.h" | ||
|
||
elxInstallMacro( PointToSurfaceDistanceMetric ); |
172 changes: 172 additions & 0 deletions
172
Components/Metrics/PointToSurfaceDistance/elxPointToSurfaceDistanceMetric.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
/*====================================================================== | ||
This file is part of the elastix software. | ||
Copyright (c) University Medical Center Utrecht. All rights reserved. | ||
See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php 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 __elxPointToSurfaceDistanceMetric_H__ | ||
#define __elxPointToSurfaceDistanceMetric_H__ | ||
|
||
#include "elxIncludes.h" // include first to avoid MSVS warning | ||
#include "itkPointToSurfaceDistanceMetric.h" | ||
|
||
namespace elastix | ||
{ | ||
|
||
/** | ||
* \class TransformRigidityPenalty | ||
* \brief A penalty term based on non-rigidity. | ||
* | ||
* For more information check the paper:\n | ||
* Gunay, G. , Luu, M. H., Moelker, A. , Walsum, T. and Klein, S. (2017), | ||
* "Semiautomated registration of pre‐ and intraoperative CT for image‐guided percutaneous | ||
* liver tumor ablation interventions," Med. Phys., 44: 3718-3725. | ||
* | ||
* The parameters used in this class are:\n | ||
* \parameter Metric: Select this metric as follows: | ||
* </tt>(Metric "PointToSurfaceDistance")</tt> | ||
* | ||
* \parameter PointToSurfaceDistanceAverage: A parameter to get average of the points by dividing the weight of the penalty with the number of the points included. | ||
* example: </tt>(PointToSurfaceDistanceAverage "true")</tt> \n | ||
* Default is "true". | ||
* | ||
* \Command line parameters | ||
* \parameter -fp "file" : Elastix pointset file. | ||
* example: | ||
* \parameter -dt "file" : Distance transform (file) of segmentation of the organ under interest in the moving image. | ||
* \parameter -seg "file" : Segmentation (file) of the organ under interest in the moving image. With this parameter the algorithm internally computes the distance transform. | ||
* \parameter -dtout "file" : If the user wants to get the distance transform from organ segmentation, this parameter is called with the name of the distance transform image file to write . | ||
* | ||
* | ||
* \ingroup Metrics | ||
* | ||
*/ | ||
|
||
template< class TElastix > | ||
class PointToSurfaceDistanceMetric : | ||
public | ||
itk::PointToSurfaceDistanceMetric < | ||
typename MetricBase< TElastix >::FixedPointSetType, | ||
typename MetricBase< TElastix >::MovingPointSetType >, | ||
public MetricBase< TElastix > | ||
{ | ||
public: | ||
|
||
using Self = PointToSurfaceDistanceMetric; | ||
/** The private constructor. */ | ||
PointToSurfaceDistanceMetric(const Self &) = delete; | ||
/** The private copy constructor. */ | ||
void operator=(const Self &) = delete; | ||
|
||
/** Standard ITK-stuff. */ | ||
using Superclass1 = itk::PointToSurfaceDistanceMetric<typename MetricBase< TElastix >::FixedPointSetType, typename MetricBase< TElastix >::MovingPointSetType >; | ||
using Superclass2 = MetricBase< TElastix >; | ||
using Pointer = itk::SmartPointer< Self >; | ||
using ConstPointer = itk::SmartPointer< const Self >; | ||
|
||
/** Method for creation through the object factory. */ | ||
itkNewMacro( Self ); | ||
|
||
/** Run-time type information (and related methods). */ | ||
itkTypeMacro( PointToSurfaceDistanceMetric, itk::PointToSurfaceDistanceMetric ); | ||
|
||
/** Name of this class. | ||
* Use this name in the parameter file to select this specific metric. \n | ||
* example: <tt>(Metric "PointToSurfaceDistance")</tt>\n | ||
*/ | ||
elxClassNameMacro( "PointToSurfaceDistance" ); | ||
|
||
/** Typedefs from the superclass. */ | ||
using CoordinateRepresentationType = typename Superclass1::CoordinateRepresentationType; | ||
using FixedPointSetType = typename Superclass1::FixedPointSetType; | ||
using FixedPointSetConstPointer = typename Superclass1::FixedPointSetConstPointer; | ||
using MovingPointSetType = typename Superclass1::MovingPointSetType; | ||
using MovingPointSetConstPointer = typename Superclass1::MovingPointSetConstPointer; | ||
using TransformType = typename Superclass1::TransformType; | ||
using TransformPointer = typename Superclass1::TransformPointer; | ||
using InputPointType = typename Superclass1::InputPointType; | ||
using OutputPointType = typename Superclass1::OutputPointType; | ||
using TransformParametersType = typename Superclass1::TransformParametersType; | ||
using TransformJacobianType = typename Superclass1::TransformJacobianType; | ||
using FixedImageMaskType = typename Superclass1::FixedImageMaskType; | ||
using FixedImageMaskPointer = typename Superclass1::FixedImageMaskPointer; | ||
using MovingImageMaskType = typename Superclass1::MovingImageMaskType; | ||
using MovingImageMaskPointer = typename Superclass1::MovingImageMaskPointer; | ||
using MeasureType = typename Superclass1::MeasureType; | ||
using DerivativeType = typename Superclass1::DerivativeType; | ||
using ParametersType = typename Superclass1::ParametersType; | ||
|
||
/** Typedefs inherited from elastix. */ | ||
using ElastixType = typename Superclass2::ElastixType; | ||
using ElastixPointer = typename Superclass2::ElastixPointer; | ||
using ConfigurationType = typename Superclass2::ConfigurationType; | ||
using ConfigurationPointer = typename Superclass2::ConfigurationPointer; | ||
using RegistrationType = typename Superclass2::RegistrationType; | ||
using RegistrationPointer = typename Superclass2::RegistrationPointer; | ||
using ITKBaseType = typename Superclass2::ITKBaseType; | ||
using FixedImageType = typename Superclass2::FixedImageType; | ||
using MovingImageType = typename Superclass2::MovingImageType; | ||
|
||
/** The fixed image dimension. */ | ||
itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension ); | ||
|
||
/** The moving image dimension. */ | ||
itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension ); | ||
|
||
using PointSetType = FixedPointSetType; | ||
using ImageType = typename Superclass1::ImageType; | ||
|
||
|
||
/** Sets up a timer to measure the initialisation time and | ||
* calls the Superclass' implementation. | ||
*/ | ||
virtual void Initialize(); | ||
|
||
/** | ||
* Do some things before all: | ||
* \li Check and print the command line arguments fp and mp. | ||
* This should be done in BeforeAllBase and not BeforeAll. | ||
*/ | ||
virtual int BeforeAllBase(); | ||
|
||
/** | ||
* Do some things before registration: | ||
* \li Load and set the pointsets. | ||
*/ | ||
virtual void BeforeRegistration(); | ||
|
||
/** Function to read the corresponding points. */ | ||
/** Function to read the corresponding points. */ | ||
using ImageConstPointer = typename Superclass1::ImageType::ConstPointer; | ||
|
||
unsigned int ReadLandmarks( const std::string & landmarkFileName, typename PointSetType::Pointer & pointSet, typename FixedImageType::ConstPointer image ); | ||
|
||
/** Overwrite to silence warning. */ | ||
virtual void SelectNewSamples( void ){} | ||
|
||
protected: | ||
|
||
/** The constructor. */ | ||
PointToSurfaceDistanceMetric(){} | ||
/** The destructor. */ | ||
virtual ~PointToSurfaceDistanceMetric() {} | ||
|
||
}; | ||
|
||
|
||
|
||
} // end namespace elastix | ||
|
||
#ifndef ITK_MANUAL_INSTANTIATION | ||
#include "elxPointToSurfaceDistanceMetric.hxx" | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.