Skip to content
Snippets Groups Projects
Commit d045f677 authored by Malte Kuhlmann's avatar Malte Kuhlmann
Browse files

NaNs in input data are now changed to zeros to make the viewer functional for such files.

parent 979abc4c
No related branches found
No related tags found
No related merge requests found
......@@ -158,6 +158,12 @@ def loadImageFromFile(filename, pref, f_type):
except RuntimeError:
print("Cannot load .v file given!")
# if data contain NaNs convert to zero
if np.isnan(image.get_data()).any():
notnan = image.get_data()
notnan[np.isnan(image.get_data())] = 0
image = Nifti1Image(notnan, image.affine)
# allow 2d-images here:
if len(image.get_data().shape) == 2:
image = Nifti1Image(np.atleast_3d(image.get_data()), image.affine)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment