I need to change the Window Width and Window Level of the volume rendered image with mouse using vtk .
I referred this link https://vtk.org/pipermail/vtkusers/2015-September/092338.html .But it has no precise answer.
How do i change the color transfer function and opacity transfer
functions in the callback?
If you do this as a learning exercise only, then I would suggest to read the VTK textbook and study VTK examples. From these you should be able to piece together everything you need.
If your primary goal is to solve a problem (implement a feature) and not learning more about VTK, then I would suggest to use higher-level interface to VTK, where such low-level features are already implemented. For example, you can use VTK in ParaView or 3D Slicer application platforms, which already provide all basic features and you just need to implement your custom processing or GUI elements as plugins or extensions. You might also try to convince pyvista developers to provide volume rendering plot with interactive window/level settings.
If you don’t want to build on existing platforms, because you “just want to have something very simple” then probably your users would not be willing to install an application but they would just want to run your application in a web browser. For that, you can use vtk.js - see this interactive volume rendering example, where you can adjust window/level with your mouse: https://kitware.github.io/vtk-js/examples/PiecewiseGaussianWidget.html