Commit fdc2f62f authored by Christoph Arthofer's avatar Christoph Arthofer
Browse files

added lesion mask support

parent f52f009c
......@@ -53,7 +53,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 \n' \
'use_mask_mov_scalar = 0 0 \n' \
'use_mask_mov_scalar = 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 \n' \
'fwhm_mov_scalar = 8.0 8.0 \n' \
'lambda_scalar = 1 1 \n' \
......@@ -93,7 +93,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 1 \n' \
'use_mask_mov_scalar = 0 0 0 \n' \
'use_mask_mov_scalar = 1 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 4.0 \n' \
'fwhm_mov_scalar = 8.0 8.0 4.0 \n' \
'lambda_scalar = 1 1 1 \n' \
......@@ -133,7 +133,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 1 1 \n' \
'use_mask_mov_scalar = 0 0 0 0 \n' \
'use_mask_mov_scalar = 1 1 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 4.0 2.0 \n' \
'fwhm_mov_scalar = 8.0 8.0 4.0 2.0 \n' \
'lambda_scalar = 1 1 1 1 \n' \
......@@ -173,7 +173,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 1 1 1 \n' \
'use_mask_mov_scalar = 0 0 0 0 0 \n' \
'use_mask_mov_scalar = 1 1 1 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 4.0 2.0 1.0 \n' \
'fwhm_mov_scalar = 8.0 8.0 4.0 2.0 1.0 \n' \
'lambda_scalar = 1 1 1 1 1 \n' \
......@@ -213,7 +213,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 1 1 1 1 \n' \
'use_mask_mov_scalar = 0 0 0 0 0 0 \n' \
'use_mask_mov_scalar = 1 1 1 1 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 4.0 2.0 1.0 0.5 \n' \
'fwhm_mov_scalar = 8.0 8.0 4.0 2.0 1.0 0.5 \n' \
'lambda_scalar = 1 1 1 1 1 1 \n' \
......@@ -253,7 +253,7 @@ def writeConfig(step,mod,fpath):
'; Whole-head T1 \n' \
'use_implicit_mask = 0 \n' \
'use_mask_ref_scalar = 1 1 1 1 1 1 1 \n' \
'use_mask_mov_scalar = 0 0 0 0 0 0 0 \n' \
'use_mask_mov_scalar = 1 1 1 1 1 1 1 \n' \
'fwhm_ref_scalar = 8.0 8.0 4.0 2.0 1.0 0.5 0.25 \n' \
'fwhm_mov_scalar = 8.0 8.0 4.0 2.0 1.0 0.5 0.25 \n' \
'lambda_scalar = 1 1 1 1 1 1 1 \n' \
......@@ -477,8 +477,8 @@ def applyWarpWrapper(img_path, ref_path, warped_path, warp_path, interp='spline'
# return job_id
def submitJob(name, log_dir, queue, wait_for=[], script=None, command=None, coprocessor_class=None, export_var=None,
debug=False):
def fslsubWrapper(name, log_dir, queue, wait_for=[], script=None, command=None, coprocessor_class=None,
coprocessor=None, export_var=None, debug=False):
"""! Wrapper for fslsub - submits a job to the cluster. This function can be easily extended to work with other workload managers.
@param name: Job name
......@@ -493,23 +493,28 @@ def submitJob(name, log_dir, queue, wait_for=[], script=None, command=None, copr
@return The job ID.
"""
cmd = 'fsl_sub -n'
job_ids_bool = [job != '' for job in wait_for]
if wait_for and any(job_ids_bool):
cmd += ' -j '
wait_for_arr = np.array(wait_for)
wait_for_arr = wait_for_arr[job_ids_bool]
for j, job in enumerate(wait_for_arr):
cmd += job.replace("\n", "")
if j < len(wait_for_arr) - 1:
cmd += ','
cmd = 'fsl_sub'
if wait_for:
job_ids_bool = [job != '' for job in wait_for]
if any(job_ids_bool):
cmd += ' -j '
wait_for_arr = np.array(wait_for)
wait_for_arr = wait_for_arr[job_ids_bool]
for j, job in enumerate(wait_for_arr):
cmd += job.replace("\n", "")
if j < len(wait_for_arr) - 1:
cmd += ','
cmd += ' -N ' + name + \
' -l ' + log_dir + \
' -q ' + queue
if coprocessor_class is not None :
cmd += ' --coprocessor cuda'
if coprocessor_class is not None:
cmd += ' --coprocessor_class ' + coprocessor_class
cmd += ' --coprocessor_class_strict '
if coprocessor is not None:
cmd += ' --coprocessor ' + coprocessor + ' -R 32'
if export_var is not None :
cmd += ' --export ' + export_var
......@@ -1348,7 +1353,7 @@ if __name__ == "__main__":
aff_ref_scalar = [tree.get('identity_mat')]
aff_mov_scalar = [tree.get('T1_to_MNI_mat')]
mask_ref_scalar = [img_ref_T1brain_mask_path]
mask_mov_scalar = ['NULL']
mask_mov_scalar = [tree.get('lesion_mask_in_T1')]
img_ref_tensor = []
img_mov_tensor = []
aff_ref_tensor = []
......@@ -1387,7 +1392,7 @@ if __name__ == "__main__":
job_ids[28] = submitJob(tag+'_'+task_name, log_dir, script=script_path, queue=gpuq,
wait_for=list(itemgetter(*[21, 23, 24, 25, 26, 27, 28, 44, 45, 46, 47, 48, 50])(job_ids)),
coprocessor_class='P',
coprocessor_class=None, coprocessor='cuda',
export_var=export_var_str['SINGULARITY_BIND'], debug=False)
print('submitted: ' + task_name)
......
......@@ -6,3 +6,4 @@ ext_mat=.mat
T1_orig{ext_nii} (T1_head)
T1_brain{ext_nii} (T1_brain)
T1_brain_mask{ext_nii} (T1_brain_mask)
T2Lesion_in_T1{ext_nii} (lesion_mask_in_T1)
\ No newline at end of file
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