<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi vtkusers,<div><br></div><div>My goal is to find the camera position when wheeling the mouse.</div><div>I have tried to follow the example in <font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><b>VTK/Example/ImageProcessing/ImageSlicing. </b>Intuitively, I think the only thing I need to do is adding a "mouseWheelEvent" in the example, so my code looks like this:</span></font></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" color="#AA0D91"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">class</span> vtkImageInteractionCallback : <span style="color: #aa0d91">public</span> <span style="color: #5c2699">vtkCommand</span></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">{</span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"> ...</span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"> </span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(170, 13, 145); "><span style="color: #000000"> </span>virtual<span style="color: #000000"> </span>void<span style="color: #000000"> Execute(</span><span style="color: #5c2699">vtkObject</span><span style="color: #000000"> *, </span>unsigned<span style="color: #000000"> </span>long<span style="color: #000000"> </span><span style="color: #2e0d6e">event</span><span style="color: #000000">, </span>void<span style="color: #000000"> *)</span></div><div><font class="Apple-style-span" color="#000000"> {</font></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); "> ...</span></div><div><font class="Apple-style-span" color="#000000"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(46, 13, 110); "><font class="Apple-style-span" color="#000000"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(46, 13, 110); "><span style=""> </span><span style="">else</span><span style=""> </span><span style="">if</span><span style=""> (</span>event<span style=""> == </span><span style="">vtkCommand</span><span style="">::</span>MouseWheelForwardEvent || <span style="">vtkCommand</span><span style="">::</span>MouseWheelBackwardEvent<span class="Apple-style-span" style="">)</span></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> double cPos[3] // camera position</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera()->GetPosition(cPos);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> std::cout << "camera position: " << cPos[0] << " " << cPos[1] << " " << cPos[2] << "\n";</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> }</div><div> ...</div><div><br></div></div></font></div><div><font class="Apple-style-span" color="#000000"> }</font></div></span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px; ">}</span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" color="#5C2699" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">int</span> main (<span style="color: #aa0d91">int</span> argc, <span style="color: #aa0d91">char</span> **argv)</div><div>{</div><div> ...</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(46, 13, 110); "><font class="Apple-style-span" color="#5C2699"> </font><span style="color: #000000">imageStyle-></span>AddObserver<span style="color: #000000">(</span><span style="color: #5c2699">vtkCommand</span><span style="color: #000000">::</span>MouseWheelForwardEvent<span style="color: #000000">, callback);</span></span></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-style-span" style="color: rgb(46, 13, 110); "><span style="color: rgb(0, 0, 0); "> imageStyle-></span>AddObserver<span style="color: rgb(0, 0, 0); ">(</span><span style="color: rgb(92, 38, 153); ">vtkCommand</span><span style="color: rgb(0, 0, 0); ">::</span>MouseWheelBackwardEvent<span style="color: rgb(0, 0, 0); ">, callback);</span></span></font></div><div><font class="Apple-style-span" color="#000000"> ...</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div>}</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: medium; "><div>Now the problem is that the mouseWheelEvent behaves like been disabled when I add mouseWheel observers for the callback... Does anyone know where the issue is? Thanks in advance.</div><div><br></div></span></div></span></font></div></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Comic Sans MS'; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Wei Lu</div><div>Master Candidate</div><div>Image Analysis Lab, Dept. Psychiatry</div><div>Dept. Electrical and Computer Engineering</div><div>University of Iowa</div><div><span class="Apple-style-span" style="font-size: medium;"><br></span></div></div></span></div></span></div></span></div></span></div></span></div></body></html>