Re: [Freesurfer] Freesurfer equivalent to fslmaths?

2018-02-22 Thread Bruce Fischl

Hi Jared

what are the exact command lines you ran? I don't think it can be a 
freeview problem if the overlays are different.


cheers
Bruce
On Wed, 21 Feb 2018, 
Zimmerman, Jared wrote:




Hey Doug, Bruce, et al., any update on why fscalc and Matlab are not producing 
the same values when
trying to run a mean?  I’m using fscalc to pilot some stuff now, but not sure 
if I should be
trusting the values I’m getting out of it.

 

It seems this issue might be caused by how Freeview is reading the images and 
not by either Matlab
or fscalc.  See the screenshot below.  The two overlays loaded in Freeview 
should be the exact same
image, which is the mean of three other images, one calculated with fscalc 
(*smMean246.mgh) and the
other by reading the images into Matlab (*matlab_lh.mgh).  Notice that at the 
crosshair (vertex
37431) the values in the two overlays are different by ~0.03, or ~3.5%. 

 

However, if I read these two images into Matlab with MRIread() and look at that 
vertex, both images
have the same value, which is 1.9042

 

So it seems like maybe Freeview and Matlab are not reporting the same values 
for the images, and
possibly the images I write in Matlab are somehow getting depressed by 
Freeview.  I’m not able to
stay connected to my cluster for much longer than 10-15 min at the moment, so 
it’s hard for me to
troubleshoot more, but I can provide sample images and code to recreate the 
problem tomorrow.

 

Is this a known issue that somehow images written in Matlab are not read 
properly by Freeview?

 

This is on v5.3.0 and Matlab 2014b.  I can try tomorrow if the issue persists 
in v6.0

 

Thanks,

Jared

 

 

 

[IMAGE]

 

 

From: <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of "Zimmerman, Jared"
<jar...@pennmedicine.upenn.edu>
Reply-To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Date: Friday, February 16, 2018 at 2:12 PM
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] Freesurfer equivalent to fslmaths?

 

Thanks Doug and Bruce, 

 

Fscalc is great because I can do maths with multiple inputs, like a mean.  I’m 
noticing, however,
that when I do a mean with fscalc I get different values than when I do the 
mean in Matlab, any idea
why?  In some regions the differences are as much as 5-10% so I don’t think 
it’s just a
rounding/precision issue.

 

fscalc a.mgh add b.mgh add c.mgh add d.mgh add e.mgh div 5 --odt float --o 
mean.mgh

 

Hard to imagine it’s an order of operations issue, but I am a little confused 
about how fscalc
handles order of operations from the help page.

 

I’m using v5.3.0 and Matlab 2014b

 

Thanks,

Jared

 

From: <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Douglas Greve
<gr...@nmr.mgh.harvard.edu>
Reply-To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Date: Friday, February 16, 2018 at 11:31 AM
To: "freesurfer@nmr.mgh.harvard.edu" <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] Freesurfer equivalent to fslmaths?

 

Or fscalc

 

On 2/16/18 11:22 AM, Bruce Fischl wrote:

  Hi Jared

  I think mris_calc does at least some of what you want.

  cheers
  Bruce
  On Fri, 16 Feb 2018, Zimmerman, Jared wrote:




    Hi all,

     

Is there an equivalent of fslmaths in Freesurfer?  I would like to 
add two
scalar value images (.mgh
files) that are registered to the fsaverage6 surface but I’m not 
seeing an
obvious way to do it. 
Right now I’m reading the images into Matlab to add them, but this 
is a bit
inconvenient because
what I would like to do is smooth an image by a small amount, add 
the
original image back to it,
then smooth again marginally and iterate until I get to a target 
fwhm. 
Since I can’t smooth inside
Matlab this necessitates writing out a temp image for each 
smoothing step
then reading it back into
Matlab for the adding.  Obviously this is a solvable problem, but 
as someone
only marginally
proficient in Matlab it’s something I’d like to avoid, plus it 
seems like a
lot of I/O for this
task.

 

A little more detail on my data and what I’m trying to do:

 

The scalar images I’m working with are network confidence maps, 
basically
like the spatial maps from
an ICA dual-regression.  I want to combine the confidence maps 
together into
a hard partition and
write it to an annot file, but I want to smooth them first.  I’m 
concerned,
however, that smoothing
is going to bias the parcellation against small network parcels and 
in favor
of large network
parcels because in each confidence map the 

Re: [Freesurfer] Freesurfer equivalent to fslmaths?

2018-02-16 Thread Zimmerman, Jared
Thanks Doug and Bruce,

Fscalc is great because I can do maths with multiple inputs, like a mean.  I’m 
noticing, however, that when I do a mean with fscalc I get different values 
than when I do the mean in Matlab, any idea why?  In some regions the 
differences are as much as 5-10% so I don’t think it’s just a 
rounding/precision issue.

fscalc a.mgh add b.mgh add c.mgh add d.mgh add e.mgh div 5 --odt float --o 
mean.mgh

Hard to imagine it’s an order of operations issue, but I am a little confused 
about how fscalc handles order of operations from the help page.

I’m using v5.3.0 and Matlab 2014b

Thanks,
Jared

From: <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Douglas Greve 
<gr...@nmr.mgh.harvard.edu>
Reply-To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Date: Friday, February 16, 2018 at 11:31 AM
To: "freesurfer@nmr.mgh.harvard.edu" <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] Freesurfer equivalent to fslmaths?


Or fscalc

On 2/16/18 11:22 AM, Bruce Fischl wrote:
Hi Jared

I think mris_calc does at least some of what you want.

cheers
Bruce
On Fri, 16 Feb 2018, Zimmerman, Jared wrote:



Hi all,



Is there an equivalent of fslmaths in Freesurfer?  I would like to add two 
scalar value images (.mgh
files) that are registered to the fsaverage6 surface but I’m not seeing an 
obvious way to do it.
Right now I’m reading the images into Matlab to add them, but this is a bit 
inconvenient because
what I would like to do is smooth an image by a small amount, add the original 
image back to it,
then smooth again marginally and iterate until I get to a target fwhm.  Since I 
can’t smooth inside
Matlab this necessitates writing out a temp image for each smoothing step then 
reading it back into
Matlab for the adding.  Obviously this is a solvable problem, but as someone 
only marginally
proficient in Matlab it’s something I’d like to avoid, plus it seems like a lot 
of I/O for this
task.



A little more detail on my data and what I’m trying to do:



The scalar images I’m working with are network confidence maps, basically like 
the spatial maps from
an ICA dual-regression.  I want to combine the confidence maps together into a 
hard partition and
write it to an annot file, but I want to smooth them first.  I’m concerned, 
however, that smoothing
is going to bias the parcellation against small network parcels and in favor of 
large network
parcels because in each confidence map the small parcels will be surrounded by 
lots of zeros (does
this make sense?).  To correct for this, my idea was to iteratively smooth by 
small amounts and to
add the original confidence values (or some fraction of them) back to the 
smoothed map after each
iteration so that regions of high confidence with a small/narrow spatial spread 
do not become
diluted by the smoothing and don’t get taken over by larger high confidence 
regions in nearby
networks.



One final question would be how to smooth on a surface without resampling.  
Right now I’m using
mri_surf2surf and smoothing when I resample to the native mesh, but if I take 
the above approach I
would not want to resample at each smoothing step.  Could I just use 
mri_surf2surf with –srcsubject
and –trgsubject pointing to the same subject?





Thanks,

Jared



Jared P. Zimmerman

jar...@pennmedicine.upenn.edu<mailto:jar...@pennmedicine.upenn.edu>

Neuroscience Graduate Student

Oathes Lab

University of Pennsylvania










___

Freesurfer mailing list

Freesurfer@nmr.mgh.harvard.edu<mailto: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] Freesurfer equivalent to fslmaths?

2018-02-16 Thread Douglas Greve

Or fscalc


On 2/16/18 11:22 AM, Bruce Fischl wrote:

Hi Jared

I think mris_calc does at least some of what you want.

cheers
Bruce
On Fri, 16 Feb 2018, Zimmerman, Jared wrote:



Hi all,



Is there an equivalent of fslmaths in Freesurfer?  I would like to 
add two scalar value images (.mgh
files) that are registered to the fsaverage6 surface but I’m not 
seeing an obvious way to do it.
Right now I’m reading the images into Matlab to add them, but this is 
a bit inconvenient because
what I would like to do is smooth an image by a small amount, add the 
original image back to it,
then smooth again marginally and iterate until I get to a target 
fwhm.  Since I can’t smooth inside
Matlab this necessitates writing out a temp image for each smoothing 
step then reading it back into
Matlab for the adding.  Obviously this is a solvable problem, but as 
someone only marginally
proficient in Matlab it’s something I’d like to avoid, plus it seems 
like a lot of I/O for this

task.



A little more detail on my data and what I’m trying to do:



The scalar images I’m working with are network confidence maps, 
basically like the spatial maps from
an ICA dual-regression.  I want to combine the confidence maps 
together into a hard partition and
write it to an annot file, but I want to smooth them first.  I’m 
concerned, however, that smoothing
is going to bias the parcellation against small network parcels and 
in favor of large network
parcels because in each confidence map the small parcels will be 
surrounded by lots of zeros (does
this make sense?).  To correct for this, my idea was to iteratively 
smooth by small amounts and to
add the original confidence values (or some fraction of them) back to 
the smoothed map after each
iteration so that regions of high confidence with a small/narrow 
spatial spread do not become
diluted by the smoothing and don’t get taken over by larger high 
confidence regions in nearby

networks.



