Dear Mathhew Webster
Thank you for pointing out that "-e" option is not available on OSX.
however, the current implementation has a bug (both linux and OSX)
Currently if the link is relative and the
current process directory is not the same as the directory where the
links are stored,
the imtest will return zero instead of 1.
example:
mkdir A
touch A/aaa.nii
mkdir B
cd B
ln -s ../A/aaa.nii bbb.nii
imtest bbb.nii returns 1 ( correct)
imtest bbb returns 1 ( correct)
cd ..
imtest B/bbb.nii returns 0 (incorrect)
imtest B/bbb returns 1 (correct)
Maybe put
inputfile=`${FSLDIR}/bin/remove_ext $1`
instead of
inputfile=$1
in the begining and remove the whole passage about readlink?
Thank you very much
Lazar
On 8/29/13, Lazar Fleysher <[log in to unmask]> wrote:
> Hello everybody
>
> Not sure if this is the right place, but I do not know any other fsl email
> list.
>
> I think a minor modification is needed to $FSLDRI/bin/imtest
>
> maybe it was done already, maybe not
>
> imtest which I have has this section
>
> for i in 1 2 3 4 5 6 7 8 9 10 11 12
> do
> if [ -h $inputfile ] ; then
> inputfile=`readlink $inputfile`;
> fi
> done
>
> I would think that in place of "readlink" it should be "readlink -e"
> and remove the for-loop:
>
> if [ -h $inputfile ] ; then
> inputfile=`readlink -e $inputfile`;
> fi
>
>
> That is we are trying to check if the "target" exists.
> Current imtest will work for absolute links but might fail for relative
> ones.
>
> with the modification it should work for all.
>
> Thank you
>
> Lazar
>
|