sjtans commited on
Commit
4001908
·
verified ·
1 Parent(s): d89f61c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -34,11 +34,17 @@ def imread(filepath):
34
  return img
35
 
36
  def check_dims(filepath):
37
- tif = tiff.TiffFile(filepath)
38
 
39
- store = tif.aszarr()
40
- img = zarr.open(store, mode='r', chunks=None)
41
- store.close()
 
 
 
 
 
 
 
42
 
43
  if img.ndim==3:
44
  return img.shape[0], None
@@ -258,7 +264,7 @@ def update(filepath, filepath_result, filepath_coordinates, z, c):
258
  if filepath_coordinates is None:
259
  display_boxes = []
260
  else:
261
- display_boxes = filter_coordinates_alt(filepath_coordinates, z, check_dims(filepath_show))
262
 
263
  return (filepath_show, display_boxes), (filepath_result_show, display_boxes)
264
 
 
34
  return img
35
 
36
  def check_dims(filepath):
 
37
 
38
+ fpath, fext = os.path.splitext(filepath)
39
+
40
+ if fext in ['.tiff', '.tif']:
41
+ tif = tiff.TiffFile(filepath)
42
+
43
+ store = tif.aszarr()
44
+ img = zarr.open(store, mode='r', chunks=None)
45
+ store.close()
46
+ else:
47
+ img = cv2.imread(filepath)
48
 
49
  if img.ndim==3:
50
  return img.shape[0], None
 
264
  if filepath_coordinates is None:
265
  display_boxes = []
266
  else:
267
+ display_boxes = filter_coordinates_alt(filepath_coordinates, z, check_dims(filepath_re))
268
 
269
  return (filepath_show, display_boxes), (filepath_result_show, display_boxes)
270