Skip to content

metadata - auto-fill scales from N5 attributes#45

Open
martinschorb wants to merge 1 commit intoconstantinpape:masterfrom
martinschorb:patch-1
Open

metadata - auto-fill scales from N5 attributes#45
martinschorb wants to merge 1 commit intoconstantinpape:masterfrom
martinschorb:patch-1

Conversation

@martinschorb
Copy link
Copy Markdown
Contributor

auto-fill scales from N5 attributes

auto-fill scales from N5 attributes
@constantinpape
Copy link
Copy Markdown
Owner

I would rather not merge this here, because storing the scale factors in t0_attribs['scales'] is non standard, see https://github.com/bigdataviewer/bigdataviewer-core/blob/master/BDV%20N5%20format.md.
(Which means that the code changes here would just fail without a reasonable error message for users unless they call this function on (undocumented) render n5 output).
I think this a bug in the render exporter and would suggest to fix it in there, so that they are compatible with the documented bdv file format.

In the meantime, you can simply read the scale_factors from the n5 in the code where you call write_n5_metadata, e.g.

with open(os.path.join(path, "setup0", "timepoint0", "attributes.json")) as f:
   scale_factors = json.load(f)["scales"]
# first need to reverse the axis order of the scale factors due to XYZ convention in java vs. ZYX convention in python
scale_factors = [sf[::-1] for sf in scale_factors]
# then need to translate from absolute to relative scale factors, which are expected by pybdv
scale_factors = pybdv.util.absolute_to_relative_scale_factors(scale_factors)
write_n5_metadata(path, scale_factors, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants