From 65414d2d6a71aea0d37cf64b1267d65d243b9f81 Mon Sep 17 00:00:00 2001 From: sarthakpati Date: Sun, 31 Mar 2024 12:27:23 -0400 Subject: [PATCH] added more defaults --- ereg/registration.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ereg/registration.py b/ereg/registration.py index 6e3e9e5..92afa2e 100644 --- a/ereg/registration.py +++ b/ereg/registration.py @@ -179,6 +179,9 @@ def register( sitk.WriteTransform(self.transform, transform_file) # apply composite transform if provided + self.parameters["composite_transform"] = self.parameters.get( + "composite_transform", None + ) if self.parameters["composite_transform"] is not None: self.logger.info("Applying composite transform.") transform_composite = sitk.ReadTransform( @@ -256,7 +259,8 @@ def resample_image( resampler = sitk.ResampleImageFilter() resampler.SetReferenceImage(target_image) interpolator_type = self.interpolator_type.get( - self.parameters["interpolator"] + self.parameters.get("interpolator", "linear").lower(), + sitk.sitkLinear, ) resampler.SetInterpolator(interpolator_type) resampler.SetDefaultPixelValue(0) @@ -389,6 +393,7 @@ def _register_image_and_get_transform( self.logger.info("Initializing registration.") R = sitk.ImageRegistrationMethod() + self.parameters["metric_parameters"] = self.parameters.get("metric_parameters", {}) metric = ( self.parameters["metric_parameters"].get("type", "mean_squares").lower() ) @@ -445,7 +450,7 @@ def _register_image_and_get_transform( self.parameters.get("sampling_strategy", "random").lower() ] ) - R.SetMetricSamplingPercentagePerLevel(self.parameters["sampling_percentage"]) + R.SetMetricSamplingPercentagePerLevel(self.parameters.get("sampling_percentage", 0.01))) self.parameters["optimizer_parameters"] = self.parameters.get( "optimizer_parameters", {}