Hi,<div>I wrote a program using several vtkImageViewer to show a image series for the user to choose one, and each vtkImageViewer contains one image with different Z slice. Here is the problem: how to know which vtkImageViewer is clicked and get its Z slice. I try to use addObserver, the code is like this:</div>
<div> .......</div><div><div> vtkWin32RenderWindowInteractor* interator = vtkWin32RenderWindowInteractor::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> vtkCallbackCommand* command = vtkCallbackCommand::New();<span class="Apple-tab-span" style="white-space:pre">        </span></div>
</div><div> command->SetCallback(mycallback);</div><div> myviewer->SetupInteractor(interator);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> interator->AddObserver(vtkCommand::LeftButtonPressEvent,command);</div>
<div> .....</div><div> </div><div> here i don't know how to write, because the caller is not vtkImageViewer, if i write it like this:</div><div> void mycallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)</div>
<div> { </div><div> vtkImageViewer* viewer = reinterpret_cast<vtkImageViewer*>(caller);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> viewer ->GetZSlice();</div>
<div> }</div><div> it works wrong, if i use</div><div><span class="Apple-style-span"> vtkWin32RenderWindowInteractor* interator = reinterpret_cast<</span>vtkWin32RenderWindowInteractor<span class="Apple-style-span">*>(caller);</span></div>
<div> i wouldn't get the Z slice. can you give me some advice to solve this problem? Thanks very much and with regards.</div><div><br></div><div><br></div>