Skip to content

Commit b637860

Browse files
FIX: remove compatibility for ants<2.2
1 parent a17b557 commit b637860

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

nirodents/workflows/brainextraction.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,12 @@ def init_rodent_brain_extraction_wf(
125125
name='init_aff',
126126
n_procs=omp_nthreads)
127127

128-
# Tolerate missing ANTs at construction time
129-
_ants_version = Registration().version
130-
# if _ants_version and parseversion(_ants_version) >= Version('2.3.0'):
131-
# init_aff.inputs.search_grid = (1, (1, 2, 2))
132-
133128
# Initial warping of template mask to subject space
134129
warp_mask = pe.Node(ApplyTransforms(
135130
interpolation='Linear', invert_transform_flags=True), name='warp_mask')
136131

137-
fixed_mask_trait = 'fixed_image_mask'
138-
moving_mask_trait = 'moving_image_mask'
139-
if _ants_version and parseversion(_ants_version) >= Version('2.2.0'):
140-
fixed_mask_trait += 's'
141-
moving_mask_trait += 's'
132+
fixed_mask_trait = 'fixed_image_masks'
133+
moving_mask_trait = 'moving_image_masks'
142134

143135
# Set up initial spatial normalization
144136
init_settings_file = f'data/brainextraction_{init_normalization_quality}_{modality}.json'
@@ -153,16 +145,10 @@ def init_rodent_brain_extraction_wf(
153145
inu_n4_final = pe.MapNode(
154146
N4BiasFieldCorrection(
155147
dimension=3, save_bias=True, copy_header=True,
156-
n_iterations=[50] * 5, convergence_threshold=1e-7, shrink_factor=4,
157-
bspline_fitting_distance=bspline_fitting_distance),
148+
n_iterations=[50] * 5, convergence_threshold=1e-7,
149+
bspline_fitting_distance=bspline_fitting_distance,
150+
rescale_intensities = True, shrink_factor=4),
158151
n_procs=omp_nthreads, name='inu_n4_final', iterfield=['input_image'])
159-
if _ants_version and parseversion(_ants_version) >= Version('2.1.0'):
160-
inu_n4_final.inputs.rescale_intensities = True
161-
else:
162-
warn("""\
163-
Found ANTs version %s, which is too old. Please consider upgrading to 2.1.0 or \
164-
greater so that the --rescale-intensities option is available with \
165-
N4BiasFieldCorrection.""" % _ants_version, DeprecationWarning)
166152

167153
split_init_transforms = pe.Node(niu.Split(splits=[1,1]), name='split_init_transforms')
168154
mrg_init_transforms = pe.Node(niu.Merge(2), name='mrg_init_transforms')

0 commit comments

Comments
 (0)