|
| 1 | +/*====================================================================== |
| 2 | +
|
| 3 | + This file is part of the elastix software. |
| 4 | +
|
| 5 | + Copyright (c) University Medical Center Utrecht. All rights reserved. |
| 6 | + See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for |
| 7 | + details. |
| 8 | +
|
| 9 | + This software is distributed WITHOUT ANY WARRANTY; without even |
| 10 | + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 11 | + PURPOSE. See the above copyright notices for more information. |
| 12 | +
|
| 13 | +======================================================================*/ |
| 14 | +#ifndef __elxPointToSurfaceDistanceMetric_H__ |
| 15 | +#define __elxPointToSurfaceDistanceMetric_H__ |
| 16 | + |
| 17 | +#include "elxIncludes.h" // include first to avoid MSVS warning |
| 18 | +#include "itkPointToSurfaceDistanceMetric.h" |
| 19 | + |
| 20 | +namespace elastix |
| 21 | +{ |
| 22 | + |
| 23 | +/** |
| 24 | + * \class TransformRigidityPenalty |
| 25 | + * \brief A penalty term based on non-rigidity. |
| 26 | + * |
| 27 | + * For more information check the paper:\n |
| 28 | + * Gunay, G. , Luu, M. H., Moelker, A. , Walsum, T. and Klein, S. (2017), |
| 29 | + * "Semiautomated registration of pre‐ and intraoperative CT for image‐guided percutaneous |
| 30 | + * liver tumor ablation interventions," Med. Phys., 44: 3718-3725. |
| 31 | + * |
| 32 | + * The parameters used in this class are:\n |
| 33 | + * \parameter Metric: Select this metric as follows: |
| 34 | + * </tt>(Metric "PointToSurfaceDistance")</tt> |
| 35 | + * |
| 36 | + * \parameter PointToSurfaceDistanceAverage: A parameter to get average of the points by dividing the weight of the penalty with the number of the points included. |
| 37 | + * example: </tt>(PointToSurfaceDistanceAverage "true")</tt> \n |
| 38 | + * Default is "true". |
| 39 | + * |
| 40 | + * \Command line parameters |
| 41 | + * \parameter -fp "file" : Elastix pointset file. |
| 42 | + * example: |
| 43 | +
|
| 44 | + * \parameter -dt "file" : Distance transform (file) of segmentation of the organ under interest in the moving image. |
| 45 | + * \parameter -seg "file" : Segmentation (file) of the organ under interest in the moving image. With this parameter the algorithm internally computes the distance transform. |
| 46 | + * \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 . |
| 47 | + * |
| 48 | + * |
| 49 | + * \ingroup Metrics |
| 50 | + * |
| 51 | + */ |
| 52 | + |
| 53 | +template< class TElastix > |
| 54 | +class PointToSurfaceDistanceMetric : |
| 55 | + public |
| 56 | + itk::PointToSurfaceDistanceMetric < |
| 57 | + typename MetricBase< TElastix >::FixedPointSetType, |
| 58 | + typename MetricBase< TElastix >::MovingPointSetType >, |
| 59 | + public MetricBase< TElastix > |
| 60 | +{ |
| 61 | +public: |
| 62 | + |
| 63 | + using Self = PointToSurfaceDistanceMetric; |
| 64 | + /** The private constructor. */ |
| 65 | + PointToSurfaceDistanceMetric(const Self &) = delete; |
| 66 | + /** The private copy constructor. */ |
| 67 | + void operator=(const Self &) = delete; |
| 68 | + |
| 69 | + /** Standard ITK-stuff. */ |
| 70 | + using Superclass1 = itk::PointToSurfaceDistanceMetric<typename MetricBase< TElastix >::FixedPointSetType, typename MetricBase< TElastix >::MovingPointSetType >; |
| 71 | + using Superclass2 = MetricBase< TElastix >; |
| 72 | + using Pointer = itk::SmartPointer< Self >; |
| 73 | + using ConstPointer = itk::SmartPointer< const Self >; |
| 74 | + |
| 75 | + /** Method for creation through the object factory. */ |
| 76 | + itkNewMacro( Self ); |
| 77 | + |
| 78 | + /** Run-time type information (and related methods). */ |
| 79 | + itkTypeMacro( PointToSurfaceDistanceMetric, itk::PointToSurfaceDistanceMetric ); |
| 80 | + |
| 81 | + /** Name of this class. |
| 82 | + * Use this name in the parameter file to select this specific metric. \n |
| 83 | + * example: <tt>(Metric "PointToSurfaceDistance")</tt>\n |
| 84 | + */ |
| 85 | + elxClassNameMacro( "PointToSurfaceDistance" ); |
| 86 | + |
| 87 | + /** Typedefs from the superclass. */ |
| 88 | + using CoordinateRepresentationType = typename Superclass1::CoordinateRepresentationType; |
| 89 | + using FixedPointSetType = typename Superclass1::FixedPointSetType; |
| 90 | + using FixedPointSetConstPointer = typename Superclass1::FixedPointSetConstPointer; |
| 91 | + using MovingPointSetType = typename Superclass1::MovingPointSetType; |
| 92 | + using MovingPointSetConstPointer = typename Superclass1::MovingPointSetConstPointer; |
| 93 | + using TransformType = typename Superclass1::TransformType; |
| 94 | + using TransformPointer = typename Superclass1::TransformPointer; |
| 95 | + using InputPointType = typename Superclass1::InputPointType; |
| 96 | + using OutputPointType = typename Superclass1::OutputPointType; |
| 97 | + using TransformParametersType = typename Superclass1::TransformParametersType; |
| 98 | + using TransformJacobianType = typename Superclass1::TransformJacobianType; |
| 99 | + using FixedImageMaskType = typename Superclass1::FixedImageMaskType; |
| 100 | + using FixedImageMaskPointer = typename Superclass1::FixedImageMaskPointer; |
| 101 | + using MovingImageMaskType = typename Superclass1::MovingImageMaskType; |
| 102 | + using MovingImageMaskPointer = typename Superclass1::MovingImageMaskPointer; |
| 103 | + using MeasureType = typename Superclass1::MeasureType; |
| 104 | + using DerivativeType = typename Superclass1::DerivativeType; |
| 105 | + using ParametersType = typename Superclass1::ParametersType; |
| 106 | + |
| 107 | + /** Typedefs inherited from elastix. */ |
| 108 | + using ElastixType = typename Superclass2::ElastixType; |
| 109 | + using ElastixPointer = typename Superclass2::ElastixPointer; |
| 110 | + using ConfigurationType = typename Superclass2::ConfigurationType; |
| 111 | + using ConfigurationPointer = typename Superclass2::ConfigurationPointer; |
| 112 | + using RegistrationType = typename Superclass2::RegistrationType; |
| 113 | + using RegistrationPointer = typename Superclass2::RegistrationPointer; |
| 114 | + using ITKBaseType = typename Superclass2::ITKBaseType; |
| 115 | + using FixedImageType = typename Superclass2::FixedImageType; |
| 116 | + using MovingImageType = typename Superclass2::MovingImageType; |
| 117 | + |
| 118 | + /** The fixed image dimension. */ |
| 119 | + itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension ); |
| 120 | + |
| 121 | + /** The moving image dimension. */ |
| 122 | + itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension ); |
| 123 | + |
| 124 | + using PointSetType = FixedPointSetType; |
| 125 | + using ImageType = typename Superclass1::ImageType; |
| 126 | + |
| 127 | + |
| 128 | + /** Sets up a timer to measure the initialisation time and |
| 129 | + * calls the Superclass' implementation. |
| 130 | + */ |
| 131 | + virtual void Initialize(); |
| 132 | + |
| 133 | + /** |
| 134 | + * Do some things before all: |
| 135 | + * \li Check and print the command line arguments fp and mp. |
| 136 | + * This should be done in BeforeAllBase and not BeforeAll. |
| 137 | + */ |
| 138 | + virtual int BeforeAllBase(); |
| 139 | + |
| 140 | + /** |
| 141 | + * Do some things before registration: |
| 142 | + * \li Load and set the pointsets. |
| 143 | + */ |
| 144 | + virtual void BeforeRegistration(); |
| 145 | + |
| 146 | +/** Function to read the corresponding points. */ |
| 147 | +/** Function to read the corresponding points. */ |
| 148 | + using ImageConstPointer = typename Superclass1::ImageType::ConstPointer; |
| 149 | + |
| 150 | + unsigned int ReadLandmarks( const std::string & landmarkFileName, typename PointSetType::Pointer & pointSet, typename FixedImageType::ConstPointer image ); |
| 151 | + |
| 152 | + /** Overwrite to silence warning. */ |
| 153 | + virtual void SelectNewSamples( void ){} |
| 154 | + |
| 155 | +protected: |
| 156 | + |
| 157 | + /** The constructor. */ |
| 158 | + PointToSurfaceDistanceMetric(){} |
| 159 | + /** The destructor. */ |
| 160 | + virtual ~PointToSurfaceDistanceMetric() {} |
| 161 | + |
| 162 | +}; |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | +} // end namespace elastix |
| 167 | + |
| 168 | +#ifndef ITK_MANUAL_INSTANTIATION |
| 169 | +#include "elxPointToSurfaceDistanceMetric.hxx" |
| 170 | +#endif |
| 171 | + |
| 172 | +#endif |
0 commit comments