Skip to content

Commit

Permalink
Merge pull request dipy#3228 from jhlegarreta/FixCombinedWorkflowExam…
Browse files Browse the repository at this point in the history
…pleWarning

STYLE: Fix unused loop control variable warning
  • Loading branch information
skoudoro authored May 20, 2024
2 parents 3e2437d + 05de2b6 commit 19ae6a6
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions doc/examples/combined_workflow_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
file is usually located in the ``dipy/workflows`` directory.
"""

import os

from dipy.workflows.combined_workflow import CombinedWorkflow

###############################################################################
Expand Down Expand Up @@ -37,7 +39,14 @@ def _get_sub_flows(self):
sub workflows parameters available in commandline.
"""

def run(self, input_files, out_dir="", out_file="processed.nii.gz"):
def run(
self,
input_files,
out_dir="",
out_denoised="processed.nii.gz",
out_mask="brain_mask.nii.gz",
out_masked="dwi_masked.nii.gz",
):
"""
Parameters
----------
Expand All @@ -48,8 +57,14 @@ def run(self, input_files, out_dir="", out_file="processed.nii.gz"):
out_dir : string, optional
Where the resulting file will be saved. (default '')
out_file : string, optional
Name of the result file to be saved. (default 'processed.nii.gz')
out_denoised : string, optional
Name of the denoised file to be saved.
out_mask : string, optional
Name of the Otsu mask file to be saved.
out_masked : string, optional
Name of the Otsu masked file to be saved.
"""

"""
Expand All @@ -65,13 +80,26 @@ def run(self, input_files, out_dir="", out_file="processed.nii.gz"):

io_it = self.get_io_iterator()

for in_file, out_file in io_it:
for fnames in io_it:
in_fname = fnames[0]
_out_denoised = os.path.basename(fnames[1])
_out_mask = os.path.basename(fnames[2])
_out_masked = os.path.basename(fnames[3])

nl_flow = NLMeansFlow()
self.run_sub_flow(nl_flow, in_file, out_dir=out_dir)
self.run_sub_flow(
nl_flow, in_fname, out_dir=out_dir, out_denoised=_out_denoised
)
denoised = nl_flow.last_generated_outputs["out_denoised"]

me_flow = MedianOtsuFlow()
self.run_sub_flow(me_flow, denoised, out_dir=out_dir)
self.run_sub_flow(
me_flow,
denoised,
out_dir=out_dir,
out_mask=_out_mask,
out_masked=_out_masked,
)


###############################################################################
Expand Down

0 comments on commit 19ae6a6

Please sign in to comment.