[Freesurfer] MRIread.m and hippocampal subfields

2013-06-18 Thread Marcos Martins da Silva
Hi, Freesurfer experts
If you try to read one of the posterior*.mgz files generated by reco-all
-hippo-subfield into MatLab/Octave using MRIread.m it fails like this:
 Ps=MRIread('posterior_left_subiculum.mgz')  
 WARNING: error reading MR params
 Attempted to access mr_parms(1); index out of bounds because
 numel(mr_parms)=0.

 Error in MRIread (line 100)
   tr = mr_parms(1);

That is because the posterior*.mgz files does not have this data. I made
a  creating a little customized nMRIread.m with the following
 changes:
 
 if numel(mr_parms) > 0
 tr = mr_parms(1);
flip_angle = mr_parms(2);
 te = mr_parms(3);
 ti = mr_parms(4);
   else
mr_parms(1) = 0;
 mr_parms(2) = 0;
 mr_parms(3) = 0;
 mr_parms(4) = 0;
 tr = mr_parms(1);
 flip_angle = mr_parms(2);
te = mr_parms(3);
ti = mr_parms(4);
  end

That works but it is only a quick workaround since MRIread,m calls
load_mgh.m and it shows a warning message about the mr_parms. This
message does not block my work but it is not good to see the warning all
the time on my screen. Perhaps the best fix would be just creating the
posterior*.mgz files with these data defined as 0. But I would be happy
if I could just "edit" these files defining these values. Is there a
freesurfer tool to make this simple edition? I noticed, for example,
that when you use mri_concat to sum these files the resulting
concatenated file is fixed and these parameters are defined.
Thanks in advance,
Marcos. 
___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


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.


Re: [Freesurfer] MRIread.m and hippocampal subfields

2013-06-18 Thread Douglas Greve
Hi Marcos, it is weird that the posterior*.mgz does not have that info. 
Maybe Koen or Eugenio know why. In the mean time, you can use 
mri_convert to change/set the parameters, eg


mri_convert in.mgz out.mgz -tr 0 -ti 0 -te 0 -flip_angle 0

doug





On 6/18/13 2:50 PM, Marcos Martins da Silva wrote:

Hi, Freesurfer experts
If you try to read one of the posterior*.mgz files generated by 
reco-all -hippo-subfield into MatLab/Octave using MRIread.m it fails 
like this:

*Ps=MRIread('posterior_left_subiculum.mgz') *
*WARNING: error reading MR params*
*Attempted to access mr_parms(1); index out of bounds because*
*numel(mr_parms)=0.*

*Error in MRIread (line 100)*
*   tr = mr_parms(1);*

That is because the posterior*.mgz files does not have this data.I 
made a  creating a little customized nMRIread.m with the following

changes:

*if numel(mr_parms) > 0*
* tr = mr_parms(1);*
*flip_angle = mr_parms(2);*
* te = mr_parms(3);*
* ti = mr_parms(4);*
*   else*
*mr_parms(1) = 0;*
* mr_parms(2) = 0;*
* mr_parms(3) = 0;*
* mr_parms(4) = 0;*
* tr = mr_parms(1);*
* flip_angle = mr_parms(2);*
*te = mr_parms(3);*
*ti = mr_parms(4);*
*  end*

That works but it is only a quick workaround since MRIread,m calls 
load_mgh.m and it shows a warning message about the mr_parms. This 
message does not block my work but it is not good to see the warning 
all the time on my screen. Perhaps the best fix would be just creating 
the posterior*.mgz files with these data defined as 0. But I would be 
happy if I could just "edit" these files defining these values. Is 
there a freesurfer tool to make this simple edition? I noticed, for 
example, that when you use mri_concat to sum these files the resulting 
concatenated file is fixed and these parameters are defined.

Thanks in advance,
Marcos.


___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


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.


Re: [Freesurfer] MRIread.m and hippocampal subfields

2013-06-19 Thread Marcos Martins da Silva
I knew you would have a clean solution. :-)
Thank you, Doug.
Em Ter, 2013-06-18 às 23:45 -0700, Douglas Greve escreveu:

