Skip to content

Commit 163a13b

Browse files
gokhangggokhangunay01
authored andcommitted
ADD: Addition of point to surface metric to Elastix.
In this commit addition of point to surface metric is done. This metric essentially considers how surface of an masked organ is aligned with the points provided from the surface of the organ. Therefore, it is used to improve alignment of the organ under interest.
1 parent 8fecccd commit 163a13b

File tree

5 files changed

+127
-114
lines changed

5 files changed

+127
-114
lines changed

Components/Metrics/PointToSurfaceDistance/elxPointToSurfaceDistanceMetric.cxx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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-
======================================================================*/
1+
/*=========================================================================
2+
*
3+
* Copyright UMC Utrecht and contributors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0.txt
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*=========================================================================*/
1418

1519
#include "elxPointToSurfaceDistanceMetric.h"
1620

Components/Metrics/PointToSurfaceDistance/elxPointToSurfaceDistanceMetric.h

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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-
======================================================================*/
1+
/*=========================================================================
2+
*
3+
* Copyright UMC Utrecht and contributors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0.txt
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*=========================================================================*/
1418
#ifndef __elxPointToSurfaceDistanceMetric_H__
1519
#define __elxPointToSurfaceDistanceMetric_H__
1620

@@ -21,8 +25,6 @@ namespace elastix
2125
{
2226

2327
/**
24-
* \class TransformRigidityPenalty
25-
* \brief A penalty term based on non-rigidity.
2628
*
2729
* For more information check the paper:\n
2830
* Gunay, G. , Luu, M. H., Moelker, A. , Walsum, T. and Klein, S. (2017),
@@ -61,17 +63,14 @@ class PointToSurfaceDistanceMetric :
6163
public:
6264

6365
using Self = PointToSurfaceDistanceMetric;
64-
/** The private constructor. */
65-
PointToSurfaceDistanceMetric(const Self &) = delete;
66-
/** The private copy constructor. */
67-
void operator=(const Self &) = delete;
6866

6967
/** Standard ITK-stuff. */
7068
using Superclass1 = itk::PointToSurfaceDistanceMetric<typename MetricBase< TElastix >::FixedPointSetType, typename MetricBase< TElastix >::MovingPointSetType >;
7169
using Superclass2 = MetricBase< TElastix >;
7270
using Pointer = itk::SmartPointer< Self >;
7371
using ConstPointer = itk::SmartPointer< const Self >;
7472

73+
ITK_DISALLOW_COPY_AND_ASSIGN(PointToSurfaceDistanceMetric);
7574
/** Method for creation through the object factory. */
7675
itkNewMacro( Self );
7776

@@ -143,8 +142,6 @@ class PointToSurfaceDistanceMetric :
143142
*/
144143
virtual void BeforeRegistration();
145144

146-
/** Function to read the corresponding points. */
147-
/** Function to read the corresponding points. */
148145
using ImageConstPointer = typename Superclass1::ImageType::ConstPointer;
149146

150147
unsigned int ReadLandmarks( const std::string & landmarkFileName, typename PointSetType::Pointer & pointSet, typename FixedImageType::ConstPointer image );
@@ -155,9 +152,9 @@ class PointToSurfaceDistanceMetric :
155152
protected:
156153

157154
/** The constructor. */
158-
PointToSurfaceDistanceMetric(){}
155+
PointToSurfaceDistanceMetric() = default;
159156
/** The destructor. */
160-
virtual ~PointToSurfaceDistanceMetric() {}
157+
virtual ~PointToSurfaceDistanceMetric() = default;
161158

162159
};
163160

Components/Metrics/PointToSurfaceDistance/elxPointToSurfaceDistanceMetric.hxx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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-
======================================================================*/
1+
/*=========================================================================
2+
*
3+
* Copyright UMC Utrecht and contributors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0.txt
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*=========================================================================*/
1418

1519
#ifndef __elxPointToSurfaceDistanceMetric_HXX__
1620
#define __elxPointToSurfaceDistanceMetric_HXX__
@@ -57,15 +61,15 @@ PointToSurfaceDistanceMetric< TElastix >
5761

5862
/** Check for appearance of parameter "PointToSurfaceDistanceAverage". */
5963
std::string PointToSurfaceDistanceAverageStr = "true";
60-
this->m_AvPointWeigh=true;
61-
if (this->m_Configuration->CountNumberOfParameterEntries( "PointToSurfaceDistanceAverage" )==1)
64+
this->m_AvPointWeigh = true;
65+
if (this->m_Configuration->CountNumberOfParameterEntries( "PointToSurfaceDistanceAverage" ) == 1)
6266
{
6367
this->m_Configuration->ReadParameter( PointToSurfaceDistanceAverageStr, "PointToSurfaceDistanceAverage", 0 );
64-
if (PointToSurfaceDistanceAverageStr=="false") this->m_AvPointWeigh=false;
68+
if (PointToSurfaceDistanceAverageStr == "false") this->m_AvPointWeigh = false;
6569
}
6670

6771
elxout << "\nAverage of points in annotation set : "
68-
<< PointToSurfaceDistanceAverageStr<<"\n"
72+
<< PointToSurfaceDistanceAverageStr <<"\n"
6973
<< std::endl;
7074

7175
/** Check for appearance of "-fp". */

Components/Metrics/PointToSurfaceDistance/itkPointToSurfaceDistanceMetric.h

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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-
======================================================================*/
1+
/*=========================================================================
2+
*
3+
* Copyright UMC Utrecht and contributors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0.txt
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*=========================================================================*/
1418
#ifndef __itkPointToSurfaceDistanceMetric_h
1519
#define __itkPointToSurfaceDistanceMetric_h
1620

@@ -79,16 +83,16 @@ class PointToSurfaceDistanceMetric :
7983
/** Run-time type information (and related methods). */
8084
itkTypeMacro( PointToSurfaceDistanceMetric, SingleValuedPointSetToPointSetMetric );//OK
8185
/** Initialize. */
82-
virtual void Initialize() noexcept(false);
86+
virtual void Initialize();
8387

8488
/** Get the value for single valued optimizers. */
85-
MeasureType GetValue( const TransformParametersType & parameters ) const noexcept(false);
89+
MeasureType GetValue( const TransformParametersType & parameters ) const;
8690

8791
/** Get the derivatives of the match measure. */
88-
void GetDerivative( const TransformParametersType & parameters, DerivativeType & Derivative ) const noexcept(false);
92+
void GetDerivative( const TransformParametersType & parameters, DerivativeType & Derivative ) const;
8993

9094
/** Get value and derivatives for multiple valued optimizers. */
91-
void GetValueAndDerivative( const TransformParametersType & parameters, MeasureType & Value, DerivativeType & Derivative ) const noexcept(false);
95+
void GetValueAndDerivative( const TransformParametersType & parameters, MeasureType & Value, DerivativeType & Derivative ) const;
9296

9397
/** Set input Segmented Image File **/
9498
void SetSegImageIn( const std::string str ) ;
@@ -105,15 +109,15 @@ class PointToSurfaceDistanceMetric :
105109
protected:
106110

107111
PointToSurfaceDistanceMetric();
108-
virtual ~PointToSurfaceDistanceMetric() {}
109-
bool m_AvPointWeigh;
112+
virtual ~PointToSurfaceDistanceMetric() = default;
113+
bool m_AvPointWeigh{true};
110114

111115
private:
112116

113117
PointToSurfaceDistanceMetric( const Self & );
114-
std::string m_SegFileIn,m_DTFileIn,m_DTFileOut;
115-
typename ImageType::Pointer m_ADTimage;
116-
typename InterpolatorType::Pointer m_interpolator;
118+
std::string m_segmentationFileIn, m_distanceTransformFileIn, m_distanceTransformFileOut;
119+
typename ImageType::Pointer m_internalDistanceTransformImage;
120+
typename InterpolatorType::Pointer m_interpolator;
117121

118122
};
119123

0 commit comments

Comments
 (0)