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

Multiscale labeled images #45

Merged
merged 39 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c45f450
Open images for a mask via the array link
joshmoore Aug 18, 2020
47d8563
Move python code to a module
joshmoore Aug 19, 2020
aafd5ed
Fix mypy errors
joshmoore Aug 19, 2020
185157f
Refactor to re-use multiscale loading
joshmoore Aug 19, 2020
266b357
Have mypy check all API methods
joshmoore Aug 19, 2020
fc8df8f
Enfore mypy annotations on all definitions
joshmoore Aug 19, 2020
db43af5
Fix 'bool(false)' in color test
joshmoore Aug 19, 2020
967b36c
move create_test_data to ome_zarr.data
joshmoore Aug 21, 2020
c146101
Add isort as the first pre-commit step
joshmoore Aug 21, 2020
1c50a26
refactor create_zarr method for use from CLI
joshmoore Aug 21, 2020
3a9f360
Major API refactoring
joshmoore Aug 24, 2020
7c8cff1
More tests and bug fixes
joshmoore Aug 25, 2020
b57d439
Deal with empty labels from astronauts
joshmoore Aug 26, 2020
9665c4c
ome_zarr.scale: migrate scale.py to ome_zarr
joshmoore Aug 26, 2020
6b18581
Enable make_test_viewer from napari
joshmoore Aug 26, 2020
4fb4213
Fix recursive reading, info, and downloading
joshmoore Aug 26, 2020
c4ef738
Fix number of channels in coins()
joshmoore Aug 26, 2020
77e631a
Fix CLI tools incl. prefix stripping
joshmoore Aug 27, 2020
7a4f865
Update style and fill out well-formed docs
joshmoore Aug 28, 2020
56f7ef5
Use GH Actions & Conda for tests
joshmoore Aug 31, 2020
12b9493
Fix "loaded as" doc sentence
joshmoore Aug 31, 2020
b90b68d
Activate doctests
joshmoore Aug 31, 2020
151c52e
Correct channel array for grayscale images
joshmoore Aug 31, 2020
930c303
Use latest setup-conda for posix and windows
joshmoore Aug 31, 2020
b7e8196
Try pyside2 for all platforms
joshmoore Aug 31, 2020
69288fc
Fix label colors key
joshmoore Aug 31, 2020
ab0cdc1
Fix 'colormap' key thanks to Will
joshmoore Sep 1, 2020
723fe0c
Remove unwrapping of pyramids thanks to Will
joshmoore Sep 1, 2020
8125dd4
Change 'Layer' to 'Node'
joshmoore Sep 2, 2020
31082bc
Remove is_zarr() in favor of exists()
joshmoore Sep 3, 2020
0a95ff2
Fix double negative
joshmoore Sep 3, 2020
f2cff53
Remove extra 'of'
joshmoore Sep 3, 2020
c0806ec
Rename test_layer to test_node
joshmoore Sep 3, 2020
6cc1c25
Re-instate visiblility via a property
joshmoore Sep 3, 2020
171e122
Use 'greyscale'
joshmoore Sep 4, 2020
ee73e06
Restore downloading without --output
joshmoore Sep 4, 2020
d2f9f1c
Rework Node.add documentation
joshmoore Sep 4, 2020
fbfa932
Disable napari viewer test on non-OSX platforms
joshmoore Sep 4, 2020
4ed3078
Use bash script with activated conda environment on Windows
joshmoore Sep 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ repos:
rev: v0.782
hooks:
- id: mypy
files: ome_zarr.py
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
hooks:
- id: mypy
args: [
--disallow-untyped-defs,
--ignore-missing-imports,
]
exclude: tests/*|setup.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.24.2
hooks:
Expand Down
Empty file added ome_zarr/__init__.py
Empty file.
12 changes: 6 additions & 6 deletions ome_zarr_cli.py → ome_zarr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
import argparse
import logging

from ome_zarr import info as zarr_info
from ome_zarr import download as zarr_download
from .utils import info as zarr_info
from .utils import download as zarr_download


def config_logging(loglevel, args):
def config_logging(loglevel: int, args: argparse.Namespace) -> None:
loglevel = loglevel - (10 * args.verbose) + (10 * args.quiet)
logging.basicConfig(level=loglevel)
# DEBUG logging for s3fs so we can track remote calls
logging.getLogger("s3fs").setLevel(logging.DEBUG)


def info(args):
def info(args: argparse.Namespace) -> None:
config_logging(logging.INFO, args)
zarr_info(args.path)


def download(args):
def download(args: argparse.Namespace) -> None:
config_logging(logging.WARN, args)
zarr_download(args.path, args.output, args.name)


def main():
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"-v",
Expand Down
42 changes: 42 additions & 0 deletions ome_zarr/napari.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
This module is a napari plugin.

It implements the ``napari_get_reader`` hook specification, (to create
a reader plugin).
"""


import logging

from typing import Any, Callable, Optional
from .reader import PathLike, ReaderFunction
from .utils import parse_url


try:
from napari_plugin_engine import napari_hook_implementation
except ImportError:

def napari_hook_implementation(
func: Callable, *args: Any, **kwargs: Any
) -> Callable:
return func


LOGGER = logging.getLogger("ome_zarr.napari")


@napari_hook_implementation
def napari_get_reader(path: PathLike) -> Optional[ReaderFunction]:
"""
Returns a reader for supported paths that include IDR ID

- URL of the form: https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/ID.zarr/
"""
if isinstance(path, list):
path = path[0]
instance = parse_url(path)
if instance is not None and instance.is_zarr():
return instance.get_reader_function()
# Ignoring this path
return None
Loading