-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporary fix until libvips 8.15 will be released, which will come with OpenSlide 4.0.0 which offers dicom-wsi support.
- Loading branch information
1 parent
4a2d4fb
commit 499d4c1
Showing
7 changed files
with
165 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from pathlib import Path | ||
from tempfile import TemporaryDirectory | ||
|
||
import pytest | ||
from tifffile import TiffFile | ||
from wsidicom import WsiDicom | ||
|
||
from panimg.contrib.wsi_dcm_to_tiff.dcm_to_tiff import dcm_to_tiff | ||
from tests import RESOURCE_PATH | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"src", | ||
( | ||
RESOURCE_PATH / "dicom_wsi/sparse_with_bot", | ||
RESOURCE_PATH / "dicom_wsi/sparse_no_bot", | ||
RESOURCE_PATH / "dicom_wsi/full_with_bot", | ||
RESOURCE_PATH / "dicom_wsi/full_no_bot", | ||
), | ||
) | ||
def test_dcm_to_tiff(src: Path): | ||
with TemporaryDirectory() as output_directory: | ||
converted_tiff = Path(output_directory) / "output.tiff" | ||
dcm_to_tiff(src, converted_tiff) | ||
files = {f for f in src.rglob("*") if f.is_file()} | ||
with WsiDicom.open(files) as o_tif: | ||
with TiffFile(converted_tiff) as c_tif: | ||
assert len(o_tif.levels) == len(c_tif.pages) | ||
for i in range(0, len(o_tif.levels)): | ||
assert ( | ||
o_tif.collection[i].size.height | ||
== c_tif.pages[i].shape[0] | ||
) | ||
assert ( | ||
o_tif.collection[i].size.width | ||
== c_tif.pages[i].shape[1] | ||
) | ||
assert ( | ||
o_tif.collection[i].tile_size.height | ||
== c_tif.pages[i].tile[0] | ||
) | ||
assert ( | ||
o_tif.collection[i].tile_size.width | ||
== c_tif.pages[i].tile[1] | ||
) |
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.