Are you saying that you have the actual surface data stored as an array in matlab or just the filename pointing to the surface data. The routine that you have there will not work because mri_vol2surf is a linux command. However, you can run linux commaand from matlab using the matlab "system" command.
On 11/10/2015 05:21 PM, Fatemeh.Molaei-Vaneghi wrote:
Dear Douglas,
Thanks for your reply. The reason I want to use mri_vol2surf in Matlab is that I have a huge dataset saved in cell arrays of Matlab i.e. multiple subjects, multiple datasets for each subject, multiple ROIs for each of these datasets, multiple surfaces for each of these ROIs, and etc. Therefore the most convenient way for me is to save my data in cell arrays: in Matlab some thing like "data {sub,tval}{hem,roi}{s,1} = MRIread ([tvalss{tval} hemphh{hem} roiss{roi} depth{s} 'p_surf.nii']);.
As far as I know multidimensional arrays are not supported in shell scripting. How, in a shell script, I can use mri_vol2surf with it's input variables stored in cell arrays? In a shell I wrote some thing like the following, but it does not work!
# freesurfer project directory export PATH=$PATH:/Volumes/DATA/projects/ret_obj_purs_recon/subjects
# subjects: SUBJ=(“ 2_MzBOLD02_GB15042014_UnMasked_Mp2rage_1_0” “4_MzBOLD04_US14082015_Masked_Mp2rage_1_0” “5_MzBOLD05_MW14082015_Masked_Mp2rage_1_0” “7_MzBOLD07_HG21082015_Masked_Mp2rage_1_0” “8_MzBOLD08_SN21082015_Masked_Mp2rage_1_0” “9_MzBOLD09_AS28082015_Masked_Mp2rage_1_0” “10_MzBOLD10_CS28082015_Masked_Mp2rage_1_0” )
# smp directory SPMDIR=/spm/
# smoothness: SMOOTH=( “0_8mm” “1_2mm” “1_6mm” )
# t-values TVALS=( “ret_tval_” “obj_tval_” “purs_tval_” “v3a_tval_” )
# hemispheres 1 HEMPH=( “_lh_” “_rh_” )
# hemispheres 2 HEM=( “lh” “rh” )
# rois 1 ROIS=( “v3aroi” “v6roi” “v7roi” )
# rois 2 ROISS=( “v3a” “v6” “v7” )
# depth line:44 DEPTH=( “000” “001” “002” “003” “004” “005” “006” “007” “008” “009” “010” )
# ==============================================================
for sub in ${SUBJ[@]} ; do for sm in ${SMOOTH[@]} ; do cd /Volumes/DATA/projects/ret_obj_purs_recon/subjects/ “${SUBJ[sub]}” “${SMOOTH[sm]}“ echo “current directory: /Volumes/DATA/projects/ret_obj_purs_recon/subjects/ ${SUBJ[sub]} ${SMOOTH[sm]}“ for tval in ${TVALS[@]} ; do for h in ${HEMPH[@]} ; do for roi in ${ROIS[@]} ; do mri_vol2surf --src $SUBJECT_DIR/${SUBJ[1]}/spm/${SMOOTH[1]}/"spmT_000${TVALS[tval]}.nii" --srcreg register.dat --hemi ${HEMPH[h]} --surf depth ${DEPTH[s]} --mask "${HEM[h]}.${ROISS[roi]}.label" --out ./"${TVALS[tval]} ${HEM[h]}_${ROIS[roi]}_depth ${DEPTH[s]}_surf.nii" --out_type nii done done done done done
I would really appreciate it if you could please let me know what you think.
All the Best, Fatemeh _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer