From cb7b7692612147d6c77393d1dd5d413198a1bb5d Mon Sep 17 00:00:00 2001 From: Sebastien Tourbier Date: Thu, 28 Oct 2021 09:39:02 +0200 Subject: [PATCH] FIX: Add a filter that returns a sublist of manual masks if specified by "stacks" in the param file right after the datagrabber for masks --- pymialsrtk/pipelines/anatomical/srr.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pymialsrtk/pipelines/anatomical/srr.py b/pymialsrtk/pipelines/anatomical/srr.py index 9a04dd216..d026c7f0d 100644 --- a/pymialsrtk/pipelines/anatomical/srr.py +++ b/pymialsrtk/pipelines/anatomical/srr.py @@ -295,6 +295,11 @@ def create_workflow(self): name='brain_masks_bypass', iterfield=['out_file']) + if self.m_stacks is not None: + custom_masks_filter = Node(interface=preprocess.FilteringByRunid(), + name='custom_masks_filter') + custom_masks_filter.inputs.stacks_id = self.m_stacks + else: dg = Node(interface=DataGrabber(outfields=['T2ws']), name='data_grabber') @@ -455,7 +460,11 @@ def create_workflow(self): # Build workflow : connections of the nodes # Nodes ready : Linking now if self.use_manual_masks: - self.wf.connect(dg, "masks", brainMask, "out_file") + if self.m_stacks is not None: + self.wf.connect(dg, "masks", custom_masks_filter, "input_files") + self.wf.connect(custom_masks_filter, "output_files", brainMask, "out_file") + else: + self.wf.connect(dg, "masks", brainMask, "out_file") else: if self.m_stacks is not None: self.wf.connect(dg, "T2ws", t2ws_filter_prior_masks, "input_files")