nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
60 stars 15 forks source link

allow manually setting shape #192

Closed kushalkolar closed 1 year ago

kushalkolar commented 1 year ago

partly addresses #178

Allows manually setting the shape when using LazyTiff if known.

Example:

from mesmerize_core import *
from mesmerize_core.arrays import LazyTiff
from fastplotlib.widgets import ImageWidget

# set parent data path, load batch as `df`, etc.

def load_tiff(path):
  tif = tifffile.TiffFile(path)  # create tiff object

  # sometimes you can get the shape like this, but it varies depending on your filetyep
  # explore the structure of your tif to determine how to get the shape
  s = tif.series[0].levels[0].shape
  # return lazy tiff instance
  return LazyTiff(path, shape=s)

input_movie = df.iloc[0].caiman.get_input(load_tiff)

iw = ImageWidget(data=input_movie)
iw.show()