def __init__(self, names=None, objs=None, is_placed=False): if names is None: names, objs = [], [] dict.__init__(self, zip(names, objs)) Object.__init__(self, is_placed=is_placed) self.names = sorted(self.keys()) self.n_class = len(self.names)
def __init__(self, dims=None, units=None, resolution=None, n_object=None, n_slice=None): Object.__init__(self, name='box', dims=np.array(dims, dtype=np.float64), units=units, resolution=resolution, n_object=n_object, n_slice=n_slice) if not isinstance(self.n_slice, dict): self.n_slice = {'z' : int(self.n_slice)} self.init_trait('volume', np.prod(self.dims)) self._axis_map = {'x' : [1, 2, 0], 'y' : [2, 0, 1], 'z' : [0, 1, 2]}