[GRASS-dev] 3D Vector to Voxel

Soeren Gebbert soerengebbert at googlemail.com
Sun Oct 4 10:23:20 EDT 2009


Hi Ben,

2009/9/30 Benjamin Ducke <benjamin.ducke at oxfordarch.co.uk>:
> That looks very straight-forward. I don't know Python
> either, though.
> Could you write a little example script that runs the
> VTK Delaunay 2D filter on a GRASS points map, as well? ;)

Here we are:
http://code.google.com/p/vtk-grass-bridge/source/browse/trunk/Examples/v.delaunay2d.py?spec=svn24&r=24

Best reagards
Soeren

btw:
Some additional informations:

The help:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> python v.delaunay2d.py --help

Description:
 Delaunay 2d triangulation using the vtkDelaunay2D class. The created
triangles will be converted into the grass vector feature face.

Keywords:
 vector, delaunay

Usage:
 v.delaunay2d.py [-tw] input=name output=name [alpha=alpha]
   [tolerance=tolerance] [--overwrite] [--verbose] [--quiet]

Flags:
  -t   Build vector topology
  -w   Write the triangulated map as vtk xml file to the current
working directoy named <output>.vtk
 --o   Allow output files to overwrite existing files
 --v   Verbose module output
 --q   Quiet module output

Parameters:
      input   Name of input vector map
     output   Name for output vector map
      alpha   Specify alpha (or distance) value to control output of
this filter. For a non-zero alpha value, only edges or triangles
contained within a sphere centered at mesh vertices will be output.
Otherwise, only triangles will be output.
              default: 0
  tolerance   Specify a tolerance to control discarding of closely
spaced points. This tolerance is specified as a fraction of the
diagonal length of the bounding box of the points.
              default: 0

Now some Computation.

VTK version with topo and vtk xml output:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> time python v.delaunay2d.py input=elev_lid792_randpts at user1
output=delaunay2d --o -tw
Vector map <delaunay2d> already exists and will be overwritten
Building topology for vector map <delaunay2d>...
Registering primitives...
11912 primitives registered
35736 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 5773
Number of primitives: 11912
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of faces: 11912
Number of areas: 0
Number of isles: 0

real    0m1.750s
user    0m1.564s
sys     0m0.144s

VTK version without topo and vtk xml output:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> time python v.delaunay2d.py input=elev_lid792_randpts at user1
output=delaunay2d --o
Vector map <delaunay2d> already exists and will be overwritten

real    0m1.167s
user    0m1.004s
sys     0m0.144s


Comparsion to v.delaunay with huge map, notice its a 3d vector map:

VTK version without grass topology build:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> time python v.delaunay2d.py input=elev_ned10m_cont10m
output=delaunay2d --o
Vector map <delaunay2d> already exists and will be overwritten

real    0m27.422s
user    0m25.230s
sys     0m1.904s

VTK version with grass topology build:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> time python v.delaunay2d.py input=elev_ned10m_cont10m
output=delaunay2d --o -t
Vector map <delaunay2d> already exists and will be overwritten
Building topology for vector map <delaunay2d>...
Registering primitives...
369281 primitives registered
1107843 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 151776
Number of primitives: 369281
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of faces: 369281
Number of areas: 0
Number of isles: 0

real    0m45.035s
user    0m42.243s
sys     0m2.464s


Now the grass version:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples
> time v.delaunay input=elev_ned10m_cont10m at user1 output=delaunay2d
--o
WARNING: Vector map <delaunay2d> already exists and will be overwritten
Building topology for vector map <delaunay2d>...
Registering primitives...
0 primitives registered
0 vertices registered
Building areas...
0 areas built
0 isles built
Number of nodes: 0
Number of primitives: 0
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
Building topology for vector map <delaunay2d>...
Attaching islands...
Attaching centroids...
Number of nodes: 0
Number of primitives: 0
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

real    0m0.053s
user    0m0.028s
sys     0m0.020s

That was fast! Well looks like v.delaunay only works with 2d vector maps???

>
> Ben
>
> ----- Original Message -----
> From: "Soeren Gebbert" <soerengebbert at googlemail.com>
> To: "Benjamin Ducke" <benjamin.ducke at oxfordarch.co.uk>
> Cc: "GRASS developers list" <grass-dev at lists.osgeo.org>
> Sent: Tuesday, September 29, 2009 5:38:12 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
> Subject: Re: [GRASS-dev] 3D Vector to Voxel
>
>
> You don't need to learn C++. You can use Python or Java to connect
> grass, vtkGRASSBridge and VTK.
> And even TCL/TK if im going crazy and support the vtkTckTkWrapper. ;)
>
> A simple Python example which will work right out of the box:
>
> http://code.google.com/p/vtk-grass-bridge/source/browse/trunk/Examples/r.gauss.smooth
>
> On command line call within the nc dataset:
>
> python r.gauss.smooth input=lsat5_1987_10 output=test --o
>
> Thats all :)
>
>> Beń
>>
>> ----- Original Message -----
>> From: "Soeren Gebbert" <soerengebbert at googlemail.com>
>> To: "Benjamin Ducke" <benjamin.ducke at oxfordarch.co.uk>
>> Cc: "GRASS developers list" <grass-dev at lists.osgeo.org>
>> Sent: Tuesday, September 29, 2009 2:49:53 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
>> Subject: Re: [GRASS-dev] 3D Vector to Voxel
>>
>> Hello Ben,
>>
>> 2009/9/21 Benjamin Ducke <benjamin.ducke at oxfordarch.co.uk>:
>>> Hi all,
>>>
>>> I just saw a little GPL'd sofwtare that may provide a base for
>>> a v.to.r3 module that could actually cast arbitrary vector geometries
>>> to a voxel grid:
>>
>> Have a look at the vtkVoxelModeller class :
>> http://www.vtk.org/doc/release/5.4/html/a01861.html
>>
>> or the vtkImplicitModeller class:
>> http://www.vtk.org/doc/release/5.4/html/a00859.html
>>
>> Booth classes convert arbitrary datasets to a voxel representations.
>>
>> I have just committed a grass vector topology reader to the vtkGRASSBridge
>> repository.
>> Maybe you can now create voxel representations of 3d grass vector
>> data, using GRAS, VTK and vtkGRASSBridge?
>>
>> Best regards
>> Soeren
>>
>>>
>>> http://www.cs.princeton.edu/~min/binvox/
>>>
>>> maybe someone would like to look at possibilities for integrating
>>> this into GRASS?
>>>
>>> Best,
>>>
>>> Ben
>>>
>>>
>>> ------
>>> Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
>>>
>>> _______________________________________________
>>> grass-dev mailing list
>>> grass-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>>>
>>
>>
>>
>> ------
>> Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
>>
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>>
>
>
>
> ------
> Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>


More information about the grass-dev mailing list