[Freesurfer] Freesurfer equivalent to fslmaths?
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.
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: on behalf of Douglas Greve Reply-To: Freesurfer support list Date: Friday, February 16, 2018 at 11:31 AM To: "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] mni152reg yields bad registration
External Email - Use Caution Thanks Doug, Yeah, I’m confused as to what happened with that registration too. I just used ANTs to do the warping and that worked well. Good to know about mri_cvs_register though, I will try to use that next time. -jared On 4/19/18, 12:12 PM, "freesurfer-boun...@nmr.mgh.harvard.edu on behalf of Douglas N. Greve" wrote: I don't know what might have happened (under the hood, mni152reg uses the FSL flirt program). If you want a non-linear registration, then you'll need to use CVS (mri_cvs_register) and choose the mni target. If you just want the aparc of the aparc+aseg, then don't go into the volume at all. On 04/17/2018 01:57 PM, Zimmerman, Jared wrote: > > Hi All, > > I’m trying to register the aparc+aseg volumes from subject T1 space to > MNI152 space and running into problems. I’ve taken the following steps > > 1.mri152reg –s Subj241 > > 2.mri_vol2vol --targ $FSLDIR/data/standard/MNI152_T1_2mm_brain.nii.gz > --mov $SUBJECTS_DIR/Subj241/mri/aparc+aseg.mgz --o > Subj241_aparc+aseg_mni2mm.nii.gz --reg > $SUBJECTS_DIR/Subj241/mri/transforms/reg.mni152.2mm.dat > > This yields an image that is rotated and shrunken relative to the > MNI152_T1_2mm template as shown in the attached image. > > I’m wondering if this is the right way to do what I’d like to do. The > reg.mni152.2mm.dat file is only a linear transform, but I’d like to > apply a non-linear transformation to the subject aparc+aseg to get it > well matched to the MNI152 template space. Some of my subjects have > atypical head shapes and I really think a non-linear warp will be > necessary to achieve a good fit. > > I’ve run the MNI152 1mm template through recon-all so I have that as a > reference. Is there a way to map volumes from one subject space to > another via fsaverage or sphere sort of like mri_label2label does for > labels? > > Alternatively, I could just calculate the appropriate T1 to MNI warps > with FNIRT or ANTs and apply those to the aparc+aseg, but I figured it > would be possible to do with FreeSurfer without calculating any new > transforms. > > Thanks, > > Jared > > > > ___ > 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
[Freesurfer] mris_compute_parc_overlap average minimum distance measurement
External Email - Use Caution Hi Freesurfers, I’m using mris_compute_parc_overlap to compare the similarity between two parcellations and I’m curious about how the average minimum distance measurement is calculated. The help text for the function says “… a table of mean minimum distances between corresponding labels.” My questions are 1) what set of measurements is being meaned here, and 2) what exactly is the measurement. My current interpretation is that for every vertex in annot1 the minimum distance to a vertex in annot2 with the same label is calculated such that overlapping regions have a distance of zero. The mean is then calculated over these distance measures for all vertices in a given label. If this is true, do you recommend doing any subject level corrections? Seems like subjects with larger cortical surface areas would be biased to have larger distances. Thanks, Jared ___ 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] resampling to native space for recons with multiple T1s
External Email - Use Caution Hi Freesurfers, What’s the best way to resample recon data such as aparc+aseg.mgz into scanner space for recons with multiple T1s? Right now I’m using mri_vol2vol with –regheader to resample from orig space to rawavg, then using mri_vol2vol again with the 001.lta, 002.lta etc. registration matrices to get it back to the original scanner space for each T1. Is there a way to do this without two interpolation steps? Thanks, jared ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] [External] Re: resampling to native space for recons with multiple T1s
External Email - Use Caution Thanks, I'll give this a shot. On 5/2/19, 4:39 PM, "freesurfer-boun...@nmr.mgh.harvard.edu on behalf of Greve, Douglas N.,Ph.D." wrote: First, create an LTA to go from the orig to rawavg space: tkregister2 --noedit --mov orig.mgz --targ rawavg.mgz --reg deleteme.dat --ltaout reg.orig-to-rawavg.lta --regheader Then concatenate with the input volume lta, eg, mri_concatenate_lta -invert2 reg.orig-to-rawavg.lta 001.lta reg.orig-to-001.lta Check: tkregister2 --mov orig.mgz --targ 001.mgz --reg reg.orig-to-001.lta The to volumes should be in registration Then use mri_vol2vol (intensity image) or mri_label2vol (segmenation) to resample On 5/2/19 4:15 PM, Zimmerman, Jared wrote: > > External Email - Use Caution > > Hi Freesurfers, > > What’s the best way to resample recon data such as aparc+aseg.mgz into > scanner space for recons with multiple T1s? Right now I’m using > mri_vol2vol with –regheader to resample from orig space to rawavg, > then using mri_vol2vol again with the 001.lta, 002.lta etc. > registration matrices to get it back to the original scanner space for > each T1. Is there a way to do this without two interpolation steps? > > Thanks, > > jared > > > ___ > 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 ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] Connectivity design ill-conditioned
Thanks Doug, this worked. Misconfigured my nuisance regressor seeds. Matrix still has 47 columns, but it seems to be appropriately designed. Best, Jared Message: 2 Date: Thu, 26 May 2016 12:14:27 -0400 From: Douglas N Greve Subject: Re: [Freesurfer] Connectivity design ill-conditioned To: freesurfer@nmr.mgh.harvard.edu Message-ID: <574720e3.30...@nmr.mgh.harvard.edu> Content-Type: text/plain; charset=windows-1252; format=flowed It is strange that it has 47 columns, I would have expected 48, however, the current problem is caused by the wm.dat and vcsf.dat having the same content. Probably it was an error when you set up the command line for fcseed-config On 05/25/2016 06:40 PM, Zimmerman, Jared Perry wrote: > Hi, I'm having a problem running first level connectivity analysis on > my resting-state data. When I run selxavg3-sess I keep getting a > notice that my design is ill-conditioned but I can't figure out why. > I am trying to run analysis on two 124 volume rsfMRI runs in my fsd > and the design matrix looks fine to me with dimensions 248x47 > (although should ncols be an even number since I'm doing two runs?). > > Poking around the Xtmp.mat I noticed a few things that are confusing. > Notably, flac.funcfspec points only to one of my runs in the fsd, and > flac.X is a 124x24 matrix which appears to be the design matrix for > just one of my runs (and if there are 24 columns in that, should there > be 28 columns in the design matrix for combining both runs?). Any > help figuring out why this design is ill-conditioned would be great. > > I've attached my Xtmp.mat, selxavg3.log and analysis design file to > this email, but it's unclear to me if the mailing list will scrub them > off. If so I can make them available some other way. > > > Thanks, > Jared > > > ___ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Douglas N. Greve, Ph.D. MGH-NMR Center gr...@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422 ___ 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.