Skip to content

Commit

Permalink
Merge fb0cc12 into 6407512
Browse files Browse the repository at this point in the history
  • Loading branch information
swkeemink committed Jun 7, 2021
2 parents 6407512 + fb0cc12 commit 4846eb3
Show file tree
Hide file tree
Showing 10 changed files with 15,765 additions and 14,239 deletions.
27,661 changes: 14,503 additions & 13,158 deletions examples/Basic usage.html

Large diffs are not rendered by default.

1,320 changes: 719 additions & 601 deletions examples/Basic usage.ipynb

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions fissa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import numpy as np
from scipy.io import savemat

from . import datahandler
from . import deltaf
from . import neuropil as npil
from . import roitools
Expand Down Expand Up @@ -48,6 +47,7 @@ def extract_func(inputs):
rois = inputs[1]
nNpil = inputs[2]
expansion = inputs[3]
datahandler = inputs[4]

# get data as arrays and rois as masks
curdata = datahandler.image2array(image)
Expand Down Expand Up @@ -107,6 +107,7 @@ def separate_func(inputs):
X = inputs[0]
alpha = inputs[1]
method = inputs[2]

Xsep, Xmatch, Xmixmat, convergence = npil.separate(
X, method, maxiter=20000, tol=1e-4, maxtries=1, alpha=alpha
)
Expand Down Expand Up @@ -186,9 +187,9 @@ def __init__(self, images, rois, folder=None, nRegions=4,
option reduces the memory load, and may be necessary for very
large inputs. Default is ``False``.
datahandler_custom : object, optional
A custom datahandler for handling ROIs and calcium data can
be given here. See datahandler.py (the default handler) for
an example.
A custom datahandler class object for handling ROIs and calcium data can
be given here. See extraction.py for examples. Easiest way to go about it usually is to inheret the standard
DataHandlerTifffile class. Note: will overwrite the datahandler used for lowmemory_mode.
"""
if isinstance(images, basestring):
Expand All @@ -209,11 +210,16 @@ def __init__(self, images, rois, folder=None, nRegions=4,
self.rois *= len(self.images)
else:
raise ValueError('rois should either be string or list')
global datahandler
if lowmemory_mode:
from . import datahandler_framebyframe as datahandler
if datahandler_custom is not None:
datahandler = datahandler_custom

if datahandler_custom is None:
if lowmemory_mode:
from .extraction import DataHandlerPillow
self.datahandler = DataHandlerPillow()
else:
from .extraction import DataHandlerTifffile
self.datahandler = DataHandlerTifffile()
else:
self.datahandler = datahandler_custom

# define class variables
self.folder = folder
Expand Down Expand Up @@ -294,7 +300,7 @@ def separation_prep(self, redo=False):
inputs = [0] * self.nTrials
for trial in range(self.nTrials):
inputs[trial] = [self.images[trial], self.rois[trial],
self.nRegions, self.expansion]
self.nRegions, self.expansion, self.datahandler]

# Check whether we should use multiprocessing
use_multiprocessing = (
Expand Down
130 changes: 0 additions & 130 deletions fissa/datahandler.py

This file was deleted.

153 changes: 0 additions & 153 deletions fissa/datahandler_framebyframe.py

This file was deleted.

0 comments on commit 4846eb3

Please sign in to comment.