Skip to content

Commit

Permalink
Revert tifffile write to what is in dev since it works
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Apr 11, 2024
1 parent 20bb8ab commit 2647b59
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions caiman/utils/sbx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,17 @@ def sbx_chain_to_tif(filenames: list[str], fileout: str, subindices: Optional[Ch
fileout = fileout + '.tif'

dtype = np.float32 if to32 else np.uint16
with tifffile.TiffWriter(fileout, bigtiff=bigtiff, imagej=imagej) as tif:
tif.write(None, shape=save_shape, dtype=dtype, photometric='MINISBLACK')
tifffile.imwrite(fileout, data=None, shape=save_shape, bigtiff=bigtiff, imagej=imagej,
dtype=dtype, photometric='MINISBLACK')

# Now convert each file
memmap_tif = tifffile.memmap(fileout, series=0)
tif_memmap = tifffile.memmap(fileout, series=0)
offset = 0
for filename, subind, file_N in zip(filenames, subindices, Ns):
_sbxread_helper(filename, subindices=subind, channel=channel, out=memmap_tif[offset:offset+file_N], plane=plane, chunk_size=chunk_size)
_sbxread_helper(filename, subindices=subind, channel=channel, out=tif_memmap[offset:offset+file_N], plane=plane, chunk_size=chunk_size)
offset += file_N

memmap_tif._mmap.close()
tif_memmap._mmap.close()


def sbx_shape(filename: str, info: Optional[dict] = None) -> tuple[int, int, int, int, int]:
Expand Down

0 comments on commit 2647b59

Please sign in to comment.