alexposts | 1 Mar 09:57 2007
Picon

Mayavi

Hi,

I want to use mayavi (and pyvtk) to visualize of 2 dimensional mesh (more
particulary adataptive mesh, it looks like this
http://www.cita.utoronto.ca/~ljdursi/research/curve-region-oct.png).
It consists of a grid splitted in square of the same area, each
square can be divided in four over squares and one or more of these four over
squares can be divided in four over squares ... (and this process is achieved
recursively depends of your refinement level).
I have a list which contains the coordinates of the center of each squares and I
want to use these points do display the mesh. I tried to use pyVtk with the
UnstructuredGrid method but I never succeeded to display the mesh like in the
png link given before.
How can achieve it ? If someone got a python example to use for displaying AMR
or a tutorial.

Thanks

Alex

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Picon

selecting geometry conditionally

Hi,

I'm new to (t\i)vtk but am amazed having such powerful tools that are pretty straightforward to operate!

Ok, here's what I'm having a hard time finding out:
I'm using tvtk.Curvatures to get a gaussian curvature analyses of a PolyData.
So far so good, but I'd like to subdivide the PolyData conditionally: where the gaussian curvature is between 2 values.
tvtk.ButterflySubdivisionFilter works perfectly, the sole thing I need to do is to apply it conditionally.

If you have some pointers on how to do this, I surely will appreciate it!

Many thanks,

-jelle

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Prabhu Ramachandran | 8 Mar 05:27 2007
Picon

Re: Mayavi

>>>>> "Alex" == alexposts  <alexposts <at> free.fr> writes:

    Alex> Hi, I want to use mayavi (and pyvtk) to visualize of 2
    Alex> dimensional mesh (more particulary adataptive mesh, it looks
    Alex> like this
    Alex> http://www.cita.utoronto.ca/~ljdursi/research/curve-region-oct.png).
    Alex> It consists of a grid splitted in square of the same area,
    Alex> each square can be divided in four over squares and one or
    Alex> more of these four over squares can be divided in four over
    Alex> squares ... (and this process is achieved recursively
    Alex> depends of your refinement level).  I have a list which
    Alex> contains the coordinates of the center of each squares and I
    Alex> want to use these points do display the mesh. I tried to use
    Alex> pyVtk with the UnstructuredGrid method but I never succeeded
    Alex> to display the mesh like in the png link given before.  How
    Alex> can achieve it ? If someone got a python example to use for
    Alex> displaying AMR or a tutorial.

Unfortunately, I don't have the time at the moment to create a
tutorial nor do I have an example I can point you at.  I can however
say that this should be doable using an unstructured grid or polydata
dataset.  I guess you want to be able to create this using numpy
arrays rather than by creating a file.  In this case maybe you should
take a look at tvtk: 
 http://svn.enthought.com/enthought/wiki/TVTK

which lets you create vtk datasets using numpy arrays.  A simple
example is in the enthought/tvtk/examples/tiny_mesh.py that should get
you started.

cheers,
prabhu

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Prabhu Ramachandran | 8 Mar 05:36 2007
Picon

Re: selecting geometry conditionally

>>>>> "Jelle" == Jelle Feringa / EZCT Architecture & Design Research <jelleferinga <at> gmail.com> writes:

    Jelle> Hi, I'm new to (t\i)vtk but am amazed having such powerful
    Jelle> tools that are pretty straightforward to operate!

Thanks!

    Jelle> Ok, here's what I'm having a hard time finding out: I'm
    Jelle> using tvtk.Curvatures to get a gaussian curvature analyses
    Jelle> of a PolyData.  So far so good, but I'd like to subdivide
    Jelle> the PolyData conditionally: where the gaussian curvature is
    Jelle> between 2 values.  tvtk.ButterflySubdivisionFilter works
    Jelle> perfectly, the sole thing I need to do is to apply it
    Jelle> conditionally.

    Jelle> If you have some pointers on how to do this, I surely will
    Jelle> appreciate it!

Hmm, this is a VTK question and I don't have a ready answer without
doing research (for which I don't have the time ATM).  I think you
will be better served by posting a geneiric VTK question on the
vtkusers mailing list.

cheers,
prabhu

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Steve Juranich | 12 Mar 20:14 2007
Picon

Trouble getting using Volume plot.

I'm trying to get my head around how the Volume module is working.  I saw in
the documentation that the module requires the scalar data to be either
chars or shorts (Is that right?  What is the reason for this restriction?).

So in the interest of just getting something pretty on my screen, I create
some data with the following script:

-- <mkdata.py> --
#! /usr/bin/env python

import vtk

points = vtk.vtkPoints()
for z in xrange(3):
    for y in xrange(3):
        for x in xrange(3):
            points.InsertNextPoint(x, y, z)

vals = vtk.vtkShortArray()
vals.SetName('simple')
for i in xrange(27):
    vals.InsertNextValue(i + 1)

sg = vtk.vtkStructuredGrid()
sg.SetPoints(points)
sg.GetPointData().SetScalars(vals)

w = vtk.vtkXMLStructuredGridWriter()
w.SetFileName('simple_cube.vts')
w.SetInput(sg)

w.Write()
-- </mkdata.py> --

I run the script and I get the following ".vts" file:

-- <simple_cube.vts> --
<?xml version="1.0"?>
<VTKFile type="StructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">
  <StructuredGrid WholeExtent="0 -1 0 -1 0 -1">
    <Piece Extent="0 -1 0 -1 0 -1">
      <PointData Scalars="simple">
        <DataArray type="Int16" Name="simple" format="appended"
offset="0"                   />
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float32" NumberOfComponents="3" format="appended"
offset="88"                  />
      </Points>
    </Piece>
  </StructuredGrid>
  <AppendedData encoding="base64">

_AQAAAACAAAA2AAAALwAAAA==eJwFwYcBQDAAALCYpWZR8/8/JYVSpdZoBZ1eNBhNZotVstkdstPl9nh9fhzCAXs=AQAAAACAAABEAQAARAAAAA==eJxjYEAGDfZIHAcGrHIgGq7OAbsesJgDkhgWs5DNQ9GHJI+MYXah240sB7ML3U3IelDcxYDFbGQz0PyALI/AAJqqGuY=
  </AppendedData>
</VTKFile>
-- </simple_cube.vts> --

I apologize for including this inline.  I know it's a mess, but I couldn't
remember if this list accepts attachments or not.

So anyway, I use the following command to bring up MayaVi:

mayavi -d simple_cube.vts -m Volume

and I get the following garbage printed to my shell screen (along with a
very empty MayaVi visualization window):

-- <run.log> --
ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Common/vtkLookupTable.cxx,
line 84
vtkLookupTable (0xaec8d0): Bad table range: [1e+299, -1e+299]

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/VolumeRendering/vtkVolumeMapper.cxx,
line 83
vtkVolumeRayCastMapper (0xb33090): The SetInput method of this mapper
requires vtkImageData as input

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/VolumeRendering/vtkVolumeMapper.cxx,
line 83
vtkVolumeRayCastMapper (0xb33090): The SetInput method of this mapper
requires vtkImageData as input

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Common/vtkLookupTable.cxx,
line 84
vtkLookupTable (0xb4e670): Bad table range: [1e+299, -1e+299]

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.

ERROR:
In /volume80/ror/swl-mini/x86_64-linux/tmp/vtk-5.0.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 710
vtkStreamingDemandDrivenPipeline (0xb4f870): Input port 0 of algorithm
vtkVolumeRayCastMapper(0xb33090) has 0 connections but is not optional.
-- </run.log>

So can anybody tell me what I'm doing wrong?  Like I said, my visualization
window is blank, so something is definitely going awry.  I just don't have
enough experience with MayaVi's volume visualization to diagnose this
problem.

Many thanks in advance.

--

-- 
Steve Juranich
Tucson, AZ
USA

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Prabhu Ramachandran | 13 Mar 17:56 2007
Picon

Re: Trouble getting using Volume plot.

>>>>> "Steve" == Steve Juranich <sjuranic <at> gmail.com> writes:

    Steve> I'm trying to get my head around how the Volume module is
    Steve> working.  I saw in the documentation that the module
    Steve> requires the scalar data to be either chars or shorts (Is
    Steve> that right?  What is the reason for this restriction?).

Earlier VTK's Volume code supported only such data structured points
data.  The work around with mayavi1 is to use the
StructuredPointsProbe filter before you use the volume module.  This
filter will convert the data to a suitable datatype and also convert
the dataset to a structured points one given any input dataset.

Incidentally, MayaVi2 supports fixed point rendering and also supports
unstructured grid rendering but does not yet support structured grids.

    Steve> So can anybody tell me what I'm doing wrong?  Like I said,
    Steve> my visualization window is blank, so something is
    Steve> definitely going awry.  I just don't have enough experience
    Steve> with MayaVi's volume visualization to diagnose this
    Steve> problem.

In your case you have created a structured grid data set and not a
structuredpoints/image data dataset this causes your error.  Just try
this instead:

 mayavi -d simple_cube.vts -f StructuredPointsProbe -m Volume

This will not work with mayavi2 since I haven't ported the
structuredPointsProbe filter yet to mv2 and VTK does not AFAIK support
structured grid volume rendering.

cheers,
prabhu

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Anders Lyckegaard | 14 Mar 07:52 2007
Picon

[Newbie] Drawing a cylinder

Dear list,

I hope that you accept newbie questions. 

My goal is to draw a circular cylinder or some other embedded manifold with some objects moving on top of the
cylindrical surface.

Here is my approach (I'm wondering if it is a good one).

The first thing I have tried is to generate a VTK file with the points of the cylinder using pyVTK. (I have
attached the file). I have generated these as unstructured data. 

Next I opened the file with mayavi, used a Delaunay3D filter and a SurfaceMap module.  My problem is that the
surface I get is not completely filled out. There are some open triangles in the surface which are not
rendered. I have tried tweaking the settings of the Delaunay filter, but I haven't been able to close the
open triangles.

Any help or comments are appreciated.

Anders Lyckegaard

 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
Attachment (cylinder.vtk): application/octet-stream, 3067 bytes
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Peter Schmitt | 16 Mar 19:52 2007
Picon

MayaVi 2: Loading a custom lookup/gradient table/CTF for volume visualization

I want to load a custom gradient table color transfer function (*.grad file) via a MayaVi2 script.

Here's how I do it via the GUI:
1.  Load data
2.  Modules -> Volume
3.  Select the "Volume" module from the "MayaVi" panel"
4.  Right click the colortable (by default it looks like all the colors from the rainbow)
5.  Click "Load"... select table and load it...

So, now I want to do it via a script.  Here's what I have to set up my volume visualization
<start snip>
from enthought.mayavi.modules.volume import Volume

# start MayaVi, load data, etc.
...
vol = Volume()
mayavi.add_module(vol)
</end snip>

I noticed the following functions/classes/members of Volume:
      vol.module_manager.lut_data_mode
      vol.module_manager.scalar_lut_manager.load_lut_from_file(filename)
but these do not seem to actually update the ctf... They look like something implemented in VTK that changes scalar lookup tables only, not the CTF.

I poked around the MayaVi2 code a little and found this:
https://svn.enthought.com/enthought/browser/trunk/src/lib/enthought/mayavi/core/lut_manager.py?rev=9906

Which leads me to believe the CTF/gradient editor is abstracted from the Volume module, and I somehow need to get access to MayaVi's lut_manager.

How do I change the CTF via a MayaVi2 script?

Thanks,
Pete

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Colin Cotter | 17 Mar 11:00 2007
Picon

user-defined plugins

Dear list,
   I'm running Mayavi 1 on unstable Debian, and I'm struggling to get
my user-defined plugins loaded. I've added the path containing
Modules, Filters using preferences, and  our new filters now appear in
Visualize -> Filters -> User but when I click on one, I get:

Exception:
/var/lib/python-support/python2.4/mayavi/Common.py:588:ImportError:No
module named IsoSurfaceProbe (in mod_fil_import)

Is this a problem with my setup?

all the best
--Colin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Gmane