-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support resolution and spacing metadata (#349)
Add 'tiff.resolution_unit' and 'tiff.x_resolution', 'tiff.y_resolution' metadata to the CuImage object. (See https://www.awaresystems.be/imaging/tiff/tifftags/resolutionunit.html) If `resolution_unit` is not 1 (1 = No absolute unit of measurement), `spacing_units` is `['micrometer', 'micrometer', 'color']` and spacing unit is calculated based on `micrometer`. **spacing_test.py** ```python from pprint import pprint from cucim import CuImage img = CuImage("TCGA-18-3406-01Z-00-DX1_tissue.tif") pprint(img.metadata, indent=2, compact=True) ``` ```bash ❯ python spacing_test.py { 'cucim': { 'associated_images': [], 'channel_names': ['R', 'G', 'B', 'A'], 'coord_sys': 'LPS', 'dims': 'YXC', 'direction': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'dtype': {'bits': 8, 'code': 1, 'lanes': 1}, 'ndim': 3, 'origin': [0.0, 0.0, 0.0], 'path': '/home/gbae/Downloads/TCGA-18-3406-01Z-00-DX1_tissue.tif', 'resolutions': { 'level_count': 6, 'level_dimensions': [ [16034, 10970], [8017, 5485], [4008, 2742], [2004, 1371], [1002, 685], [501, 342]], 'level_downsamples': [ 1.0, 2.0, 4.000614166259766, 8.001228332519531, 16.008296966552734, 32.040008544921875], 'level_tile_sizes': [ [512, 512], [512, 512], [512, 512], [512, 512], [512, 512], [512, 512]]}, 'shape': [10970, 16034, 4], 'spacing': [2.0159945487976074, 2.0159945487976074, 1.0], 'spacing_units': ['micrometer', 'micrometer', 'color'], 'typestr': '|u1'}, 'tiff': { 'model': '', 'resolution_unit': 'centimeter', 'software': '', 'x_resolution': 4960.3310546875, 'y_resolution': 4960.3310546875}} ``` **Test install** ```bash python -m pip install --force-reinstall --extra-index-url https://test.pypi.org/simple/ cucim==0.0.333 ``` Address #333 Signed-off-by: Gigon Bae <[email protected]> Authors: - Gigon Bae (https://github.com/gigony) - Gregory Lee (https://github.com/grlee77) Approvers: - Gregory Lee (https://github.com/grlee77) URL: #349
- Loading branch information
Showing
11 changed files
with
235 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
GPUtil==1.4.0 | ||
imagecodecs==2021.6.8 | ||
openslide-python==1.1.2 | ||
psutil==5.8.0 | ||
pytest==6.2.4 | ||
pytest-cov==2.12.1 | ||
pytest-lazy-fixture==0.6.3 | ||
tifffile==2021.7.2 | ||
GPUtil>=1.4.0 | ||
imagecodecs>=2021.6.8 | ||
openslide-python>=1.1.2 | ||
psutil>=5.8.0 | ||
pytest>=6.2.4 | ||
pytest-cov>=2.12.1 | ||
pytest-lazy-fixture>=0.6.3 | ||
tifffile>=2022.7.28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.