From 69d82d868edc5375b238bce5393b6670b465b2a7 Mon Sep 17 00:00:00 2001 From: Mathias Goncalves Date: Wed, 11 Dec 2024 01:07:50 -0500 Subject: [PATCH] ENH: Allow adjusting histogram matching of configuration files --- niworkflows/interfaces/norm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/niworkflows/interfaces/norm.py b/niworkflows/interfaces/norm.py index 9fa9c240e42..d3a3336b9ea 100644 --- a/niworkflows/interfaces/norm.py +++ b/niworkflows/interfaces/norm.py @@ -114,6 +114,7 @@ class _SpatialNormalizationInputSpec(BaseInterfaceInputSpec): """, ) initial_moving_transform = File(exists=True, desc='transform for initialization') + use_histogram_matching = traits.Bool(desc='determine use of histogram matching') float = traits.Bool(False, usedefault=True, desc='use single precision calculations') @@ -196,6 +197,15 @@ def _run_interface(self, runtime): NIWORKFLOWS_LOG.info('Loading settings from file %s.', ants_settings) # Configure an ANTs run based on these settings. self.norm = Registration(from_file=ants_settings, **ants_args) + if isdefined(self.inputs.use_histogram_matching): + # Most (all?) configuration files use histogram matching, so more important + # to allow disabling, such as in the case of intermodality normalization + NIWORKFLOWS_LOG.info( + 'Overriding (%sabling) histogram matching for file %s', + 'en' if self.inputs.use_histogram_matching else 'dis', + ants_settings, + ) + self.norm.inputs.use_histogram_matching = self.inputs.use_histogram_matching self.norm.resource_monitor = False self.norm.terminal_output = self.terminal_output