Skip to content
Snippets Groups Projects
Commit 6b19dd03 authored by Fidel Alfaro Almagro's avatar Fidel Alfaro Almagro :speech_balloon:
Browse files

Changing the env variable modification for FreeSurfer

parent 60bc491a
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ def run(ctx, ...@@ -31,7 +31,7 @@ def run(ctx,
if os.path.exists(FreeSurfer_dir): if os.path.exists(FreeSurfer_dir):
shutil.rmtree(FreeSurfer_dir) shutil.rmtree(FreeSurfer_dir)
subjects_dir=os.getcwd() env = dict(os.environ, SUBJECTS_DIR=os.getcwd())
os.environ["SUBJECTS_DIR"] = subjects_dir + "/" + ctx.subject os.environ["SUBJECTS_DIR"] = subjects_dir + "/" + ctx.subject
T1_path = subjects_dir + "/" + T1_unbiased T1_path = subjects_dir + "/" + T1_unbiased
...@@ -42,7 +42,7 @@ def run(ctx, ...@@ -42,7 +42,7 @@ def run(ctx,
if os.path.exists(T2_FLAIR_unbiased): if os.path.exists(T2_FLAIR_unbiased):
cmd += " -FLAIR " + T2_path + " -FLAIRpial" cmd += " -FLAIR " + T2_path + " -FLAIRpial"
output = run_command(log, cmd) output = run_command(log, cmd, env)
log.info(output) log.info(output)
......
...@@ -22,10 +22,10 @@ from subprocess import check_output ...@@ -22,10 +22,10 @@ from subprocess import check_output
from fsl import wrappers from fsl import wrappers
def run_command(logger, command): def run_command(logger, command, env):
try: try:
logger.info('COMMAND TO RUN: \t' + command.strip()) logger.info('COMMAND TO RUN: \t' + command.strip())
job_output = check_output(command, shell=True).decode('UTF-8') job_output = check_output(command, shell=True, env=env).decode('UTF-8')
logger.info('COMMAND OUTPUT: \t' + job_output.strip()) logger.info('COMMAND OUTPUT: \t' + job_output.strip())
except Exception as e: except Exception as e:
logger.error('Exception raised during: \t' + command.strip()) logger.error('Exception raised during: \t' + command.strip())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment