Commit 29c37353 authored by Christoph Arthofer's avatar Christoph Arthofer
Browse files

upgraded to new version of Filetree

parent 2de507c6
......@@ -3,9 +3,9 @@ ext_mat=.mat
ext_ini=.ini
ext_txt=.txt
{data_dir}
!{data_dir}
->data (data)
{template_dir}
!{template_dir}
misc (misc_dir)
ident{ext_mat} (identity_mat)
log (log_dir)
......@@ -69,6 +69,7 @@ ext_txt=.txt
nln_template_T1_brain_mask_{step_id}_{it_id}{ext_nii} (T1_brain_mask_nln_template)
nln_template_T1_brain_mask_weighted_{step_id}_{it_id}{ext_nii} (T1_brain_mask_weighted_nln_template)
nln_template_T1_brain_SD_{step_id}_{it_id}{ext_nii} (T1_brain_SD_nln_template)
nln_template_T1_head_SD_{step_id}_{it_id}{ext_nii} (T1_head_SD_nln_template)
nln_template_T1_head_{step_id}_{it_id}{ext_nii} (T1_head_nln_template)
nln_template_T2_head_{step_id}_{it_id}{ext_nii} (T2_head_nln_template)
nln_template_DTI_{step_id}_{it_id}{ext_nii} (DTI_nln_template)
......
......@@ -15,8 +15,8 @@ import nibabel as nib
import numpy as np
from fsl.wrappers import fslmaths,flirt,applyxfm,concatxfm,bet,fast,fslstats
from fsl.wrappers.fnirt import invwarp, applywarp, convertwarp
# from file_tree import FileTree
from fsl.utils.filetree import FileTree
from file_tree import FileTree
# from fsl.utils.filetree import FileTree
from fsl.utils.fslsub import func_to_cmd
from operator import itemgetter
import tempfile
......@@ -433,7 +433,6 @@ def submitJob(name, log_dir, queue, wait_for=[], script=None, command=None, copr
@return The job ID.
"""
cmd = 'fsl_sub'
if wait_for and any(job != '' for job in wait_for):
cmd += ' -j '
......@@ -466,7 +465,6 @@ def submitJob(name, log_dir, queue, wait_for=[], script=None, command=None, copr
return job_id
def RMSdifference(img1_path, img2_path, mask1_path=None, mask2_path=None, rms_path=None):
"""! Calculates the difference between two images or warps as the root mean squared (RMS)
......@@ -748,7 +746,7 @@ if __name__ == "__main__":
os.mkdir(base_dir, mode=0o700) if not os.path.exists(base_dir) else print(base_dir + ' exists')
os.chmod(base_dir, 0o700)
tree = FileTree.read(tree_path, directory='')
tree = FileTree.read(tree_path, top_level='')
tree = tree.update(data_dir=data_dir, template_dir=base_dir)
script_dir = tree.get('script_dir')
......@@ -1215,7 +1213,7 @@ if __name__ == "__main__":
img_ref_T1brain_path = tree.get('T1_brain_affine_template')
img_ref_T1head_path = tree.get('T1_head_affine_template')
img_ref_T2head_path = tree.get('T2_head_affine_template')
img_ref_tensor_path = tree.get('DTI_tensor_affine_template')
img_ref_tensor_path = tree.get('T1_head_affine_template')
img_ref_T1brain_mask_path = tree.get('T1_brain_mask_weighted_affine_template')
else:
if it == 1:
......@@ -1229,7 +1227,7 @@ if __name__ == "__main__":
img_ref_T1brain_path = tree.get('T1_brain_nln_template')
img_ref_T1head_path = tree.get('T1_head_nln_template')
img_ref_T2head_path = tree.get('T2_head_nln_template')
img_ref_tensor_path = tree.get('DTI_tensor_nln_template')
img_ref_tensor_path = tree.get('T1_head_nln_template')
img_ref_T1brain_mask_path = tree.get('T1_brain_mask_weighted_nln_template')
avgwarp_prev_it_path = tree.get('avg_warp')
avgmask_prev_it_path = tree.get('T1_brain_mask_nln_template')
......@@ -1706,7 +1704,7 @@ if __name__ == "__main__":
tmp_dir=script_dir, kwargs=None,
clean="never")
job_ids[52] = submitJob(tag+'_'+task_name, log_dir, command=jobcmd, queue=cpuq,
wait_for=[job_ids[44]])
wait_for=list(itemgetter(*[44,49])(job_ids)))
print('submitted: ' + task_name)
# RMS of intensity standard deviation of individual images in template space
......@@ -1718,14 +1716,14 @@ if __name__ == "__main__":
img_paths.append(tree.get('warped_T1brain'))
jobcmd = func_to_cmd(RMSstandardDeviation, args=(img_paths,
tree.get('T1_brain_nln_template'),
tree.get('T1_head_nln_template'),
tree.get('T1_brain_mask_nln_template'),
tree.get('T1_brain_SD_nln_template'),
tree.get('T1_head_SD_nln_template'),
tree.get('sd_intensity_output')),
tmp_dir=script_dir, kwargs=None,
clean="never")
job_ids[53] = submitJob(tag+'_'+task_name, log_dir, command=jobcmd, queue=cpuq,
wait_for=[job_ids[44]])
wait_for=list(itemgetter(*[45, 49])(job_ids)))
print('submitted: ' + task_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment