Hi Andreas:

Very kind of you to share your code. I am sure many of us will benefit from
this.

thanks,

Alan Francis


On Mon, Jul 21, 2014 at 9:12 AM, Andreas Berger <
n0642...@students.meduniwien.ac.at> wrote:

> Hello FreeSurfers,
>
> during the course of my diploma thesis i wrote a few R functions around
> FreeSurfer, mainly for group analysis of FreeSurfer surface data in R. I
> thought i'd just contribute the code here, on the off chance that
> someone may find it useful, and despite the code quality (i wrote this
> as part of me learning R, so it may actually set your house on fire and
> so on). It could be of use for someone already working in R and looking
> to bring FreeSurfer data into it, or someone looking for an alternative
> to QDEC and the plots created by QDEC. Hardware requirement is not
> entirely modest unfortunately; it eats up about 8G of memory and takes
> about 15 minutes around here.
>
>
> Here's an example of how it is used:
>
>
> ############################ BEGIN R CODE ##############################
> # Presupposing that you have a dataframe 'data' containing your group
> # description and that all subjects have been processed in ~/subjects
>
> ### Group analysis with lm ###
> # Run the model. This takes some time and memory.
> lm <- freesurfer.group.analysis.lm(data = data, formula = thickness ~
> Age + Gender + Diagnosis, hemi = "lh", fwhm = 10, template =
> "fsaverage", freesurfer_subjects_dir = "~/subjects")
>
> # Extract t values from the model, do FDR correction
> t <- freesurfer.group.analysis.lm.stats(lm, type.of.value = "t",
> correction="fdr")
>
> # Write the t values to mgh files and open them in FreeSurfer's freeview
> freesurfer.group.analysis.lm.stats.to.mgh(t, hemi = "lh", template =
> "fsaverage", freesurfer_subjects_dir = "~/subjects", launch.freeview =
> TRUE)
>
> # Write the t values to .dset ASCII files and open them in AFNI's SUMA
> freesurfer.group.analysis.lm.stats.to.suma(t, hemi = "lh", template =
> "fsaverage", freesurfer_subjects_dir = "~/subjects", launch.suma = TRUE)
>
> # Make nice plots for vertex #1000
> freesurfer.group.analysis.lm.plot(lm, vertex = 1000, interactive = TRUE)
>
>
> ### Group analysis with QDEC ###
> # Call QDEC
> freesurfer.group.analysis.QDEC(data = data, freesurfer_subjects_dir =
> "~/subjects")
>
>
> ### Extract stats ###
> # Get segmentation stats
> segstats <- freesurfer.get.segstats(subjects = data$ID,
> freesurfer_subjects_dir = "~/subjects")
> ############################## END R CODE ##############################
>
>
> i uploaded the R package here, i called it freesurfR:
> https://www.nitrc.org/projects/freesurf_r/
>
> thanks also goes to Heath Pardoe, whose code for reading and writing MGH
> files (also posted on this list) i was allowed to include.
>
>
> regards,
> Andreas
> _______________________________________________
> 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.

Reply via email to