nipy / PySurfer

Cortical neuroimaging visualization in Python
https://pysurfer.github.io/
BSD 3-Clause "New" or "Revised" License
240 stars 97 forks source link

Check environment and run FreeSurferEnv.sh if necessary #132

Closed effigies closed 9 years ago

effigies commented 9 years ago

Addresses #102.

Check os.environ and run $FREESURFER_HOME/FreeSurferEnv.sh if not the most recent script to edit the PATH. Parse the resulting environment and pass to mri_vol2surf, avoiding modifying the base process environment.

larsoner commented 9 years ago

LGTM. I assume you've tried it and it works?

effigies commented 9 years ago

Yes, run through all new paths.

effigies commented 9 years ago

Though, it would mistake a manual PATH="$FREESURFER/bin:$PATH" for having previously run FreeSurferEnv.sh. If that's a problem, I could use a different check.

A possibility, since mri_vol2surf depends on $SUBJECTS_DIR:

if not (env['PATH'].startswith(os.path.join(env['FREESURFER_HOME'], 'bin'))
        and 'SUBJECTS_DIR' in env):
larsoner commented 9 years ago

I think that's an okay corner case to address later if need be

coveralls commented 9 years ago

Coverage Status

Coverage decreased (-0.25%) to 72.31% when pulling b70372def668090a12cbe26c2d2a73af9e36e253 on effigies:freesurfer_env into bcdd7a08ccc56dec9272b211922cb09d7247b4f9 on nipy:master.

agramfort commented 9 years ago

if this works I am happy

mwaskom commented 9 years ago

This won't work on windows, but I am guessing that is not an issue because this whole function won't work on windows anyway?

effigies commented 9 years ago

That was my assumption.

larsoner commented 9 years ago

Thanks @effigies!