Skip to content

Commit

Permalink
Return the 3d ROI mask file.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Jul 11, 2017
1 parent bf08841 commit be60fc9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions qipipe/pipeline/roi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
from nipype.interfaces.utility import (IdentityInterface, Function)
import qiutil
from ..helpers.logging import logger
from ..interfaces import (ConvertBoleroMask, ReorderBoleroMask, XNATUpload)
from ..interfaces import (
StickyIdentityInterface, ConvertBoleroMask, ReorderBoleroMask, XNATUpload
)
from .workflow_base import WorkflowBase
from .pipeline_error import PipelineError

Expand Down Expand Up @@ -109,8 +111,16 @@ def run(self, subject, session, scan, time_series, *inputs):
self.logger.info("Executed the %s workflow on %s %s scan %d." %
(self.workflow.name, subject, session, scan))

# Return the ROI resource name.
return ROI_RESOURCE
# The magic incantation to get the Nipype workflow result.
output_res = next(n for n in wf_res.nodes() if n.name == 'output_spec')
out_file = output_res.inputs.get()['out_file']
self.logger.debug(
"Executed the %s workflow on the %s %s scan %d to create"
" the 3D ROI mask file %s." %
(self.workflow.name, subject, session, scan, out_file)
)

return out_file

def _set_inputs(self, subject, session, scan, time_series, *inputs):
"""
Expand Down Expand Up @@ -214,6 +224,10 @@ def _create_workflow(self, **opts):
workflow.connect(input_spec, 'scan', upload_roi, 'scan')
workflow.connect(merge, 'out_file', upload_roi, 'in_files')

# The output is the 3D ROI overlay.
output_spec = pe.Node(StickyIdentityInterface(fields=['out_file']))
workflow.connect(merge, 'out_file', output_spec, 'out_file')

self._configure_nodes(workflow)

self.logger.debug("Created the %s workflow." % workflow.name)
Expand Down

0 comments on commit be60fc9

Please sign in to comment.