Demo: scanreader

Demo: scanreader#

Examples of scanreader usage from a jupyter notebook and from the commmand line.

Libraries:#

  • tifffile to read ScanImage BigTiff files.

  • zarr and dask for lazy-loading operations

Imports#

from pathlib import Path
import matplotlib.pyplot as plt
from scanreader import read_scan

%load_ext autoreload
%autoreload 2
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 2
      1 from pathlib import Path
----> 2 import matplotlib.pyplot as plt
      3 from scanreader import read_scan
      5 get_ipython().run_line_magic('load_ext', 'autoreload')

ModuleNotFoundError: No module named 'matplotlib'

Data path setup#

Put all of the .tiff output files in a single directory. There should be **no other .tiff files other than those belonging to this session.

datapath = Path().home() / 'caiman_data' / 'high_res'
if datapath.is_dir():
    print([x.expanduser() for x in datapath.glob("*.tif*")])
else:
    print(f"No tiff files found in {datapath}")

scanreader#

Initialize a scanreader class object.

  • The object returned from read_scan can be visualized just like a dask array

The resulting class holds metadata and slice locations that re-tile the strip when indexed.

data = read_scan(datapath)
data.shape
scan = data[:200,0,:,:]
scan.shape