Thread Subject: is MATLAB GUI + vtk renderer possible?

Subject: is MATLAB GUI + vtk renderer possible?

From: Baran Aydogan

Date: 16 Sep, 2008 14:05:03

Message: 1 of 5

Hi,

I wonder if it is possible to use the vtk renderer in MATLAB GUIs?

More precisely speaking, is such a thing like; passing the handle of some axes to a mex file and rendering that axes using vtk possible?

Thanks,

-Baran

Subject: is MATLAB GUI + vtk renderer possible?

From: Baran Aydogan

Date: 19 Feb, 2009 12:26:02

Message: 2 of 5

Here is some related information;

http://www.vtk.org/Wiki/VTK/VTKMatlab

I could make the above link work; but this was not what I was trying to achieve exactly. I can render using VTK through MATLAB however I cannot visualize in a MATLAB figure.

Subject: is MATLAB GUI + vtk renderer possible?

From: Greg

Date: 19 Feb, 2009 14:04:01

Message: 3 of 5

"Baran Aydogan" <baran.aydogan@tut.fi> wrote in message <gnjj4p$nqf$1@fred.mathworks.com>...
> Here is some related information;
>
> http://www.vtk.org/Wiki/VTK/VTKMatlab
>
> I could make the above link work; but this was not what I was trying to achieve exactly. I can render using VTK through MATLAB however I cannot visualize in a MATLAB figure.

Hi Baran,

  Unfortunately this post isn't really answering your question, but rather posing one for you. I am curious why you are looking to render the MATLAB figure in VTK. Is there some particular set of functionality you need that is not available in MATLAB that VTK offers?

Please feel free to elaborate. You may also use my email address if you would rather not add that kind of information to this post.

Cheers,
-Greg

Subject: is MATLAB GUI + vtk renderer possible?

From: Phil Goddard

Date: 19 Feb, 2009 16:36:01

Message: 4 of 5


The easiest approach to incorporating VTK into a MATLAB figure window is to use the ActiViz COM object available from www.kitware.com.
(KitWare are the people who write/maintain the core VTK code.)
It is a fully functional COM interface into VTK and can easily be instantated in MATLAB using the function actxcontrol.
Unfortunately it is only compiled for win32, and does cost (about $4000 if I remember correctly).

There are a couple of other alternatives for calling VTK from MATLAB, none of them currently allow for embedding the VTK renderer into a figure window, but with a little effort a lot can be done by using a "2 window" approach: visualization rendering performed in a VTK window with other UI functionality in a MATLAB figure/UI.

- writing a mex file that calls your VTK code.
This is described in the link posted in this thread, and there's also a mex file example on the File Exchange (just search it for VTK).

- writing your own COM object called from MATLAB using actxserver.
(I have found this particularly useful when you need the same code to work from not just MATLAB but also from other C code and FORTRAN, and also on different platforms like win32, win64, linux, etc.)
With enough effort this could be extended to become a COM control embeddable in a figure window but I have not done that.

And for the future, but again at a price:
- Kitware have recently released a (multi-platform) .NET version of their COM object.
Hopefully it won't be long before these can be called directly from MATLAB in a similar way to the way that generic dlls can be called now.

As for Greg's question about why to go to VTK, I went there for 2 reasons:
- I have some images that cannot be efficiently rotated when displayed in a MATLAB figure window.
(In VTK when the mouse is moved the images smoothly rotate.
In MATLAB when the mouse is moved the image rotates a couple of degrees then redraws, moves a couple more degrees then redraws, etc, etc, making for "chunky graphics".
I sent an example to MathWorks tech support and they don't believe it can be done any faster in MATLAB.)
- I was doing the work for a consulting client who needed to call the same graphics from not just MATLAB but also C and FORTRAN.

Phil.

Subject: is MATLAB GUI + vtk renderer possible?

From: Baran Aydogan

Date: 20 Feb, 2009 09:00:20

Message: 5 of 5

Thank you for both comments. Phil's post especially is really useful not only for me but also for others who are searching similar threads in the Newsreader.

As a brief answer to Greg regarding the comparison between MATLAB and VTK, I can group the reasons into three.

1 - VTK is faster and gives better quality results in 3D rendering
2 - It can handle larger data better than MATLAB
3 - It has additional routines for 3D image manipulation, (e.g: vtkMassProperties) that MATLAB does not have

Ideally I would like to have everything in MATLAB. It really speeds up researchers' job to test algorithms; also enables making GUIs very quickly. However it is not perfect of course and needs improvement.

I quickly wrote three main points that improvement is needed. One can of add additional tweaks to MATLAB in order to match VTK's performance in 3D image manipulation and visualization.

Regards,

-Baran

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
vtk mex Baran Aydogan 16 Sep, 2008 10:10:05
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com