How to hide and show vtkDistancewidget on vtkResliceImageviewer?


I created vtkDistanceWidget to measure distance on reslice image viewer. and it works fine but when I scroll through slices, the distanceWidget also appears.
I want to display the measure tool only for current slice not all slices.

Any assistance you can provide would be greatly appreciated.

Thank you