{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# imports\n", "import pathlib\n", "import numpy as np\n", "from tqdm.notebook import tqdm\n", "import napari\n", "import dask.array as da\n", "from shapely.affinity import translate, scale\n", "from coda_visual.datasets.raw_hamamatsu_file import RawHamamatsuFile\n", "from coda_visual.analyses.tissue_area_segmentation import TissueAreaSegmentation" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "RAW_IMAGE_DIR = pathlib.Path().resolve().parent.parent / \"sample_dataset\" / \"20x files\"\n", "raw_image_list = sorted(list(RAW_IMAGE_DIR.glob(\"*.ndpi\")), key=lambda x: x.name)\n", "TEST_OUTLINE_FILE = RAW_IMAGE_DIR / \"tissue_area.h5\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "LOW_RES_LEVEL = 5" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "largest_layer_width = 0.\n", "largest_layer_height = 0.\n", "for fp in raw_image_list:\n", " hamamatsu_file = RawHamamatsuFile(fp)\n", " level_width, level_height = hamamatsu_file.openslide_slide.level_dimensions[LOW_RES_LEVEL]\n", " if level_width>largest_layer_width:\n", " largest_layer_width = level_width\n", " if level_height>largest_layer_height:\n", " largest_layer_height = level_height" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "12ae86eb12eb4aca8080b9f27b1eec51", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading images and outlines...: 0%| | 0/150 [00:00