Module for importing and exporting 2p imaging datasets
(c) 2015 C. Schmidt-Hieber GPLv3
haussio.DoricHaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None, xycal=350.0)[source]¶Object representing 2p imaging data acquired with ScanImage 4
haussio.HaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]¶Base class for objects representing 2p imaging data.
xsize¶float – Width of frames in specimen dimensions (e.g. um)
ysize¶float – Height of frames in specimen dimensions (e.g. um)
xpx¶int – Width of frames in pixels
ypx¶int – Height of frames in pixels
timing¶numpy.ndarray – Time points of frame acquisitions
fps¶float – Acquisition rate in frames per seconds
fpsfloat – Acquisition interval in seconds
movie_fn¶str – File path (full path) for exported movie
scale_png¶str – File path (full path) for png showing scale bar
sima_dir¶str – Full path to directory for sima exports
basefile¶str – File name trunk for individual tiffs (without path)
(e.g. ChanA_0001_)
filetrunk¶str – Full path and file name trunk for individual tiffs
(e.g. /home/cs/data/ChanA_0001_)
ffmpeg_fn¶str – File name filter (full path) used as input to ffmpeg
(e.g. /home/cs/data/ChanA_0001_%04d.tif)
filenames¶list of str – List of file paths (full paths) of individual tiffs
width_idx¶str – Width of index string in file names
maxtime¶float – Limit data to maxtime
format_index(n, width_idx=None)[source]¶Return formatted index string
| Parameters: |
|
|---|---|
| Returns: | format – Formatted index string, or series of ”?”, or old-school formatter |
| Return type: | string |
get_normframe()[source]¶Return a representative frame that will be used to normalize the brightness in movies
| Returns: | arr – Frame converted to numpy.ndarray |
|---|---|
| Return type: | numpy.ndarray |
get_scale_bar(prop=0.125)[source]¶Returns lengths in specimen dimensions (e.g. um) and in pixels of a scale bar that fills the given fraction of the width of the image
| Parameters: | prop (float, optional) – Length of scale bar expressed as fraction of image width |
|---|---|
| Returns: |
|
make_movie(norm=16.0, scalebar=True, crf=28.0)[source]¶Produce a movie of the experiment
| Parameters: |
|
|---|---|
| Returns: | html_movie – An html tag containing the complete movie |
| Return type: | str |
make_movie_extern(path_extern, norm=16.0, scalebar=True, crf=28, width_idx=None)[source]¶Produce a movie from a directory with individual tiffs, using the present experimental settings for scale bar and frame rate
| Parameters: |
|
|---|---|
| Returns: | html_movie – An html tag containing the complete movie |
| Return type: | str |
plot_scale_bar(ax)[source]¶Add scale bar to a matplotlib axis
| Parameters: | ax (matplotlib.axes.Axes) – matplotlib axes on which to plot the scale bar, as e.g. returned by ‘fig.add_suplot(1,1,1)’ |
|---|
haussio.MovieHaussIO(dirname, dx, dt, chan='A', xml_path=None, sync_path=None, width_idx=4)[source]¶Object representing 2p imaging data for which only a movie is available
haussio.PrairieHaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]¶Object representing 2p imaging data acquired with Prairie scopes
haussio.SI4HaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None, xycal=1200.0)[source]¶Object representing 2p imaging data acquired with ScanImage 4
haussio.ThorHaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]¶Object representing 2p imaging data acquired with ThorImageLS
haussio.sima_export_frames(dataset, path, filenames, startIdx=0, stopIdx=None, ftype='tiff', compress=False)[source]¶Export a sima.ImagingDataset to individual tiffs. Works around sima only producing multipage tiffs.
| Parameters: |
|
|---|
haussio.HaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]Base class for objects representing 2p imaging data.
xsizefloat – Width of frames in specimen dimensions (e.g. um)
ysizefloat – Height of frames in specimen dimensions (e.g. um)
xpxint – Width of frames in pixels
ypxint – Height of frames in pixels
timingnumpy.ndarray – Time points of frame acquisitions
fpsfloat – Acquisition rate in frames per seconds
fpsfloat – Acquisition interval in seconds
movie_fnstr – File path (full path) for exported movie
scale_pngstr – File path (full path) for png showing scale bar
sima_dirstr – Full path to directory for sima exports
basefilestr – File name trunk for individual tiffs (without path)
(e.g. ChanA_0001_)
filetrunkstr – Full path and file name trunk for individual tiffs
(e.g. /home/cs/data/ChanA_0001_)
ffmpeg_fnstr – File name filter (full path) used as input to ffmpeg
(e.g. /home/cs/data/ChanA_0001_%04d.tif)
filenameslist of str – List of file paths (full paths) of individual tiffs
width_idxstr – Width of index string in file names
maxtimefloat – Limit data to maxtime
format_index(n, width_idx=None)[source]Return formatted index string
| Parameters: |
|
|---|---|
| Returns: | format – Formatted index string, or series of ”?”, or old-school formatter |
| Return type: | string |
get_normframe()[source]Return a representative frame that will be used to normalize the brightness in movies
| Returns: | arr – Frame converted to numpy.ndarray |
|---|---|
| Return type: | numpy.ndarray |
get_scale_bar(prop=0.125)[source]Returns lengths in specimen dimensions (e.g. um) and in pixels of a scale bar that fills the given fraction of the width of the image
| Parameters: | prop (float, optional) – Length of scale bar expressed as fraction of image width |
|---|---|
| Returns: |
|
make_movie(norm=16.0, scalebar=True, crf=28.0)[source]Produce a movie of the experiment
| Parameters: |
|
|---|---|
| Returns: | html_movie – An html tag containing the complete movie |
| Return type: | str |
make_movie_extern(path_extern, norm=16.0, scalebar=True, crf=28, width_idx=None)[source]Produce a movie from a directory with individual tiffs, using the present experimental settings for scale bar and frame rate
| Parameters: |
|
|---|---|
| Returns: | html_movie – An html tag containing the complete movie |
| Return type: | str |
plot_scale_bar(ax)[source]Add scale bar to a matplotlib axis
| Parameters: | ax (matplotlib.axes.Axes) – matplotlib axes on which to plot the scale bar, as e.g. returned by ‘fig.add_suplot(1,1,1)’ |
|---|
save_scale_bar()[source]Save scale bar as png (using file name stored in self.scale_png) so that it can be used in a movie
tosima(startIdx=0, stopIdx=None)[source]Convert the experiment to a sima.ImagingDataset
| Parameters: |
|
|---|---|
| Returns: | dataset – A sima.ImagingDataset |
| Return type: | sima.ImagingDataset |
haussio.ThorHaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]Object representing 2p imaging data acquired with ThorImageLS
haussio.PrairieHaussIO(dirname, chan='A', xml_path=None, sync_path=None, width_idx=4, maxtime=None)[source]Object representing 2p imaging data acquired with Prairie scopes