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

WIP: Remove unused estimate learning rate at each iteration. #1411

Merged
merged 3 commits into from
Aug 11, 2022

Conversation

ntustison
Copy link
Member

Description

I'm guessing this is a legacy option before we switched to the conjugate gradient descent optimizers for everything but the exponential transforms. But even those don't use this flag as no scales estimator is applied in these two cases (B-spline and Gaussian).

Addresses #1405

@cookpa
Copy link
Member

cookpa commented Aug 10, 2022

Thanks @ntustison !

I think this means we should also remove this option from antsMotionCorr.cxx, which also uses a conjugate gradient optimizer

https://github.com/ANTsX/ANTs/blob/master/Examples/antsMotionCorr.cxx#L131

@@ -193,7 +193,6 @@ antsRegistrationInitializeCommandLineOptions(itk::ants::CommandLineParser * pars
option->SetShortName('z');
option->SetUsageOption(0, "(1)/0");
option->SetDescription(description);
option->AddFunction(std::string("1"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should have been removed, I get a seg fault now unless I specify --collapse-output-transforms 1. The argument handling is inconsistent and probably needs to be refactored, but some args (like this) have the convention that a default is assumed. In others, there is a check for the number of functions and only if > 0 is the value queried.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I this going to impact ANTsR and ANTsPy? I believe these do set the option internally.

@ntustison
Copy link
Member Author

Thanks for trying this. Can you tell me exactly the command you're running because I can't reproduce?

@cookpa
Copy link
Member

cookpa commented Aug 10, 2022

bash -c "../install/bin/antsRegistration --verbose 1 --dimensionality 3 --float 0 --output [ test,testWarped.nii.gz,testInverseWarped.nii.gz ] --interpolation Linear --use-histogram-matching 0 --winsorize-image-intensities [ 0.005,0.995 ] --initial-moving-transform [ tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz,T1w.nii.gz,1 ] --transform Rigid[ 0.1 ] --metric MI[ tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz,T1w.nii.gz,1,32,Regular,0.25 ] --convergence [ 100x50x25x10,1e-6,10 ] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox --transform Affine[ 0.1 ] --metric MI[ tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz,T1w.nii.gz,1,32,Regular,0.25 ] --convergence [ 100x50x25x10,1e-6,10 ] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox --transform SyN[ 0.1,3,0 ] --metric CC[ tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz,T1w.nii.gz,1,4 ] --convergence [ 10x7x5x0,1e-6,10 ] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox"

This doesn't work, but it does work if I add --collapse-output-transforms 1

@ntustison
Copy link
Member Author

Thanks @cookpa , I'll look at it in a few minutes.

An alternative is to just add documentation to the option. I'm fine with whatever.

Copy link
Member

@cookpa cookpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me

@ntustison
Copy link
Member Author

Thanks @cookpa , @stnava . I'll take a look at any ANTsPy/ANTsR dependencies later today before merging.

@ntustison
Copy link
Member Author

Also, I'll take a look at the other programs (eg, antsMotionCorr).

@cookpa
Copy link
Member

cookpa commented Aug 11, 2022

Thanks for sorting this @ntustison

@effigies
Copy link

effigies commented Jan 11, 2023

@ntustison Do you know when "we switched to the conjugate gradient descent optimizers for everything but the exponential transforms"? For nipype wrapping, it would be good to know at what point this had an effect.


Edit: From a quick git-blame, it may have been around 5bedd97, which was released in ANTs 2.0.

@cookpa
Copy link
Member

cookpa commented Jan 11, 2023

I think it was 2013, here

42dd9d3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants