From: Eric on
I am trying to use MATLAB's system command to run dcm2nii on a CentOS 5.5 Linux box. The script basically takes a set of DICOM images and converts them to a single NIfTI image. Simply calling dcm2nii with no parameters should output the usage.

As it stands now, when I attempt to call dcm2nii either from within the directory containing dcm2nii (system('./dcm2nii')) or outside of the dcm2nii directory via an absolute path (system('/path/to/dcm2nii')) MATLAB hangs and only responds to an interrupt with Ctrl-C. It seems that any other system call works fine (system('ls')).

Does anyone have any ideas or suggestions for this problem? The software in question is located here for free download:
http://www.cabiatl.com/mricro/mricron/install.html

Thanks ahead of time!
~Eric
From: Walter Roberson on
Eric wrote:
> I am trying to use MATLAB's system command to run dcm2nii on a CentOS
> 5.5 Linux box. The script basically takes a set of DICOM images and
> converts them to a single NIfTI image. Simply calling dcm2nii with no
> parameters should output the usage.
>
> As it stands now, when I attempt to call dcm2nii either from within the
> directory containing dcm2nii (system('./dcm2nii')) or outside of the
> dcm2nii directory via an absolute path (system('/path/to/dcm2nii'))
> MATLAB hangs and only responds to an interrupt with Ctrl-C. It seems
> that any other system call works fine (system('ls')).
>
> Does anyone have any ideas or suggestions for this problem?

I would suggest checking to see what libraries dcm2nii uses, and use
system('echo $LD_LIBRARY_PATH') and investigate those directories to see
whether one of the libraries happens to appear elsewhere on the path.

Though what I'd be tempted to do first is use strace on the dcm2nii invocation
to see where it is getting stuck.
From: Eric on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2ah0h$4b6$1(a)canopus.cc.umanitoba.ca>...
> Eric wrote:
> > I am trying to use MATLAB's system command to run dcm2nii on a CentOS
> > 5.5 Linux box. The script basically takes a set of DICOM images and
> > converts them to a single NIfTI image. Simply calling dcm2nii with no
> > parameters should output the usage.
> >
> > As it stands now, when I attempt to call dcm2nii either from within the
> > directory containing dcm2nii (system('./dcm2nii')) or outside of the
> > dcm2nii directory via an absolute path (system('/path/to/dcm2nii'))
> > MATLAB hangs and only responds to an interrupt with Ctrl-C. It seems
> > that any other system call works fine (system('ls')).
> >
> > Does anyone have any ideas or suggestions for this problem?
>
> I would suggest checking to see what libraries dcm2nii uses, and use
> system('echo $LD_LIBRARY_PATH') and investigate those directories to see
> whether one of the libraries happens to appear elsewhere on the path.
>
> Though what I'd be tempted to do first is use strace on the dcm2nii invocation
> to see where it is getting stuck.

Thanks for the tips, Walter! As it turned out, strace in unix showed the problem lies in when dcm2nii tries to connect to the buggy /dev/gpmctl and fails. Bug details here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=470882

Now I am wondering why this happens in a system call in MATLAB and not in a terminal window?
From: Walter Roberson on
Eric wrote:

> Thanks for the tips, Walter! As it turned out, strace in unix showed
> the problem lies in when dcm2nii tries to connect to the buggy
> /dev/gpmctl and fails. Bug details here:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=470882
>
> Now I am wondering why this happens in a system call in MATLAB and not
> in a terminal window?

Different LD_LIBRARY_PATH's might result in a different version of the library
being linked in, perhaps.
From: Eric on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2cmrr$m2l$1(a)canopus.cc.umanitoba.ca>...
>
> Different LD_LIBRARY_PATH's might result in a different version of the library
> being linked in, perhaps.

I suspect you are thinking that GPM gets called from either MATLAB or the terminal window. I assure you, GPM is not called from the terminal window using the same command. GPM only gets called by MATLAB. Does anyone know why MATLAB uses GPM in its UNIX system calls?

In similar news, I found a workaround was to disable the GPM service on the system, but this is a poor workaround.

Thanks!
~Eric