bioimage-io / spec-bioimage-io

Specification for the bioimage.io model description file.
https://bioimage-io.github.io/spec-bioimage-io/
MIT License
18 stars 17 forks source link

fixed `RawNodeTransformer` to resolve names of files hosted on zenodo properly #548

Closed k-dominik closed 9 months ago

k-dominik commented 9 months ago

Background - in ilastik we use get_resource_package_content to get the list of files for a given model. See #547 for more background.

Filenames would currently be resolved to "content", "content-0" and so on in case of multiple such files. Previously one could get the filenames in the keys. Some functionality relies on at least having the file extensions, which currently would be omitted.

With this PR, the original filenames are restored by removing the "/content" bit from the zenodo urls.

get_resource_package_content resolves filenames correctly with this patch:

output of get_resource_package_content (abbreviated) ```python 'cover.png': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/cover.png/content', query='', fragment=''), 'documentation.md': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/documentation.md/content', query='', fragment=''), 'rdf.yaml': ..., 'sample_input_0.tif': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/sample_input_0.tif/content', query='', fragment=''), 'sample_output_0.tif': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/sample_output_0.tif/content', query='', fragment=''), 'test_input_0.npy': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/test_input_0.npy/content', query='', fragment=''), 'test_output_0.npy': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/test_output_0.npy/content', query='', fragment=''), 'unet.py': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/unet.py/content', query='', fragment=''), 'weights-torchscript.pt': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/weights-torchscript.pt/content', query='', fragment=''), 'weights.pt': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/weights.pt/content', query='', fragment=''), 'zero_mean_unit_variance.ijm': URI(uri_string=None, scheme='https', authority='zenodo.org', path='/api/records/5874742/files/zero_mean_unit_variance.ijm/content', query='', fragment='')} ```

fixes #547