Skip to content

Commit

Permalink
Merge pull request #911 from mgxd/enh/normalize-histogram-matching
Browse files Browse the repository at this point in the history
ENH: Allow adjusting histogram matching of configuration files
  • Loading branch information
mgxd authored Dec 12, 2024
2 parents 7bd6a53 + 69d82d8 commit a1ae76b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions niworkflows/interfaces/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a1ae76b

Please sign in to comment.