Skip to content

Commit

Permalink
moving the node declaration inside the if block
Browse files Browse the repository at this point in the history
  • Loading branch information
birajstha committed Oct 3, 2024
1 parent f865aec commit 9262d74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
25 changes: 12 additions & 13 deletions CPAC/pipeline/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,19 +1377,6 @@ def gather_pipes(self, wf, cfg, all=False, add_incl=None, add_excl=None):

wf.connect(id_string, "out_filename", write_json, "filename")

# Node to validate TR (and other scan parameters)
validate_bold_header = pe.Node(
Function(
input_names=["input_bold", "RawSource_bold"],
output_names=["output_bold"],
function=validate_outputs,
imports=[
"from CPAC.pipeline.utils import find_pixdim4, update_pixdim4"
],
),
name=f"validate_bold_header_{resource_idx}_{pipe_x}",
)

ds = pe.Node(DataSink(), name=f"sinker_{resource_idx}_{pipe_x}")
ds.inputs.parameterization = False
ds.inputs.base_directory = out_dct["out_dir"]
Expand All @@ -1414,6 +1401,18 @@ def gather_pipes(self, wf, cfg, all=False, add_incl=None, add_excl=None):
),
)
if resource.endswith("_bold"):
# Node to validate TR (and other scan parameters)
validate_bold_header = pe.Node(
Function(
input_names=["input_bold", "RawSource_bold"],
output_names=["output_bold"],
function=validate_outputs,
imports=[
"from CPAC.pipeline.utils import find_pixdim4, update_pixdim4"
],
),
name=f"validate_bold_header_{resource_idx}_{pipe_x}",
)
raw_source, raw_out = self.get_data("bold")
wf.connect(
[
Expand Down
6 changes: 3 additions & 3 deletions CPAC/pipeline/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def validate_outputs(input_bold, RawSource_bold):
)
update_pixdim4(output_bold, source_pixdim4)
else:
IFLOGGER.info("TR match detected between output_bold and RawSource_bold.")
IFLOGGER.info(f"output_bold TR: {output_pixdim4} seconds")
IFLOGGER.info(f"RawSource_bold TR: {source_pixdim4} seconds")
IFLOGGER.debug("TR match detected between output_bold and RawSource_bold.")
IFLOGGER.debug(f"output_bold TR: {output_pixdim4} seconds")
IFLOGGER.debug(f"RawSource_bold TR: {source_pixdim4} seconds")
return output_bold
except Exception as e:
error_message = f"Error in validating outputs: {e}"
Expand Down

0 comments on commit 9262d74

Please sign in to comment.