Commit 0359cdb3 authored by Christoph Arthofer's avatar Christoph Arthofer
Browse files

lesion + brain mask for moving image in registration; mean for 2 iterations...

lesion + brain mask for moving image in registration; mean for 2 iterations and median for all following iterations; additional iteration 7
parent 4d0f1da2
......@@ -400,6 +400,9 @@ def clampImage(img_path, out_path):
img_clamped_nib = nib.Nifti1Image(img_clamped_np, affine=img_nib.affine, header=img_nib.header)
img_clamped_nib.to_filename(out_path)
def maskPreprocessing(tree):
fslmaths(tree.get('data/T1_brain_mask')).thr(0.1).bin().mul(7).add(1).inm(1).run(tree.get('T1_weighted_brain_mask'))
fslmaths(tree.get('data/lesion_mask_in_T1')).binv().mul(tree.get('T1_weighted_brain_mask')).run(tree.get('inverse_lesion_and_brain_mask_in_T1'))
def averageImages(img_paths, out_path, mod='average', norm_bool=False):
"""! Creates an average image from individual (non)normalised images.
......@@ -892,7 +895,7 @@ if __name__ == "__main__":
tree = tree.update(sub_id=aff_ref_id, ref_id=aff_ref_id)
affine_ref_path = tree.get(mod['T1_brain_key'])
# Soft clamping of high skull intensities
# Soft clamping of high skull intensities and mask preprocessing
task_name = '{:03d}_prep_clamping'.format(task_count)
script_path = os.path.join(script_dir, task_name + '.sh')
with open(script_path, 'w+') as f:
......@@ -905,10 +908,12 @@ if __name__ == "__main__":
args=(T1_head_path, T1_clamped_path),
tmp_dir=script_dir,
kwargs=None,
clean="never")
jobcmd = jobcmd + '\n'
jobcmd = jobcmd + 'fslmaths ' + tree.get('data/T1_brain_mask') + ' -thr 0.1 -bin -mul 7 -add 1 -inm 1 ' + tree.get('T1_weighted_brain_mask') + '\n'
jobcmd = jobcmd + 'fslmaths ' + tree.get('data/lesion_mask_in_T1') + ' -binv -mul ' + tree.get('T1_weighted_brain_mask') + tree.get('inverse_lesion_and_brain_mask_in_T1') + '\n'
clean="never") + '\n'
jobcmd += func_to_cmd(maskPreprocessing,
args=(tree,),
tmp_dir=script_dir,
kwargs=None,
clean="never") + '\n'
f.write(jobcmd)
# job_ids[0] = submitJob(tag+'_'+task_name, log_dir, script=script_path, queue=cpuq)
job_ids[0] = submitJob(script_path, tag+'_'+task_name, log_dir, queue=cpuq, wait_for=None, array_task=True, jobram=jobram_low, jobtime=jobtime_low)
......@@ -1435,11 +1440,11 @@ if __name__ == "__main__":
if affine_on:
job_ids[28] = submitJob(script_path, tag + '_' + task_name, log_dir, queue=gpuq,
wait_for=list(itemgetter(*[21, 23, 24, 25, 26, 27, 28, 44, 45, 46, 47, 48, 50])(job_ids)),
array_task=True, coprocessor='cuda', coprocessor_class=None, coprocessor_multi="1", threads=1, export_var=[export_var_str['SINGULARITY_BIND']], jobtime=jobtime_high)
array_task=True, coprocessor='-R 32', coprocessor_class=None, coprocessor_multi="1", threads=1, export_var=[export_var_str['SINGULARITY_BIND']], jobtime=jobtime_high)
else:
job_ids[28] = submitJob(script_path, tag + '_' + task_name, log_dir, queue=gpuq,
wait_for=list(itemgetter(*[44, 45, 46, 47, 48, 50])(job_ids)),
array_task=True, coprocessor='cuda', coprocessor_class=None, coprocessor_multi="1", threads=1, export_var=[export_var_str['SINGULARITY_BIND']], jobtime=jobtime_high)
array_task=True, coprocessor='-R 32', coprocessor_class=None, coprocessor_multi="1", threads=1, export_var=[export_var_str['SINGULARITY_BIND']], jobtime=jobtime_high)
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