Closed maedoc closed 7 years ago
or for a general utility function consider
function mrchoose () {
choice=$1
shift # $2 becomes $1, $3 becomes $2 etc
$@ <<EOF
$choice
EOF
}
and use like
mrchoose 0 mrconvert dti/ol-p03 -o dwi_1.nii
mrchoose 1 mrconvert dti/ol-p03 -o dwi_2.nii
I was looking in the direction of expect scripts, but this is nice as well, I will update
Probably we can send a PR to mrtrix so that these aren't necessary. I would avoid expect
unless you need extended interactivity with process. Here it works because there's a single block of stdin
and then stdout
.
I don't know if it very useful for MRtrix guys, because you want to know what is in you data before doing this, and this is done by doing mrinfo. Our case is very specific, what if the data are organized differently in the DICOM? That's why their script ask directly for dwi1.mif and dwi2.mif, and I think it makes sense
ah I see then at least we have a workaround..
done
using bash redirection may solve this one at least where there are only two runs to choose from:
Calling mrconvert with a choice is then