freeman-lab / mesoscope

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mesoscope

Latest Version Build Status Binder

preprocessing and conversion for mesoscope data

This package contains a module and command line tool to process raw data from the two-photon random access mesoscope (2P-RAM). The raw output of the mesocope, via the ScanImage control software, is a matrix of resonant scan lines across multiple rois stored as TIF files. For the majority of applications, users will want to merge and reshape their contents into images that are appropriately merged and reshaped. This module helps you do that.

install

You can install using pip

pip install mesoscope

example

Here we'll convert the example test data included with the repository

import mesoscope as ms

data, meta = ms.load('test/resources/input')
newdata, newmeta = ms.convert(data, meta)

data.shape
>> (23, 5152, 64)

converted.shape
>> (23, 464, 576)

use as command line tool

Given a directory with input TIF files and a metadata file as JSON, just call

mesoscope convert input/ output/

This will create a folder output with the converted images. Type mesoscope convert -h to see other options. Note that during image writing int16 values will be written as uint16 so any negative values will be clipped at 0.

use as a module

The mesocope package includes just two methods

data, meta = load(path, engine=None)

Loads both data and metadata from the specified path. The optional engine can be used to load the data using a parallel backend. Currently supports either None (for local compute) or a SparkContext (for parallelization using a Spark cluster).

newdata, newmeta = convert(data, meta)

Converts the given data using the provided metadata. The data should be a numpy array or a thunder images object.

About

License:MIT License


Languages

Language:Jupyter Notebook 99.2%Language:Python 0.8%