def updateSlice(self, target_slice):
        if 0 <= slice < self.image_dim[1]:
            self.fig.set_data(self.volume.data[:, target_slice, :])
            self.current_slice = bisect(self.list_slices, target_slice)
            self.fig.figure.canvas.draw()
This function change the viewer to update the current slice
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_viewer.py/SinglePlot.updateSlice