Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix remaining mypy errors and mistake in test suite (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
JorenB authored Sep 4, 2024
1 parent aa0ec32 commit f600d04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ahcore/cli/tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
import PIL.Image
import PIL.ImageCms
from dlup import SlideImage
from dlup.backends import ImageBackend # type: ignore # pylint: disable=no-name-in-module
from dlup.data.dataset import TiledWsiDataset
from dlup.tiling import GridOrder, TilingMode
from dlup.utils.backends import ImageBackend
from PIL import Image
from PIL.ImageCms import ImageCmsProfile
from PIL.ImageCms import ( # type: ignore # types-Pillow is not up to date with pillow 10.4
Flags,
ImageCmsProfile,
Intent,
)
from pydantic import BaseModel
from rich.progress import Progress

Expand Down Expand Up @@ -159,9 +163,9 @@ def _save_thumbnail(
# If the color_profile is applied to the filtered tiles, apply it to the thumbnail too
if dataset_cfg.color_profile_applied and slide_image.color_profile:
to_profile = PIL.ImageCms.createProfile("sRGB")
intent = PIL.ImageCms.getDefaultIntent(ImageCmsProfile(slide_image.color_profile)) # type: ignore
intent = Intent(PIL.ImageCms.getDefaultIntent(ImageCmsProfile(slide_image.color_profile))) # type: ignore
rgb_color_transform = PIL.ImageCms.buildTransform(
ImageCmsProfile(slide_image.color_profile), to_profile, "RGB", "RGB", intent, 0
ImageCmsProfile(slide_image.color_profile), to_profile, "RGB", "RGB", intent, Flags.NONE
)
PIL.ImageCms.applyTransform(thumbnail, rgb_color_transform, True)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_readers/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def create_colored_tiles(


class TestFileImageReader(FileImageReader):
__test__ = False

def _open_file_handle(self, filename: Path) -> h5py.File:
return h5py.File(filename, "r")

Expand Down

0 comments on commit f600d04

Please sign in to comment.