def _get_voxel_time_series_region(self, ts_h5, x, y, z, var=0, mode=0): region_mapping_volume_gid = ts_h5.region_mapping_volume.load() if region_mapping_volume_gid is None: raise Exception("Invalid method called for TS without Volume Mapping!") volume_rm_h5_class, volume_rm_h5_path = self._load_h5_of_gid(region_mapping_volume_gid.hex) volume_rm_h5 = volume_rm_h5_class(volume_rm_h5_path) volume_rm_shape = volume_rm_h5.array_data.shape x, y, z = preprocess_space_parameters(x, y, z, volume_rm_shape[0], volume_rm_shape[1], volume_rm_shape[2]) idx_slices = slice(x, x + 1), slice(y, y + 1), slice(z, z + 1) idx = int(volume_rm_h5.array_data[idx_slices]) time_length = ts_h5.data.shape[0] var, mode = int(var), int(mode) voxel_slices = prepare_time_slice(time_length), slice(var, var + 1), slice(idx, idx + 1), slice(mode, mode + 1) connectivity_gid = volume_rm_h5.connectivity.load() connectivity_h5_class, connectivity_h5_path = self._load_h5_of_gid(connectivity_gid.hex) connectivity_h5 = connectivity_h5_class(connectivity_h5_path) label = connectivity_h5.region_labels.load()[idx] background, back_min, back_max = None, None, None if idx < 0: back_min, back_max = ts_h5.get_min_max_values() background = numpy.ones((time_length, 1)) * ts_h5.out_of_range(back_min) label = 'background' volume_rm_h5.close() connectivity_h5.close() result = postprocess_voxel_ts(ts_h5, voxel_slices, background, back_min, back_max, label) return result
def get_volume_view(self, x_plane, y_plane, z_plane, **kwargs): shape = self.array_data.shape length_1d = shape[0] length_2d = shape[1] length_3d = shape[2] # Work with space inside Volume: x_plane, y_plane, z_plane = preprocess_space_parameters(x_plane, y_plane, z_plane, length_1d, length_2d, length_3d) slice_x, slice_y, slice_z = self.get_volume_slice(x_plane, y_plane, z_plane) return [[slice_x.tolist()], [slice_y.tolist()], [slice_z.tolist()]]
def get_voxel_region(self, x_plane, y_plane, z_plane): data_shape = self.array_data.shape x_plane, y_plane, z_plane = preprocess_space_parameters(x_plane, y_plane, z_plane, data_shape[0], data_shape[1], data_shape[2]) slices = slice(x_plane, x_plane + 1), slice(y_plane, y_plane + 1), slice(z_plane, z_plane + 1) voxel = self.array_data[slices][0, 0, 0] if voxel != -1: conn_index = load_entity_by_gid(self.connectivity.load().hex) return conn_index.region_labels[int(voxel)] else: return 'background'