Z-buffer scale

I’m creating a depth map from 3D just like in example:
Is there an easy way to set the output so that the closest point of actor is Whitest (255,255,255) and the furthest point is Blackest (0,0,0)
I know that it can be adjusted through vtkImageShiftScale(), but I can’t make it work the way I want.

you can also use
float* renZBuffer = renWin->GetZbufferData(0, 0, renderWindowSizeX - 1, renderWindowSizeY - 1);