How to access Labelmap indexes and change them?

Hi everyone!

I´m trying to manage imports from mask volumes and have some trouble with index of segments inside them.

For example:
I have a mask.nii.gz with 3 segments inside (1:bone, 2:fat , 3:muscle)
I also have a ColorTable with values:
1 muscle 255 0 0 255
2 bone 0 255 0 255
3 fat 0 0 255 255

I want to import mask file, reorder segments to match each one with ColorTable and then import LBM into SegmentationNode

It could be something like:

maskFilePath = ("//mask.nii.gz")
maskLBMNode = slicer.util.loadLabelVolume(maskFilePath)
label = slicer.util.arrayFromVolume(maskLBMNode)
# code to change indexes
slicer.util.arrayFromVolumeModified(maskLBMNode)
maskLBMNode.GetDisplayNode().SetAndObserveColorNodeID(colorTable.GetID())
slicer.modules.segmentations.logic().ImportLabelmapToSegmentationNode(maskLBMNode,outputSegmentationNode)
slicer.mrmlScene.RemoveNode(importLBMNode)

Thanks in advance!!!