Skip to content

Commit

Permalink
Merge pull request #943 from flatironinstitute/dev
Browse files Browse the repository at this point in the history
dev to master for release
  • Loading branch information
pgunn authored Dec 14, 2021
2 parents e4ac1df + d7f7a66 commit 6e6608c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
24 changes: 13 additions & 11 deletions caiman/base/rois.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
import numpy as np
import os
from past.utils import old_div

import scipy
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage import label, center_of_mass
from skimage.morphology import remove_small_objects, remove_small_holes, dilation, closing
import scipy
from scipy import ndimage as ndi
from scipy.optimize import linear_sum_assignment

import shutil
from skimage.filters import sobel
from skimage.morphology import watershed

from skimage.draw import polygon
from skimage.filters import sobel
from skimage.morphology import remove_small_objects, remove_small_holes, dilation, closing
from skimage.segmentation import watershed

import tempfile
import time
from typing import Any, Dict, List, Optional, Tuple
Expand Down Expand Up @@ -251,16 +254,15 @@ def nf_match_neurons_in_binary_masks(masks_gt,
), order='F'))

# have the center of mass of each element of the two masks
cm_ben = [scipy.ndimage.center_of_mass(mm) for mm in masks_gt]
cm_ben = [scipy.ndimage.center_of_mass(mm) for mm in masks_gt]
cm_cnmf = [scipy.ndimage.center_of_mass(mm) for mm in masks_comp]

if D is None:
#% find distances and matches
# find the distance between each masks
D = distance_masks([A_ben, A_cnmf], [cm_ben, cm_cnmf], min_dist, enclosed_thr=enclosed_thr)
level = 0.98
else:
level = .98

level = 0.98

matches, costs = find_matches(D, print_assignment=print_assignment)
matches = matches[0]
Expand Down Expand Up @@ -1178,13 +1180,13 @@ def extract_binary_masks_blob(A,
markers[gray_image > thr_2] = 2
edges = watershed(elevation_map, markers) - 1
# only keep largest object
label_objects, _ = ndi.label(edges)
label_objects, _ = scipy.ndimage.label(edges)
sizes = np.bincount(label_objects.ravel())

if len(sizes) > 1:
idx_largest = np.argmax(sizes[1:])
edges = (label_objects == (1 + idx_largest))
edges = ndi.binary_fill_holes(edges)
edges = scipy.ndimage.binary_fill_holes(edges)
else:
logging.warning('empty component')
edges = np.zeros_like(edges)
Expand Down
4 changes: 2 additions & 2 deletions demos/notebooks/demo_seeded_CNMF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@
"outputs": [],
"source": [
"from scipy import ndimage as ndi\n",
"from skimage.morphology import watershed, dilation\n",
"from skimage.segmentation import find_boundaries\n",
"from skimage.io import imsave, imread\n",
"from skimage.morphology import dilation\n",
"from skimage.segmentation import find_boundaries, watershed\n",
"\n",
"# Create local correlations image and save it\n",
"# swap_dim should be set to True if the movie is in MATLAB format (time is last instead of first axis)\n",
Expand Down
6 changes: 3 additions & 3 deletions environment-minimal.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
channels:
- conda-forge
dependencies:
- python=3.8
- python >=3.9
- cython
- future
- h5py=2.10.0
- h5py >=2.10.0,<3
- holoviews
- ipyparallel
- matplotlib
Expand All @@ -14,7 +14,7 @@ dependencies:
- peakutils
- psutil
- pynwb
- scikit-image
- scikit-image >=0.19.0
- scikit-learn
- scipy
- tensorflow
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
dependencies:
- python >=3.7
- python >=3.9
- bokeh
- coverage
- cython
Expand All @@ -21,9 +21,9 @@ dependencies:
- peakutils
- pims
- psutil
- pynwb==1.4.0
- pynwb
- pyqtgraph
- scikit-image
- scikit-image >=0.19.0
- scikit-learn
- scipy
- tensorflow
Expand Down

0 comments on commit 6e6608c

Please sign in to comment.