> Hi Marcos, it is weird that the posterior*.mgz does not have that
> info. Maybe Koen or Eugenio know why. In the mean time, you can use
> mri_convert to change/set the parameters, eg
> 
> mri_convert in.mgz out.mgz -tr 0 -ti 0 -te 0 -flip_angle 0
> 
> doug
> 
> 
> 
> 
> 
> 
> On 6/18/13 2:50 PM, Marcos Martins da Silva wrote:
> 
> > 
> > Hi, Freesurfer experts
> > If you try to read one of the posterior*.mgz files generated by
> > reco-all -hippo-subfield into MatLab/Octave using MRIread.m it fails
> > like this:
> > Ps=MRIread('posterior_left_subiculum.mgz')  
> > WARNING: error reading MR params
> > Attempted to access mr_parms(1); index out of bounds because
> > numel(mr_parms)=0.
> > 
> > Error in MRIread (line 100)
> >tr = mr_parms(1);
> > 
> > That is because the posterior*.mgz files does not have this data. I
> > made a  creating a little customized nMRIread.m with the following
> > changes:
> > 
> > if numel(mr_parms) > 0
> >  tr = mr_parms(1);
> > flip_angle = mr_parms(2);
> >  te = mr_parms(3);
> >  ti = mr_parms(4);
> >else
> > mr_parms(1) = 0;
> >  mr_parms(2) = 0;
> >  mr_parms(3) = 0;
> >  mr_parms(4) = 0;
> >  tr = mr_parms(1);
> >  flip_angle = mr_parms(2);
> > te = mr_parms(3);
> > ti = mr_parms(4);
> >   end
> > 
> > That works but it is only a quick workaround since MRIread,m calls
> > load_mgh.m and it shows a warning message about the mr_parms. This
> > message does not block my work but it is not good to see the warning
> > all the time on my screen. Perhaps the best fix would be just
> > creating the posterior*.mgz files with these data defined as 0. But
> > I would be happy if I could just "edit" these files defining these
> > values. Is there a freesurfer tool to make this simple edition? I
> > noticed, for example, that when you use mri_concat to sum these
> > files the resulting concatenated file is fixed and these parameters
> > are defined.
> > Thanks in advance,
> > Marcos. 
> > 
> > 
> > ___
> > Freesurfer mailing list
> > Freesurfer@nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
> 
> 
> 
> ___
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
> 
> 
> 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.


<>___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


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.


Re: [Freesurfer] MRIread.m and hippocampal subfields

2013-06-19 Thread Marcos Martins da Silva
Hi, Doug
Hi, all

This single BASH script line works like a charm for all posterior.mgz
files in a once and keeps the original names (must be in yoursubject/mri
folder).
for f in $(ls posterior*.mgz); do mri_convert -tr 0 -ti 0 -te 0
-flip_angle 0 -i $f -o $f; done

You can also use in a more complete script like:

#!/bin/bash
#usage myrecon subj (for example, myrecon bert)
mkdir ~/freesurfer/subjects/$1/mri/orig -p
cp  ~/freesurfer/ImgOrig/$1/* ~/freesurfer/subjects/$1/mri/orig/
recon-all -all -s $1 -cw256 -hippo-subfields -qcache
cd ~/freesurfer/subjects/$1/mri
for f in $(ls posterior*.mgz); do mri_convert -tr 0 -ti 0 -te 0
-flip_angle 0 -i $f -o $f; done

This way all files will be fixed just after usual recon-all pipeline.
Notice you may adapt for your environment and recon-all options. Also,
ImgOrig is a custom folder where I have 1 folder for each of my subjects
with their respective images already prepared as 00x.mgz.
I hope you think it is useful. 
BTW, I had to specify -i and -o in the command line. Using just the name
of the files did not work.
Thank you again, Doug.

Marcos

Em Ter, 2013-06-18 às 23:45 -0700, Douglas Greve escreveu:

> Hi Marcos, it is weird that the posterior*.mgz does not have that
> info. Maybe Koen or Eugenio know why. In the mean time, you can use
> mri_convert to change/set the parameters, eg
> 
> mri_convert in.mgz out.mgz -tr 0 -ti 0 -te 0 -flip_angle 0
> 
> doug
> 
> 
> 
> 
> 
> 
> On 6/18/13 2:50 PM, Marcos Martins da Silva wrote:
> 
> > 
> > Hi, Freesurfer experts
> > If you try to read one of the posterior*.mgz files generated by
> > reco-all -hippo-subfield into MatLab/Octave using MRIread.m it fails
> > like this:
> > Ps=MRIread('posterior_left_subiculum.mgz')  
> > WARNING: error reading MR params
> > Attempted to access mr_parms(1); index out of bounds because
> > numel(mr_parms)=0.
> > 
> > Error in MRIread (line 100)
> >tr = mr_parms(1);
> > 
> > That is because the posterior*.mgz files does not have this data. I
> > made a  creating a little customized nMRIread.m with the following
> > changes:
> > 
> > if numel(mr_parms) > 0
> >  tr = mr_parms(1);
> > flip_angle = mr_parms(2);
> >  te = mr_parms(3);
> >  ti = mr_parms(4);
> >else
> > mr_parms(1) = 0;
> >  mr_parms(2) = 0;
> >  mr_parms(3) = 0;
> >  mr_parms(4) = 0;
> >  tr = mr_parms(1);
> >  flip_angle = mr_parms(2);
> > te = mr_parms(3);
> > ti = mr_parms(4);
> >   end
> > 
> > That works but it is only a quick workaround since MRIread,m calls
> > load_mgh.m and it shows a warning message about the mr_parms. This
> > message does not block my work but it is not good to see the warning
> > all the time on my screen. Perhaps the best fix would be just
> > creating the posterior*.mgz files with these data defined as 0. But
> > I would be happy if I could just "edit" these files defining these
> > values. Is there a freesurfer tool to make this simple edition? I
> > noticed, for example, that when you use mri_concat to sum these
> > files the resulting concatenated file is fixed and these parameters
> > are defined.
> > Thanks in advance,
> > Marcos. 
> > 
> > 
> > ___
> > Freesurfer mailing list
> > Freesurfer@nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
> 
> 
> 
> ___
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
> 
> 
> 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.


___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


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.