Failing to pull Girder Tile Source - CCIPD lab project
See original GitHub issueHere is sample code which is not working:
import girder_large_image
import girder_client
import large_image
import json
gc = girder_client.GirderClient(apiUrl='http://localhost:8080/api/v2')
gc.authenticate(username='admin', password='password')
item = gc.getItem('6204344429b98b9caa33c7ec')
print(item)
ts = girder_large_image.girder_tilesource.GirderTileSource(item)
ts_metadata = ts.getMetadata()
print(json.dumps(ts_metadata, indent=2))
is_wsi = ts_metadata['magnification'] is not None
print("WSI ", is_wsi)
print(ts.getSingleTile())
We used this svs file: https://styx.neurology.emory.edu/girder/#item/60df5a4c68f4fe34fc7e92d2
Here is the printout and error message:
{‘_id’: ‘6204344429b98b9caa33c7ec’, ‘_modelType’: ‘item’, ‘baseParentId’: ‘61dd35a75ef164ec2f932d35’, ‘baseParentType’: ‘collection’, ‘created’: ‘2022-02-09T21:38:12.879000+00:00’, ‘creatorId’: ‘61dd3564bd467a0ab2a0244c’, ‘description’: ‘’, ‘folderId’: ‘6204340929b98b9caa33c7ea’, ‘largeImage’: {‘fileId’: ‘6204344429b98b9caa33c7ed’, ‘sourceName’: ‘openslide’}, ‘meta’: {}, ‘name’: ‘girder-test.svs’, ‘size’: 134394101, ‘updated’: ‘2022-02-09T21:38:12.879000+00:00’}
Using python for large_image caching
None
{ “levels”: null, “sizeX”: null, “sizeY”: null, “tileWidth”: null, “tileHeight”: null, “magnification”: null, “mm_x”: null, “mm_y”: null }
WSI False
Traceback (most recent call last):
File "/Users/varunverma/Desktop/playground/test.py", line 23, in <module>
print(ts.getSingleTile())
File "/usr/local/lib/python3.9/site-packages/large_image/tilesource/base.py", line 2241, in getSingleTile
return next(self.tileIterator(*args, kwargs), None)
File "/usr/local/lib/python3.9/site-packages/large_image/tilesource/base.py", line 2202, in tileIterator
iterInfo = self._tileIteratorInfo(format=iterFormat, resample=resample,
File "/usr/local/lib/python3.9/site-packages/large_image/tilesource/base.py", line 467, in _tileIteratorInfo
magLevel = self.getLevelForMagnification(magArgs)
File "/usr/local/lib/python3.9/site-packages/large_image/tilesource/base.py", line 2010, in getLevelForMagnification
mag = self.getMagnificationForLevel()
File "/usr/local/lib/python3.9/site-packages/large_image/tilesource/base.py", line 1982, in getMagnificationForLevel
if mag.get('level') == self.levels - 1:
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (4 by maintainers)
Are you installing any sources in your python environment? That is, did you either do
pip install large_image[sources]
or specify an explicit source? I’m guessing that this might occur if no sources are installed.If your algorithm specifies the image (e.g., https://github.com/DigitalSlideArchive/HistomicsTK/blob/master/histomicstk/cli/NucleiDetection/NucleiDetection.xml#L14-L20), the girder_worker module ensures that the image is local to the running job and passes a path that will access it as a command line argument (as
args.inputImageFile
if you are usingCLIArgumentParser().parse_args()
). Inside the algorithm, you would then uselarge_image.open(args.inputImageFile)
.