Repository navigation
🐛 BUG: Fix Level When Using DICOM read_region - #564
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #564 +/- ##
========================================
Coverage 99.51% 99.51%
========================================
Files 62 62
Lines 6591 6596 +5
Branches 1053 1078 +25
========================================
+ Hits 6559 6564 +5
Misses 20 20
Partials 12 12
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
read_region
|
I've tested this on another example that john provided (a non-folder dicom), and it worked as expected, so i'm fairly confident this is ok, now its been tested on more than one example. |
|
I can't find where in the wsidicom source or documentation this behaviour is specified. Can you provide any reference? It's not really a DICOM thing but a wsidicom thing IMO. Perhaps this is what is causing the issue: https://github.com/imi-bigpicture/wsidicom/blob/fc2149e61958dd6d69baeae02a7da3fef8969533/wsidicom/series.py#L407-L436, called from read_region |
Yes, its a wsidicom thing. it's not specifically documented, but you can see it in the source, for example: from which you can see that the level is defined as the power of 2 between the pixel size at that level compared to base resolution, as opposed to being an index into a list of levels with the scale information stored independently from that as in tiatoolbox WSIReader. So what wsidicom is expecting as the level in read_region is log2(level_downsamples[read_level]) , not read_level. (or we can just get the level directly from the wsidicom level instance, as in the PR here) |
|
@measty thanks for finding that! Just wanted to verify the behaviour before we change it. Looks good. |
## 1.4.0 (2023-04-24) ### Major Updates and Feature Improvements - Adds Python 3.11 support \[experimental\] #500 - Python 3.11 is not fully supported by `pytorch` pytorch/pytorch#86566 and `openslide` openslide/openslide-python#188 - Removes Python 3.7 support - This allows upgrading all the dependencies which were dependent on an older version of Python. - Adds Neighbourhood Querying Support To AnnotationStore #540 - This enables easy and efficient querying of annotations within a neighbourhood of other annotations. - Adds `MultiTaskSegmentor` engine #424 - Fixes an issue with stain augmentation to apply augmentation to only tissue regions. - #546 contributed by @navidstuv - Filters logger output to stdout instead of stderr. - Fixes #255 - Allows import of some modules at higher level for improved usability - `WSIReader` can now be imported as `from tiatoolbox.wsicore import WSIReader` - `WSIMeta` can now be imported as `from tiatoolbox.wsicore import WSIMeta` - `HoVerNet`, `HoVerNetPlus`, `IDaRS`, `MapDe`, `MicroNet`, `NuClick`, `SCCNN` can now be imported as \`from tiatoolbox.models import HoVerNet, HoVerNetPlus, IDaRS, MapDe, MicroNet, NuClick, SCCNN - Improves `PatchExtractor` performance. Updates `WSIPatchDataset` to be consistent. #571 - Updates documentation for `License` for clarity on source code and model weights license. ### Changes to API - Updates SCCNN architecture to make it consistent with other models. #544 ### Bug Fixes and Other Changes - Fixes Parsing Missing Omero Version NGFF Metadata #568 - Fixes #535 raised by @benkamphaus - Fixes reading of DICOM WSIs at the correct level #564 - Fixes #529 - Fixes `scipy`, `matplotlib`, `scikit-image` deprecated code - Fixes breaking changes in `DICOMWSIReader` to make it compatible with latest `wsidicom` version. #539, #580 - Updates `shapely` dependency to version >=2.0.0 and fixes any breaking changes. - Fixes bug with `DictionaryStore.bquery` and `geometry=None`, i.e. only a where predicate given. - Partly Fixes #532 raised by @blaginin - Fixes local tests for Windows/Linux - Fixes `flake8`, `deepsource` errors. - Uses `logger` instead of `warnings` and `print` statements to properly log runs. ### Development related changes - Upgrades dependencies which are dependent on Python 3.7 - Moves `requirements*.txt` files to `requirements` folder - Removes `tox` - Uses `pyproject.toml` for `bdist_wheel`, `pytest` and `isort` - Adds `joblib` and `numba` as dependencies.
## 1.4.0 (2023-04-24) ### Major Updates and Feature Improvements - Adds Python 3.11 support \[experimental\] #500 - Python 3.11 is not fully supported by `pytorch` pytorch/pytorch#86566 and `openslide` openslide/openslide-python#188 - Removes Python 3.7 support - This allows upgrading all the dependencies which were dependent on an older version of Python. - Adds Neighbourhood Querying Support To AnnotationStore #540 - This enables easy and efficient querying of annotations within a neighbourhood of other annotations. - Adds `MultiTaskSegmentor` engine #424 - Fixes an issue with stain augmentation to apply augmentation to only tissue regions. - #546 contributed by @navidstuv - Filters logger output to stdout instead of stderr. - Fixes #255 - Allows import of some modules at higher level for improved usability - `WSIReader` can now be imported as `from tiatoolbox.wsicore import WSIReader` - `WSIMeta` can now be imported as `from tiatoolbox.wsicore import WSIMeta` - `HoVerNet`, `HoVerNetPlus`, `IDaRS`, `MapDe`, `MicroNet`, `NuClick`, `SCCNN` can now be imported as \`from tiatoolbox.models import HoVerNet, HoVerNetPlus, IDaRS, MapDe, MicroNet, NuClick, SCCNN - Improves `PatchExtractor` performance. Updates `WSIPatchDataset` to be consistent. #571 - Updates documentation for `License` for clarity on source code and model weights license. ### Changes to API - Updates SCCNN architecture to make it consistent with other models. #544 ### Bug Fixes and Other Changes - Fixes Parsing Missing Omero Version NGFF Metadata #568 - Fixes #535 raised by @benkamphaus - Fixes reading of DICOM WSIs at the correct level #564 - Fixes #529 - Fixes `scipy`, `matplotlib`, `scikit-image` deprecated code - Fixes breaking changes in `DICOMWSIReader` to make it compatible with latest `wsidicom` version. #539, #580 - Updates `shapely` dependency to version >=2.0.0 and fixes any breaking changes. - Fixes bug with `DictionaryStore.bquery` and `geometry=None`, i.e. only a where predicate given. - Partly Fixes #532 raised by @blaginin - Fixes local tests for Windows/Linux - Fixes `flake8`, `deepsource` errors. - Uses `logger` instead of `warnings` and `print` statements to properly log runs. ### Development related changes - Upgrades dependencies which are dependent on Python 3.7 - Moves `requirements*.txt` files to `requirements` folder - Removes `tox` - Uses `pyproject.toml` for `bdist_wheel`, `pytest` and `isort` - Adds `joblib` and `numba` as dependencies.
This PR fixes the dicom slide thunbnail issue (maybe). the issue seems to arise from a difference in how the wsidicom reader treats levels, in that it labels them by their relative magnification (in power of 2).
so for example the levels in the wsidicom reader are [0, 2, 4] if the level downsamples are [1, 4, 16]
whereas in our WSIReader level is just an index [0, 1, 2], and the level_downsamples are separate.
My knowledge of DICOM is nonexistant, so it may be that the fix is wrong - hopefully john can have a look at it. It fixed the thumbnail issue for me though.