How to create a color map based on the coordinate of pixels


I am trying to create and apply a color map based on the thickness or z-coordinate of each pixel to the 3D rendering of one segment, which would be just like a height contour plot but I cannot figure out a way to realize. The version of Slicer I’m using is 5.1.0

Would you care to share some insight on it? Thanks a lot!