|
23 | 23 | """Nipype translation of ANTs' workflows.""" |
24 | 24 |
|
25 | 25 | # general purpose |
26 | | -from collections import OrderedDict |
27 | 26 | from multiprocessing import cpu_count |
28 | 27 | from warnings import warn |
29 | 28 |
|
|
55 | 54 | from ..utils.misc import get_template_specs |
56 | 55 |
|
57 | 56 | ATROPOS_MODELS = { |
58 | | - 'T1w': OrderedDict([('nclasses', 3), ('csf', 1), ('gm', 2), ('wm', 3)]), |
59 | | - 'T2w': OrderedDict([('nclasses', 3), ('csf', 3), ('gm', 2), ('wm', 1)]), |
60 | | - 'FLAIR': OrderedDict([('nclasses', 3), ('csf', 1), ('gm', 3), ('wm', 2)]), |
| 57 | + 'T1w': {'nclasses': 3, 'csf': 1, 'gm': 2, 'wm': 3}, |
| 58 | + 'T2w': {'nclasses': 3, 'csf': 3, 'gm': 2, 'wm': 1}, |
| 59 | + 'FLAIR': {'nclasses': 3, 'csf': 1, 'gm': 3, 'wm': 2}, |
61 | 60 | } |
| 61 | +T1W_MODEL = tuple(ATROPOS_MODELS['T1w'].values()) |
62 | 62 |
|
63 | 63 |
|
64 | 64 | def init_brain_extraction_wf( |
@@ -293,7 +293,8 @@ def init_brain_extraction_wf( |
293 | 293 | except ValueError: |
294 | 294 | warn( |
295 | 295 | "antsAI's option --search-grid was added in ANTS 2.3.0 " |
296 | | - f'({init_aff.interface.version} found.)' |
| 296 | + f'({init_aff.interface.version} found.)', |
| 297 | + stacklevel=1, |
297 | 298 | ) |
298 | 299 |
|
299 | 300 | # Set up spatial normalization |
@@ -355,6 +356,7 @@ def init_brain_extraction_wf( |
355 | 356 | "N4BiasFieldCorrection's --rescale-intensities option was added in ANTS 2.1.0 " |
356 | 357 | f'({inu_n4_final.interface.version} found.) Please consider upgrading.', |
357 | 358 | UserWarning, |
| 359 | + stacklevel=1, |
358 | 360 | ) |
359 | 361 |
|
360 | 362 | # Apply mask |
@@ -501,7 +503,7 @@ def init_atropos_wf( |
501 | 503 | omp_nthreads=None, |
502 | 504 | mem_gb=3.0, |
503 | 505 | padding=10, |
504 | | - in_segmentation_model=tuple(ATROPOS_MODELS['T1w'].values()), |
| 506 | + in_segmentation_model=T1W_MODEL, |
505 | 507 | bspline_fitting_distance=200, |
506 | 508 | wm_prior=False, |
507 | 509 | ): |
@@ -758,6 +760,7 @@ def init_atropos_wf( |
758 | 760 | "N4BiasFieldCorrection's --rescale-intensities option was added in ANTS 2.1.0 " |
759 | 761 | f'({inu_n4_final.interface.version} found.) Please consider upgrading.', |
760 | 762 | UserWarning, |
| 763 | + stacklevel=1, |
761 | 764 | ) |
762 | 765 |
|
763 | 766 | # Apply mask |
@@ -987,6 +990,7 @@ def init_n4_only_wf( |
987 | 990 | "N4BiasFieldCorrection's --rescale-intensities option was added in ANTS 2.1.0 " |
988 | 991 | f'({inu_n4_final.interface.version} found.) Please consider upgrading.', |
989 | 992 | UserWarning, |
| 993 | + stacklevel=1, |
990 | 994 | ) |
991 | 995 |
|
992 | 996 | # fmt: off |
|
0 commit comments