Mercurial > repos > bgruening > 3dtrees_smart_tile
comparison smart_tile.xml @ 0:53ee54da7150 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/3dtrees_smart_tile commit fe65e773176a1e35cb4ba32ce9e038e95e780d4c
| author | bgruening |
|---|---|
| date | Tue, 27 Jan 2026 13:22:53 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:53ee54da7150 |
|---|---|
| 1 <tool id="3dtrees_smart_tile" name="3DTrees: SmartTile" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2"> | |
| 2 <description>Subsampling, tiling, merging and matching of (multiple) point clouds</description> | |
| 3 <macros> | |
| 4 <token name="@TOOL_VERSION@">1.0.0</token> | |
| 5 <token name="@VERSION_SUFFIX@">0</token> | |
| 6 </macros> | |
| 7 <requirements> | |
| 8 <container type="docker">ghcr.io/3dtrees-earth/3dtrees_smart_tile:@TOOL_VERSION@</container> | |
| 9 </requirements> | |
| 10 <command detect_errors="exit_code"><![CDATA[ | |
| 11 ## Create output directory | |
| 12 mkdir -p output_dir && | |
| 13 | |
| 14 ## Task-specific input setup and command execution | |
| 15 #if $operation.task == 'tile': | |
| 16 ## Create input directory and symlink files | |
| 17 mkdir -p input_dir && | |
| 18 #for $f in $operation.input_files: | |
| 19 ln -s '$f' input_dir/'${f.element_identifier}.laz' && | |
| 20 #end for | |
| 21 | |
| 22 ## Run tile task | |
| 23 python -u /src/run.py | |
| 24 --task tile | |
| 25 --input-dir input_dir | |
| 26 --output-dir output_dir | |
| 27 --tile-length '$operation.tile_length' | |
| 28 --tile-buffer '$operation.tile_buffer' | |
| 29 #if $operation.tiling_threshold: | |
| 30 --tiling-threshold '$operation.tiling_threshold' | |
| 31 #end if | |
| 32 --resolution-1 '$operation.resolution_1' | |
| 33 --resolution-2 '$operation.resolution_2' | |
| 34 --skip-dimension-reduction '$operation.skip_dimension_reduction' | |
| 35 --num-spatial-chunks \${GALAXY_SLOTS:-4} | |
| 36 --workers '$operation.workers' | |
| 37 --threads \${GALAXY_SLOTS:-4} | |
| 38 | |
| 39 #elif $operation.task == 'merge': | |
| 40 ## Create input directories and symlink files | |
| 41 mkdir -p input_segmented && | |
| 42 #for $f in $operation.input_segmented: | |
| 43 ln -s '$f' input_segmented/'${f.element_identifier}.laz' && | |
| 44 #end for | |
| 45 | |
| 46 mkdir -p input_res1 && | |
| 47 #for $f in $operation.input_res1: | |
| 48 ln -s '$f' input_res1/'${f.element_identifier}.laz' && | |
| 49 #end for | |
| 50 | |
| 51 #if $operation.input_original: | |
| 52 mkdir -p input_original && | |
| 53 #for $f in $operation.input_original: | |
| 54 ln -s '$f' input_original/'${f.element_identifier}.laz' && | |
| 55 #end for | |
| 56 #end if | |
| 57 | |
| 58 ## Run merge task | |
| 59 python -u /src/run.py | |
| 60 --task merge | |
| 61 --subsampled-segmented-folder input_segmented | |
| 62 --subsampled-target-folder input_res1 | |
| 63 #if $operation.input_original: | |
| 64 --original-input-dir input_original | |
| 65 #end if | |
| 66 --output-tiles-folder output_dir/output_tiles | |
| 67 --buffer '$operation.buffer' | |
| 68 --overlap-threshold '$operation.overlap_threshold' | |
| 69 --max-centroid-distance '$operation.max_centroid_distance' | |
| 70 --correspondence-tolerance '$operation.correspondence_tolerance' | |
| 71 --max-volume-for-merge '$operation.max_volume_for_merge' | |
| 72 --min-cluster-size '$operation.min_cluster_size' | |
| 73 --border-zone-width '$operation.border_zone_width' | |
| 74 $operation.disable_matching | |
| 75 --workers 2 | |
| 76 #end if | |
| 77 ]]></command> | |
| 78 <inputs> | |
| 79 <conditional name="operation"> | |
| 80 <param name="task" type="select" label="Task"> | |
| 81 <option value="tile">Tile</option> | |
| 82 <option value="merge">Merge</option> | |
| 83 </param> | |
| 84 <when value="tile"> | |
| 85 <param name="input_files" type="data" format="laz,las" multiple="true" label="Input LAZ/LAS files" help="Collection of point cloud files to tile and subsample"/> | |
| 86 <param argument="--tile-length" type="integer" min="1" max="10000" value="300" label="Tile Length" help="Size of tiles in meters (default: 300m)"/> | |
| 87 <param argument="--tile-buffer" type="integer" min="1" max="10000" value="20" label="Tile Buffer" help="Overlap/buffer between tiles in meters (default: 20m)"/> | |
| 88 <param argument="--tiling-threshold" type="float" min="0.1" max="50000" value="10000" optional="true" label="Tiling Threshold (MB)" help="File size threshold in MB. If input folder has single file below this size, skip tiling (optional)"/> | |
| 89 <param argument="--resolution-1" type="float" min="0.001" max="1.0" value="0.01" label="Resolution 1 (m)" help="First subsampling resolution in meters (default: 0.02 = 2cm)"/> | |
| 90 <param argument="--resolution-2" type="float" min="0.001" max="1.0" value="0.1" label="Resolution 2 (m)" help="Second subsampling resolution in meters (default: 0.1 = 10cm)"/> | |
| 91 <param argument="--skip-dimension-reduction" type="boolean" truevalue="--skip-dimension-reduction" falsevalue="" checked="true" label="Skip Dimension Reduction" help="Keep all point dimensions instead of reducing to XYZ-only. Set to False only for raw pre-segmentation data (default: True)"/> | |
| 92 <param argument="--workers" type="hidden" min="1" max="10" value="2" label="Workers" help="Number of workers for parallel processing (default: 2)"/> | |
| 93 </when> | |
| 94 <when value="merge"> | |
| 95 <param name="input_segmented" type="data" format="laz" multiple="true" label="Segmented files (e.g.10cm)" help="Collection of subsampled LAZ files with predictions (PredInstance/PredSemantic dimensions)"/> | |
| 96 <param name="input_res1" type="data" format="laz" multiple="true" label="Subsampled target files (e.g. 1cm)" help="Collection of subsampled LAZ files at target resolution (for remapping)"/> | |
| 97 <param name="input_original" type="data" format="laz,las" multiple="true" optional="true" label="Original input files (optional)" help="Optional collection of original input LAZ files for final remap to original resolution"/> | |
| 98 <param argument="--buffer" type="float" min="0" max="100" value="30.0" label="Buffer Distance (m)" help="Buffer distance for filtering in meters (default: 10.0m)"/> | |
| 99 <param argument="--overlap-threshold" type="float" min="0" max="1" value="0.3" label="Overlap Threshold" help="Overlap ratio threshold for instance matching (0.3 = 30%)"/> | |
| 100 <param argument="--max-centroid-distance" type="float" min="0" max="100" value="3.0" label="Max Centroid Distance (m)" help="Maximum centroid distance to merge instances in meters (default: 3.0m)"/> | |
| 101 <param argument="--max-volume-for-merge" type="float" min="0" max="100" value="4.0" label="Max Volume for Merge (m³)" help="Max convex hull volume for small instance merging in m³ (default: 4.0m³)"/> | |
| 102 <param argument="--min-cluster-size" type="integer" min="1" max="10000" value="300" label="Minimum Cluster Size" help="Minimum cluster size in points for reassignment (default: 300)"/> | |
| 103 <param argument="--border-zone-width" type="float" min="0" max="100" value="10.0" label="Border Zone Width (m)" help="Width of border zone beyond buffer for instance matching in meters (default: 10.0m)"/> | |
| 104 <param argument="--correspondence-tolerance" type="float" min="0" max="1" value="0.05" label="Correspondence Tolerance (m)" help="Max distance for point correspondence in meters - should be small ~5cm (default: 0.05m)"/> | |
| 105 <param argument="--disable-matching" type="boolean" truevalue="--disable-matching" falsevalue="" checked="false" label="Disable Matching" help="Disable cross-tile instance matching (default: False)"/> | |
| 106 <param argument="--workers" type="hidden" min="1" max="10" value="2" label="Workers" help="Number of workers for parallel processing (default: 2)"/> | |
| 107 </when> | |
| 108 </conditional> | |
| 109 </inputs> | |
| 110 <outputs> | |
| 111 <!-- Tile task outputs: collection of all output files --> | |
| 112 <collection name="Subsampled_Resolution_1" type="list" label="${tool.name}: Subsampled ${operation.resolution_1}m"> | |
| 113 <filter>operation['task'] == "tile"</filter> | |
| 114 <discover_datasets pattern="__name_and_ext__" directory="output_dir/subsampled_res1" format="laz" recurse="false"/> | |
| 115 </collection> | |
| 116 <collection name="Subsampled_Resolution_2" type="list" label="${tool.name}: Subsampled ${operation.resolution_2}m"> | |
| 117 <filter>operation['task'] == "tile"</filter> | |
| 118 <discover_datasets pattern="__name_and_ext__" directory="output_dir/subsampled_res2" format="laz" recurse="false"/> | |
| 119 </collection> | |
| 120 <data name="output_png" format="png" label="${tool.name}: Tiling preview" from_work_dir="output_dir/overview_copc_tiles.png"> | |
| 121 <filter>operation['task'] == "tile"</filter> | |
| 122 </data> | |
| 123 | |
| 124 <!-- Merge task outputs: collection of per-tile files + optional merged file --> | |
| 125 <collection name="output_merge_tiles" type="list" label="${tool.name}: Original with added dimensions"> | |
| 126 <filter>operation['task'] == "merge"</filter> | |
| 127 <discover_datasets pattern="__name_and_ext__" directory="output_dir/original_with_predictions" format="laz"/> | |
| 128 </collection> | |
| 129 <data name="output_merged_laz" format="laz" label="${tool.name}: Merged LAZ file" from_work_dir="merged.laz"> | |
| 130 <filter>operation['task'] == "merge"</filter> | |
| 131 </data> | |
| 132 | |
| 133 </outputs> | |
| 134 <tests> | |
| 135 <test expect_num_outputs="3"> | |
| 136 <conditional name="operation"> | |
| 137 <param name="task" value="tile"/> | |
| 138 <param name="input_files" value="mikro.laz"/> | |
| 139 <param name="tile_length" value="50"/> | |
| 140 <param name="tile_buffer" value="20"/> | |
| 141 <param name="tiling_threshold" value="3"/> | |
| 142 <param name="resolution_1" value="0.01"/> | |
| 143 <param name="resolution_2" value="0.1"/> | |
| 144 </conditional> | |
| 145 <output_collection name="Subsampled_Resolution_1" type="list" count="1"/> | |
| 146 <output_collection name="Subsampled_Resolution_2" type="list" count="1"/> | |
| 147 <output name="output_png" file="mikro_preview.png" compare="image_diff"> | |
| 148 <assert_contents> | |
| 149 <has_image_center_of_mass center_of_mass="1732,1785" eps="100"/> | |
| 150 </assert_contents> | |
| 151 </output> | |
| 152 </test> | |
| 153 <test expect_num_outputs="2"> | |
| 154 <conditional name="operation"> | |
| 155 <param name="task" value="merge"/> | |
| 156 <param name="input_segmented" value="mikro_segmented.laz"/> | |
| 157 <param name="input_res1" value="mikro_res1.laz"/> | |
| 158 <param name="input_original" value="mikro.laz"/> | |
| 159 </conditional> | |
| 160 <output_collection name="output_merge_tiles" type="list" count="1"/> | |
| 161 <output name="output_merged_laz"> | |
| 162 <assert_contents> | |
| 163 <has_size value="47500" delta="1000"/> | |
| 164 </assert_contents> | |
| 165 </output> | |
| 166 </test> | |
| 167 </tests> | |
| 168 <help format="markdown"> | |
| 169 **What it does** | |
| 170 | |
| 171 This tool processes 3D point cloud data for tree segmentation with four task modes: | |
| 172 | |
| 173 1. **Tile**: Subsample input point clouds and create overlapping tiles for processing | |
| 174 3. **Merge**: Remaps predictions to target resolution and merge tiles with instance matching | |
| 175 | |
| 176 **Tile Task** | |
| 177 | |
| 178 Processes input LAZ/LAS files through tiling and subsampling pipeline: | |
| 179 - Converts to COPC format | |
| 180 - Creates overlapping tiles | |
| 181 - Generates two subsampled resolutions (default: 2cm and 10cm) | |
| 182 | |
| 183 *Parameters:* | |
| 184 - Tile Length: Size of tiles in meters (default: 100m) | |
| 185 - Tile Buffer: Overlap between tiles in meters (default: 5m) | |
| 186 - Tiling Threshold: File size threshold in MB - files below this skip tiling (optional) | |
| 187 - Resolution 1: First subsampling resolution in meters (default: 0.02 = 2cm) | |
| 188 - Resolution 2: Second subsampling resolution in meters (default: 0.1 = 10cm) | |
| 189 - Skip Dimension Reduction: Keep all point dimensions (default: True) | |
| 190 | |
| 191 *Outputs:* Collection of tiled and subsampled LAZ files organized in subdirectories | |
| 192 | |
| 193 **Remap Task** | |
| 194 | |
| 195 Remaps predictions from source files to target resolution files using KDTree nearest neighbor matching. | |
| 196 Files are matched by spatial bounds. | |
| 197 | |
| 198 *Parameters:* | |
| 199 - Source files: LAZ files with predictions (e.g., segmented 10cm files) | |
| 200 - Target files: LAZ files at target resolution (e.g., 2cm subsampled files) | |
| 201 - Tolerance: Bounds matching tolerance in meters (default: 5.0m) | |
| 202 | |
| 203 *Outputs:* Collection of remapped LAZ files with predictions transferred to target resolution | |
| 204 | |
| 205 **Merge Task** | |
| 206 | |
| 207 Complete merge workflow: | |
| 208 1. Remaps 10cm predictions to target resolution (default: 2cm) | |
| 209 2. Merges overlapping tiles with cross-tile instance matching | |
| 210 3. Optionally remaps to original input resolution | |
| 211 | |
| 212 *Parameters:* | |
| 213 - Input: Collection of 10cm subsampled LAZ files with predictions (PredInstance/PredSemantic) | |
| 214 - Target Resolution: Resolution for remapping (default: 2cm) | |
| 215 - Buffer: Buffer distance for filtering in meters (default: 10.0m) | |
| 216 - Overlap Threshold: Ratio for instance matching, 0-1 (default: 0.3 = 30%) | |
| 217 - Max Centroid Distance: Max distance to merge instances (default: 3.0m) | |
| 218 - Correspondence Tolerance: Point matching tolerance (default: 0.05m = 5cm) | |
| 219 - Max Volume for Merge: Max volume for small instance merging (default: 4.0m³) | |
| 220 - Min Cluster Size: Minimum points per cluster (default: 300) | |
| 221 - Border Zone Width: Width of border zone for matching (default: 10.0m) | |
| 222 - Retile Buffer: Buffer expansion during retiling (fixed: 2.0m) | |
| 223 | |
| 224 *Outputs:* | |
| 225 - Collection of per-tile segmented LAZ files | |
| 226 - Single merged LAZ file (if not skipped) | |
| 227 | |
| 228 **Remap and Merge Task** | |
| 229 | |
| 230 Combined remap + merge workflow: | |
| 231 1. Remaps predictions from source to target files | |
| 232 2. Merges tiles with instance matching | |
| 233 3. Optionally remaps to original input resolution | |
| 234 | |
| 235 Uses same parameters as separate remap and merge tasks. | |
| 236 | |
| 237 *Outputs:* | |
| 238 - Collection of per-tile segmented LAZ files | |
| 239 - Single merged LAZ file (if not skipped) | |
| 240 | |
| 241 **Processing Notes** | |
| 242 | |
| 243 - All tasks use parallel processing with configurable workers (defaults to Galaxy job slots) | |
| 244 - Tiling uses spatial chunks aligned to voxel grid to prevent duplicate points | |
| 245 - Merge identifies whole trees, reassigns small clusters, and handles cross-tile instances | |
| 246 - Remap uses cKDTree for efficient nearest neighbor queries | |
| 247 </help> | |
| 248 <creator> | |
| 249 <person name="Kilian Gerberding" email="kilian.gerberding@geosense.uni-freiburg.de" identifier="0009-0002-5001-2571"/> | |
| 250 <organization name="3Dtrees-Team, University of Freiburg" url="https://github.com/3dTrees-earth"/> | |
| 251 </creator> | |
| 252 <citations> | |
| 253 <citation type="bibtex"> | |
| 254 @misc{3dtrees_tile_merge, title = {3D Trees Tile and Merge Tool}, author = {3D Trees Project}, year = {2025}} | |
| 255 </citation> | |
| 256 </citations> | |
| 257 </tool> |
