Skip to content
Snippets Groups Projects
Commit f6f545ec authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add workaround for uncalibrated ICS/IDS exports in BF 6.0 series

parent 58ab5218
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,17 @@ def export(imp, filename, overwrite=False): ...@@ -72,6 +72,17 @@ def export(imp, filename, overwrite=False):
keep existing files, in this case an IOError is raised. keep existing files, in this case an IOError is raised.
""" """
log.info("Exporting to [%s]", filename) log.info("Exporting to [%s]", filename)
suffix = filename[-3:].lower()
try:
unit = imp.calibration.unit
log.debug("Detected calibration unit: %s", unit)
except Error as err:
log.error("Unable to detect spatial unit: %s", err)
raise RuntimeError("Error detecting image calibration!")
if unit == 'pixel' and (suffix == 'ics' or suffix == 'ids'):
log.warn("Forcing unit to be 'm' instead of 'pixel' to avoid "
"Bio-Formats 6.0.x Exporter bug!")
imp.calibration.unit = 'm'
if os.path.exists(filename): if os.path.exists(filename):
if not overwrite: if not overwrite:
raise IOError('file [%s] already exists!' % filename) raise IOError('file [%s] already exists!' % filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment