pyushkevich / greedy

Very fast greedy diffeomorphic registration code
GNU General Public License v3.0
62 stars 17 forks source link

Inconsistent warning message #43

Closed neurolabusc closed 9 months ago

neurolabusc commented 9 months ago

I am running the version of greedy that ships with the latest version of ITKsnap (4.0.2). I am getting inconsistent results where sometimes an error is generated and sometimes it is not.

tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
 IFLAG= -1  LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 3 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: Error. Netlib routine lbfgs failed.
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
tmp % rm ./new.mat                                                                           
tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10
 IFLAG= -1  LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 6 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: Error. Netlib routine lbfgs failed.

I have set the SForm and QForm so fslhd reports both are Scanner Anat. In ITKsnap the alignment looks reasonable.

The values in the output new.mat file look a tiny bit different between runs, but visually are pretty close, including the failed runs.

Screenshot 2023-12-20 at 8 53 12 PM

pyushkevich commented 9 months ago

Hi Chris,

The message you see is actually not really an error, just a failure of the LBFGS optimizer to trap a minimum during a line search. Not sure how to suppress that message. The different outputs are due to random seeding, I believe, there is some random jitter added to the coordinates where the metric is sampled to prevent getting trapped in a local minimum. I think that as long as the .mat files and metric values you are getting in each run are pretty consistent, then the tool is operating correctly.

Thanks, Paul

On Wed, Dec 20, 2023 at 9:14 PM Chris Rorden @.***> wrote:

I am running the version of greedy that ships with the latest version of ITKsnap (4.0.2). I am getting inconsistent results where sometimes an error is generated and sometimes it is not.

tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 IFLAG= -1 LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 3 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: Error. Netlib routine lbfgs failed. tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 tmp % rm ./new.mat tmp % greedy -V 0 -a -d 3 -m MI -i $fixed $moving -o ./new.mat -ia-image-centers -n 100x50x10 IFLAG= -1 LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 6 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: Error. Netlib routine lbfgs failed.

I have set the SForm and QForm so fslhd reports both are Scanner Anat. In ITKsnap the alignment looks reasonable.

The values in the output new.mat file look a tiny bit different between runs, but visually are pretty close, including the failed runs.

Screenshot.2023-12-20.at.8.53.12.PM.png (view on web) https://github.com/pyushkevich/greedy/assets/8930807/a2bbe1a1-6ed9-4fab-9f4c-65901563b164

— Reply to this email directly, view it on GitHub https://github.com/pyushkevich/greedy/issues/43, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJPEWY2KU6UGGLSWAXZ7ADYKOLQ7AVCNFSM6AAAAABA5WROFSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TCNJXGEZDOMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

neurolabusc commented 9 months ago

OK, The subsequent results look good when I ignore this. I will close this issue. As a feature request, it would be nice if -V 0 suppressed messages for each iteration of the non-linear registration, e.g.

greedy -V 0 -d 3 -m WNCC 2x2x2 -i $fixed $moving -it affine.mat -o warp.nii.gz -oinv inverse_warp.nii.gz -sv -n 100x50x10