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

Refactor NGFF module and migrate to Pydantic v2 #233

Merged
merged 18 commits into from
Jul 29, 2024
3 changes: 2 additions & 1 deletion iohub/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from tqdm.contrib.logging import logging_redirect_tqdm

from iohub._version import version as iohub_version
from iohub.ngff import Position, TransformationMeta, open_ome_zarr
from iohub.ngff.models import TransformationMeta
from iohub.ngff.nodes import Position, open_ome_zarr
from iohub.reader import MMStack, NDTiffDataset, read_images

__all__ = ["TIFFConverter"]
Expand Down
4 changes: 4 additions & 0 deletions iohub/ngff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from iohub.ngff.models import TransformationMeta
from iohub.ngff.nodes import Plate, Position, open_ome_zarr

__all__ = ["open_ome_zarr", "Plate", "Position", "TransformationMeta"]
20 changes: 11 additions & 9 deletions iohub/display_utils.py → iohub/ngff/display.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Utility functions for displaying data """
"""OME-Zarr display settings (OMERO metadata)"""

import numpy as np
from PIL.ImageColor import colormap

from iohub.ngff_meta import ChannelMeta, WindowDict
from iohub.ngff.models import ChannelMeta, WindowDict

""" Dictionary with key works and most popular fluorescent probes """
CHANNEL_COLORS = {
Expand All @@ -25,8 +25,10 @@
# emission around 440 - 460 nmm
"blue": ["Blue", "DAPI", "BFP", "Hoechst"],
"red": ["Red"],
"yellow": ["Yellow", "Cy3"], # Emission around 540-570 nm
"orange": ["Orange", "Cy5", "Y5"], # emission around 650-680 nm
# Emission around 540-570 nm
"yellow": ["Yellow", "Cy3"],
# emission around 650-680 nm
"orange": ["Orange", "Cy5", "Y5"],
}


Expand All @@ -49,12 +51,12 @@ def color_to_hex(color: str) -> str:

def channel_display_settings(
chan_name: str,
clim: tuple[float, float, float, float] = None,
clim: tuple[float, float, float, float] | None = None,
first_chan: bool = False,
):
"""This will create a dictionary used for OME-zarr metadata.
Allows custom contrast limits and channel.
names for display. Defaults everything to grayscale.
"""This will create a dictionary used for OME-Zarr metadata.
Allows custom contrast limits and channel names for display.
Defaults everything to grayscale.

Parameters
----------
Expand Down Expand Up @@ -85,7 +87,7 @@ def channel_display_settings(
"S3": (-1.0, 1.0, -10.0, -10.0),
"Other": (0, U16_FMAX, 0.0, U16_FMAX),
}
if not clim:
if clim is None:
if chan_name in channel_settings.keys():
clim = channel_settings[chan_name]
else:
Expand Down
Loading
Loading