If you save segmentation as 4D .seg.nrrd file (to allow overlapping segments) then color indices are not used, but each segment is stored with 0/1 values along the 4th dimension. You can look up the index of each segment in the custom metadata fields in the file header.
If you export the segmentation to a merged labelmap before writing to a 3D nrrd file, you can change voxel values using numpy before writing to file:
volumeNode = getNode('Segmentation-label')
volumeArray=slicer.util.arrayFromVolume(volumeNode)
volumeArray[volumeArray==5] = 7 # change all voxel values of 5 to 7
slicer.util.arrayFromVolumeModified(volumeNode)