public static void OverwriteHdf5_DaimlerLidar(int fileIndex_inp, Dictionary <Tuple <int, int>, int> indexToID, Hdf5Container_LidarDaimler container, List <GameObject> pointList, string pathToFile_inp) { var previousTime = Time.realtimeSinceStartup; var duration = Time.realtimeSinceStartup - previousTime; previousTime = Time.realtimeSinceStartup; Debug.Log("Start: " + duration); int status = 0; long file_id = H5F.open(pathToFile_inp, H5F.ACC_RDWR); int rows = container._labels.GetLength(0); int cols = container._labels.GetLength(1); uint[,] labels = new uint[rows, cols]; var pointValid = container._pointValid; labels = container._labels; pointList.OrderBy(x => x.GetComponent <CustomAttributes>()._ID); indexToID.OrderBy(x => x.Value); for (int i = 0; i < pointList.Count; i++) { var attr = pointList[i].GetComponent <CustomAttributes>(); var key = indexToID.ElementAt(i).Key; labels[key.Item1, key.Item2] = attr._label; } //for (int i = 0; i < pointList.Count; i++) //{ // var attr = pointList[i].GetComponent<CustomAttributes>(); // var index = indexToID.First(indx => indx.Value == attr._ID).Key; // labels[index.Item1, index.Item2] = attr._label; //} Hdf5IO.WriteUIntDataset(file_id, "labels", labels, true); Hdf5IO.WriteLabelWorkingSet(file_id, true); status = H5F.close(file_id); }
public static void CreateNewHdf5File_DaimlerLidar(int fileIndex_inp, Dictionary <Tuple <int, int>, int> indexToID, Hdf5Container_LidarDaimler container, List <GameObject> pointList, string exportDatapath) { int status = 0; long file_id = H5F.create(exportDatapath, H5F.ACC_TRUNC); int rows = container._labels.GetLength(0); int cols = container._labels.GetLength(1); uint[,] labels = container._labels; pointList.OrderBy(x => x.GetComponent <CustomAttributes>()._ID); indexToID.OrderBy(x => x.Value); for (int i = 0; i < pointList.Count; i++) { var attr = pointList[i].GetComponent <CustomAttributes>(); labels[indexToID.ElementAt(i).Key.Item1, indexToID.ElementAt(i).Key.Item2] = attr._label; } //for (int i = 0; i < pointList.Count; i++) //{ // var attr = pointList[i].GetComponent<CustomAttributes>(); // var index = indexToID.First(indx => indx.Value == attr._ID).Key; // labels[index.Item1, index.Item2] = attr._label; //} Hdf5IO.WriteUIntDataset(file_id, "labels", labels, false); Hdf5IO.WriteLabelWorkingSet(file_id, false); //write unchangenged datasets Hdf5IO.WriteFloatDataset(file_id, "distance", container._distances, false); Hdf5IO.WriteFloatDataset(file_id, "intensity", container._intensity, false); Hdf5IO.WriteFloatDataset(file_id, "labelProbabilities", container._labelProbabilities, false); Hdf5IO.WriteIntDataset(file_id, "pointValid", container._pointValid, false); Hdf5IO.WriteFloatDataset(file_id, "sensorX", container._sensorX, false); Hdf5IO.WriteFloatDataset(file_id, "sensorY", container._sensorY, false); Hdf5IO.WriteFloatDataset(file_id, "sensorZ", container._sensorZ, false); Hdf5IO.WriteFloatDataset(file_id, "vehicleX", container._vehicleX, false); Hdf5IO.WriteFloatDataset(file_id, "vehicleY", container._vehicleY, false); Hdf5IO.WriteFloatDataset(file_id, "vehicleZ", container._vehicleZ, false); status = H5F.close(file_id); }