Rendering inner cells of a StructuredGrid

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering inner cells of a StructuredGrid

Lionel-3
Hi,

I'm having trouble rendering cells of a StructuredGrid.
It seems I can't find the right combination of filters/modules to do so.

For instance, let's look at this example:
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/data.html#structuredgrid

When I bring the resulting grid in Mayavi and apply a 'Surface' module
on it, only the exterior faces are filled (which makes sense). That is,
if you set the representation to 'wireframe', you won't be able to see
edges connecting the interior cells.

The contrary is perfectly visible with an UnstructuredGrid, where each
cell is rendered separately.

How may I achieve this with the mlab pipeline ?

Thanks,

Lionel

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Rendering inner cells of a StructuredGrid

Gael Varoquaux
Hey Lionel,

Sorry for the slow answer. I am once again running after a deadline, and
as a results I am badly sleep deprieved.

On Fri, Mar 05, 2010 at 01:07:25PM +0100, Lionel wrote:
> I'm having trouble rendering cells of a StructuredGrid.
> It seems I can't find the right combination of filters/modules to do so.

> For instance, let's look at this example:
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/data.html#structuredgrid

> When I bring the resulting grid in Mayavi and apply a 'Surface' module
> on it, only the exterior faces are filled (which makes sense). That is,
> if you set the representation to 'wireframe', you won't be able to see
> edges connecting the interior cells.

> The contrary is perfectly visible with an UnstructuredGrid, where each
> cell is rendered separately.

> How may I achieve this with the mlab pipeline ?

I am not sure how you want to visualized the cells of an
UnstructuredGrid. It is a dense structure, so if you draw each plane, you
won't see much. Can you tell us what exactly you are looking for. If it
is to explore the connectivity of the grid, maybe this example can help:
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_datasets.html

HTH,

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Rendering inner cells of a StructuredGrid

Lionel-3
Gael Varoquaux wrote:

> Hey Lionel,
>
> Sorry for the slow answer. I am once again running after a deadline, and
> as a results I am badly sleep deprieved.
>
> On Fri, Mar 05, 2010 at 01:07:25PM +0100, Lionel wrote:
>> I'm having trouble rendering cells of a StructuredGrid.
>> It seems I can't find the right combination of filters/modules to do so.
>
>> For instance, let's look at this example:
>> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/data.html#structuredgrid
>
>> When I bring the resulting grid in Mayavi and apply a 'Surface' module
>> on it, only the exterior faces are filled (which makes sense). That is,
>> if you set the representation to 'wireframe', you won't be able to see
>> edges connecting the interior cells.
>
>> The contrary is perfectly visible with an UnstructuredGrid, where each
>> cell is rendered separately.
>
>> How may I achieve this with the mlab pipeline ?
>
> I am not sure how you want to visualized the cells of an
> UnstructuredGrid. It is a dense structure, so if you draw each plane, you
> won't see much. Can you tell us what exactly you are looking for. If it
> is to explore the connectivity of the grid, maybe this example can help:
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_datasets.html
>
> HTH,
>
> Gaël

Hi Gaël.
This is not exactly what I'm looking for. I'm not sure sure if I'm
allowed to attach images here or not, so here's a link:
http://img121.imageshack.us/img121/3581/totozx.png
(forget about the gridplanes)

This was rendered using an unstructured grid, and setting a scalar value
for each cell. I then lowered the opacity of the surface module, and
that's the result.
But as you can see, a trivial shape like this could be drawn with a
StructuredGrid, or even a RectilinearGrid. However, we won't be able to
see the inner cells (and their scalar value) with those datasets.

In the example you mention, we can indeed see the connectivity in the
shape, but we cannot know (or at least, guess) what the scalar value is
for each point.

Lionel

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Rendering inner cells of a StructuredGrid

Gael Varoquaux
On Thu, Mar 11, 2010 at 09:46:31AM +0100, Lionel wrote:
> Hi Gaël.
> This is not exactly what I'm looking for. I'm not sure sure if I'm
> allowed to attach images here or not, so here's a link:
> http://img121.imageshack.us/img121/3581/totozx.png
> (forget about the gridplanes)

> This was rendered using an unstructured grid, and setting a scalar value
> for each cell. I then lowered the opacity of the surface module, and
> that's the result.
> But as you can see, a trivial shape like this could be drawn with a
> StructuredGrid, or even a RectilinearGrid. However, we won't be able to
> see the inner cells (and their scalar value) with those datasets.

Hi,

This is a fairly no-standard way of looking at data, AFAIK. I wonder how
it scales on complex data (ie many cells, little order). The closest
thing I can think of with more or less standard tools would be this:

import numpy as np

x, y, z = np.ogrid[-4:4, -4:4, -4:4]
a = x**2 + y**2 + z**2

from enthought.mayavi import mlab

src     = mlab.pipeline.scalar_field(-a)
edges   = mlab.pipeline.extract_edges(src)
lines   = mlab.pipeline.surface(edges, )#color=(.7, .7, .7))
outline = mlab.outline(line_width=3)
vol     = mlab.pipeline.volume(src)
vol.volume_property.interpolation_type = 'nearest'
vol.volume_property.shade = False

HTH,

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Rendering inner cells of a StructuredGrid

Lionel-3
Gael Varoquaux wrote:

> On Thu, Mar 11, 2010 at 09:46:31AM +0100, Lionel wrote:
>> Hi Gaël.
>> This is not exactly what I'm looking for. I'm not sure sure if I'm
>> allowed to attach images here or not, so here's a link:
>> http://img121.imageshack.us/img121/3581/totozx.png
>> (forget about the gridplanes)
>
>> This was rendered using an unstructured grid, and setting a scalar value
>> for each cell. I then lowered the opacity of the surface module, and
>> that's the result.
>> But as you can see, a trivial shape like this could be drawn with a
>> StructuredGrid, or even a RectilinearGrid. However, we won't be able to
>> see the inner cells (and their scalar value) with those datasets.
>
> Hi,
>
> This is a fairly no-standard way of looking at data, AFAIK. I wonder how
> it scales on complex data (ie many cells, little order). The closest
> thing I can think of with more or less standard tools would be this:
>
> import numpy as np
>
> x, y, z = np.ogrid[-4:4, -4:4, -4:4]
> a = x**2 + y**2 + z**2
>
> from enthought.mayavi import mlab
>
> src     = mlab.pipeline.scalar_field(-a)
> edges   = mlab.pipeline.extract_edges(src)
> lines   = mlab.pipeline.surface(edges, )#color=(.7, .7, .7))
> outline = mlab.outline(line_width=3)
> vol     = mlab.pipeline.volume(src)
> vol.volume_property.interpolation_type = 'nearest'
> vol.volume_property.shade = False
>
> HTH,
>
> Gaël

This is very helpful ! Thanks a lot !

Lionel

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev