def __init__(self, args): self.dataset = self.LBLS_DATASET self.default_data_type = self.LBLS_DTYPE # added to constructors dpWriteh5.__init__(self,args) # reinitialize these for non-default data-type self.EMPTY_LABEL = np.iinfo(self.data_type).max self.fillvalue = self.EMPTY_LABEL
def __init__(self, args): self.LIST_ARGS += ['train_offsets', 'prob_types'] dpWriteh5.__init__(self, args) self.nprob_types = len(self.prob_types) self.train_chunks = self.train_chunks.reshape((-1, 3)) self.ntrain_chunks = self.train_chunks.shape[0] if len(self.train_offsets) == 0: self.train_offsets = np.zeros_like(self.train_chunks) else: self.train_offsets = np.array(self.train_chunks).reshape((-1, 3)) assert (self.ntrain_chunks == self.train_offsets.shape[0]) if (self.train_size < 1).all(): self.train_size = np.array(self.chunksize) assert ((self.size[:2] % self.test_size == 0).all()) self.ntest = self.size[:2] // self.test_size self.nztrain = self.train_size[2] * self.ntrain_chunks # print out all initialized variables in verbose mode if self.dpVolumeXcorr_verbose: print('dpVolumeXcorr, verbose mode:\n') print(vars(self))
def __init__(self, args): dpWriteh5.__init__(self,args) # print out all initialized variables in verbose mode if self.dpWarp_verbose: print('dpWarp, verbose mode:\n'); print(vars(self))
def __init__(self, args): self.LIST_ARGS += dpCubeIter.LIST_ARGS dpWriteh5.__init__(self, args) # xxx - also semi-unclean, would fix along with cleaner in/out method self.dataset_in = self.dataset self.datasize_in = self.datasize self.resample_dims = self.resample_dims.astype(bool) self.nresample_dims = self.resample_dims.sum(dtype=np.uint8) assert (self.nresample_dims > 0) # no resample dims specified self.nslices = self.factor**self.nresample_dims # print out all initialized variables in verbose mode if self.dpResample_verbose: print('dpResample, verbose mode:\n') print(vars(self)) ## xxx - probably a way to do this programatically, but easier to read as enumerated. ## this code commented out was only for downsampling by factor of 2 #if (self.resample_dims == np.array([1,0,0])).all(): # self.slices = [np.s_[::2,:,:], np.s_[1::2,:,:]] #elif (self.resample_dims == np.array([0,1,0])).all(): # self.slices = [np.s_[:,::2,:], np.s_[:,1::2,:]] #elif (self.resample_dims == np.array([0,0,1])).all(): # self.slices = [np.s_[:,:,::2], np.s_[:,:,1::2]] #elif (self.resample_dims == np.array([1,1,0])).all(): # self.slices = [np.s_[::2,::2,:], np.s_[1::2,::2,:], np.s_[::2,1::2,:], np.s_[1::2,1::2,:]] #elif (self.resample_dims == np.array([1,0,1])).all(): # self.slices = [np.s_[::2,:,::2], np.s_[1::2,:,::2], np.s_[::2,:,1::2], np.s_[1::2,:,1::2]] #elif (self.resample_dims == np.array([0,1,1])).all(): # self.slices = [np.s_[:,::2,::2], np.s_[:,1::2,::2], np.s_[:,::2,1::2], np.s_[:,1::2,1::2]] #elif self.resample_dims.all(): # self.slices = [np.s_[::2,::2,::2], np.s_[1::2,::2,::2], np.s_[::2,1::2,::2], np.s_[::2,::2,1::2], # np.s_[1::2,1::2,::2], np.s_[1::2,::2,1::2], np.s_[::2,1::2,1::2], np.s_[1::2,1::2,1::2]] #assert( len(self.slices) == self.nslices ) # sanity check # programmatic for factor, but still not for dimensions, again didn't seem worth it, always 3d self.slices = [None] * self.nslices f = self.factor if (self.resample_dims == np.array([1, 0, 0])).all(): for i in range(f): self.slices[i] = np.s_[i::f, :, :] elif (self.resample_dims == np.array([0, 1, 0])).all(): for i in range(f): self.slices[i] = np.s_[:, i::f, :] elif (self.resample_dims == np.array([0, 0, 1])).all(): for i in range(f): self.slices[i] = np.s_[:, :, i::f] elif (self.resample_dims == np.array([1, 1, 0])).all(): for i in range(f): for j in range(f): self.slices[i * f + j] = np.s_[i::f, j::f, :] elif (self.resample_dims == np.array([1, 0, 1])).all(): for i in range(f): for j in range(f): self.slices[i * f + j] = np.s_[i::f, :, j::f] elif (self.resample_dims == np.array([0, 1, 1])).all(): for i in range(f): for j in range(f): self.slices[i * f + j] = np.s_[:, i::f, j::f] elif self.resample_dims.all(): ff = f * f for i in range(f): for j in range(f): for k in range(f): self.slices[i * ff + j * f + k] = np.s_[i::f, j::f, k::f]
def __init__(self, args): self.default_data_type = self.VOXTYPE_DTYPE #self.data_type = self.VOXTYPE_DTYPE self.dataset = self.VOXTYPE_DATASET self.fillvalue = self.EMPTY_VOXTYPE dpWriteh5.__init__(self,args)
def __init__(self, args): #self.data_type = self.PROBS_DTYPE self.default_data_type = self.PROBS_DTYPE self.fillvalue = self.EMPTY_PROB #self.dataset = self.PROBS_DATASET # don't do this, set in classmethod dpWriteh5.__init__(self,args)