Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Which datatype to use saving nifti labels #722

Closed
davidkvcs opened this issue May 16, 2022 · 2 comments · Fixed by #723
Closed

Which datatype to use saving nifti labels #722

davidkvcs opened this issue May 16, 2022 · 2 comments · Fixed by #723

Comments

@davidkvcs
Copy link

davidkvcs commented May 16, 2022

Hello

In your guide (https://github.com/microsoft/InnerEye-DeepLearning/blob/main/docs/creating_dataset.md) you write:

  • For images can be encoded as float32 with dimensions (X, Y, Z)
  • For segmentations should be encoded as binary masks with dimensions (X, Y, Z)

For segmentations: What do you mean by "encoded as binary masks"? that the array should be converted to an np.bool_?
This gives the following error with nifti (for me at least):
HeaderDataError: data dtype "<class 'numpy.bool_'>" not supported

Would for instance int8 be OK instead?
And of course in practice the label file will contain ones and zeros alone (I think this is what you mean by "binary encoding").

AB#5937

@ant0nsc
Copy link
Contributor

ant0nsc commented May 17, 2022

Hi @davidkvcs , sorry that this is not clear. In our code, we use np.uint8 for masks. And you're right, it should be zeros and ones alone. I'll try to clarify in the docs.

@davidkvcs
Copy link
Author

thanks, sounds good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants