Skip to content

Commit

Permalink
List a few more known extensions for different sources
Browse files Browse the repository at this point in the history
Based on reading the gdal and omero test data sets, list extensions for
a few sources that were not listed by the originating libraries.
  • Loading branch information
manthey committed Jan 27, 2025
1 parent 8931fa1 commit c6643ce
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
7 changes: 4 additions & 3 deletions large_image/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ class SourcePriority(enum.IntEnum):
LOWER = 6
IMPLICIT_HIGH = 7
IMPLICIT = 8
FALLBACK_HIGH = 9
FALLBACK = 10
MANUAL = 11 # This and higher values will never be selected automatically
IMPLICIT_LOW = 9
FALLBACK_HIGH = 10
FALLBACK = 11
MANUAL = 12 # This and higher values will never be selected automatically


TILE_FORMAT_IMAGE = 'image'
Expand Down
4 changes: 4 additions & 0 deletions sources/bioformats/large_image_source_bioformats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ def addKnownExtensions(cls):
'fake', 'no'}:
if ext not in cls.extensions:
cls.extensions[ext] = SourcePriority.IMPLICIT
# These were found by reading some OMERO test files
for ext in {'columbusidx', 'dv_vol', 'lifext'}:
if ext.lower() not in cls.extensions:
cls.extensions[ext.lower()] = SourcePriority.IMPLICIT_LOW


def open(*args, **kwargs):
Expand Down
10 changes: 10 additions & 0 deletions sources/gdal/large_image_source_gdal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,16 @@ def addKnownExtensions(cls):
if drvmimes is not None:
if drvmimes not in cls.mimeTypes:
cls.mimeTypes[drvmimes] = SourcePriority.IMPLICIT
# This list was compiled by trying to read the test files in GDAL's
# repo.
for ext in {
'adf', 'aux', 'demtif', 'dim', 'doq', 'flt', 'fst',
'gdbtable', 'gsc', 'h3', 'idf', 'lan', 'los', 'lrc',
'mapml', 'mint.bin', 'mtw', 'nsf', 'nws', 'on2', 'on9',
'osm.pbf', 'pjg', 'prj', 'ptf', 'rasterlite', 'rdb', 'rl2',
'shx', 'sos', 'tif.grd', 'til', 'vic', 'xlb'}:
if ext.lower() not in cls.extensions:
cls.extensions[ext.lower()] = SourcePriority.IMPLICIT_LOW


def open(*args, **kwargs):
Expand Down
4 changes: 4 additions & 0 deletions sources/pil/large_image_source_pil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ def addKnownExtensions(cls):
for mimeType in PIL.Image.MIME.values():
if mimeType not in cls.mimeTypes:
cls.mimeTypes[mimeType] = SourcePriority.IMPLICIT_HIGH
# These were found by reading various test files.
for ext in {'ppg'}:
if ext.lower() not in cls.extensions:
cls.extensions[ext.lower()] = SourcePriority.IMPLICIT_LOW


def open(*args, **kwargs):
Expand Down
9 changes: 9 additions & 0 deletions sources/rasterio/large_image_source_rasterio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,15 @@ def addKnownExtensions(cls):
for ext in rasterio.drivers.raster_driver_extensions():
if ext not in cls.extensions:
cls.extensions[ext] = SourcePriority.IMPLICIT
# This list was compiled by trying to read the test files in GDAL's
# repo.
for ext in {
'adf', 'aux', 'demtif', 'dim', 'doq', 'flt', 'fst', 'gsc',
'h3', 'lan', 'los', 'lrc', 'mint.bin', 'mtw', 'nsf', 'nws',
'on9', 'pjg', 'png.ovr', 'prj', 'ptf', 'rasterlite', 'rdb',
'tif.grd', 'til', 'vic', 'xlb'}:
if ext.lower() not in cls.extensions:
cls.extensions[ext.lower()] = SourcePriority.IMPLICIT_LOW


def open(*args, **kwargs):
Expand Down

0 comments on commit c6643ce

Please sign in to comment.