Skip to content

Commit

Permalink
multichannel parameter removed from latest scikit-image
Browse files Browse the repository at this point in the history
  • Loading branch information
sambit-giri committed Aug 13, 2024
1 parent ef2d868 commit c7996b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

14 changes: 11 additions & 3 deletions src/tools21cm/superpixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import sys, time
from tqdm import tqdm

def slic_cube(cube, n_segments=5000, compactness=0.1, max_iter=20, sigma=0, min_size_factor=0.5, max_size_factor=3, cmap=None, verbose=True):
def slic_cube(cube, n_segments=5000, compactness=0.1,
max_iter=20, sigma=0, min_size_factor=0.5, max_size_factor=3,
cmap=None, verbose=True):
if cmap is not None:
color = plt.get_cmap(cmap)
multichannel = True
Expand All @@ -16,8 +18,14 @@ def slic_cube(cube, n_segments=5000, compactness=0.1, max_iter=20, sigma=0, min_
else:
multichannel = False
if verbose: print('Estimating superpixel labels using SLIC...')
try: labels = slic(cube, n_segments=n_segments, compactness=compactness, max_num_iter=max_iter, sigma=sigma, max_size_factor=max_size_factor, slic_zero=True, multichannel=multichannel, start_label=0)
except: labels = slic(cube, n_segments=n_segments, compactness=compactness, max_num_iter=max_iter, sigma=sigma, max_size_factor=max_size_factor, slic_zero=True, multichannel=multichannel)
try:
labels = slic(cube, n_segments=n_segments, compactness=compactness,
max_num_iter=max_iter, sigma=sigma, max_size_factor=max_size_factor,
slic_zero=True, multichannel=multichannel, start_label=0)
except:
labels = slic(cube, n_segments=n_segments, compactness=compactness,
max_num_iter=max_iter, sigma=sigma, max_size_factor=max_size_factor,
slic_zero=True, start_label=0)
if verbose: print("The output contains the labels with %d segments"%(labels.max()+1))
return labels

Expand Down

0 comments on commit c7996b1

Please sign in to comment.