Skip to content
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

ENH: Add convenience transforms QuickRigid and SyNCC #21

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/itkANTSRegistration.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,13 @@ ANTSRegistration<TFixedImage, TMovingImage, TParametersValueType>::GenerateData(
{
SingleStageRegistration(xfrmMethod, initialTransform, fixedImage, movingImage, true);
}
else if (whichTransform == "quickrigid")
{
auto originalIterations = m_AffineIterations;
m_AffineIterations = { 20, 20, 0, 0 };
SingleStageRegistration(RegistrationHelperType::XfrmMethod::Rigid, initialTransform, fixedImage, movingImage, true);
m_AffineIterations = originalIterations;
}
else if (whichTransform == "trsaa")
{
auto originalGradientStep = m_GradientStep;
Expand Down Expand Up @@ -537,6 +544,21 @@ ANTSRegistration<TFixedImage, TMovingImage, TParametersValueType>::GenerateData(
SingleStageRegistration(
RegistrationHelperType::XfrmMethod::SyN, intermediateTransform, fixedImage, movingImage, true);
}
else if (whichTransform == "syncc")
{
std::string originalMetric = m_AffineMetric;
m_AffineMetric = "CC";
SingleStageRegistration(
RegistrationHelperType::XfrmMethod::Affine, initialTransform, fixedImage, movingImage, m_MaskAllStages);
m_AffineMetric = originalMetric;
this->UpdateProgress(0.15);
originalMetric = m_SynMetric;
m_SynMetric = "CC";
typename OutputTransformType::Pointer intermediateTransform = m_Helper->GetModifiableCompositeTransform();
SingleStageRegistration(
RegistrationHelperType::XfrmMethod::SyN, intermediateTransform, fixedImage, movingImage, true);
m_SynMetric = originalMetric;
}
else if (whichTransform.substr(0, 3) == "tv[") // TV[n]
{
unsigned tsl = whichTransform.size(); // transform string length
Expand Down
32 changes: 32 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,38 @@ itk_add_test(NAME antsRegistrationTest_SyNScaleNoMasks_2stage
1 # maskAllStages
)

itk_add_test(NAME antsRegistration_SyNCC
COMMAND ANTsWasmTestDriver
--compare
DATA{Baseline/antsRegistrationTest_SyNScaleNoMasks_Float.result.nii.gz}
${ITK_TEST_OUTPUT_DIR}/antsRegistration_SyNCC.result.nii.gz
--compareIntensityTolerance 9
--compareRadiusTolerance 1
--compareNumberOfPixelsTolerance 1000
itkANTSRegistrationTest
DATA{Input/test.nii.gz} # fixed image
DATA{Input/scale.test.nii.gz} # moving image
${ITK_TEST_OUTPUT_DIR}/antsRegistration_SyNCC.tfm # output transform
${ITK_TEST_OUTPUT_DIR}/antsRegistration_SyNCC.result.nii.gz # moving image warped to fixed space
DATA{Input/Initializer_0.05_antsRegistrationTest_AffineScaleMasks_Float.mat} # initial transform
none # fixedMask
none # movingMask
0.25 # GradientStep
SyNCC
Irrelevant # affineMetric
0.20 # samplingRate
4 # ccRadius
25x20x5 # affineIterations
3x2x1 # shrinkFactors
2x1x0 # smoothingSigmas
0 # randomSeed (0 means do not set)
Irrelevant # synMetric
100x70x20 # synIterations
--float
0 # collapseTransforms
1 # maskAllStages
)

itk_add_test(NAME antsRegistration_SyNRA
COMMAND ANTsWasmTestDriver
--compare
Expand Down
Loading