Skip to content

Commit 48a2ce7

Browse files
kgerbbgruening
andauthored
Update 3dtrees: py3dtiles to v1.1 (#1746)
* update tool to v1.1 - collection support * fix linting issue * fix min to count - issue (9 instead of 1) * Update tools/3dtrees_py3dtiles/py3dtiles.xml Co-authored-by: Björn Grüning <bjoern@gruenings.eu> * update to support multiple = true instead of collections --------- Co-authored-by: Björn Grüning <bjoern@gruenings.eu>
1 parent b3780cc commit 48a2ce7

File tree

1 file changed

+34
-56
lines changed

1 file changed

+34
-56
lines changed

tools/3dtrees_py3dtiles/py3dtiles.xml

Lines changed: 34 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
<tool id="3dtrees_py3dtiles" name="3Dtrees: Py3DTiles Converter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.1">
2-
<description>Convert LAZ point clouds to Cesium 3D Tiles with custom attribute support</description>
1+
<tool id="3dtrees_py3dtiles" name="3Dtrees: Py3DTiles Converter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
2+
<description>Convert LAS/LAZ collection to Cesium 3D points_tiles</description>
33
<macros>
4-
<token name="@TOOL_VERSION@">1.0.0</token>
4+
<token name="@TOOL_VERSION@">1.1.0</token>
55
<token name="@VERSION_SUFFIX@">0</token>
66
</macros>
77
<requirements>
8-
<container type="docker">ghcr.io/3dtrees-earth/3dtrees_py3dtiles:latest</container>
8+
<container type="docker">ghcr.io/3dtrees-earth/3dtrees_py3dtiles:@TOOL_VERSION@</container>
99
</requirements>
1010
<command detect_errors="exit_code"><![CDATA[
1111
export NUMBA_CACHE_DIR=\$TMPDIR &&
12-
ln -s '$input' input.laz &&
12+
mkdir -p input_files &&
13+
mkdir -p tiles_output &&
14+
#for $f in $input
15+
ln -s '$f' input_files/'${f.element_identifier}.laz' &&
16+
#end for
1317
python /src/run.py
14-
--input input.laz
15-
--output-dir src/tiles_output
18+
--input input_files
19+
--output-dir tiles_output
1620
#if $extra_fields
1721
--extra-fields '$extra_fields'
1822
#end if
@@ -22,27 +26,25 @@
2226
#if $overwrite
2327
--overwrite
2428
#end if
29+
2>&1
2530
]]>
2631
</command>
2732
<inputs>
28-
<param name="input" type="data" format="laz" label="Point Cloud Dataset" help="LAS/LAZ point cloud file to convert to 3D Tiles"/>
29-
<param name="extra_fields" type="text" optional="true" label="Extra Fields" help="Comma-separated list of extra fields to include in tiles (e.g., 'PredInstance' for segmentation visualization). Leave empty to include only standard fields."/>
30-
<param name="srs_out" type="text" value="4978" label="Output CRS (EPSG code)" help="Output coordinate reference system. Default is 4978 (ECEF) for proper Cesium visualization. Leave empty to preserve original CRS."/>
31-
<param name="overwrite" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Overwrite existing output" help="Clear output directory before conversion if it already contains files"/>
33+
<param name="input" type="data" format="laz" multiple="true" label="Point Cloud Collection" help="Collection of LAZ/LAS files to merge and convert to 3D Tiles" />
34+
<param name="extra_fields" type="text" optional="true" label="Extra Fields" help="Comma-separated list of extra fields to include in tiles (e.g., 'PredInstance' for segmentation visualization). Leave empty to include only standard fields." />
35+
<param name="srs_out" type="text" value="4978" label="Output CRS (EPSG code)" help="Output coordinate reference system. Default is 4978 (ECEF) for proper Cesium visualization. Leave empty to preserve original CRS." />
36+
<param name="overwrite" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Overwrite existing output" help="Clear output directory before conversion if it already contains files" />
3237
</inputs>
3338
<outputs>
34-
<!-- Root level: tileset.json metadata -->
35-
<data name="tileset_json" format="json" label="tileset" from_work_dir="src/tiles_output/tileset.json"/>
36-
<!-- Root level: preview.pnts thumbnail -->
37-
<data name="preview_pnts" format="pnts" label="preview" from_work_dir="src/tiles_output/preview.pnts"/>
38-
<!-- Points subdirectory: all r*.pnts tile files -->
39+
<data name="tileset_json" format="json" label="tileset" from_work_dir="tiles_output/tileset.json"/>
40+
<data name="preview_pnts" format="pnts" label="preview" from_work_dir="tiles_output/preview.pnts"/>
3941
<collection name="points_tiles" type="list" label="points">
40-
<discover_datasets pattern="(?P&lt;designation&gt;r.*)\.pnts" directory="src/tiles_output" recurse="true" visible="false" format="pnts"/>
42+
<discover_datasets pattern="(?P&lt;designation&gt;r.*)\.pnts" directory="tiles_output" recurse="true" visible="false" format="pnts"/>
4143
</collection>
4244
</outputs>
4345
<tests>
44-
<test>
45-
<param name="input" value="mikro.laz"/>
46+
<test expect_num_outputs="3">
47+
<param name="input" value="mikro.laz" ftype="laz"/>
4648
<param name="srs_out" value="4978"/>
4749
<output name="tileset_json" ftype="json" compare="contains">
4850
<assert_contents>
@@ -51,9 +53,6 @@
5153
<has_text text="asset"/>
5254
<has_text text="version"/>
5355
<has_text text="geometricError"/>
54-
<has_text text="preview.pnts"/>
55-
<has_text text="points/"/>
56-
<has_n_lines n="1"/>
5756
</assert_contents>
5857
</output>
5958
<output_collection name="points_tiles" type="list" count="9"/>
@@ -63,21 +62,20 @@
6362

6463
**What it does**
6564

66-
This tool converts LAS/LAZ point cloud files to Cesium 3D Tiles format using py3dtiles. Unlike other tiling tools (e.g., gocesiumtiler), py3dtiles supports custom attributes, which is essential for visualizing segmentation results and other point cloud classifications.
65+
This tool converts a collection of LAS/LAZ point cloud files to a single Cesium 3D Tiles tileset using py3dtiles.
6766

68-
The tool automatically:
67+
**Key features:**
6968

70-
1. Detects the coordinate reference system (CRS) from the input file
71-
2. Transforms coordinates to ECEF (EPSG:4978) for proper Cesium visualization if CRS is available
72-
3. Preserves custom attributes like segmentation IDs when specified
73-
4. Generates an optimized octree structure for efficient web visualization
74-
5. Post-processes tileset structure to fix potential URI path issues
69+
1. **Memory-efficient merging**: Uses streaming to merge multiple files with constant memory (~50MB) regardless of total dataset size
70+
2. **Custom attributes**: Supports extra point attributes like PredInstance for segmentation visualization
71+
3. **Automatic CRS transformation**: Transforms to ECEF (EPSG:4978) for proper Cesium visualization
72+
4. **Out-of-core processing**: py3dtiles handles large merged files efficiently
7573

7674
-----
7775

7876
**Input**
7977

80-
- **Point Cloud Dataset**: LAS or LAZ format point cloud file
78+
- **Point Cloud Collection**: Collection of LAZ/LAS files (e.g., segmented outputs from the merge step)
8179
- **Extra Fields**: Optional comma-separated list of extra point attributes to include (e.g., "PredInstance" for instance segmentation)
8280
- **Output CRS**: EPSG code for output coordinates (default: 4978 for ECEF). Leave empty to keep original coordinates.
8381
- **Overwrite**: Clear output directory before conversion
@@ -86,44 +84,24 @@ The tool automatically:
8684

8785
**Output**
8886

89-
- **3D Tileset Metadata**: The main tileset.json file that describes the tile structure
90-
- **3D Tile Files**: Collection of binary tile files (.pnts format) containing the point cloud data
87+
- **tileset.json**: The main tileset metadata file
88+
- **preview.pnts**: Preview tile for quick loading
89+
- **points collection**: All tile files (.pnts format) containing the point cloud data
9190

9291
The output can be directly hosted on a web server and visualized using CesiumJS.
9392

9493
-----
9594

96-
**Use Cases**
95+
**Workflow Integration**
9796

98-
1. **Standard Visualization**: Convert standardized point clouds to 3D Tiles for web-based viewing
99-
2. **Segmentation Visualization**: Include custom attributes like "PredInstance" to visualize tree segmentation results
100-
3. **Custom Attributes**: Preserve any extra point attributes (e.g., quality scores, classifications) for specialized visualization
101-
102-
-----
103-
104-
**Technical Details**
105-
106-
- **Coordinate Transformation**: Files with CRS metadata are automatically transformed to ECEF (EPSG:4978) for proper Cesium camera controls
107-
- **Files without CRS**: Coordinates are preserved as-is, assuming they're already in a suitable local/relative system
108-
- **Custom Attributes**: Full support for extra dimensional attributes via py3dtiles
109-
- **Format**: Generates Cesium 3D Tiles v1.0 with PNTS (Point Cloud) tiles
110-
111-
-----
112-
113-
**Comparison with gocesiumtiler**
114-
115-
While gocesiumtiler is faster, py3dtiles is chosen for this workflow because:
116-
117-
- Supports custom point attributes (essential for segmentation visualization)
118-
- Includes bug fixes for specific use cases
119-
- Better handling of coordinate transformations with pyproj
97+
In the EndToEndPipeline workflow, this tool receives the segmented LAZ collection from the merge step and produces a single unified 3D Tiles tileset for the entire dataset.
12098

12199
</help>
122100
<creator>
123101
<organization name="3Dtrees-Team, University of Freiburg" url="https://github.com/3dTrees-earth"/>
124102
</creator>
125103
<citations>
126-
<citation type="bibtex">@misc{py3dtiles title = {Py3DTiles: Python library for 3D Tiles}, author = {py3dtiles Contributors}, year = {2024}, url = {https://gitlab.com/py3dtiles/py3dtiles}}</citation>
104+
<citation type="bibtex">@misc{py3dtiles, title = {Py3DTiles: Python library for 3D Tiles}, author = {py3dtiles Contributors}, year = {2024}, url = {https://gitlab.com/py3dtiles/py3dtiles}}</citation>
127105
<citation type="bibtex">
128106
@misc{3dtrees_py3dtiles, title = {3Dtrees: Py3DTiles}, author = {3Dtrees-Project}, year = {2025}}
129107
</citation>

0 commit comments

Comments
 (0)