How do I change the color of the corresponding area after setting the threshold?

Hello Everyone,

I used the method in 3D Slicer Documentation to modify the thresholds in the volume 。Script repository — 3D Slicer documentation

How do I change the color of the corresponding area after setting the threshold? Because gray is indistinguishable from the rest of the image.

Thank you very much for your help.

Regardless of what voxel values you set in a volume that is displayed using “gray” colormap then the volume will still always appear as shades of gray.

What are you trying to achieve: show a colored overlay (segmentation, markups, etc.) on the volume for highlighting something, or change the CT volume content? What is the clinical application and your overall goal?

Thank you for your reply!

Functional goals:Multiple markers are affixed to the patient’s skin (markers can be recognized in CT and displayed in CT images) . We want to set the image threshold via the Python script (only marks on the skin will be labeled) . Automatically creates a segment for each tag and gets the center of mass for each segment as A,A’,A’’,…gets the coordinates of each center of mass

Sample graph:

You can make the marker detection fully automatic quite easily:

  • threshold the image (you can use Segment Editor for these first few steps, first manually, then automate using Python scripting)
  • apply some global smoothing (median, maybe Gaussian) if needed
  • split each island to a separate segment using Island effect; set the minimum size just slightly smaller than the fiducial marker’s volume
  • use Segment statistics module to compute shape and size metrics (this can be scripted, too); by checking oriented bounding box size, flatness, roundness, elongation you can determine which segments correspond to fiducial marker

Segment statistics module also provides the centroid of each segment that you can use in the Fiducial registration module to compute the transform between the phantom’s coordinate system and the image coordinate system.

All the steps can be executed using the GUI and I would recommend to start with that. Once you have figured out a robust workflow then you can write a short Python script that automates all the steps. THe script repository is a good starting point, but if you get stuck at any point then you can ask for help here.

Thank you so so so much! I will try it.