diff --git a/girder/test_girder/test_tiles_rest.py b/girder/test_girder/test_tiles_rest.py index a0134879c..e809e48d2 100644 --- a/girder/test_girder/test_tiles_rest.py +++ b/girder/test_girder/test_tiles_rest.py @@ -481,7 +481,8 @@ def testTilesFromGreyscale(boundServer, admin, fsAssetstore, girderWorker): file = utilities.uploadTestFile('grey10kx5k.tif', admin, fsAssetstore) itemId = str(file['itemId']) fileId = str(file['_id']) - tileMetadata = _postTileViaHttp(boundServer, admin, itemId, fileId) + boundServer.request(path='/item/%s/tiles' % itemId, method='DELETE', user=admin) + tileMetadata = _postTileViaHttp(boundServer, admin, itemId, fileId, data={'force': True}) assert tileMetadata['tileWidth'] == 256 assert tileMetadata['tileHeight'] == 256 assert tileMetadata['sizeX'] == 10000 diff --git a/sources/gdal/large_image_source_gdal/__init__.py b/sources/gdal/large_image_source_gdal/__init__.py index eeda447d7..b39f75105 100644 --- a/sources/gdal/large_image_source_gdal/__init__.py +++ b/sources/gdal/large_image_source_gdal/__init__.py @@ -134,10 +134,12 @@ def __init__(self, path, projection=None, unitsPerPixel=None, **kwargs): scale = self.getPixelSizeInMeters() except RuntimeError: raise TileSourceException('File cannot be opened via GDAL.') - if not scale and not is_netcdf: + if (self.projection or self._getDriver() in { + 'PNG', + }) and not scale and not is_netcdf: raise TileSourceException( 'File does not have a projected scale, so will not be ' - 'opened via GDAL.') + 'opened via GDAL with a projection.') self.sourceLevels = self.levels = int(max(0, math.ceil(max( math.log(float(self.sizeX) / self.tileWidth), math.log(float(self.sizeY) / self.tileHeight)) / math.log(2))) + 1) diff --git a/sources/openjpeg/large_image_source_openjpeg/__init__.py b/sources/openjpeg/large_image_source_openjpeg/__init__.py index 8b0244d9c..b11e3d1e3 100644 --- a/sources/openjpeg/large_image_source_openjpeg/__init__.py +++ b/sources/openjpeg/large_image_source_openjpeg/__init__.py @@ -19,6 +19,7 @@ import math import multiprocessing import queue +import struct import warnings from xml.etree import ElementTree @@ -90,7 +91,7 @@ def __init__(self, path, **kwargs): self._pixelInfo = {} try: self._openjpeg = glymur.Jp2k(largeImagePath) - except glymur.jp2box.InvalidJp2kError: + except (glymur.jp2box.InvalidJp2kError, struct.error): raise TileSourceException('File cannot be opened via Glymur and OpenJPEG.') glymur.set_option('lib.num_threads', multiprocessing.cpu_count()) self._openjpegHandles = queue.LifoQueue()