Changing opacity of volume rendering based on window width/window level in VTK

I need to change the opacity transfer function of volume rendered image based in window width and window level .I need to know how to set the opacity transfer function with respect to WW/WL

ie) OpacityTransferFunction->AddPoint(??,??);

What I tried:

I went through this :link but it is not answered precisely.Can anyone help?

(I want to do exactly Like the Adjust Window option in 3D VR of Radiant Dicom Viewer)

This is implemented in 3D Slicer here:

You can use Slicer source code any way you want (e.g., copy-paste any code without acknowledgment), and we are happy if we could help you with that. Since Slicer already contains all basic medical image visualization and computing features that you can think of, you might go further, and save a lot of time and effort by not copying it feature-by-feature but simply implement your custom algorithms and GUI as a 3D Slicer extension or 3D Slicer custom application. See some more information here and you can also ask further questions on the Slicer forum.