octaviz and color

View: New views
4 Messages — Rating Filter:   Alert me  

octaviz and color

by Jeff Abrahamson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been playing with octaviz all morning.  It's very nice.  My need
is to image surfaces for which I have triangular meshes, so I find
myself using vtk_trisurf mostly.

Near as I can tell, though, vtk_trisurf.m ignores anything I say about
color.  Am I confused?

What I want to be able to do is color certain triangles special
colors, such as have a triangulated shape that is all light gray but a
few regions I'll want to highlight in blue and a few others I'll want
to highlight in red.

As a toy example, suppose I want to discover regions of high
curvature.  I'd then want to highlight triangles adjacent to high
curvature areas so I can see how well my curvature program works.

Any pointers appreciated.

--
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B


signature.asc (196 bytes) Download Attachment

Re: octaviz and color

by Jonathan Stickel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would have responded sooner, but I have been away at a conference ...

Jeff Abrahamson wrote:
> I've been playing with octaviz all morning.  It's very nice.  My need
> is to image surfaces for which I have triangular meshes, so I find
> myself using vtk_trisurf mostly.
>
> Near as I can tell, though, vtk_trisurf.m ignores anything I say about
> color.  Am I confused?

There are currently two ways to give color information to vtk_surf and
vtk_trisurf: either a set of scalars corresponding to the individual
points, or an [R,G,B] vector defining a single color for the entire
plot.  For the former, the scalars are mapped through a color scheme to
produce the final color of the surface.  In Octaviz CVS there is now a
function to change the color mapping (vtk_colormap).

>
> What I want to be able to do is color certain triangles special
> colors, such as have a triangulated shape that is all light gray but a
> few regions I'll want to highlight in blue and a few others I'll want
> to highlight in red.
>
> As a toy example, suppose I want to discover regions of high
> curvature.  I'd then want to highlight triangles adjacent to high
> curvature areas so I can see how well my curvature program works.
>

Assigning scalar inputs and a color scheme may be sufficient for you.
Assign high scalar values to points of high curvature and low scalar
values elsewhere.  Then choose a color scheme that you like (from
octave-forge functions).  You could also define your own colormap.

It is possible to use low level vtk programming to assign individual
points (or triangles) certain colors, but for that you will need to
learn VTK.  I think you will get what you want quicker by using the
available scripts.

Jonathan



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------


Re: octaviz and color

by alberto_gh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Could you be more specific in how to assign scalar inputs and modifying a color scheme please? I have tried to plot only one triangle at each time with one color based in my curvature value at each of that triangle's peaks but I don't get a good result. Is there any way to do it as if it was a 4d plot, where the fourth dimension, represented as a color, takes values from a vector?

Thanks very much

Alberto
Jonathan Stickel wrote:
I would have responded sooner, but I have been away at a conference ...

Jeff Abrahamson wrote:
> I've been playing with octaviz all morning.  It's very nice.  My need
> is to image surfaces for which I have triangular meshes, so I find
> myself using vtk_trisurf mostly.
>
> Near as I can tell, though, vtk_trisurf.m ignores anything I say about
> color.  Am I confused?

There are currently two ways to give color information to vtk_surf and
vtk_trisurf: either a set of scalars corresponding to the individual
points, or an [R,G,B] vector defining a single color for the entire
plot.  For the former, the scalars are mapped through a color scheme to
produce the final color of the surface.  In Octaviz CVS there is now a
function to change the color mapping (vtk_colormap).

>
> What I want to be able to do is color certain triangles special
> colors, such as have a triangulated shape that is all light gray but a
> few regions I'll want to highlight in blue and a few others I'll want
> to highlight in red.
>
> As a toy example, suppose I want to discover regions of high
> curvature.  I'd then want to highlight triangles adjacent to high
> curvature areas so I can see how well my curvature program works.
>

Assigning scalar inputs and a color scheme may be sufficient for you.
Assign high scalar values to points of high curvature and low scalar
values elsewhere.  Then choose a color scheme that you like (from
octave-forge functions).  You could also define your own colormap.

It is possible to use low level vtk programming to assign individual
points (or triangles) certain colors, but for that you will need to
learn VTK.  I think you will get what you want quicker by using the
available scripts.

Jonathan



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Parent Message unknown Re: octaviz and color

by Jonathan Stickel-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2/11/09 help-octave-request@... wrote:

> Date: Tue, 10 Feb 2009 11:43:57 -0800 (PST)
> From: alberto_gh <albertogomezherrero@...>
> Subject: Re: octaviz and color
> To: help-octave@...
> Message-ID: <21939511.post@...>
> Content-Type: text/plain; charset=us-ascii
>
>
> Hi,
>
> Could you be more specific in how to assign scalar inputs and modifying a
> color scheme please? I have tried to plot only one triangle at each time
> with one color based in my curvature value at each of that triangle's peaks
> but I don't get a good result. Is there any way to do it as if it was a 4d
> plot, where the fourth dimension, represented as a color, takes values from
> a vector?
>
> Thanks very much
>
> Alberto
>

Unfortunately, octaviz is not currently being maintained.  It will not
compile with vtk > 5.0.x, and therefore I am no longer able to install
octaviz on my computer (which is Mac OS X).  I do not have the c++/bison
knowledge to fix the bugs, and no one else has offered to help.  Also,
there is a separate effort to provide OpenGL 3d rendering via FLTK to
Octave; this will likely supersede all projects like Octaviz.

That said, I think your problem may be simple.  The vtk_surf (and other
similar functions) will take 4 matrix inputs, the last being a set of
scalar values to use for the colormap:

vtk_surf(x,y,z,c)

To change the colormap that is applied, use the function "vtk_colormap"
(you can download the m-file from octaviz cvs).  For example:

vtk_colormap (jet(256))

HTH,
Jonathan
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave