Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate image data to raster schema proposal #90

Merged
merged 14 commits into from
Apr 7, 2020
Merged

Conversation

manzt
Copy link
Member

@manzt manzt commented Apr 5, 2020

I think the plumbing is mostly in place now. I have updated the fixtures and tried to consolidate some of the code. Now readers use the tile_zarr_base module to generate the image pyramids.

@manzt manzt requested review from ilan-gold and mccalluc April 5, 2020 19:58
Copy link
Collaborator

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Little comments but very solid. Did you fix the channels that are still wrong from spraggins and replace on source? I realized I did not but I can do that right quick if you haven't.

# Consolidate metadata into single .zmetadata for pyramid
# https://zarr.readthedocs.io/en/stable/tutorial.html#consolidating-metadata
z_group = zarr.open(str(zarr_path))
zarr.consolidate_metadata(z_group.store)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually going to be used, right? Like, zarr.js will still use the .zarray file for parsing? If this is only for future use, maybe a comment about that would be helpful

Copy link
Member Author

@manzt manzt Apr 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intend to use this to gather what the levels are in the pyramid. I'll be adding the convenience method openConsolidated to zarr.js (which is implemented in zarr-python) but this way we have zarr-generated information about where the levels are relative to the store base.

let data;
if (isPyramid) {
  const { metadata } = await (fetch(`${url}/.zmetadata`).then(res => res.json());
  const levels = Object.keys(metadata);
  data = levels.map(key => zarr.openArray({ store: url, path: key});
} else {
  data = zarr.openArray({ store: url });
}
const loader = ZarrLoader(data);

# Consolidate zarr metadata for easy access to array/group heirachy
# https://zarr.readthedocs.io/en/stable/tutorial.html#consolidating-metadata
z_group = zarr.open(str(zarr_path))
zarr.consolidate_metadata(z_group.store)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto about metadata

import json
import urllib

from tile_zarr_base import tile_zarr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just curious what the status of img2zarr with respect to this stuff is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tile_zarr_base is essentially a port from what I've implemented in img2zarr right now. I think the efficient converters to zarr base are really immature and neither Heath or myself have the bandwidth to take that on at the moment. I'd prefer to write custom in vitessce-data until that matures more.

return bool((np.log2(shape) >= 12).any())


class OmeTiffReader:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment that this only reads tiff and outputs zarr, and does not actually do the tiling/pyramid generation?

python/imzml_reader.py Outdated Show resolved Hide resolved
python/ome_tiff_reader.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mccalluc mccalluc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scattered tweaks you can take or leave, but no blockers.

python/create_ome_tif_fixtures.py Outdated Show resolved Hide resolved
python/img_hdf5_reader.py Outdated Show resolved Hide resolved
python/img_hdf5_reader.py Outdated Show resolved Hide resolved
python/imzml_reader.py Show resolved Hide resolved
scripts/process_spraggins.sh Outdated Show resolved Hide resolved
scripts/process_spraggins.sh Show resolved Hide resolved
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.

3 participants