Changing a segmented mask datatype from int16 to uint8

Hi,
I’ve exporting a segmented mask of brain in nifti format, which is int16, for CNN segmentation using Matlab, however, pixel Label Datastore only supports pixel label image files with uint8 data.
Is there anyway to convert the segmented mask from int16 to uint8?

Thanks

@lassoan Can you help with that Dr?

You can cast read the nifti file into Matlab and then cast it to int8.

I would not recommend to use Matlab, though. 10-20 years ago Matlab was probably the best development environment for numerical computing, but the world moved on. Nowadays you are generally much better off with using Python.

1 Like

@lassoan Thanks a lot