Skip to content

Commit

Permalink
fix evaluate segmentation operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jingpengw committed Feb 29, 2020
1 parent 43537df commit fb6d6cc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions chunkflow/chunk/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

from typing import Union
import os
from numbers import Number
import h5py
Expand Down Expand Up @@ -26,11 +26,15 @@ class Chunk(NDArrayOperatorsMixin):
:param global_offset: the offset of this array chunk
:return: a new chunk with array data and global offset
"""
def __init__(self, array: np.ndarray, global_offset: tuple = None):
assert isinstance(array, np.ndarray)
def __init__(self, array, global_offset: tuple = None):
assert isinstance(array, np.ndarray) or isinstance(array, Chunk)
self.array = array
if global_offset is None:
global_offset = tuple(np.zeros(array.ndim, dtype=np.int))
if isinstance(array, Chunk):
self.array = array.array
global_offset = array.global_offset
else:
global_offset = tuple(np.zeros(array.ndim, dtype=np.int))
self.global_offset = global_offset
assert array.ndim == len(global_offset)

Expand Down

0 comments on commit fb6d6cc

Please sign in to comment.