Loading in a segmentation generated outside slicer (on matlab)

Nassir
Sun, 22 Jul 2018 10:50:09 +0000
Support

Hey guys! I’m trying to load a scalar volume that was exported out of slicer, “WHS_SD_rat_atlas_v2_original”, back in as a segmentation. The whole reason I am doing this is to avoid manually defining the segments.

To do so, I pulled together some matlab scripts I found online to make the matlab script “Copy_of_read_Atlas2” which loads the scalar volume together with a legend in the form of a .txt file. It begins to generate the segmentation file with header information embedded in the same file, similar to a segmentation that I exported out of slicer “1015Segmentation.seg”. There’s a loop in there that I have printing the information for each segment (line 169), but I have it set to 1 right now because this is a high-RAM demand script. I think it’s good to just get one segmentation going for now. Then there’s the loop that reassigns the scalar volume onto 4-D array for the segmentation (line 208, also set to 1). I think all that stuff works well.

I think the issue might have to do with datatypes? I don’t have a compsci background but I’m suspicious of all the "U"s that can be read (in matlab, line 25) off the bad generated segmentation. The generation of the data starts on line 225 in “Copy_of_read_Atlas2”. Could someone point it out?

Trying to load the bad segmentation into slicer crashes it. It won’t load on old versions of slicer (I’m using 4.8.1).

Here are all the files:

https://drive.google.com/open?id=1vP9KQiKK9NHCrKB3G03fXsAV3JAclOdT

3 posts - 2 participants