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

Making the diffusion more flexible

parent 9d42ab86
No related branches found
No related tags found
No related merge requests found
Pipeline #17723 passed
Source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
......@@ -47,8 +47,9 @@ def run(ctx,
outdir=logs_dir):
t_name = autoptx_tract.value
# TODO: Allow for customization for this multiplication factor
t_seeds = int(ctx.tract_struct[t_name]["num_seeds"] * 300)
seed_mult = ctx.get('dMRI_multiplier_autoPtx_seeds', 300)
t_seeds = int(ctx.tract_struct[t_name]["num_seeds"] * seed_mult)
orig_tract_dir = ctx.get_data('dMRI/autoptx/protocols/' + t_name + '/')
FMRIB58_FA_1mm = ctx.get_standard('FMRIB58_FA_1mm.nii.gz')
......
......@@ -37,12 +37,11 @@ def run(ctx,
list_vals = []
b_vals = np.loadtxt(eddy_bvals)
b_vecs = np.loadtxt(eddy_bvecs)
lim_file = ctx.get_data('dMRI/b0_threshold.txt')
lim_file = ctx.get('dMRI_b0_threshold', 100)
lim = int(np.loadtxt(lim_file))
# TODO: This can be modifiable by the user
b_value_shell_to_keep = 1000
b_value_shell_to_keep = ctx.get('dMRI_b_value_shell', 1000)
for count, b_val in enumerate(b_vals):
# These are the b0 images: They are automatically included
......
......@@ -7,7 +7,7 @@
# Author: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
#
# pylint: disable=C0103,E0602,C0114,C0115,C0116,R0913,R0914,R0915
# pylint: disable=W0613
# pylint: disable=W0613,W0719,R0912
#
import os
......@@ -23,8 +23,10 @@ log = logging.getLogger(__name__)
def run(ctx,
AP: In,
AP_bval: In,
AP_bvec: In,
AP_bval: In(optional=True),
AP_bvec: In(optional=True),
PA_bval: In(optional=True),
PA_bvec: In(optional=True),
AP_best_index: In,
fieldmap_iout_mean: In,
fieldmap_mask: In,
......@@ -45,6 +47,32 @@ def run(ctx,
with redirect_logging(job_name(run), outdir=logs_dir):
# Adapting the code to let the user use commin BVAL and BVEC files
folder_b_files = ctx.get("dMRI_b_files", "")
if op.exists(folder_b_files):
new_AP_bval = op.join(folder_b_files, "AP.bval")
new_PA_bval = op.join(folder_b_files, "PA.bval")
new_AP_bvec = op.join(folder_b_files, "AP.bvec")
new_PA_bvec = op.join(folder_b_files, "PA.bvec")
if op.exists(new_AP_bval):
copyfile(src=new_AP_bval, dst=AP_bval)
else:
raise Exception("Missing AP.bval in " + folder_b_files)
if op.exists(new_PA_bval):
copyfile(src=new_PA_bval, dst=PA_bval)
else:
raise Exception("Missing PA.bval in " + folder_b_files)
if op.exists(new_AP_bvec):
copyfile(src=new_AP_bvec, dst=AP_bvec)
else:
raise Exception("Missing AP.bvec in " + folder_b_files)
if op.exists(new_PA_bvec):
copyfile(src=new_PA_bvec, dst=PA_bvec)
else:
raise Exception("Missing PA.bvec in " + folder_b_files)
# Creates links
if eddy_AP is not None and not op.exists(eddy_AP):
rel_path = op.relpath(AP, op.dirname(eddy_AP))
......
......@@ -133,8 +133,7 @@ def run(ctx,
run(TBSS_mean_FA_skeleton)
# Create Skeleton mask
# TODO: This threshold could be configurable by user
thresh = 2000
thresh = ctx.get('dMRI_TBSS_skeleton_threshold', 2000)
wrappers.fslmaths(TBSS_mean_FA_skeleton).thr(thresh).bin().\
run(TBSS_mean_FA_skeleton_mask)
wrappers.fslmaths(TBSS_all_FA).mas(TBSS_mean_FA_skeleton_mask).\
......
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