Skip to content

Commit 3c43d31

Browse files
committed
FIX: Clean up invalid resolution catching
1 parent 9eea92f commit 3c43d31

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

niworkflows/utils/misc.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ def get_template_specs(
9191
# Verify resolution is valid
9292
if fallback:
9393
res = template_spec['resolution']
94-
if res and not isinstance(res, list):
95-
res = [int(res)]
94+
if not isinstance(res, list):
95+
try:
96+
res = [int(res)]
97+
except Exception:
98+
res = None
99+
if res is None:
100+
res = []
96101

97102
available_resolutions = tf.TF_LAYOUT.get_resolutions(template=in_template)
98-
if res and not set(res) & set(available_resolutions):
103+
if not (set(res) & set(available_resolutions)):
99104
fallback_res = available_resolutions[0] if available_resolutions else None
100105
warnings.warn(
101106
f"Template {in_template} does not have resolution: {res}."

0 commit comments

Comments
 (0)