nipype icon indicating copy to clipboard operation
nipype copied to clipboard

BRAINSResample interface changes

Open andrewcyung opened this issue 5 years ago • 1 comments

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\"")

andrewcyung avatar Apr 17 '19 19:04 andrewcyung

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.

christianhacker avatar Dec 28 '20 18:12 christianhacker