Hi Rodolfo, <br><br>Thanks for your code and help. One last question: Which particular key on the keyboard causes the callback to be invoked?? Where do you define this key? <br><br>Thanks very much again. <br><br>Best Regards, 
<br>Rashed <br><br><div><span class="gmail_quote">On 7/28/06, <b class="gmail_sendername"><a href="mailto:scsrsao@leeds.ac.uk">scsrsao@leeds.ac.uk</a></b> &lt;<a href="mailto:scsrsao@leeds.ac.uk">scsrsao@leeds.ac.uk</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi...<br><br> Sorry I didn't reply till now, but I didn't check my email yesterday afternoon
<br>XD... now to the questions...<br><br>&gt;Hi Rodolfo,<br>&gt;<br>&gt;Thanks for the code! I was actually too looking for how I could get orthogonal<br>&gt;views through a volume. I had a question: Does your code allow you to drag and
<br>&gt;move the orthogonal slices with a mouse, back and forth? If you needed this<br>&gt;extra functionality, how would you modify your code? I guess you put some sort<br>&gt;of window interactor.<br>&gt;<br>&gt;Thanks in advance for your help, and thanks again for the code.
<br>&gt;<br>&gt;<br>&gt;Rashed<br><br>Hmmm.... to actually manage the interaction with the mouse I guess you would not<br>clearly need to override some of the methods of the vtkRenderWindowInteractor<br>class and do some work to first select the slice (pick it) and so forth.. I've
<br>done some work to actually move the slices, but using either the keyboard or<br>some external graphical interface (buttons and slide bars, etc)... I did have a<br>hard time trying to find how to do this thins, so I'm attaching a bit of code
<br>to do this using keyboard... from there you should be able to extend it for<br>interface or use it as a first step to do mouse interactions...<br><br>first, you need to overload the function to handle the key events (or at least
<br>thats how I understand the whole thing)<br>static void keyPressedFunction(vtkObject* obj, unsigned long,void *sr, void *){<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::SafeDownCast(obj);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkImageDataGeometryFilter *imageFilter = (vtkImageDataGeometryFilter *)(sr);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xPos = xPos + 10;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;imageFilter-&gt;SetExtent(xPos,xPos,0,374,0,99);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iren-&gt;Render();<br><br>}<br>
<br>And then add this handler to the render window interactor<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkCallbackCommand *callback = vtkCallbackCommand::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;callback-&gt;SetCallback(keyPressedFunction);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;callback-&gt;SetClientData((void *)imageFilter);
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// I create the interactor to handle the render window<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderWindowInteractor *wInteractor = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wInteractor-&gt;SetRenderWindow(rWindow);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wInteractor-&gt;AddObserver(vtkCommand::KeyPressEvent, callback);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wInteractor-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wInteractor-&gt;Render();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wInteractor-&gt;Start();<br><br>&gt; Ok, just ignore my question. After thinking about it, it was a stupid<br>&gt; question :D<br>&gt;
<br>&gt; Actually, looking at the code for vtkImageViewer2.cxx, I am learning a lot.<br>&gt; Thanks for that tip!<br>&gt;<br>&gt; Cheers,<br>&gt; Luca<br>&gt;<br><br>Ignoring the questions, however, just to say that there are no stupid questions
<br>;)... any how, the array values you get are the actual dimensions of your<br>dataset X: 0-511 etc... now, when slicing through the volume, usually you want<br>to get the whole exteng on two dimensions, while restricting the third one to
<br>just 1 slice (thats why in my code you can see things like 0..max 0..max<br>99..99)<br><br><br>&gt;Hi Rodolfo,<br><br>&gt;Ok, I am guessing this is returning me the number of slices in the YZ, XZ and<br>&gt;XY direction.... am I correct in that?
<br>&gt;<br>&gt;I guess I am asking you very basic questions... how are these 3D data<br>&gt;organized? &gt;I have a DICOm file which is split into 100 files...<br>&gt;<br>&gt;Now, when I load this file into a DICOM reader and get the whole extent...
<br>&gt;<br>&gt;I get the following array values:<br>&gt;<br>&gt;0-511<br>&gt;0-511<br>&gt;0-99.<br>&gt;<br>&gt;How is the volume data in the other dimensions (0-511) represented...<br>&gt;<br>&gt;Ok, you might be laughing your ass off....
<br><br><br>&gt;I have one final question for you.... What does the GetWholeExtent() function<br>&gt;really do? I know I get six double values... but what do these values<br>&gt;represent?<br>&gt;<br>&gt;Luca<br><br>Cheers,
<br>Rodolfo<br><br></blockquote></div><br><br clear="all"><br>-- <br>Rashed