<div class="gmail_quote">Hi Benjamin,<br><br><div class="gmail_quote">2009/8/28 Benjamin Ducke <span dir="ltr">&lt;<a href="mailto:benjamin.ducke@oxfordarch.co.uk" target="_blank">benjamin.ducke@oxfordarch.co.uk</a>&gt;</span><div class="im">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is great! Did you consider writing a little plug-on for one<br>
of the VTK viewers, like ParaView or VisIt, to allow direct access<br>
to GRASS data from there?</blockquote></div><div><br>No.I do not consider to implement plug-ins for ParaView or Visit for now.<br>This may change in the far future.<br>First i need to validate the library concept and then i will implement full raster,<br>

vector, volume and grass sql database support ..  and this will take a while.<br><br>Then i need to understand the vtkGeo and projection concept in VTK 5.4+ . <br><br>So the plugin development does not have a high priority on my todo list. :)<br>

<br>Cheers<br><font color="#888888">Soeren<br><br></font></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Cheers,<br>
<br>
Ben<br>
<br>
Soeren Gebbert wrote:<br>
&gt; Hi,<br>
&gt; JFYI i have implemented a small demo library which connects parts of the<br>
&gt; grass gis library<br>
&gt; with the Visual-Tool-Kit VTK.<br>
&gt; It is called vtkGRASSBridge.<br>
&gt;<br>
&gt; Additionally the VTK Python and Java wrapping mechanism have been<br>
&gt; enabled. So the user can use the<br>
&gt; library from C++, Python and Java.<br>
&gt;<br>
&gt; Features:<br>
&gt; * The library can read and write raster maps row by row, as well as<br>
&gt; regions and the raster history.<br>
&gt; * It can list files of the grass database.<br>
&gt; * It can convert grass raster maps into the vtkImageData format and the<br>
&gt; other way round.<br>
&gt; Missing Features:<br>
&gt; * Full raster support (categories, colors, ..)<br>
&gt; * Imagery support (groups, ...)<br>
&gt; * Full vector support ....<br>
&gt; * ....<br>
&gt;<br>
&gt; You can use every vtkDataSet processing algorithm available in VTK (more<br>
&gt; than 50 i think)<br>
&gt; to process the converted raster map and write it back to the grass<br>
&gt; raster database.<br>
&gt;<br>
&gt; You can use the VTK render functionality to display the raster map.<br>
&gt;<br>
&gt; There are examples and tests in the library showing this functionality<br>
&gt; in Python.<br>
&gt;<br>
&gt; The documentation of the library can be found here:<br>
&gt; <a href="http://www-pool.math.tu-berlin.de/%7Esoeren/grass/files/vtkGRASSBridge/doc/html/index.html" target="_blank">http://www-pool.math.tu-berlin.de/~soeren/grass/files/vtkGRASSBridge/doc/html/index.html</a><br>
&gt;<br>
&gt; The GPL source code is located here:<br>
&gt;  <a href="http://www-pool.math.tu-berlin.de/%7Esoeren/grass/files/vtkGRASSBridge/vtkGRASSBridge_0.1.tar.gz" target="_blank">http://www-pool.math.tu-berlin.de/~soeren/grass/files/vtkGRASSBridge/vtkGRASSBridge_0.1.tar.gz</a><br>


&gt;<br>
&gt; Here is a small Python code example to read and write grass raster maps<br>
&gt; in Python (within a grass session):<br>
&gt;<br>
&gt; ##############################################<br>
&gt; #include the VTK and vtkGRASSBridge Python libraries<br>
&gt; from libvtkCommonPython import *<br>
&gt; from libvtkFilteringPython import *<br>
&gt; from libvtkGraphicsPython import *<br>
&gt; from libvtkRenderingPython import *<br>
&gt; from libvtkIOPython import *<br>
&gt; from libvtkImagingPython import *<br>
&gt; from libvtkGRASSBridgeIOPython import *<br>
&gt; from libvtkGRASSBridgeCommonPython import *<br>
&gt;<br>
&gt; #Initiate grass<br>
&gt; init = vtkGRASSInit()<br>
&gt;<br>
&gt; #The region settings<br>
&gt; region = vtkGRASSRegion()<br>
&gt; region.ReadCurrentRegion()<br>
&gt; region.SetCols(10)<br>
&gt; region.SetRows(10)<br>
&gt; region.AdjustRegion()<br>
&gt;<br>
&gt; #Create a new map and write some data into it<br>
&gt; writer = vtkGRASSRasterMapWriter()<br>
&gt; writer.SetMapTypeToCELL()<br>
&gt; writer.SetRegion(region)<br>
&gt; writer.UseUserDefinedRegion()<br>
&gt; writer.OpenMap(&quot;test_cell&quot;)<br>
&gt;<br>
&gt; #this is the row buffer<br>
&gt; data = vtkIntArray()<br>
&gt; data.SetNumberOfTuples(writer.GetNumberOfCols())<br>
&gt;<br>
&gt; #iterate over each raster cell<br>
&gt; for i in range(writer.GetNumberOfRows()):<br>
&gt;     for j in range(writer.GetNumberOfCols()):<br>
&gt;         data.SetTuple1(j, i + j + 100)<br>
&gt;     writer.PutNextRow(data)<br>
&gt;<br>
&gt; #close the map<br>
&gt; writer.CloseMap()<br>
&gt;<br>
&gt; #now reopen the map for reading<br>
&gt; reader = vtkGRASSRasterMapReader()<br>
&gt; reader.OpenMap(&quot;test_cell&quot;)<br>
&gt;<br>
&gt; #print the cells to stdout<br>
&gt; print &quot; &quot;<br>
&gt; for i in range(reader.GetNumberOfRows()):<br>
&gt;     data = reader.GetRow(i)<br>
&gt;     for j in range(reader.GetNumberOfCols()):<br>
&gt;         print data.GetTuple1(j),<br>
&gt;     print &quot; &quot;<br>
&gt;<br>
&gt; #print the range of the raster map<br>
&gt; val = [0,0]<br>
&gt; reader.GetRange(val);<br>
&gt; print &quot;Range &quot;, val<br>
&gt;<br>
&gt; #print the history<br>
&gt; print reader.GetHistory()<br>
&gt; reader.CloseMap()<br>
&gt;<br>
&gt; #############################################<br>
&gt;<br>
&gt;<br>
&gt; Have fun<br>
&gt; Soeren<br>
&gt;<br>
&gt;<br>
&gt; ------------------------------------------------------------------------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; grass-dev mailing list<br>
&gt; <a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
<br>
<br>
--<br>
Benjamin Ducke<br>
Senior Applications Support and Development Officer<br>
<br>
Oxford Archaeological Unit Limited<br>
Janus House<br>
Osney Mead<br>
OX2 0ES<br>
Oxford, U.K.<br>
<br>
Tel: +44 (0)1865 263 800 (switchboard)<br>
Tel: +44 (0)1865 980 758 (direct)<br>
Fax :+44 (0)1865 793 496<br>
<a href="mailto:benjamin.ducke@oxfordarch.co.uk" target="_blank">benjamin.ducke@oxfordarch.co.uk</a><br>
<br>
<br>
<br>
<br>
------<br>
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit <a href="http://iso26300.info" target="_blank">http://iso26300.info</a> for more information.<br>


<br>
</blockquote></div></div></div><br>
</div><br>