Skip to content

Commit

Permalink
Standardize sub-workflow creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed May 20, 2017
1 parent dd3873c commit d6eb918
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions qipipe/pipeline/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def run(subject, session, scan, time_series, **opts):
parameters
:return: the mask file location
"""
wf_gen = MaskWorkflow(**opts)
workflow = MaskWorkflow(**opts)

# Run the workflow.
return wf_gen.run(subject, session, scan, time_series)
return workflow.run(subject, session, scan, time_series)


class MaskWorkflow(WorkflowBase):
Expand Down
7 changes: 4 additions & 3 deletions qipipe/pipeline/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def run(self, subject, session, scan, time_series, **opts):
:param time_series: the 4D modeling input time series file
location
:param opts: the following keyword parameters:
:option bolus_arrival_index: the bolus uptake volume index
:option mask: the XNAT mask resource name
:return: the modeling result dictionary
"""
Expand Down Expand Up @@ -321,10 +322,10 @@ def _create_workflow(self, **opts):
# parent_opt = '.'.join(modules[:-1])
# child_opt = modules[-1]
# if parent_opt:
# wf_gen = __import__(parent_opt, globals(), locals(), [child_opt])
# workflow = __import__(parent_opt, globals(), locals(), [child_opt])
# else:
# wf_gen = __import__(child_opt)
# child_wf = wf_gen.create_workflow(**opts)
# workflow = __import__(child_opt)
# child_wf = workflow.create_workflow(**opts)
#
if self.technique == 'bolero':
child_wf = self._create_bolero_workflow(**opts)
Expand Down
4 changes: 2 additions & 2 deletions qipipe/pipeline/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _create_execution_workflow(self, reference, dest, recursive=False):

# The execution workflow.
exec_wf = pe.Workflow(
name='reg_exec', base_dir=self.workflow.base_dir
name='registration', base_dir=self.workflow.base_dir
)

# The registration workflow input.
Expand Down Expand Up @@ -405,7 +405,7 @@ def _create_realignment_workflow(self, **opts):

# The workflow.
base_dir = opts.get('base_dir', tempfile.mkdtemp(prefix='qipipe_'))
realign_wf = pe.Workflow(name='registration', base_dir=self.base_dir)
realign_wf = pe.Workflow(name=self.technique, base_dir=self.base_dir)

# The workflow input.
in_fields = ['subject', 'session', 'scan', 'moving_image',
Expand Down
2 changes: 1 addition & 1 deletion qipipe/pipeline/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def run(subject, session, scan, *in_dirs, **opts):
# Look for the 3D volume output in the workflow base directory
# work area directly instead.
vol_file = ("%s/staging/stack/volume%03d.nii.gz" %
(base_dir, volume))
(stg_wf.base_dir, volume))
if os.path.exists(vol_file):
vol_nii_files.append(vol_file)
elif not stg_wf.dry_run:
Expand Down

0 comments on commit d6eb918

Please sign in to comment.