Skip to content

Commit a46a7cd

Browse files
kgerbbgruening
andauthored
Update 3dtrees_standardization v1.1 (#1747)
* Update standard.xml to use conditional mode selector and fix Docker image * naming consistency * Refactor standard.xml to improve command paths and update input collection parameter. Changed output expectations for tests and clarified documentation for collection mode validation. * add second test file * remove mikro2; add single file test; fix multiple=true issue * update to include mikro2 * Update tools/3dtrees_standardization/standard.xml Co-authored-by: Björn Grüning <bjoern@gruenings.eu> * Update tools/3dtrees_standardization/standard.xml Co-authored-by: Björn Grüning <bjoern@gruenings.eu> * add proper json tests * add suggestions * fix typo * Update standard.xml --------- Co-authored-by: Björn Grüning <bjoern@gruenings.eu>
1 parent ffebc04 commit a46a7cd

File tree

2 files changed

+125
-51
lines changed

2 files changed

+125
-51
lines changed

tools/3dtrees_standardization/standard.xml

Lines changed: 125 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,160 @@
1-
<tool id="3dtrees_standardization" name="3Dtrees: LAZ Standardization" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
2-
<description>
3-
laz file checks and standardization.
4-
</description>
1+
<tool id="3dtrees_standardization" name="3DTrees: LAS/LAZ Standardization" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
2+
<description>Standardize LAS/LAZ files or validate collections for consistency</description>
53
<macros>
6-
<token name="@TOOL_VERSION@">1.0.1</token>
4+
<token name="@TOOL_VERSION@">1.1.0</token>
75
<token name="@VERSION_SUFFIX@">0</token>
86
</macros>
97
<requirements>
108
<container type="docker">ghcr.io/3dtrees-earth/3dtrees-pc-standard:@TOOL_VERSION@</container>
119
</requirements>
1210
<command detect_errors="exit_code"><![CDATA[
13-
## needed because the Rscript is following symlinks
14-
cp '$input' /in/input.laz &&
15-
cd /src &&
16-
Rscript run.R
17-
--dataset-path /in/input.laz
18-
--output-dir .
19-
--min-density
20-
$min_density &&
21-
mv /src/pc_standardized.laz '$pc_standardized'
22-
]]>
23-
</command>
11+
#if $mode.task == 'single_file':
12+
cp '$mode.input' input.laz &&
13+
Rscript /src/run.R
14+
--dataset-path ./input.laz
15+
--output-dir ./
16+
--method single_file
17+
--min-density '$mode.min_density'
18+
#if $mode.removeable_attributes:
19+
--removeable_attributes '$mode.removeable_attributes'
20+
#end if
21+
#else:
22+
mkdir -p ./input_files &&
23+
#for $f in $mode.input_collection
24+
cp '$f' ./input_files/'${f.element_identifier}.laz' &&
25+
#end for
26+
Rscript /src/run.R
27+
--dataset-path ./input_files/
28+
--output-dir ./
29+
--method collection
30+
#end if
31+
]]></command>
32+
2433
<inputs>
25-
<param name="input" type="data" format="laz" label="Point Cloud Dataset" help="LAZ point cloud to process"/>
26-
<param name="min_density" type="integer" value="500" min="1" max="10000" label="Minimum Point Density (points/m²)" help="Minimum required point density in points per square meter. Default: 500 for TLS data. Use lower values (e.g., 10-50) for ALS data."/>
34+
<conditional name="mode">
35+
<param name="task" type="select" label="Mode">
36+
<option value="single_file">Single File Standardization</option>
37+
<option value="collection">Collection Validation</option>
38+
</param>
39+
<when value="single_file">
40+
<param name="input" type="data" format="laz" label="Point Cloud File"
41+
help="LAS/LAZ point cloud file to standardize (CRS validation, density check, format normalization)"/>
42+
<param argument="--min-density" type="integer" min="1" max="10000" value="10"
43+
label="Minimum Point Density"
44+
help="Minimum acceptable point density in points per square meter. Default: 10 pts/m²"/>
45+
<param argument="--removeable_attributes" type="text" value="" optional="true"
46+
label="Attributes to Remove"
47+
help="Space-separated list of attribute names to remove (e.g., 'Intensity UserData'). Leave empty for auto-detection."/>
48+
</when>
49+
<when value="collection">
50+
<param name="input_collection" type="data" format="laz" multiple="true" label="Point Cloud Collection"
51+
help="Multiple LAZ/LAS files to validate for consistency (CRS homogeneity, attribute consistency, overlaps)"/>
52+
</when>
53+
</conditional>
2754
</inputs>
2855
<outputs>
29-
<data name="pc_standardized" format="laz" label="Standardized Point Cloud"/>
56+
<data name="pc_standardized" format="laz" label="standardized" from_work_dir="input.laz">
57+
<filter>mode['task'] == "single_file"</filter>
58+
</data>
59+
<data name="metadata_json" format="json" label="metadata" from_work_dir="input.json">
60+
<filter>mode['task'] == "single_file"</filter>
61+
</data>
62+
<data name="convex_hull" format="geojson" label="convex_hull" from_work_dir="input_convex_hull_wgs84.GeoJSON">
63+
<filter>mode['task'] == "single_file"</filter>
64+
</data>
65+
<data name="collection_summary" format="json" label="collection_summary" from_work_dir="collection_summary.json">
66+
<filter>mode['task'] == "collection"</filter>
67+
</data>
3068
</outputs>
3169
<tests>
32-
<test>
33-
<param name="input" value="mikro.laz" ftype="laz"/>
34-
<param name="min_density" value="10"/>
35-
<output name="pc_standardized">
70+
<test expect_num_outputs="3">
71+
<conditional name="mode">
72+
<param name="task" value="single_file"/>
73+
<param name="input" value="mikro.laz" ftype="laz"/>
74+
<param name="min_density" value="10"/>
75+
</conditional>
76+
<output name="pc_standardized" ftype="laz">
77+
<assert_contents>
78+
<has_size min="1000"/>
79+
</assert_contents>
80+
</output>
81+
<output name="convex_hull" ftype="geojson">
3682
<assert_contents>
37-
<has_size value="100000" delta="50000"/>
83+
<has_json_property_with_text property="type" text="FeatureCollection"/>
84+
</assert_contents>
85+
</output>
86+
<output name="metadata_json" ftype="json">
87+
<assert_contents>
88+
<has_text text='"point_count":[12917]'/>
89+
<has_text text='"standardized":[true]'/>
90+
</assert_contents>
91+
</output>
92+
</test>
93+
<test expect_num_outputs="1">
94+
<conditional name="mode">
95+
<param name="task" value="collection"/>
96+
<param name="input_collection" value="mikro.laz,mikro2.laz" ftype="laz"/>
97+
</conditional>
98+
<output name="collection_summary" ftype="json">
99+
<assert_contents>
100+
<has_json_property_with_value property="n_tiles" value="2"/>
101+
<has_json_property_with_value property="homogeneous_crs" value="true"/>
102+
<has_json_property_with_value property="homogeneous_attribute_names" value="true"/>
38103
</assert_contents>
39104
</output>
40105
</test>
41106
</tests>
42-
<help>
43-
**What it does**
44107

45-
This tool performs a series of checks and standardizations on a LAS/LAZ point cloud file. It checks:
108+
<help><![CDATA[
109+
**What it does**
110+
111+
This tool supports two modes:
46112
47-
1. **Basic LAS Validation**
48-
- Validates the object using las_check()
49-
- Ensures the file has at least 100 points
113+
**Single File Mode** (standardization):
114+
Standardizes a single LAS/LAZ file:
50115
51-
2. **Bounding Box Consistency**
52-
- Updates header if bounding box doesn't match points
53-
- Validates spatial extent (all dimensions &gt; 1 meter)
54-
- Checks Z range is plausible (-100 to 5500 meters)
116+
1. **LAS Validation**: Runs ``las_check()`` and fixes header issues
117+
2. **Bounding Box**: Validates and corrects header bounding box
118+
3. **Point Density**: Checks density meets minimum threshold
119+
4. **CRS Validation**: Verifies CRS is defined and transformable to EPSG:4978
120+
5. **Land Check**: Confirms centroid is on land (using Natural Earth data)
121+
6. **Format Normalization**: Downgrades Point Data Format to ≤7 for compatibility
122+
7. **Attribute Cleanup**: Optionally removes specified attributes
55123
56-
3. **Point Density Check**
57-
- Calculates point density using convex hull
58-
- Requires minimum point density (configurable, default: 500 points/m² for TLS)
124+
**Outputs (single file mode):**
125+
- Standardized ``.laz`` file
126+
- Metadata JSON with pre/post standardization info
127+
- Convex hull GeoJSON in WGS84
59128
60-
4. **Extra Byte Data Type Check**
61-
- Validates extra byte attribute data types
62-
- Corrects mismatches if found
129+
**Collection Mode** (validation):
130+
Validates consistency of multiple LAS/LAZ files:
63131
64-
5. **CRS Validation**
65-
- Ensures CRS is specified
66-
- Validates transformation to EPSG:3857
132+
- **CRS Homogeneity**: Checks if all files share the same coordinate reference system
133+
- **Attribute Consistency**: Verifies attribute names and types across files
134+
- **Tile Geometry**: Detects overlaps and gaps between tiles
135+
- **Global Statistics**: Computes aggregated statistics across all files
136+
- **Removeable Attributes**: Identifies attributes that are all-NA or constant-zero
67137
68-
6. **Point Data Format Check**
69-
- Downgrades format to 7 if necessary
70-
- Preserves NIR channel as extra attribute
138+
**Outputs (collection mode):**
139+
- ``collection_summary.json`` containing collection-level checks and flags, per-file metadata (CRS, attributes, point counts, convex hulls), and suggested removeable attributes for standardization
71140
72-
7. **Land Coverage Validation**
73-
- Validates centroid is on land using Natural Earth data
141+
**Workflow Usage**
142+
143+
For collection-based workflows:
144+
1. Run this tool with **Collection Validation** first to check consistency
145+
2. Use the suggested ``removeable_attributes`` from the collection summary
146+
3. Then run this tool with **Single File Standardization** (Galaxy maps over collection automatically) for standardization
147+
148+
]]></help>
74149

75-
8. **Output Writing**
76-
- Writes standardized LAZ file with Point Format ≤ 7
77-
</help>
78150
<creator>
79151
<person name="Julian Frey" email="julian.frey@wwd.uni-freiburg.de" url="https://orcid.org/0000-0001-7895-702X"/>
80152
<person name="Janusch Vajna-Jehle" email="janusch.jehle@geosense.uni-freiburg.de" url="https://orcid.org/0009-0002-0034-9387"/>
81153
<person name="Kilian Gerberding" email="kilian.gerberding@geosense.uni-freiburg.de" url="https://orcid.org/0009-0002-5001-2571"/>
154+
<person name="Mirko Mälicke" identifier="0000-0002-0424-2651"/>
82155
<organization name="3Dtrees-Team, University of Freiburg" url="https://github.com/3dTrees-earth"/>
83156
</creator>
157+
84158
<citations>
85159
<citation type="bibtex">
86160
@misc{3dtrees_standard, title = {3D Trees Standardization}, author = {3D Trees Project}, year = {2025}}
30.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)