Hi,
I'm trying to interface with mipav via JIST. The command line that I want to implement is below:
java -classpath /usr/local/mipav/plugins/:/usr/local/mipav/:`find /usr/local/mipav/ -name \*.jar | sed 's#/usr/local/mipav/#:/usr/local/mipav/#' | tr -d '\n' | sed 's/^://'` edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmN3$AlgorithmIHN3CorrectionWrapper -inInput /new_home/intern2012/yasin/data_sink/T2_TSE_crop_rescale.hdr -outInhomogeneity /new_home/intern2012/yasin/data_sink/test1.img
there are 5 basic part in it:
calls java
-classpath /usr/local/mipav/plugins/:/usr/local/mipav/:`find /usr/local/mipav/ -name \*.jar | sed 's#/usr/local/mipav/#:/usr/local/mipav/#' | tr -d '\n' | sed 's/^://'`
adds all necessary paths for java to run following java classes.
edu.jhu.ece.iacl.jist.cli.run
JIST launcher for java classes
edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmN3$AlgorithmIHN3CorrectionWrapper
mipav algorithm
-inInput /new_home/intern2012/yasin/data_sink/T2_TSE_crop_rescale.hdr -outInhomogeneity /new_home/intern2012/yasin/data_sink/test1.img
input and output for the mipav algorithm
In order to use the command line in nipype, I wrapped a code below
from nipype.interfaces.base import TraitedSpec, File, traits, isdefined,CommandLine, CommandLineInputSpec, SEMLikeCommandLine
import os
class IHN3CorrectionInputSpec(CommandLineInputSpec):
in_file = File(exists=True, desc='input file', argstr='-inInput %s', position=0, mandatory=True)
out_file = File(exists=False, desc='output file', argstr='-outInhomogeneity %s', position=-1)
class IHN3CorrectionOutputSpec(TraitedSpec):
out_file = File(desc = "output file", exists = True)
class IHN3Correction(SEMLikeCommandLine):
input_spec = IHN3CorrectionInputSpec
output_spec = IHN3CorrectionOutputSpec
_cmd = "java -classpath /usr/local/mipav/plugins/:/usr/local/mipav/:`find /usr/local/mipav/ -name \*.jar | sed 's#/usr/local/mipav/#:/usr/local/mipav/#' | tr -d '\n' | sed 's/^://'` edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmN3$AlgorithmIHN3CorrectionWrapper"
_outputs_filenames = {'out_file':'T2_crop_N3rescale.img'}
if __name__ == '__main__':
N3 = IHN3Correction()
N3.inputs.in_file = '/new_home/intern2012/yasin/data_sink/T2_TSE_crop_rescale.img'
N3.inputs.out_file = '/new_home/intern2012/yasin/data_sink/T2_crop_N3rescale.img'
print N3.cmdline
N3.run()
The command line runs without error, however the wrapped code above gets stuck at "Initializing MIPAV/JIST Framework" and can not proceed to "Interpretting command line arguments". The code above is very similar to the codes in
https://github.com/chrisfilo/nipype/commit/b7286aeb91275f76f3abbc13581111a63d67eb48 The only difference is "-classpath".
Cheers
Yasin