Labsmore / pyuscope

Python machine vision platform
BSD 2-Clause "Simplified" License
80 stars 17 forks source link

Can't save exposure EXIF as .tif, only .jpg #464

Open JohnDMcMaster opened 8 months ago

JohnDMcMaster commented 8 months ago

To reproduce:

_TIFFVSetField: data/snapshot/2024-03-14_01-05-16_test.tif: Bad LONG8 or IFD8 value 18446744073709551615 for "EXIFIFDOffset" tag 34665 in ClassicTIFF. Tag won't be written to file.

WARNING: <class 'uscope.app.argus.threads.QImageProcessingThread'> thread crashed
Traceback (most recent call last):
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/threads.py", line 101, in run
    ret = f(*args)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/imagep/thread.py", line 118, in _do_process_image
    capim.save(options["save_filename"], **kwargs)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/imager/image_sequence.py", line 19, in save
    self.image.save(fn, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/PIL/Image.py", line 2432, in save
    save_handler(self, fp, filename)
  File "/usr/local/lib/python3.8/dist-packages/PIL/TiffImagePlugin.py", line 1847, in _save
    e = Image._getencoder(im.mode, "libtiff", a, encoderconfig)
  File "/usr/local/lib/python3.8/dist-packages/PIL/Image.py", line 437, in _getencoder
    return encoder(mode, *args + extra)
RuntimeError: Error setting from dictionary
JohnDMcMaster commented 8 months ago

I've put in a temporary fix to save intermediate images as .jpg

It looks like there may be issues combining focus stacking and HDR. Or at least error printing needs to be better

I'm also going to change it so that dev mode doesn't delete the intermediate image files until exit

JohnDMcMaster commented 8 months ago
WARNING: <class 'uscope.app.argus.threads.QTaskThread'> thread crashed: ('GUI thread unsafe access detected', 139943671760704, 139940285372160)

WARNING: <class 'uscope.app.argus.threads.QTaskThread'> thread crashed
Traceback (most recent call last):
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/threads.py", line 101, in run
    ret = f(*args)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/app/argus/threads.py", line 494, in _offload
    function(self.ac)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imaging.py", line 1710, in offload
    capim = self.ac.microscope.imager_ts().get_by_mode(
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imager.py", line 349, in get_by_mode
    return self.imager.get_by_mode(*args, **kwargs)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imager.py", line 182, in get_by_mode
    return self.get_composite(**kwargs)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imager.py", line 174, in get_composite
    return self.composite_grabber.get_composite(**kwargs)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imager.py", line 284, in get_composite
    self.ac.log(f"Composite snapshot: requested w/ {modes}")
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/common.py", line 451, in log
    log(s, newline=newline)
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/imaging.py", line 1908, in log
    self.ac.check_thread_safety()
  File "/home/mcmaster/doc/ext/pyuscope-rhodium/uscope/gui/common.py", line 414, in check_thread_safety
    assert self.main_thread == threading.get_ident(), (
AssertionError: ('GUI thread unsafe access detected', 139943671760704, 139940285372160)
JohnDMcMaster commented 8 months ago

Regression: thread safer imager should use core imager timestamp for kinematics settle check. Otherwise it won't wait the correct amount of time between setting HDR and snapping picture