NIRSTORM - Relabeling Segmentation Data to compare multiple segmentation methods

In an attempt to improve the voronei interpolation and fill in grey matter that the masking misses for individual segmentation programs, I was looking to import the tissue segmentation maps into Brainstorm and then export to Matlab, in order to compare maps through the raw data rather than visual inspection.

The problem I’m running into is that the 3d image data is in the form of a 256x256x256 uint8 matrix and I’m unable to visually inspect it, nor have I been able to copy it into a form of re-writable matrix or replace the labels found in the uint8 matrix to fit Nirstorm’s basic 5 tissue labels. I’ve attempted fopen/fread as well, but this returns a set of 0-255 values that I’m not sure how to re-encode into uint8 values to fit the labels. Any suggestions or recommendations are appreciated.

Update: Found the ‘cast’ function works for the encoding/decoding here.

There is also the direct call uint8()

For sake of completeness, Tissues files in Brainstorm are anatomical parcellations, and are saved following this format, where the relationship between the uint8 values and their respective tissue values are saved in the field Labels.

These files can be loaded with the function in_mri_bst() that will load the (parcellation) MRI volume and complete the missing fields if any.

mriMat = in_mri_bst(mriFileName);

1 Like