Skip to content

BRAINSResample interface changes #2918

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

Open
andrewcyung opened this issue Apr 17, 2019 · 1 comment · May be fixed by #3724
Open

BRAINSResample interface changes #2918

andrewcyung opened this issue Apr 17, 2019 · 1 comment · May be fixed by #3724

Comments

@andrewcyung
Copy link

Summary

I was trying to use the Slicer BRAINSResample interface and needed to make two main changes to the interface class definition:

  1. The first change was to the command line string that is stored in the interface - right now it is just "BRAINSResample ". This does not work for me, even if my PATH environment variable points to the CLI module folder in Slicer (a library .so file is missing). I have to change it to "Slicer --launch BRAINSResample ", which seems to be in line with what the Slicer folks consider as a standard way to call these modules. Perhaps in older versions of Slicer, you can call the command line modules directly in the terminal without the "Slicer --launch"? So therefore:

_cmd = "BRAINSResample " becomes _cmd = "Slicer --launch BRAINSResample "

Even though this worked for me, I don't know if the current nipype version works for most people, but I am inadvertently doing something else wrong, which is solved by this hack. Would all other command line modules in Slicer be affected in the same way?

  1. My image filenames all have spaces in them, which mess up the argument parsing when the function is executed on the command line. On the command line outside nipype, the problem is avoided when there are quotation marks enclosing the pathname. Therefore I changed the argstr value whenever a File input is defined in BRAINSResampleInputSpec so that it will enclose the pathname with double quotes. For example, if the original code is:

class BRAINSResampleInputSpec(CommandLineInputSpec): inputVolume = File( desc="Image To Warp", exists=True, argstr="--inputVolume %s")

Then I change it to:

class BRAINSResampleInputSpec(CommandLineInputSpec): inputVolume = File( desc="Image To Warp", exists=True, argstr="--inputVolume \"%s\"")

@christianhacker
Copy link

Can confirm that the latest Linux release of Slicer 4.11.20200930 is incompatible with latest nipype.interfaces.slicer, at least for many of the submodules. Attempting to run nipype.interfaces.slicer.generate_classes does not work.

@andrewcyung andrewcyung linked a pull request Apr 25, 2025 that will close this issue
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 a pull request may close this issue.

2 participants