[Neuroimaging] Integrating Freesurfer with Python

Katelyn Arnemann klarnemann at gmail.com
Tue Sep 5 14:28:16 EDT 2017


I'm not sure what exactly you want to accomplish, but here are some basic
things I do:

I run freesurfer commands in python as such:
>
> import os
cmd = 'recon-all -i %s -sd %s -subjid %s' %(dicom_file, subid,
subid_directory)
os.system(cmd)


After converting freesurfer files to nifti, I open them using nibabel:

import nibabel as ni
f = '%s' % (nifti_file)
data = ni.load(f).get_data()


On Mon, Sep 4, 2017 at 7:24 AM, Yaroslav Halchenko <lists at onerussian.com>
wrote:

>
> On Mon, 04 Sep 2017, Maksimovskiy, Arkadiy wrote:
>
> >    Hi Everyone,
>
>
>
> >    My apologies for the basic question. I am a beginner at integrating
> >    Freesurfer commands into python scripts, and was wondering if anyone
> has
> >    suggestions on what would be the best way to do it. Specifically, for
> a
> >    python program that uses Freesurfer commands, is it possible to source
> >    Freesurfer within the python script and then use the commands? Or does
> >    sourcing the environment need to happen prior to running such scripts?
>
> have you looked into using nipype?
> http://nipype.readthedocs.io/en/latest/
> it provides interfaces for the majority of open source toolkits in
> neuroimaging (freesurfer included) and a number of precrafted analysis
> pipelines
>
> --
> Yaroslav O. Halchenko
> Center for Open Neuroscience     http://centerforopenneuroscience.org
> Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
> Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
> WWW:   http://www.linkedin.com/in/yarik
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>



-- 
Katelyn Arnemann (née Begany)
PhD Candidate
University of California, Berkeley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20170905/6fccae0f/attachment.html>


More information about the Neuroimaging mailing list