I want to Colorize Mesh of the Volumetic Meshes. so i did simple python script from script repository of slicer document. but it does not work.
modelNode = slicer.util.getNode('Model') # select cells in this model
cellScalars = modelNode.GetMesh().GetCellData() # select cell data in this model
selectionArray = cellScalars.GetArray('labels') # select current active scalar in this model
for i in range(0, 10000):
selectionArray.SetValue(i, 100) # set selected cell's scalar value to non-zero
selectionArray.Modified()
You also need to select the scalar array to be used for coloring (in Models module, Scalars section).
==> Yes. I did but have no effect on the Display of Meshes
I’ve loaded this volumetric mesh and this script and it worked well for me. Try if it works for you, too. If it does then change things step by step to see what is different in your data or code.
Korea time, early morning from 5 AM to 8 for 3 hour. very consenstrate upon slicer open source based image processing & graphics time for enjoyment now^^