Try running the command without the '.m'. -Louis
On Mon, 25 Apr 2011, Maryam Vaziri Pashkam wrote:
There is an error:
??? Error: Unexpected MATLAB operator when I run matlab -r matlabfile.m I wanted to change the mcparams2extreg to see if it works but I don't know how to change it and where it is located.
Maryam
On Mon, Apr 25, 2011 at 3:22 PM, Douglas Greve greve@nmr.mgh.harvard.eduwrote:
Yea, I vaguely remember this problem with 4.5 and the macs. Try running this from a terminal (not from matlab):
matlab -r matlabfile.m
where matlabfile.m is the file created with -monly. If this works you can change the call to matlab from mcparams2extreg from
cat $MLF | $MATLAB -display iconic | tee -a $LF
to
$MATLAB -r $MLF -display iconic | tee -a $LF
doug
On 4/25/11 2:49 PM, Maryam Vaziri Pashkam wrote:
Hi Dough,
The generated matlab programs works from within matlab and generates mcextreg.bhdr and mcextreg_000.bfloat and mcextreg_000.hdr.
It seems that there is a problem calling matlab from terminal? any idea how I can fix this? I have two versions on Matlab on my computer. Could this be a source of the problem? I checked the program in both matlabs and it works when run from inside Matlab.
Maryam
On Mon, Apr 25, 2011 at 4:32 AM, Douglas Greve greve@nmr.mgh.harvard.eduwrote:
Try running mcparams2extreg with the -monly option to create a matlab file. Then run that matlab file from inside matlab. If that fails in the same way, send me the matlab file.
doug
On 4/25/11 4:02 AM, Maryam Vaziri Pashkam wrote:
Hi Dough,
I have attached the log file. It does not give any extra information. I ran the command you told me and gave me the exact same errors. It looks like there is a problem with that command and reading of the fmc.mcdat file. I have also attached the fmc.mcdat file from run 6. Any other idea?
Thanks, Maryam
On Mon, Apr 25, 2011 at 3:44 AM, freesurfer-request@nmr.mgh.harvard.eduwrote:
Send Freesurfer mailing list submissions to freesurfer@nmr.mgh.harvard.edu
To subscribe or unsubscribe via the World Wide Web, visit https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer or, via email, send a message with subject or body 'help' to freesurfer-request@nmr.mgh.harvard.edu
You can reach the person managing the list at freesurfer-owner@nmr.mgh.harvard.edu
When replying, please edit your Subject line so it is more specific than "Re: Contents of Freesurfer digest..."
Today's Topics:
- Fwd: error with motion correction (Maryam Vaziri Pashkam)
- Re: Fwd: error with motion correction (Douglas Greve)
Message: 1 Date: Sun, 24 Apr 2011 21:01:43 -0400 From: Maryam Vaziri Pashkam mvaziri.p@gmail.com Subject: [Freesurfer] Fwd: error with motion correction To: freesurfer@nmr.mgh.harvard.edu Message-ID: BANLkTikkaJvqP5bxVD5e2moWQvwBrev9iA@mail.gmail.com Content-Type: text/plain; charset="iso-8859-1"
Hi,
I am running into trouble with motion correction on my Mac and freesurfer 4.5. Originally I ran preproc-sess and got an error from mc-sess in the part (i think) that runs the mcextreg. I ran mc-sess and the same error happened (I have copy pasted the log bellow). It seems like the matlab program that runs mcparams2extreg cannot read the fmc.mcdat file. when I did textread('fmc.mcdat') in matlab, I could open the file and it looked perfectly fine to me with the correct number of TR's. Any idea where the problem might be?
Maryam
preproc-sess -nosmooth -i f -sf sessid -df sessdir
preproc-sess logfile is log/preproc-sess.log
instem f mc 1 f fmc stc 0 fmc sm 0 mask 1 brain 110419_xu_PDM1_02_PDM MC ----------------------------- Sun Apr 24 20:42:29 EDT 2011 /Users/maryam/mri-space/studies/PDM1/PDM1 mc-sess -fstem f -fmcstem fmc -s 110419_xu_PDM1_02_PDM -d /Users/maryam/mri-space/studies/PDM1/unpackdata -fsd bold -new -update
-no-inorm
Logfile is
/Users/maryam/mri-space/studies/PDM1/PDM1/log/mc-110419_xu_PDM1_02_PDM-bold.log
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM RunList: 005 006 007 008 011 012 013 014 Targ Stem is 005/f Update not needed -rw-r--r-- 1 maryam staff 129203552 Apr 24 20:12 005/fmc.nii -rw-r--r-- 1 maryam staff 64601952 Apr 24 19:12 005/f.nii ------- ************************** ----------- ------- Motion Correcting Run 006 ----------- ------- ************************** ----------- sess = 110419_xu_PDM1_02_PDM Sun Apr 24 20:42:30 EDT 2011 mc-afni2 --i 006/f.nii --t 005/f.nii --frame 0 --o 006/fmc.nii --mcdat 006/fmc.mcdat
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM/bold mri_info --nframes --o /tmp/mriinfo.2758 005/f.nii log file is 006/fmc.nii.mclog mcdat file is 006/fmc.mcdat tmp dir is 006/tmp.mc-afni2.2758 #@# --------------------------------
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM/bold mri_convert 005/f.nii 006/tmp.mc-afni2.2758/tempvol.nii.gz --nskip 0 --ndrop 205 -odt float mri_convert 005/f.nii 006/tmp.mc-afni2.2758/tempvol.nii.gz --nskip 0 --ndrop 205 -odt float nskip = 0 ndrop = 205 $Id: mri_convert.c,v 1.146.2.5 2009/04/08 18:40:23 nicks Exp $ reading from 005/f.nii... TR=2000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, -0.000171665, -3.15037e-05) j_ras = (0.000174532, -0.983572, -0.180519) k_ras = (-2.07852e-18, -0.180519, 0.983572) changing data type from 4 to 3 (noscale = 0)... Dropping last 205 frames writing to 006/tmp.mc-afni2.2758/tempvol.nii.gz... #@# --------------------------------
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM/bold mri_convert 006/f.nii 006/tmp.mc-afni2.2758/invol.nii.gz -odt float mri_convert 006/f.nii 006/tmp.mc-afni2.2758/invol.nii.gz -odt float $Id: mri_convert.c,v 1.146.2.5 2009/04/08 18:40:23 nicks Exp $ reading from 006/f.nii... TR=2000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, -0.000171665, -3.15037e-05) j_ras = (0.000174532, -0.983572, -0.180519) k_ras = (-2.07852e-18, -0.180519, 0.983572) changing data type from 4 to 3 (noscale = 0)... writing to 006/tmp.mc-afni2.2758/invol.nii.gz... #@# --------------------------------
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM/bold 3dvolreg -verbose -dfile 006/fmc.mcdat -base 006/tmp.mc-afni2.2758/tempvol.nii.gz -prefix 006/tmp.mc-afni2.2758/outvol.nii.gz 006/tmp.mc-afni2.2758/invol.nii.gz ++ 3dvolreg: AFNI version=AFNI_2008_02_01_1144 (Jul 3 2008) [32-bit] ++ Authored by: RW Cox *+ WARNING: If you are performing spatial transformations on an oblique dset, such as 006/tmp.mc-afni2.2758/tempvol.nii.gz, or viewing/combining it with volumes of differing obliquity, you should consider running: 3dWarp -deoblique on this and other oblique datasets in the same session. See 3dWarp -help for details. ++ Oblique dataset:006/tmp.mc-afni2.2758/tempvol.nii.gz is 10.399981 degrees from plumb. ++ Reading in base dataset 006/tmp.mc-afni2.2758/tempvol.nii.gz ++ Oblique dataset:006/tmp.mc-afni2.2758/invol.nii.gz is 10.399981 degrees from plumb. ++ Reading input dataset 006/tmp.mc-afni2.2758/invol.nii.gz ++ Edging: x=4 y=4 z=2 ++ Creating mask for -maxdisp
- Automask has 57667 voxels
- 10333 voxels left in -maxdisp mask after erosion
++ Initializing alignment base ++ Starting final pass on 206 sub-bricks:
0..1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..16..17..18..19..20..21..22..23..24..25..26..27..28..29..30..31..32..33..34..35..36..37..38..39..40..41..42..43..44..45..46..47..48..49..50..51..52..53..54..55..56..57..58..59..60..61..62..63..64..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205.. ++ CPU time for realignment=16.6 s [=0.0808 s/sub-brick] ++ Min : roll=-0.008 pitch=-0.103 yaw=-0.096 dS=+0.255 dL=-0.019 dP=-0.151 ++ Mean: roll=+0.031 pitch=-0.011 yaw=-0.045 dS=+0.619 dL=+0.037 dP=-0.055 ++ Max : roll=+0.060 pitch=+0.112 yaw=-0.010 dS=+0.693 dL=+0.075 dP=+0.015 ++ Max displacements (mm) for each sub-brick: 0.49 0.65 0.63 0.74 0.69 0.75 0.71 0.77 0.70 0.76 0.67 0.77 0.72 0.73 0.66 0.67 0.67 0.67 0.69 0.70 0.72 0.66 0.71 0.68 0.72 0.67 0.73 0.68 0.73 0.66 0.73 0.66 0.70 0.64 0.72 0.69 0.71 0.71 0.72 0.66 0.66 0.67 0.72 0.70 0.71 0.72 0.71 0.69 0.72 0.72 0.71 0.72 0.72 0.69 0.71 0.74 0.73 0.69 0.72 0.72 0.76 0.76 0.79 0.73 0.75 0.74 0.75 0.75 0.71 0.74 0.67 0.72 0.65 0.72 0.65 0.69 0.69 0.65 0.68 0.64 0.72 0.67 0.67 0.68 0.69 0.65 0.73 0.67 0.71 0.69 0.73 0.72 0.76 0.74 0.72 0.66 0.68 0.69 0.69 0.68 0.68 0.70 0.73 0.70 0.73 0.78 0.74 0.73 0.75 0.74 0.72 0.74 0.63 0.66 0.68 0.74 0.72 0.74 0.79 0.74 0.74 0.76 0.79 0.79 0.74 0.76 0.70 0.75 0.72 0.78 0.74 0.78 0.76 0.80 0.76 0.79 0.77 0.76 0.76 0.75 0.73 0.80 0.78 0.81 0.78 0.84 0.76 0.79 0.77 0.79 0.76 0.83 0.77 0.79 0.77 0.84 0.76 0.80 0.77 0.81 0.72 0.79 0.74 0.80 0.77 0.83 0.81 0.82 0.76 0.81 0.75 0.78 0.74 0.75 0.71 0.75 0.73 0.77 0.77 0.80 0.77 0.80 0.75 0.73 0.77 0.72 0.76 0.72 0.76 0.72 0.72 0.69 0.66 0.68 0.65 0.68 0.64 0.70 0.62 0.70 0.62 0.69 0.67 0.74 0.75 0.74 ++ Max displacement in automask = 0.84 (mm) at sub-brick 145 ++ Wrote dataset to disk in 006/tmp.mc-afni2.2758/outvol.nii.gz #@# --------------------------------
/Users/maryam/mri-space/studies/PDM1/unpackdata/110419_xu_PDM1_02_PDM/bold mri_convert 006/tmp.mc-afni2.2758/outvol.nii.gz 006/fmc.nii --in_like 005/f.nii mri_convert 006/tmp.mc-afni2.2758/outvol.nii.gz 006/fmc.nii --in_like 005/f.nii reading info from 005/f.nii... $Id: mri_convert.c,v 1.146.2.5 2009/04/08 18:40:23 nicks Exp $ reading from 006/tmp.mc-afni2.2758/outvol.nii.gz... TR=2000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, -0.000171665, -3.15037e-05) j_ras = (0.000174532, -0.983572, -0.180519) k_ras = (-2.07852e-18, -0.180519, 0.983572) writing to 006/fmc.nii... ... cleaning up .... Sun Apr 24 20:43:59 EDT 2011 mc-afni2 done INFO: Making external regressor from mc params mcparams2extreg -mcfile 006/fmc.mcdat -northog 6 -extreg 006/mcextreg Logfile is 006/mcparams2extreg.log ----------- Matlab file -------------- mcfile = '006/fmc.mcdat'; extreg = '006/mcextreg'; nkeep = []; northog = [6]; pctorthog = []; monly = 0;
mc = textread(mcfile); mc = mc(:,2:7); ntrs = size(mc,1); if(ntrs < 6) fprintf('ERROR: ntrs = %d < 6\n',ntrs); if(~monly) fprintf('Quiting matlab\n'); quit; fprintf('should not be here\n'); end end
if(~isempty(nkeep)) x = mc(:,1:nkeep); elseif(~isempty(northog)) [u s v] = svd(mc); ds = diag(s); pct = 100*cumsum(ds)/sum(ds); x = u(:,1:northog); nkeep = northog; fprintf('INFO: northog = %d, pct = %g\n',northog,pct(nkeep)); else [u s v] = svd(mc); ds = diag(s); pct = 100*cumsum(ds)/sum(ds); nkeep = min(find(pct > pctorthog)); x = u(:,1:nkeep); fprintf('INFO: pctorthog = %g, nkeep = %d\n',pctorthog,nkeep); end
x2 = zeros(1,1,nkeep,ntrs); x2(1,1,:,:) = x'; %' %fmri_svbvolume(x2,extreg);
mri.vol = permute(x2,[1 3 2 4]); mri.tr = 0; mri.flip_angle = 0; mri.te = 0; mri.ti = 0; mri.vox2ras0 = eye(4); mri.xsize = 1; mri.ysize = 1; mri.zsize = 1; mri.volres = [1 1 1]; mri.volsize = [size(mri.vol,1) size(mri.vol,2) size(mri.vol,3)]; fname = sprintf('%s.bhdr',extreg); MRIwrite(mri,fname);
quit;
------- matlab output -------------------- Warning: Unable to open display 'iconic'. You will not be able to display graphics on the screen.
< M A T L A B (R) > Copyright 1984-2009 The MathWorks, Inc. Version 7.9.0.529 (R2009b) 64-bit (maci64) August 12, 2009To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.
>>>>>>>>>>>>>> ??? Error using ==> textread at 167
File not found.
??? Undefined variable mc.
??? Undefined function or variable 'mc'.
??? Undefined function or variable 'ntrs'.
>> ??? Undefined function or variable 'mc'.
>> ??? Undefined function or variable 'ntrs'.
??? Undefined function or variable 'x'.
>>>> ??? Undefined function or variable 'x2'.
>>>>>>>>>>>>>>>>>> ??? Reference to non-existent field 'vol'.
>> ??? Reference to non-existent field 'vol'.
Error in ==> MRIwrite at 70 bmri.voldim = [size(mri.vol,1) size(mri.vol,2) size(mri.vol,3)];
>> ------------------------------------------
ERROR: output not created ERROR: mc-sess failed