open-forest-observatory / automate-metashape

Easy, reproducible Metashape photogrammetry workflows
Other
76 stars 27 forks source link

Convert image labels from symlink destination to symlink source #45

Open youngdjn opened 8 months ago

youngdjn commented 8 months ago

As a part of open-forest-observatory/automate-metashape-2#46 , we need to undo the Metashape operation that replaces the symlink location (source) with its destination. We want the image labels to indicate the symlink source, especially for compatibility with tools like DVC and Datalad that store the actual file (destination) in a flattened and hashed annex that is not human-readable or human-writeable.

This utility should be idempotent so that if it is run on a dataset where this was already corrected (or that never had this issue to begin with), it does not make any changes.

It should runnable from a script (either as a command line call or function call) in a way that allows running it from the metashape_workflow.py script.

russelldj commented 2 months ago

This PR adds the logic for undoing the symlinks. In that case, the intent was to run the script only in situations where this was a known issue. So additional logic will be required to make it idempotent.