Skip to content

Commit

Permalink
Merge pull request #1092 from girder/wisdicom-changes
Browse files Browse the repository at this point in the history
Update dicom source for upstream changes.
  • Loading branch information
manthey authored Apr 3, 2023
2 parents 208dd01 + df2a535 commit 21b20d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 1.20.3

### Changes
- Update dicom source for upstream changes ([#1092](../../pull/1092))

## 1.20.2

### Improvements
Expand Down
10 changes: 5 additions & 5 deletions sources/dicom/large_image_source_dicom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def __init__(self, path, **kwargs):
self._dicom = wsidicom.WsiDicom.open(self._largeImagePath)
except Exception:
raise TileSourceError('File cannot be opened via dicom tile source.')
self.sizeX = int(self._dicom.image_size.width)
self.sizeY = int(self._dicom.image_size.height)
self.sizeX = int(self._dicom.size.width)
self.sizeY = int(self._dicom.size.height)
self.tileWidth = int(self._dicom.tile_size.width)
self.tileHeight = int(self._dicom.tile_size.height)
self.tileWidth = min(max(self.tileWidth, self._minTileSize), self._maxTileSize)
Expand Down Expand Up @@ -166,8 +166,8 @@ def getNativeMagnification(self):
"""
mm_x = mm_y = None
try:
mm_x = self._dicom.base_level.pixel_spacing.width or None
mm_y = self._dicom.base_level.pixel_spacing.height or None
mm_x = self._dicom.levels[0].pixel_spacing.width or None
mm_y = self._dicom.levels[0].pixel_spacing.height or None
except Exception:
pass
# Estimate the magnification; we don't have a direct value
Expand Down Expand Up @@ -220,7 +220,7 @@ def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False, **kwargs):
bh = self.tileHeight * step
level = 0
levelfactor = 1
basefactor = self._dicom.base_level.pixel_spacing.width
basefactor = self._dicom.levels[0].pixel_spacing.width
for checklevel in range(1, len(self._dicom.levels)):
factor = round(self._dicom.levels[checklevel].pixel_spacing.width / basefactor)
if factor <= step:
Expand Down
2 changes: 1 addition & 1 deletion sources/dicom/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def prerelease_local_scheme(version):
],
install_requires=[
f'large-image{limit_version}',
'wsidicom',
'wsidicom>=0.9.0',
],
extras_require={
'girder': f'girder-large-image{limit_version}',
Expand Down

0 comments on commit 21b20d6

Please sign in to comment.