Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
SuperElastix
Commits
fc3a4525
Commit
fc3a4525
authored
Jul 28, 2016
by
Floris Berendsen
Browse files
ENH: added NumberOfIterations component setting and shortened some tests
by using 1 iteration (instead of default 100)
parent
aa848e3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Modules/Components/itkImageRegistrationMethodv4/include/selxItkGradientDescentOptimizerv4.hxx
View file @
fc3a4525
...
...
@@ -61,6 +61,28 @@ ItkGradientDescentOptimizerv4Component< InternalComputationValueType>
}
}
}
else
if
(
criterion
.
first
==
"NumberOfIterations"
)
//Supports this?
{
if
(
criterion
.
second
.
size
()
!=
1
)
{
meetsCriteria
=
false
;
//itkExceptionMacro("The criterion Sigma may have only 1 value");
}
else
{
auto
const
&
criterionValue
=
*
criterion
.
second
.
begin
();
try
{
this
->
m_Optimizer
->
SetNumberOfIterations
(
std
::
stoi
(
criterionValue
));
meetsCriteria
=
true
;
}
catch
(
itk
::
ExceptionObject
&
err
)
{
//TODO log the error message?
meetsCriteria
=
false
;
}
}
}
return
meetsCriteria
;
}
...
...
Modules/Components/itkImageRegistrationMethodv4/test/selxRegistrationItkv4Test.cxx
View file @
fc3a4525
...
...
@@ -220,6 +220,7 @@ TEST_F(RegistrationItkv4Test, WithANTSCCMetric)
ParameterMapType
component5Parameters
;
component5Parameters
[
"NameOfClass"
]
=
{
"ItkGradientDescentOptimizerv4Component"
};
component5Parameters
[
"NumberOfIterations"
]
=
{
"1"
};
blueprint
->
AddComponent
(
"Optimizer"
,
component5Parameters
);
ParameterMapType
connection1Parameters
;
...
...
@@ -303,6 +304,10 @@ TEST_F(RegistrationItkv4Test, WithMeanSquaresMetric)
component4Parameters
[
"Dimensionality"
]
=
{
"3"
};
// should be derived from the inputs
blueprint
->
AddComponent
(
"Metric"
,
component4Parameters
);
ParameterMapType
component5Parameters
;
component5Parameters
[
"NameOfClass"
]
=
{
"ItkGradientDescentOptimizerv4Component"
};
component5Parameters
[
"NumberOfIterations"
]
=
{
"1"
};
blueprint
->
AddComponent
(
"Optimizer"
,
component5Parameters
);
ParameterMapType
connection1Parameters
;
connection1Parameters
[
"NameOfInterface"
]
=
{
"itkImageFixedInterface"
};
...
...
@@ -320,6 +325,10 @@ TEST_F(RegistrationItkv4Test, WithMeanSquaresMetric)
connection4Parameters
[
"NameOfInterface"
]
=
{
"itkMetricv4Interface"
};
blueprint
->
AddConnection
(
"Metric"
,
"RegistrationMethod"
,
connection4Parameters
);
ParameterMapType
connection5Parameters
;
connection5Parameters
[
"NameOfInterface"
]
=
{
"itkOptimizerv4Interface"
};
blueprint
->
AddConnection
(
"Optimizer"
,
"RegistrationMethod"
,
connection5Parameters
);
// Instantiate SuperElastix
SuperElastixFilterType
::
Pointer
superElastixFilter
;
EXPECT_NO_THROW
(
superElastixFilter
=
SuperElastixFilterType
::
New
());
...
...
@@ -392,6 +401,11 @@ TEST_F(RegistrationItkv4Test, DisplacementField)
component6Parameters
[
"Dimensionality"
]
=
{
"3"
};
// should be derived from the outputs
blueprint
->
AddComponent
(
"TransformDisplacementFilter"
,
component6Parameters
);
ParameterMapType
component7Parameters
;
component7Parameters
[
"NameOfClass"
]
=
{
"ItkGradientDescentOptimizerv4Component"
};
component7Parameters
[
"NumberOfIterations"
]
=
{
"1"
};
blueprint
->
AddComponent
(
"Optimizer"
,
component7Parameters
);
ParameterMapType
connection1Parameters
;
connection1Parameters
[
"NameOfInterface"
]
=
{
"itkImageFixedInterface"
};
blueprint
->
AddConnection
(
"FixedImageSource"
,
"RegistrationMethod"
,
connection1Parameters
);
...
...
@@ -414,6 +428,7 @@ TEST_F(RegistrationItkv4Test, DisplacementField)
blueprint
->
AddConnection
(
"RegistrationMethod"
,
"TransformDisplacementFilter"
,
{
{}
});
blueprint
->
AddConnection
(
"FixedImageSource"
,
"TransformDisplacementFilter"
,
{
{}
});
blueprint
->
AddConnection
(
"Optimizer"
,
"RegistrationMethod"
,
{
{}
});
// Instantiate SuperElastix
SuperElastixFilterType
::
Pointer
superElastixFilter
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment