Skip to content

Conversation

@John-P
Copy link
Contributor

@John-P John-P commented Jan 27, 2022

Main Changes

  1. Add a new DICOMWSIReader for reading DICOM WSIs. Very similar to OpenSlideWSIReader.
    • Add new sample DICOM image to the toolbox samples server by converting CMU-1.svs with wsidicomizder and zipping it.
    • Update function for fetching remote samples to enable downloading of a zip (as the DICOM WSI is a directory) and unzipping it after download.
  2. Refactor some code to fix linter issues, reduce complexity, and move private functions
    from WSIReader to WSIMeta where appropriate.
    • Move level_downsample to WSIMeta to calculate the downsample for a level as it only requires access to information in the metadata object (sizes of levels in the pyramid).
    • Move relative_level_scales to WSIMeta as it only depends on level_downsample and data from the metadata object.

Additional Changes

  • DICOM terms added to whitelist.
  • This PR now also updates some requirements constraints in response to comments.
  • Pre-commit config for black updated due to CI issues.

- Add a new DICOMWSIReader for reading DICOM WSIs.
- Refactor some code to reduce complexity and move private functions
from WSIReader to WSIMeta where appropriate.
@John-P John-P added enhancement New feature or request refactoring Code Refactoring labels Jan 27, 2022
@John-P John-P requested a review from shaneahmed January 27, 2022 23:37
@John-P John-P self-assigned this Jan 27, 2022
@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #270 (4ff3151) into develop (47b9494) will increase coverage by 0.00%.
The diff coverage is 99.24%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #270   +/-   ##
========================================
  Coverage    99.81%   99.82%           
========================================
  Files           53       53           
  Lines         4934     5003   +69     
  Branches       816      824    +8     
========================================
+ Hits          4925     4994   +69     
  Misses           2        2           
  Partials         7        7           
Impacted Files Coverage Δ
tiatoolbox/wsicore/wsireader.py 99.22% <98.75%> (+0.02%) ⬆️
tiatoolbox/data/__init__.py 100.00% <100.00%> (ø)
tiatoolbox/wsicore/wsimeta.py 100.00% <100.00%> (ø)
tiatoolbox/tools/stainextract.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47b9494...4ff3151. Read the comment docs.

@John-P
Copy link
Contributor Author

John-P commented Jan 31, 2022

@shaneahmed Looks like it's just black causing it to fail now. Fixed the coverage to 100% on patch.

Copy link
Member

@shaneahmed shaneahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!
Looks good to me. A few changes and we should be ready to merge.

John-P and others added 13 commits February 1, 2022 23:40
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Copy link
Member

@shaneahmed shaneahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am leaving this to your judgement otherwise I am approving this PR.
#270 (comment)

Copy link
Contributor

@vqdang vqdang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. Why do I see here and there edit within TiffReader? Also, some helper function may perhap should be migrated to base class in the future (us time validation, shape conversion)

@John-P
Copy link
Contributor Author

John-P commented Feb 3, 2022

@vqdang I have not modified TiffReader. It may have been caused by someone merging changes merged in from develop or from a change in the Black style guide which happened during this PR e.g. 2**n now becomes 2 ** n.

@shaneahmed
Copy link
Member

@vqdang I have not modified TiffReader. It may have been caused by someone merging changes merged in from develop or from a change in the Black style guide which happened during this PR e.g. 2**n now becomes 2 ** n.

I merged these as the new version of black fails on 2 ** n you won't be able to pass this PR until you make this change or keep old version of black.

@John-P
Copy link
Contributor Author

John-P commented Feb 4, 2022

@vqdang I have not modified TiffReader. It may have been caused by someone merging changes merged in from develop or from a change in the Black style guide which happened during this PR e.g. 2**n now becomes 2 ** n.

I merged these as the new version of black fails on 2 ** n you won't be able to pass this PR until you make this change or keep old version of black.

Ah yes I just mixed up the way round the change happened for **

@shaneahmed shaneahmed merged commit c7a3728 into develop Feb 7, 2022
@shaneahmed shaneahmed deleted the feature-dicom-reader branch February 7, 2022 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactoring Code Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants