File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -441,8 +441,9 @@ def ome_to_binary(ops):
441441 nchannels = ops1 [0 ]["nchannels" ]
442442
443443 # loop over all tiffs
444- with ScanImageTiffReader (fs_Ch1 [0 ]) as tif :
445- im0 = tif .data ()
444+ TiffReader = ScanImageTiffReader if HAS_SCANIMAGE else TiffFile
445+ with TiffReader (fs_Ch1 [0 ]) as tif :
446+ im0 = tif .data () if HAS_SCANIMAGE else tif .pages [0 ].asarray ()
446447
447448 for ops1_0 in ops1 :
448449 ops1_0 ["nframes" ] = 0
@@ -465,8 +466,8 @@ def ome_to_binary(ops):
465466
466467 for ik , file in enumerate (fs_Ch1 ):
467468 # read tiff
468- with ScanImageTiffReader (file ) as tif :
469- im = tif .data ()
469+ with TiffReader (file ) as tif :
470+ im = tif .data () if HAS_SCANIMAGE else tif . pages [ 0 ]. asarray ()
470471 if im .dtype .type == np .uint16 :
471472 im = (im // 2 )
472473 im = im .astype (np .int16 )
@@ -484,8 +485,8 @@ def ome_to_binary(ops):
484485
485486 if nchannels > 1 :
486487 for ik , file in enumerate (fs_Ch2 ):
487- with ScanImageTiffReader (file ) as tif :
488- im = tif .data ()
488+ with TiffReader (file ) as tif :
489+ im = tif .data () if HAS_SCANIMAGE else tif . pages [ 0 ]. asarray ()
489490 if im .dtype .type == np .uint16 :
490491 im = (im // 2 )
491492
You can’t perform that action at this time.
0 commit comments