When I load the file directly to load_mgh I still get the error

ERROR: could not open /home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.white.projfrac35.mgh for reading
??? Attempt to reference field of non-structure array.

Error in ==> gwratiotest at 5
        gray2=gray.vol;


here is my matlab file:

function gwratiotest
    
        gray=load_mgh('/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.white.projfrac35.mgh');             
        white=load_mgh('/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.white.projdist.neg1.mgh');       
        gray2=gray.vol;
        white2=white.vol;
        gwratio.vol = gray2 / white2;               
        MRIwrite(gwratio, '/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.gwratio.mgh'); 
end

 

On Fri, Jun 4, 2010 at 12:20 PM, Bruce Fischl <fischl@nmr.mgh.harvard.edu> wrote:
Hi Corinna,

sorry, I'm not sure what's going wrong. Can you try loading that volume calling load_mgh directly? Make sure the filename is exactly right. It's hard to tell with all the carriage returns in your email.

cheers
Bruce



On Fri, 4 Jun 2010, corinna bauer wrote:

When I run mri_info I get:

Volume information for
/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.white.projfrac.35.mgh
        type: MGH
  dimensions: 23334 x 1 x 5
 voxel sizes: 1.0000, 1.0000, 1.0000
        type: FLOAT (3)
         fov: 23334.000
         dof: 0
      xstart: -11667.0, xend: 11667.0
      ystart: -0.5, yend: 0.5
      zstart: -2.5, zend: 2.5
          TR: 3000.00 msec, TE: 3.61 msec, TI: 1000.00 msec, flip angle:
8.00 degrees
     nframes: 1
ras xform present
  xform info: x_r =  -1.0000, y_r =   0.0000, z_r =   0.0000, c_r =
5.5017
            : x_a =   0.0000, y_a =   0.0000, z_a =   1.0000, c_a =
11.5254
            : x_s =   0.0000, y_s =  -1.0000, z_s =   0.0000, c_s =
0.0000

talairach xfm :
/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/transforms/talairach.xfm
Orientation   : LIA
Primary Slice Direction: coronal

voxel to ras transform:
             -1.0000   0.0000   0.0000 11672.5020
              0.0000   0.0000   1.0000     9.0254
              0.0000  -1.0000   0.0000     0.5000
              0.0000   0.0000   0.0000     1.0000

voxel-to-ras determinant -1

ras to voxel transform:
             -1.0000   0.0000   0.0000 11672.5020
             -0.0000  -0.0000  -1.0000     0.5000
             -0.0000   1.0000  -0.0000    -9.0254
              0.0000   0.0000   0.0000     1.0000



On Fri, Jun 4, 2010 at 9:58 AM, Bruce Fischl <fischl@nmr.mgh.harvard.edu>wrote:

if you run mri_info on the .mgh file does it return reasonable looking
values?

On Fri, 4 Jun 2010, corinna bauer wrote:

 Hi Bruce,
I am having trouble getting my .mgh files to open in MRIread. I get the
following error message.

ERROR: could not open /home/freesurfer4.4.0/
subjects/corinna/ADNI/003_S_1057/mri/lh.white.projfrac35.mgh for reading
ERROR: loading

/home/freesurfer4.4.0/subjects/corinna/ADNI/003_S_1057/mri/lh.white.projfrac35.mgh
as MGH
??? Attempt to reference field of non-structure array.

Error in ==> gwRatio at 24
     gwratio.vol = gray.vol / white.vol;


here's my .m file

function gwRatio

rootdir = '/home/freesurfer4.4.0/subjects/corinna/ADNI';
paths=dir([rootdir,'/*']);

numel(paths)
    num = numel(paths);

for ii = 1:num
 if(paths(ii).isdir && ~strcmp(paths(ii).name,'.') &&
~strcmp(paths(ii).name,'..'))

     graypath=
fullfile(rootdir,paths(ii).name,'mri/lh.white.projfrac35.mgh');
     whitepath =
fullfile(rootdir,paths(ii).name,'mri/lh.white.projdist.neg1.mgh');
     outpath = fullfile(rootdir,paths(ii).name,'mri/lh.gwratio.mgh');

     fprintf('----- Processing %i of %i -----\n', ii, num);
     fprintf('gray: %s\n', graypath);
     fprintf('white: %s\n', whitepath);
     fprintf('out: %s\n', outpath);

     gray = MRIread(graypath);
     white = MRIread(whitepath);
     gwratio = gray;
     gwratio.vol = gray.vol / white.vol;
     MRIwrite(gwratio, outpath);
 end
end

corinna



The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.