diff --git a/qsiprep/data/pipelines/pyafq_tractometry.json b/qsiprep/data/pipelines/pyafq_tractometry.json index cf50e428..40acf80d 100644 --- a/qsiprep/data/pipelines/pyafq_tractometry.json +++ b/qsiprep/data/pipelines/pyafq_tractometry.json @@ -16,13 +16,13 @@ "directions": "prob", "max_angle": 30.0, "sphere": "", - "seed_mask": "", - "seed_threshold": 0, + "seed_mask": "WM_probseg", + "seed_threshold": 0.5, "n_seeds": 1, "random_seeds": false, "rng_seed": "", - "stop_mask": "", - "stop_threshold": 0, + "stop_mask": "WM_probseg", + "stop_threshold": 0.5, "step_size": 0.5, "min_length": 50, "max_length": 250, @@ -67,7 +67,6 @@ "csd_lambda_": 1, "csd_tau": 0.1, "gtol": 0.01, - "brain_mask_definition": "", "bundle_info": "", "reg_template_spec": "mni_T1", "mapping_definition": "", diff --git a/qsiprep/interfaces/pyafq.py b/qsiprep/interfaces/pyafq.py index 33156fa1..2cc01f17 100644 --- a/qsiprep/interfaces/pyafq.py +++ b/qsiprep/interfaces/pyafq.py @@ -30,6 +30,7 @@ class PyAFQInputSpec(BaseInterfaceInputSpec): bvec_file = File(exists=True, mandatory=True) dwi_file = File(exists=True, mandatory=True) mask_file = File(exists=True, mandatory=True) + wm_mask_file = File(exists=True, mandatory=True) itk_file = File(exists=True, mandatory=True) kwargs = traits.Dict(exists=True, mandatory=True) tck_file = traits.Either(None, File(exists=True)) @@ -56,6 +57,8 @@ def _run_interface(self, runtime): newpath=shim_dir) mask_file = fname_presuffix(self.inputs.mask_file, newpath=shim_dir) + wm_mask_file = fname_presuffix(self.inputs.wm_mask_file, + newpath=shim_dir) itk_file = fname_presuffix(self.inputs.itk_file, newpath=shim_dir) os.symlink(self.inputs.bval_file, bval_file) @@ -63,24 +66,35 @@ def _run_interface(self, runtime): os.symlink(self.inputs.dwi_file, dwi_file) os.symlink(self.inputs.mask_file, mask_file) os.symlink(self.inputs.itk_file, itk_file) - + os.symlink(self.inputs.wm_mask_file, wm_mask_file) kwargs = self.inputs.kwargs if self.inputs.tck_file and isdefined(self.inputs.tck_file): tck_file = fname_presuffix(self.inputs.tck_file, - newpath=shim_dir) + newpath=shim_dir) os.symlink(self.inputs.tck_file, tck_file) else: tck_file = None + brain_mask_definition = ImageFile(path=mask_file) - itk_map = ItkMap(warp_path=itk_file) + seed_mask_definition = ImageFile(path=wm_mask_file) + stop_mask_definition = ImageFile(path=wm_mask_file) + + # XXX Make ItkMap work at some point + # itk_map = ItkMap(warp_path=itk_file) if tck_file is None: tck_file = kwargs['import_tract'] kwargs.pop('import_tract', None) - if brain_mask_definition is None: - brain_mask_definition = kwargs['brain_mask_definition'] kwargs.pop('brain_mask_definition', None) + + tracking_params = kwargs.pop('tracking_params', None) + if tracking_params is not None: + if tracking_params["seed_mask"] == "WM_prob": + tracking_params["seed_mask"] = seed_mask_definition + if tracking_params["stop_mask"] == "WM_prob": + tracking_params["stop_mask"] = stop_mask_definition + # if itk_map is None: # Use pyAFQ internal mapping # itk_map = kwargs['mapping_definition'] # kwargs.pop('mapping_definition', None) @@ -100,6 +114,7 @@ def _run_interface(self, runtime): import_tract=tck_file, brain_mask_definition=brain_mask_definition, # mapping_definition=itk_map, + tracking_params=tracking_params, **kwargs) if "export" not in kwargs or kwargs["export"] == "all": diff --git a/qsiprep/workflows/recon/pyafq.py b/qsiprep/workflows/recon/pyafq.py index 5d3f7a5f..b3916cc5 100644 --- a/qsiprep/workflows/recon/pyafq.py +++ b/qsiprep/workflows/recon/pyafq.py @@ -79,6 +79,7 @@ def init_pyafq_wf(omp_nthreads, available_anatomical_data, ('bval_file', 'bval_file'), ('bvec_file', 'bvec_file'), ('dwi_mask', 'mask_file'), + ('wm_mask', 'wm_mask_file'), ('t1_2_mni_reverse_transform', 'itk_file')]), (run_afq, outputnode, [('afq_dir', 'afq_dir')]) ])