[vtkusers] orthogonal views through a volume
Rashed Karim
rashed.karim at gmail.com
Fri Jul 28 06:48:36 EDT 2006
Hi Rodolfo,
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?
Thanks very much again.
Best Regards,
Rashed
On 7/28/06, scsrsao at leeds.ac.uk <scsrsao at leeds.ac.uk> wrote:
>
> Hi...
>
> Sorry I didn't reply till now, but I didn't check my email yesterday
> afternoon
> XD... now to the questions...
>
> >Hi Rodolfo,
> >
> >Thanks for the code! I was actually too looking for how I could get
> orthogonal
> >views through a volume. I had a question: Does your code allow you to
> drag and
> >move the orthogonal slices with a mouse, back and forth? If you needed
> this
> >extra functionality, how would you modify your code? I guess you put some
> sort
> >of window interactor.
> >
> >Thanks in advance for your help, and thanks again for the code.
> >
> >
> >Rashed
>
> Hmmm.... to actually manage the interaction with the mouse I guess you
> would not
> clearly need to override some of the methods of the
> vtkRenderWindowInteractor
> class and do some work to first select the slice (pick it) and so forth..
> I've
> done some work to actually move the slices, but using either the keyboard
> or
> some external graphical interface (buttons and slide bars, etc)... I did
> have a
> hard time trying to find how to do this thins, so I'm attaching a bit of
> code
> to do this using keyboard... from there you should be able to extend it
> for
> interface or use it as a first step to do mouse interactions...
>
> first, you need to overload the function to handle the key events (or at
> least
> thats how I understand the whole thing)
> static void keyPressedFunction(vtkObject* obj, unsigned long,void *sr,
> void *){
>
>
> vtkRenderWindowInteractor* iren =
> vtkRenderWindowInteractor::SafeDownCast(obj);
> vtkImageDataGeometryFilter *imageFilter =
> (vtkImageDataGeometryFilter *)(sr);
> xPos = xPos + 10;
> imageFilter->SetExtent(xPos,xPos,0,374,0,99);
> iren->Render();
>
> }
>
> And then add this handler to the render window interactor
>
> vtkCallbackCommand *callback = vtkCallbackCommand::New();
> callback->SetCallback(keyPressedFunction);
> callback->SetClientData((void *)imageFilter);
>
> // I create the interactor to handle the render window
> vtkRenderWindowInteractor *wInteractor =
> vtkRenderWindowInteractor::New();
> wInteractor->SetRenderWindow(rWindow);
> wInteractor->AddObserver(vtkCommand::KeyPressEvent, callback);
> wInteractor->Initialize();
> wInteractor->Render();
> wInteractor->Start();
>
> > Ok, just ignore my question. After thinking about it, it was a stupid
> > question :D
> >
> > Actually, looking at the code for vtkImageViewer2.cxx, I am learning a
> lot.
> > Thanks for that tip!
> >
> > Cheers,
> > Luca
> >
>
> Ignoring the questions, however, just to say that there are no stupid
> questions
> ;)... any how, the array values you get are the actual dimensions of your
> dataset X: 0-511 etc... now, when slicing through the volume, usually you
> want
> to get the whole exteng on two dimensions, while restricting the third one
> to
> just 1 slice (thats why in my code you can see things like 0..max 0..max
> 99..99)
>
>
> >Hi Rodolfo,
>
> >Ok, I am guessing this is returning me the number of slices in the YZ, XZ
> and
> >XY direction.... am I correct in that?
> >
> >I guess I am asking you very basic questions... how are these 3D data
> >organized? >I have a DICOm file which is split into 100 files...
> >
> >Now, when I load this file into a DICOM reader and get the whole
> extent...
> >
> >I get the following array values:
> >
> >0-511
> >0-511
> >0-99.
> >
> >How is the volume data in the other dimensions (0-511) represented...
> >
> >Ok, you might be laughing your ass off....
>
>
> >I have one final question for you.... What does the GetWholeExtent()
> function
> >really do? I know I get six double values... but what do these values
> >represent?
> >
> >Luca
>
> Cheers,
> Rodolfo
>
>
--
Rashed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060728/33229c33/attachment-0001.htm>
More information about the vtkusers
mailing list