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

Unclosed brackets not detected in antsRegistration command line parameters #1707

Open
LeeReid1 opened this issue Mar 24, 2024 · 3 comments
Open
Labels
bug Reproducible bugs notes about usage wouldbenice Nice ideas not under development (pull requests welcome)

Comments

@LeeReid1
Copy link

LeeReid1 commented Mar 24, 2024

Describe the problem

In antsRegistration, if using the -x argument, but missing off the final ], the command line will still run so long as no further registration stages follow. Nothing at all is printed to stdout as it runs, even if --verbose is set. It's not clear whether the flags that follow -x are ignored or not.

Expected behaviour would be an error message.

To Reproduce

When I've run this I've always provided absolute paths which is not reflected here for brevity:

antsRegistration --dimensionality 3 --initial-moving-transform [a.nii,b.nii,1] --winsorize-image-intensities [0.005,0.995] -o [_,c.nii,]  -t Rigid[0.1] -m CC[a.nii,b.nii.gz,1,0,Regular,0.5,1] -c [1000x500x200x200,1E-06,10] -s 8x4x2x1 -f 8x4x2x1 -x [f.nii,g.nii  --verbose --float 1 --use-histogram-matching 1 --collapse-output-transforms 1 --verbose 1

Note no ] after g.nii. If another stage follows the -x, then an error is correctly returned

System information

  • OS: Mac OS
  • OS version: 13.6.1
  • Type of system: Laptop
  • CPU architecture: ARM
  • Terminal: Bash

ANTs version information
ANTs Version: 2.5.1.post24-g6c29d9d
Compiled: Mar 13 2024 21:10:19
Compiled from source

Additional information
Not the biggest bother but hard to catch as antsRegistration commands can get extremely long. I thought you'd like to be aware, but not an issue for me personally now I'm aware of it.

Thanks for the great tool.

@cookpa cookpa added bug Reproducible bugs notes about usage labels Mar 27, 2024
@cookpa
Copy link
Member

cookpa commented Mar 27, 2024

Thanks for this report. This would be something I would attempt to fix at the parser level, as I expect it affects other programs as well.

@ntustison
Copy link
Member

Just an FYI, if you add --help to the command line, the parsed values are posted as part of the help menu.

So, in the corrected case, with the right delimiter, the relevant option is

     -x, --masks [fixedImageMask,movingImageMask]
          Image masks to limit voxels considered by the metric. Two options are allowed 
          for mask specification: 1) Either the user specifies a single mask to be used 
          for all stages or 2) the user specifies a mask for each stage. With the latter 
          one can select to which stages masks are applied by supplying valid file names. 
          If the file does not exist, a mask will not be used for that stage. Note that we 
          handle the fixed and moving masks separately to enforce this constraint. 
          <VALUES>: [f.nii,g.nii]

     --float 
          Use 'float' instead of 'double' for computations. 
          <VALUES>: 1

vs. uncorrected:

     -x, --masks [fixedImageMask,movingImageMask]
          Image masks to limit voxels considered by the metric. Two options are allowed 
          for mask specification: 1) Either the user specifies a single mask to be used 
          for all stages or 2) the user specifies a mask for each stage. With the latter 
          one can select to which stages masks are applied by supplying valid file names. 
          If the file does not exist, a mask will not be used for that stage. Note that we 
          handle the fixed and moving masks separately to enforce this constraint. 
          <VALUES>: 1

     --float 
          Use 'float' instead of 'double' for computations. 

So you can see that the parser is most likely skipping over the bad option value and picking up the next one.

I don't have the time right now to prioritize this as it seems a highly infrequent incorrect usage case but I'll keep it in mind if I do get some time.

@cookpa
Copy link
Member

cookpa commented Apr 2, 2024

Thanks @ntustison I agree this is not high priority.

I looked at this some more and there's nothing special happening that prevents terminal output, it's just that if you open a bracket and don't close it, the subsequent commands don't get parsed. If you put the --verbose before the unclosed bracket, it prints to the terminal. The only problem is that it prints All_Command_lines_OK, which isn't true,

@cookpa cookpa added the wouldbenice Nice ideas not under development (pull requests welcome) label Apr 2, 2024
@cookpa cookpa changed the title Missing x bracket results in nothing to stdout Unclosed brackets not detected in antsRegistration command line parameters Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible bugs notes about usage wouldbenice Nice ideas not under development (pull requests welcome)
Projects
None yet
Development

No branches or pull requests

3 participants