Skip to content

Commit 3cec363

Browse files
committed
Clarified support for ImageIO based file formats
1 parent 95b0a70 commit 3cec363

File tree

6 files changed

+635
-545
lines changed

6 files changed

+635
-545
lines changed

CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Changelog #
22

3-
See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.html)
4-
for future and past milestones.
3+
See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.html) for future and past milestones.
54

65
## DataLab Version 0.16.2 ##
76

@@ -27,8 +26,8 @@ This release requires PlotPy v2.4.0 or later, which brings the following bug fix
2726
ℹ️ Minor new features and enhancements:
2827

2928
* Image file types:
30-
* Added native support for reading .SPE, .GEL, .NTPI and .REC image files
31-
* Added support for any `imageio`-supported file format through configuration file (entry `imageio_formats` may be customized to complement the default list of supported formats: see `cdl.core.io.image.formats.IMAGEIO_FORMATS_INFO`)
29+
* Added native support for reading .SPE, .GEL, .NDPI and .REC image files
30+
* Added support for any `imageio`-supported file format through configuration file (entry `imageio_formats` may be customized to complement the default list of supported formats: see [documentation](https://datalab-platform.com/en/features/image/menu_file.html#open-image) for more details)
3231

3332
🛠️ Bug fixes:
3433

cdl/config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,17 @@ def reset():
462462

463463
PLOTPY_CONF.update_defaults(PLOTPY_DEFAULTS)
464464
PLOTPY_CONF.set_application(osp.join(APP_NAME, "plotpy"), CONF_VERSION, load=False)
465+
466+
467+
# Default image file formats supported by the ImageIO library
468+
#
469+
# This object represents the natively supported image file formats from the ImageIO
470+
# library. This list is used in the core I/O module to load data from files with the
471+
# supported formats. It may be extended using the `imageio_formats` option in the
472+
# configuration file (see section `io`).
473+
IMAGEIO_FORMATS = (
474+
("*.gel", "Opticks GEL"),
475+
("*.spe", "Princeton Instruments SPE"),
476+
("*.ndpi", "Hamamatsu Slide Scanner NDPI"),
477+
("*.rec", "PCO Camera REC"),
478+
)

cdl/core/io/image/formats.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import scipy.io as sio
1515
import skimage.io
1616

17-
from cdl.config import Conf, _
17+
from cdl.config import IMAGEIO_FORMATS, Conf, _
1818
from cdl.core.io.base import FormatInfo
1919
from cdl.core.io.conv import convert_array_to_standard_type
2020
from cdl.core.io.image import funcs
@@ -216,18 +216,10 @@ def read_data(filename: str) -> np.ndarray:
216216
return funcs.imread_sif(filename)
217217

218218

219-
IMAGEIO_FORMATS_INFO = (
220-
("*.gel", "Opticks GEL"),
221-
("*.spe", "Princeton Instruments SPE"),
222-
("*.ndpi", "Hamamatsu Slide Scanner NDPI"),
223-
("*.rec", "PCO Camera REC"),
224-
)
225-
226-
227219
# Generate classes based on the information above:
228220
def generate_imageio_format_classes():
229221
"""Generate classes based on the information above"""
230-
imageio_formats = IMAGEIO_FORMATS_INFO
222+
imageio_formats = IMAGEIO_FORMATS
231223
conf_formats = Conf.io.imageio_formats.get()
232224
if conf_formats:
233225
imageio_formats += conf_formats

doc/features/image/menu_file.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,30 @@ Create a new image from the following supported filetypes:
6969
- .sif
7070
* - Princeton Instruments SPE files
7171
- .spe
72+
* - Opticks GEL files
73+
- .gel
74+
* - Hammamatsu NDPI files
75+
- .ndpi
76+
* - PCO Camera REC files
77+
- .rec
7278
* - SPIRICON files
7379
- .scor-data
7480
* - FXD files
7581
- .fxd
7682
* - Bitmap images
7783
- .bmp
7884

85+
.. note::
86+
87+
DataLab also supports any image format that can be read by the `imageio` library,
88+
provided that the associated plugin(s) are installed (see `imageio documentation <https://imageio.readthedocs.io/en/stable/formats/index.html>`_)
89+
and that the output NumPy array data type and shape are supported by DataLab.
90+
91+
To add a new file format, you may use the `imageio_formats` entry of DataLab configuration file.
92+
This entry is a formatted like the `IMAGEIO_FORMATS` object which represents the natively supported formats:
93+
94+
.. autodata:: cdl.config.IMAGEIO_FORMATS
95+
7996
Save image
8097
^^^^^^^^^^
8198

0 commit comments

Comments
 (0)