|
8 | 8 | _align_chunks, |
9 | 9 | _compute_sigma, |
10 | 10 | _dim_scale_factors, |
| 11 | + _update_previous_dim_factors, |
11 | 12 | _get_block, |
12 | 13 | _spatial_dims, |
13 | 14 | ) |
@@ -136,10 +137,9 @@ def _downsample_itk_bin_shrink( |
136 | 137 | spatial_dims = _image_dims[: len(spatial_dims)] |
137 | 138 | for scale_factor in scale_factors: |
138 | 139 | dim_factors = _dim_scale_factors(dims, scale_factor, previous_dim_factors) |
139 | | - if isinstance(scale_factor, int): |
140 | | - previous_dim_factors = { d : scale_factor for d in spatial_dims } |
141 | | - else: |
142 | | - previous_dim_factors = scale_factor |
| 140 | + previous_dim_factors = _update_previous_dim_factors( |
| 141 | + scale_factor, spatial_dims, previous_dim_factors |
| 142 | + ) |
143 | 143 | previous_image = _align_chunks(previous_image, default_chunks, dim_factors) |
144 | 144 |
|
145 | 145 | shrink_factors = [dim_factors[sd] for sd in spatial_dims] |
@@ -225,10 +225,9 @@ def _downsample_itk_gaussian( |
225 | 225 | spatial_dims = _image_dims[: len(spatial_dims)] |
226 | 226 | for scale_factor in scale_factors: |
227 | 227 | dim_factors = _dim_scale_factors(dims, scale_factor, previous_dim_factors) |
228 | | - if isinstance(scale_factor, int): |
229 | | - previous_dim_factors = { d : scale_factor for d in spatial_dims } |
230 | | - else: |
231 | | - previous_dim_factors = scale_factor |
| 228 | + previous_dim_factors = _update_previous_dim_factors( |
| 229 | + scale_factor, spatial_dims, previous_dim_factors |
| 230 | + ) |
232 | 231 | previous_image = _align_chunks(previous_image, default_chunks, dim_factors) |
233 | 232 |
|
234 | 233 | shrink_factors = [dim_factors[sd] for sd in spatial_dims] |
|
0 commit comments