Skip to topic | Skip to bottom
Home
TModeling
TModeling.Spfinalizer1.1 - 18 Jun 2008 - 13:32 - Main.guesttopic end

Start of topic | Skip to actions
spfinalize

This spatial finalizer makes three passes over a point cloud. In the first pass it merely computes a bounding box. If this bounding box is known in advance this pass can be omitted. In the second pass it creates a "spatial histogram" of the point cloud in the form of a grid of counters, which it uses in the third pass to inject finalization tags into the point stream.

The program creates 2D as well as 3D finalizations. I expect it will mostly be used for 2D finalization of large terrain point sets. 2D finalization is the default. You can request 2D with (-terrain, -2d) and 3D with (-space, -3d).

Another important flag is (-grid 8, -level 8, -depth 8). It sets the resolution of the finalization grid as a power of two. The default is 6 and that works well for point sets up to, say 10 million. If you have a billion points you should probably set it to 10. If you have a hundred million then 8 or 9 will usually be okay. However, the accuracy does not matter too much.

For detailed info: read the code! Some parts may seem rather unreadable because it was optimized for efficient memory use. Memory fields often get re-used for different purposes without that making much sense in terms of variable names. But I tried to add as much documentation as possible to help you understand what is going on.


Example usage:

spfinalize -i ..\data\lidar_band.txt.gz -o ..\data\lidar_band.spb
Finalizes the terrain points stored in a standard ASCII format with a 64 by 64 finalization grid. It also adds the sprinkle points that are useful to destroy long edges when Delaunay triangulating. Look at the different options like this:
spfinalize -i ..\data\lidar_band.txt.gz -ospb | sp_viewer -ispb -every 10
spfinalize -i ..\data\lidar_band.txt.gz -level 4 -ospb | sp_viewer -ispb -every 10
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -ospb | sp_viewer -ispb -every 10
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -nosprinkle -ospb | sp_viewer -ispb -every 10
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -minimum_points 200 -ospb | sp_viewer -ispb -every 10
The point set is finalized with different grid resolutions, without sprinkle points, and with merging finalization grid children into their parent if their sum of points is below the minimum.

Add the -del2 option to see the effects this has on subsequently Delaunay triangulating the points.

spfinalize -i ..\data\lidar_band.txt.gz -ospb | sp_viewer -ispb -every 10 -del2
spfinalize -i ..\data\lidar_band.txt.gz -level 4 -ospb | sp_viewer -ispb -every 10 -del2
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -ospb | sp_viewer -ispb -every 10 -del2
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -nosprinkle -ospb | sp_viewer -ispb -every 10 -del2
spfinalize -i ..\data\lidar_band.txt.gz -level 8 -minimum_points 200 -ospb | sp_viewer -ispb -every 10 -del2
Let's look at some other data sets:
spfinalize -i ..\data\pt0366.txyzar.gz -itxt -parse sxyz -o ..\data\pt0366.spb
sp_viewer -i ..\data\pt0366.spb (press <p>)
sp_viewer -i ..\data\pt0366.spb -del2 (press <p>)
The -itxt tells spfinalize that it should expect to read text. The -parse sxyz tells it to skip the first number and use the next three numbers as x y z coordinate.
spfinalize -i pt.files -itxt -listoffiles -parse sxyz -o ..\data\pt.spb
sp_viewer -i ..\data\pt.spb
The -listoffiles tag tells spfinalize that pt.files contains a list of file names. The -itxt tells spfinalize that it should expect to read text. The -parse sxyz tells it to skip the first number and use the next three numbers as x y z coordinate.

Now let's create a triangulation:

spdelaunay2d -i ..\data\pt.spb -o ..\data\pt.smb
sm_viewer -i ..\data\pt.smb (press <p>)
Or in pipelined mode:
spfinalize -i pt.files -itxt -list_of_files -parse sxyz -ospb | spdelaunay2d -ispb -o pt.smb
And a longer pipe:
spfinalize -i pt.files -itxt -lof -parse sxyz -ospb | spdelaunay2d -ispb -osmb | sm_viewer -ismb -every 1000
And much faster (fewer redisplay calls to OpenGL):
spfinalize -i pt.files -itxt -lof -parse sxyz -ospb | spdelaunay2d -ispb -osmb | sm_viewer -ismb -every 100000
Finally, let's look at some LIDAR points that are stored in multiple files in LAS format:
sp_viewer -i gilmer.files -ilas -lof 
Now let's finalize & triangulate the points and pipe the TIN into a mesh viewer:
spfinalize -i gilmer.files -ilas -lof -ospb | spdelaunay2d -ispb -osmb | sm_viewer -ismb -every 10000
Now go and try your own data ...


Some more info on the command line options:

  • -parse sxsysz: only used for text files (points.txt or -itxt). Here x y and z are expected to be the 2nd, 4th, and 6th entry of each line. Look into spreader_txt.cpp for some other options that can be specified in the parse string.
  • -double or -force_double: force the scanning of text file input (such as *.txt or *.node) to produce double-precision points.
  • -tiles2d 2 2: will tile the specified input to produce a larger point cloud. Try
sp_viewer -i ..\data\lidar_band.txt.gz -tiles2d 3 2 -every 100               
spfinalize -i ..\data\lidar_band.txt.gz -tiles2d 3 2 -level 8 -ospb | sp_viewer -ispb -every 100
  • -tiles3d 2 2 2: same in 3D. Try
sp_viewer -i ..\data\spx_z.txt.gz -tiles3d 3 2 2 -every 100
  • -random 100: adds 100 random points per element if the input file (-i) is a streaming triangle mesh (e.g. *.sma *.smb) or a streaming tetrahedral mesh (e.g. *.sva *.svb).
  • -verbose: more output
  • -terrain or -2d or -nospace: finalization will be with a 2d grid
  • -space or -3d or -noterrain: finalization will be with a 3d grid. Try
 
spfinalize -i ..\data\spx_z.txt.gz -ospb -space -level 4 | sp_viewer -ispb -every 2
spfinalize -i ..\data\spx_z.txt.gz -ospb -space -level 4 | sp_viewer -ispb -every 2 -del3
  • -empty 3: pre-finalizes all completely empty grid cells of all levels down to 3 at the beginning of the stream.
  • -hist: print out histogram over the cell occupancy to stderr.
  • -hist_full : print out even more histogram info.

For more info:

 
spfinalize -h
Usage:
spfinalize -i terrain.txt -o terrain_finalized.spb
spfinalize -i lidar.txyzar -itxt -parse sxyz -o lidar_finalized.spb
spfinalize -i lidar.raw_f -hi lidar.hdr_f -o lidar_finalized.spb
spfinalize -i cloud.spa -o cloud_finalized.spa
spfinalize -i terrain.spb -o terrain_finalized.spb -terrain
spfinalize -i mesh.obj.gz -ispa -o cloud_finalized.spa -level 2 -empty 1
spfinalize -i mesh.ply -o cloud_finalized.spa -preserve
spfinalize -i terrain.txt.gz -o terrain_finalized.spb -sprinkle -level 5 -empty 4
spfinalize -h

If you find bugs let us know.

-- JackSnoeyink - 01 Jun 2008
to top


Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback