rordenlab / MRIcroGL

v1.2 GLSL volume rendering. Able to view NIfTI, DICOM, MGH, MHD, NRRD, AFNI format images.
https://www.nitrc.org/plugins/mwiki/index.php/mricrogl:MainPage
Other
204 stars 32 forks source link

Creating random color look up table #56

Closed mahirtazwar closed 1 year ago

mahirtazwar commented 1 year ago

How to create a random color look up table so that each label in a segmentation image gets a random color instead of a gradient (similar to the random colormap in fsleyes, or how segmentations are loaded on ITK-SNAP)? In this case, each region of interest with a unique label will have a unique or repeated color (since I have more than 200+ ROIs).

Reference to: _Originally posted by @mahirtazwar in https://github.com/neurolabusc/MRIcroGL10_OLD/issues/35#issuecomment-1626337859_

neurolabusc commented 1 year ago

Set the intent_code of your NIfTI header to 1002 to specify NIFTI_INTENT_LABEL. This will use the same random color scheme as FSLeyes and use nearest neighbor interpolation (to solve the partial volume issue that a voxel that is a mixture of area 17 and area 19 should not be identified as area 18).

To see examples, choose any of the images listed under the File/AddAtlas menu item.