Threshold changes when we change contrast value

i’m using contrast change in python code,

i.e.

a = slicer.util.arrayFromVolume(self.importedVolume)
self.contrastScale = 2.0
a[:] = a * self.contrastScale

i notice that it changes the threshold value impact on volume in segmentation, how can we relate it with original threshold value input for segmentation.

Do not change the voxel values of your volume if you just want to change its display brightness/contrast! Adjust window/level values in the volume’s display node instead.

For example, increase contrast by halving the display window width:

displayNode = self.importedVolume.GetDisplayNode()
displayNode.SetAutoWindowLevelOff()
displayNode.SetWindow(displayNode.GetWindow()/2.0)

i’m not using it only to change display brightness , i’m using it cause it helps in body part segmentation.
like it helps to get thin layer of skin etc.

You cannot help segmentation by applying linear offset/scaling to voxels. In general, you must not modify the original image.

Complete all segmentation tutorials to learn more about segmentation.