-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADD: Addition of point to surface metric to elastix. #236
Open
gokhangg
wants to merge
1
commit into
SuperElastix:main
Choose a base branch
from
gokhangg:develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -33,7 +33,6 @@ | |
|
||
# Generated files and | ||
help/ | ||
cmake* | ||
Makefile | ||
CMakeFiles/ | ||
CTestTestfile.cmake | ||
|
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,8 @@ | ||
|
||
ADD_ELXCOMPONENT( PointToSurfaceDistanceMetric ON | ||
elxPointToSurfaceDistanceMetric.h | ||
elxPointToSurfaceDistanceMetric.hxx | ||
elxPointToSurfaceDistanceMetric.cxx | ||
itkPointToSurfaceDistanceMetric.h | ||
itkPointToSurfaceDistanceMetric.hxx ) | ||
|
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
/*========================================================================= | ||
* | ||
* Copyright UMC Utrecht and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*=========================================================================*/ | ||
|
||
#include "elxPointToSurfaceDistanceMetric.h" | ||
|
||
elxInstallMacro( PointToSurfaceDistanceMetric ); |
169 changes: 169 additions & 0 deletions
169
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,169 @@ | ||
/*========================================================================= | ||
* | ||
* Copyright UMC Utrecht and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*=========================================================================*/ | ||
#ifndef __elxPointToSurfaceDistanceMetric_H__ | ||
#define __elxPointToSurfaceDistanceMetric_H__ | ||
|
||
#include "elxIncludes.h" // include first to avoid MSVS warning | ||
#include "itkPointToSurfaceDistanceMetric.h" | ||
|
||
namespace elastix | ||
{ | ||
|
||
/** | ||
* | ||
* 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; | ||
|
||
/** 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 >; | ||
|
||
ITK_DISALLOW_COPY_AND_ASSIGN(PointToSurfaceDistanceMetric); | ||
/** 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(); | ||
|
||
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() = default; | ||
/** The destructor. */ | ||
virtual ~PointToSurfaceDistanceMetric() = default; | ||
|
||
}; | ||
|
||
|
||
|
||
} // end namespace elastix | ||
|
||
#ifndef ITK_MANUAL_INSTANTIATION | ||
#include "elxPointToSurfaceDistanceMetric.hxx" | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Minor nitpick) In elastix, as well as in ITK, we no longer have those
__
underscores at the begin and the end of include guard macro names. See #339 Of course, we can remove them from your header files later, no problem.