def warp_patch(self, ng_path, z, bbox, res_mip_range, mip): influence_bbox = deepcopy(bbox) influence_bbox.uncrop(self.max_displacement, mip=0) agg_flow = influence_bbox.identity(mip=mip) agg_flow = np.expand_dims(agg_flow, axis=0) agg_res = data_handler.get_aggregate_rel_flow( z, influence_bbox, res_mip_range, mip, self.process_low_mip, self.process_high_mip, self.x_res_ng_paths, self.y_res_ng_paths) agg_flow += agg_res raw_data = data_handler.get_image_data(ng_path, z, influence_bbox, mip) #no need to warp if flow is identity #warp introduces noise if not influence_bbox.is_identity_flow(agg_flow, mip=mip): warped = warp(raw_data, agg_flow) else: #print ("not warping") warped = raw_data[0] mip_disp = int(self.max_displacement / 2**mip) cropped = crop(warped, mip_disp) result = data_handler.preprocess_data(cropped * 256) #preprocess divides by 256 and puts it into right dimensions #this data range is good already, so mult by 256 data_handler.save_image_patch(self.dst_ng_path, result, z, bbox, mip)
def chunkwise(patch_bbox): print("Downsampling {} to mip {}".format( patch_bbox.__str__(mip=0), m)) downsampled_patch = self.downsample_patch( self.dst_ng_path, z, patch_bbox, m) data_handler.save_image_patch(self.dst_ng_path, downsampled_patch, z, patch_bbox, m)
def chunkwise(patch_bbox): downsampled_patch = self.downsample_patch(self.dst_ng_path, z, patch_bbox, mip) data_handler.save_image_patch(self.dst_ng_path, downsampled_patch, z, patch_bbox, mip)
def chunkwise(patch_bbox): raw_patch = data_handler.get_image_data(source, z, patch_bbox, mip) data_handler.save_image_patch(dest, raw_patch, z, patch_bbox, mip)