|
57 | 57 | ] |
58 | 58 |
|
59 | 59 | """ |
60 | | -3. Define the parameters of the registration |
| 60 | +3. Define the parameters of the registration. Settings are |
| 61 | + saved in `./smri_ants_registration_settings.json`. |
61 | 62 | """ |
62 | 63 |
|
63 | | -reg = Registration() |
| 64 | +reg = Registration(from_file='./smri_ants_registration_settings.json') |
64 | 65 | reg.inputs.fixed_image = input_images[0] |
65 | 66 | reg.inputs.moving_image = input_images[1] |
66 | | -reg.inputs.output_transform_prefix = 'thisTransform' |
67 | | -reg.inputs.output_warped_image = 'INTERNAL_WARPED.nii.gz' |
68 | | - |
69 | | -reg.inputs.output_transform_prefix = "output_" |
70 | | -reg.inputs.transforms = ['Translation', 'Rigid', 'Affine', 'SyN'] |
71 | | -reg.inputs.transform_parameters = [(0.1,), (0.1,), (0.1,), (0.2, 3.0, 0.0)] |
72 | | -reg.inputs.number_of_iterations = ([[10000, 111110, 11110]] * 3 + |
73 | | - [[100, 50, 30]]) |
74 | | -reg.inputs.dimension = 3 |
75 | | -reg.inputs.write_composite_transform = True |
76 | | -reg.inputs.collapse_output_transforms = False |
77 | | -reg.inputs.metric = ['Mattes'] * 3 + [['Mattes', 'CC']] |
78 | | -reg.inputs.metric_weight = [1] * 3 + [[0.5, 0.5]] |
79 | | -reg.inputs.radius_or_number_of_bins = [32] * 3 + [[32, 4]] |
80 | | -reg.inputs.sampling_strategy = ['Regular'] * 3 + [[None, None]] |
81 | | -reg.inputs.sampling_percentage = [0.3] * 3 + [[None, None]] |
82 | | -reg.inputs.convergence_threshold = [1.e-8] * 3 + [-0.01] |
83 | | -reg.inputs.convergence_window_size = [20] * 3 + [5] |
84 | | -reg.inputs.smoothing_sigmas = [[4, 2, 1]] * 3 + [[1, 0.5, 0]] |
85 | | -reg.inputs.sigma_units = ['vox'] * 4 |
86 | | -reg.inputs.shrink_factors = [[6, 4, 2]] + [[3, 2, 1]] * 2 + [[4, 2, 1]] |
87 | | -reg.inputs.use_estimate_learning_rate_once = [True] * 4 |
88 | | -reg.inputs.use_histogram_matching = [False] * 3 + [True] |
89 | | -reg.inputs.initial_moving_transform_com = True |
90 | 67 |
|
| 68 | +""" |
| 69 | +Alternatively to the use of the `from_file` feature to load ANTs settings, |
| 70 | +the user can manually set all those inputs instead:: |
| 71 | +
|
| 72 | + reg.inputs.output_transform_prefix = 'thisTransform' |
| 73 | + reg.inputs.output_warped_image = 'INTERNAL_WARPED.nii.gz' |
| 74 | + reg.inputs.output_transform_prefix = "output_" |
| 75 | + reg.inputs.transforms = ['Translation', 'Rigid', 'Affine', 'SyN'] |
| 76 | + reg.inputs.transform_parameters = [(0.1,), (0.1,), (0.1,), (0.2, 3.0, 0.0)] |
| 77 | + reg.inputs.number_of_iterations = ([[10000, 111110, 11110]] * 3 + |
| 78 | + [[100, 50, 30]]) |
| 79 | + reg.inputs.dimension = 3 |
| 80 | + reg.inputs.write_composite_transform = True |
| 81 | + reg.inputs.collapse_output_transforms = False |
| 82 | + reg.inputs.metric = ['Mattes'] * 3 + [['Mattes', 'CC']] |
| 83 | + reg.inputs.metric_weight = [1] * 3 + [[0.5, 0.5]] |
| 84 | + reg.inputs.radius_or_number_of_bins = [32] * 3 + [[32, 4]] |
| 85 | + reg.inputs.sampling_strategy = ['Regular'] * 3 + [[None, None]] |
| 86 | + reg.inputs.sampling_percentage = [0.3] * 3 + [[None, None]] |
| 87 | + reg.inputs.convergence_threshold = [1.e-8] * 3 + [-0.01] |
| 88 | + reg.inputs.convergence_window_size = [20] * 3 + [5] |
| 89 | + reg.inputs.smoothing_sigmas = [[4, 2, 1]] * 3 + [[1, 0.5, 0]] |
| 90 | + reg.inputs.sigma_units = ['vox'] * 4 |
| 91 | + reg.inputs.shrink_factors = [[6, 4, 2]] + [[3, 2, 1]] * 2 + [[4, 2, 1]] |
| 92 | + reg.inputs.use_estimate_learning_rate_once = [True] * 4 |
| 93 | + reg.inputs.use_histogram_matching = [False] * 3 + [True] |
| 94 | + reg.inputs.initial_moving_transform_com = True |
| 95 | +
|
| 96 | +""" |
91 | 97 | print(reg.cmdline) |
92 | 98 |
|
93 | 99 |
|
|
0 commit comments