|
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> |
5 | 3 | <macros> |
6 | | - <token name="@TOOL_VERSION@">1.0.1</token> |
| 4 | + <token name="@TOOL_VERSION@">1.1.0</token> |
7 | 5 | <token name="@VERSION_SUFFIX@">0</token> |
8 | 6 | </macros> |
9 | 7 | <requirements> |
10 | 8 | <container type="docker">ghcr.io/3dtrees-earth/3dtrees-pc-standard:@TOOL_VERSION@</container> |
11 | 9 | </requirements> |
12 | 10 | <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 | + |
24 | 33 | <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> |
27 | 54 | </inputs> |
28 | 55 | <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> |
30 | 68 | </outputs> |
31 | 69 | <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"> |
36 | 82 | <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"/> |
38 | 103 | </assert_contents> |
39 | 104 | </output> |
40 | 105 | </test> |
41 | 106 | </tests> |
42 | | - <help> |
43 | | - **What it does** |
44 | 107 |
|
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: |
46 | 112 |
|
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: |
50 | 115 |
|
51 | | -2. **Bounding Box Consistency** |
52 | | - - Updates header if bounding box doesn't match points |
53 | | - - Validates spatial extent (all dimensions > 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 |
55 | 123 |
|
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 |
59 | 128 |
|
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: |
63 | 131 |
|
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 |
67 | 137 |
|
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 |
71 | 140 |
|
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> |
74 | 149 |
|
75 | | -8. **Output Writing** |
76 | | - - Writes standardized LAZ file with Point Format ≤ 7 |
77 | | - </help> |
78 | 150 | <creator> |
79 | 151 | <person name="Julian Frey" email="julian.frey@wwd.uni-freiburg.de" url="https://orcid.org/0000-0001-7895-702X"/> |
80 | 152 | <person name="Janusch Vajna-Jehle" email="janusch.jehle@geosense.uni-freiburg.de" url="https://orcid.org/0009-0002-0034-9387"/> |
81 | 153 | <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"/> |
82 | 155 | <organization name="3Dtrees-Team, University of Freiburg" url="https://github.com/3dTrees-earth"/> |
83 | 156 | </creator> |
| 157 | + |
84 | 158 | <citations> |
85 | 159 | <citation type="bibtex"> |
86 | 160 | @misc{3dtrees_standard, title = {3D Trees Standardization}, author = {3D Trees Project}, year = {2025}} |
|
0 commit comments