One final question would be how to smooth on a surface without 
resampling.  Right now I’m using
mri_surf2surf and smoothing when I resample to the native mesh, but 
if I take the above approach I
would not want to resample at each smoothing step.  Could I just use 
mri_surf2surf with –srcsubject

and –trgsubject pointing to the same subject?





Thanks,

Jared



Jared P. Zimmerman

jar...@pennmedicine.upenn.edu

Neuroscience Graduate Student

Oathes Lab

University of Pennsylvania










___
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] Freesurfer equivalent to fslmaths?

2018-02-16 Thread Bruce Fischl

Hi Jared

I think mris_calc does at least some of what you want.

cheers
Bruce
On Fri, 16 Feb 2018, 
Zimmerman, Jared wrote:




Hi all,

 

Is there an equivalent of fslmaths in Freesurfer?  I would like to add two 
scalar value images (.mgh
files) that are registered to the fsaverage6 surface but I’m not seeing an 
obvious way to do it. 
Right now I’m reading the images into Matlab to add them, but this is a bit 
inconvenient because
what I would like to do is smooth an image by a small amount, add the original 
image back to it,
then smooth again marginally and iterate until I get to a target fwhm.  Since I 
can’t smooth inside
Matlab this necessitates writing out a temp image for each smoothing step then 
reading it back into
Matlab for the adding.  Obviously this is a solvable problem, but as someone 
only marginally
proficient in Matlab it’s something I’d like to avoid, plus it seems like a lot 
of I/O for this
task.

 

A little more detail on my data and what I’m trying to do:

 

The scalar images I’m working with are network confidence maps, basically like 
the spatial maps from
an ICA dual-regression.  I want to combine the confidence maps together into a 
hard partition and
write it to an annot file, but I want to smooth them first.  I’m concerned, 
however, that smoothing
is going to bias the parcellation against small network parcels and in favor of 
large network
parcels because in each confidence map the small parcels will be surrounded by 
lots of zeros (does
this make sense?).  To correct for this, my idea was to iteratively smooth by 
small amounts and to
add the original confidence values (or some fraction of them) back to the 
smoothed map after each
iteration so that regions of high confidence with a small/narrow spatial spread 
do not become
diluted by the smoothing and don’t get taken over by larger high confidence 
regions in nearby
networks.

 

One final question would be how to smooth on a surface without resampling.  
Right now I’m using
mri_surf2surf and smoothing when I resample to the native mesh, but if I take 
the above approach I
would not want to resample at each smoothing step.  Could I just use 
mri_surf2surf with –srcsubject
and –trgsubject pointing to the same subject?

 

 

Thanks,

Jared



Jared P. Zimmerman

jar...@pennmedicine.upenn.edu

Neuroscience Graduate Student

Oathes Lab

University of Pennsylvania

 

 


___
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] Freesurfer equivalent to fslmaths?

2018-02-16 Thread Zimmerman, Jared
Hi all,

Is there an equivalent of fslmaths in Freesurfer?  I would like to add two 
scalar value images (.mgh files) that are registered to the fsaverage6 surface 
but I’m not seeing an obvious way to do it.  Right now I’m reading the images 
into Matlab to add them, but this is a bit inconvenient because what I would 
like to do is smooth an image by a small amount, add the original image back to 
it, then smooth again marginally and iterate until I get to a target fwhm.  
Since I can’t smooth inside Matlab this necessitates writing out a temp image 
for each smoothing step then reading it back into Matlab for the adding.  
Obviously this is a solvable problem, but as someone only marginally proficient 
in Matlab it’s something I’d like to avoid, plus it seems like a lot of I/O for 
this task.

A little more detail on my data and what I’m trying to do:

The scalar images I’m working with are network confidence maps, basically like 
the spatial maps from an ICA dual-regression.  I want to combine the confidence 
maps together into a hard partition and write it to an annot file, but I want 
to smooth them first.  I’m concerned, however, that smoothing is going to bias 
the parcellation against small network parcels and in favor of large network 
parcels because in each confidence map the small parcels will be surrounded by 
lots of zeros (does this make sense?).  To correct for this, my idea was to 
iteratively smooth by small amounts and to add the original confidence values 
(or some fraction of them) back to the smoothed map after each iteration so 
that regions of high confidence with a small/narrow spatial spread do not 
become diluted by the smoothing and don’t get taken over by larger high 
confidence regions in nearby networks.

One final question would be how to smooth on a surface without resampling.  
Right now I’m using mri_surf2surf and smoothing when I resample to the native 
mesh, but if I take the above approach I would not want to resample at each 
smoothing step.  Could I just use mri_surf2surf with –srcsubject and 
–trgsubject pointing to the same subject?


Thanks,
Jared

Jared P. Zimmerman
jar...@pennmedicine.upenn.edu
Neuroscience Graduate Student
Oathes Lab
University of Pennsylvania


___
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.