# vtkContourWidget can not enable on a new slice plane while vtkImageViewer2 change slice index

**URL:** https://discourse.vtk.org/t/vtkcontourwidget-can-not-enable-on-a-new-slice-plane-while-vtkimageviewer2-change-slice-index/14129
**Category:** Support
**Tags:** code
**Created:** [June 28, 2024, 3:28am UTC](https://discourse.vtk.org/t/vtkcontourwidget-can-not-enable-on-a-new-slice-plane-while-vtkimageviewer2-change-slice-index/14129 "2024-06-28T03:28:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![guofeng326](https://discourse.vtk.org/user_avatar/discourse.vtk.org/guofeng326/32/9023_2.png) [@guofeng326](https://discourse.vtk.org/u/guofeng326)
#### Post date: [June 28, 2024, 3:28am UTC](https://discourse.vtk.org/t/vtkcontourwidget-can-not-enable-on-a-new-slice-plane-while-vtkimageviewer2-change-slice-index/14129/1 "2024-06-28T03:28:35Z")

</div>

in a vtkImageViewer2 render window I can change the slice of a dicom image  
I want to enable vtkContourWidget on one certain slice of the dicom  
so I enable contour on after change the slice of the dicom,like

viewer-\>SetSlice(100)  
…  
contourwgt-\>On()

but this does not work  
when draw the contour, it takes effect on the original slice, not the recent set slice 100.

How can the vtkContourWidget know the slice changed, and take effect on the new slice  
thanks
