CoBrALab / optimized_antsMultivariateTemplateConstruction

A re-implementation of antsMultivariateTemplateConstruction2.sh using optimized image pyramid scale-space and qbatch support
Other
22 stars 8 forks source link

Off-by-one error in final output symlink for dbm #32

Closed araikes closed 2 years ago

araikes commented 2 years ago

DBM fails out of the gate. Script expects final non-linear output to be in "output/final" where as the file tree is e.g., "output/nlin/3"

https://github.com/CoBrALab/optimized_antsMultivariateTemplateConstruction/blob/d3b34c3564ca7a74c59bb22070f2ae92b236a529/dbm.sh#L380-L381

gdevenyi commented 2 years ago

Note there's a small change to the modelbuild.sh file: https://github.com/CoBrALab/optimized_antsMultivariateTemplateConstruction/pull/31/files#diff-52fbb57ee96676caf18945989c666ec63f63fc70d470d652d406efc37fe836abR1047

araikes commented 2 years ago

Small point but may be important depending on who is using it .... that change to modelbuild.sh works as long as you're not doing so inside a container, otherwise it is just an empty link.

gdevenyi commented 2 years ago

Really? That doesn't make sense to me as it is a relative symlink. Can you test a manual running of

ln -srf output/nlin/3 output/final

within a container?

araikes commented 2 years ago

I'll check it when I get back to my computer. It occurs to me though that I mounted the template folder for more generalizable code across studies, and so that pathing doesn't exist for the symbolic link if I then run DBM in a separate instance.

gdevenyi commented 2 years ago

This is what the current config is based on:

'-r'
‘--relative’
Make symbolic links relative to the link location. This option is only valid with the --symbolic option.

‘-s’
‘--symbolic’
Make symbolic links instead of hard links. This option merely produces an error message on systems that do not support symbolic links.

So as I understand (and experience on my systems) that ln traverses down into output and generates a relative symlink between nlin/3 and final

araikes commented 2 years ago

I think the problem is here:

https://github.com/CoBrALab/optimized_antsMultivariateTemplateConstruction/blob/d3b34c3564ca7a74c59bb22070f2ae92b236a529/modelbuild.sh#L1039-L1041

Pretending that the number of iterations is 4, the while loop runs 0-3. At the end of the while loop you increment i by 1 so that i = 4 and then breaks the loop. However, this makes the symlink call:

ln -srf output/nlin/4 output/final isntead of ln -srf output/nlin/3 output/final.

I've tested the symlinking in a shell using the same volume bindings and it works fine when I point it to output/nlin/3

gdevenyi commented 2 years ago

Ahh, off by one error :+1:

Will sort that.

My testing of the dbm was all post-hoc on an already done modelbuild where I manually (correctly generated a link)

gdevenyi commented 2 years ago

Fixed in #31