Browse Source

explicit converting tif images to mode "I"

master
Holger Frey 6 years ago
parent
commit
0a6f07a087
  1. 9
      mtor/gui.py
  2. 2
      mtor/imageproc.py
  3. 2
      mtor/prescan.py

9
mtor/gui.py

@ -217,6 +217,10 @@ class MtorImageAnalysis(QWidget):
def run_gui(): def run_gui():
import traceback
try:
app = QApplication(sys.argv) app = QApplication(sys.argv)
mia = MtorImageAnalysis() mia = MtorImageAnalysis()
app.exec_() app.exec_()
@ -242,5 +246,8 @@ def run_gui():
stderr=None, stderr=None,
close_fds=True, close_fds=True,
) )
except Exception as err:
traceback.print_exc()
input("Press enter to close this window")
finally:
sys.exit() sys.exit()

2
mtor/imageproc.py

@ -12,7 +12,7 @@ from .commons import (
def open_as_array(tif_image): def open_as_array(tif_image):
with tif_image.path.open("rb") as filehandle: with tif_image.path.open("rb") as filehandle:
image = Image.open(filehandle) image = Image.open(filehandle).convert(mode="I")
image_array = numpy.array(image, dtype=numpy.int32) image_array = numpy.array(image, dtype=numpy.int32)
return TifArray( return TifArray(
path=tif_image.path, frame=tif_image.frame, data=image_array path=tif_image.path, frame=tif_image.frame, data=image_array

2
mtor/prescan.py

@ -11,7 +11,7 @@ def scan_tifs(parameters):
for tif in tqdm(parameters.tif_list): for tif in tqdm(parameters.tif_list):
with tif.path.open("rb") as filehandle: with tif.path.open("rb") as filehandle:
image = Image.open(filehandle) image = Image.open(filehandle).convert(mode="I")
mi, ma = image.getextrema() mi, ma = image.getextrema()
lowest = min(lowest, mi) lowest = min(lowest, mi)
highest = max(highest, ma) highest = max(highest, ma)

Loading…
Cancel
Save