Skip to content

Commit

Permalink
Use default base_dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Jun 14, 2017
1 parent 9883e20 commit 18a3375
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
8 changes: 5 additions & 3 deletions qipipe/pipeline/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def _create_workflow(self, **opts):
self.logger.debug("Building the modeling workflow...")

# The supervisory workflow.
mdl_wf = pe.Workflow(name='modeling', base_dir=self.base_dir)
workflow = pe.Workflow(name='modeling', base_dir=self.base_dir)

# The default modeling technique is the OHSU proprietary modeling
# workflow.
Expand Down Expand Up @@ -455,7 +455,8 @@ def _create_airc_workflow(self, **opts):
:param opts: the PK modeling parameters
:return: the Nipype Workflow
"""
workflow = pe.Workflow(name='airc', base_dir=self.base_dir)
base_dir = "%s/%s" % (self.base_dir, 'airc')
workflow = pe.Workflow(name='airc', base_dir=base_dir)

# The modeling profile configuration sections.
self.profile_sections = OHSU_CONF_SECTIONS
Expand Down Expand Up @@ -634,7 +635,8 @@ def _create_mock_workflow(self, **opts):
:param opts: the PK modeling parameters
:return: the Nipype Workflow
"""
workflow = pe.Workflow(name='mock', base_dir=self.base_dir)
base_dir = "%s/%s" % (self.base_dir, 'mock')
workflow = pe.Workflow(name='mock', base_dir=base_dir)

# The modeling profile configuration sections.
self.profile_sections = []
Expand Down
8 changes: 3 additions & 5 deletions qipipe/pipeline/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _create_execution_workflow(self, reference, dest, recursive=False):

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

# The registration workflow input.
Expand Down Expand Up @@ -386,17 +386,15 @@ def _create_realignment_workflow(self, **opts):
- Upload the realign outputs to XNAT
:param opts: the following workflow options:
:keyword base_dir: the workflow directory
(default a new temp directory)
:keyword initialize: flag indicating whether to create an
initial affine transform (ANTs only, default false)
:return: the Workflow object
"""
self.logger.debug('Creating the registration realignment workflow...')

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

# The workflow input.
in_fields = ['subject', 'session', 'scan', 'in_file',
Expand Down
9 changes: 4 additions & 5 deletions qipipe/pipeline/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _create_workflow(self):
self.logger.debug('Creating the scan staging workflow...')

# The Nipype workflow object.
workflow = pe.Workflow(name='stage_scan')
workflow = pe.Workflow(name='stage_scan', base_dir=self.base_dir)

# The workflow input.
hierarchy_fields = ['subject', 'session', 'scan']
Expand All @@ -190,14 +190,12 @@ def _create_workflow(self):

# The volume staging node wraps the stage_volume function.
stg_inputs = (
in_fields + iter_fields + ['collection', 'base_dir', 'opts']
in_fields + iter_fields + ['collection', 'opts']
)
stg_xfc = Function(input_names=stg_inputs, output_names=['out_dir'],
function=stage_volume)
stg_node = pe.Node(stg_xfc, name='stage')
child_opts = self._child_options()
base_dir = child_opts.pop('base_dir')
stg_node.inputs.base_dir = base_dir
stg_node.inputs.opts = child_opts
for fld in in_fields:
workflow.connect(input_spec, fld, stg_node, fld)
Expand Down Expand Up @@ -386,7 +384,8 @@ def _create_workflow(self):
self.logger.debug('Creating the DICOM processing workflow...')

# The Nipype workflow object.
workflow = pe.Workflow(name='staging', base_dir=self.base_dir)
base_dir = "%s/%s" % (self.base_dir, 'stage_volume')
workflow = pe.Workflow(name='stage_volume', base_dir=base_dir)

# The workflow input.
in_fields = ['collection', 'subject', 'session', 'scan',
Expand Down
13 changes: 0 additions & 13 deletions qipipe/pipeline/workflow_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,14 @@ def _child_options(self, name=None):
"""
Collects the following options for creating a child workflow:
* project
* base_dir
* config_dir
* dry_run
* distributable
If the *name* option is set, then the child *base_dir* is
the subdirectory *base_dir*\ /\ *name*, where *base_dir*
is this parent workflow's *base_dir*. Otherwise the child
*base_dir* is this parent workflow's *base_dir*.
:param name: the optional child workflow name
:return: the options sufficient to create a child workflow
"""
if name:
base_dir = "%s/%s" % (self.base_dir, name)
else:
base_dir = self.base_dir

return dict(
project=self.project,
base_dir=base_dir,
config_dir=self.config_dir,
dry_run=self.dry_run,
distributable=self.is_distributable
Expand Down

0 comments on commit 18a3375

Please sign in to comment.