public static void Main(string [] args) { // use (i.e. open) HDF file "my-file.h5" HDFql.Execute("USE FILE my-file.h5"); // select (i.e. read) attribute "foo" and populate default cursor with its data HDFql.Execute("SELECT FROM foo"); // display content of default cursor while (HDFql.CursorNext() == HDFql.Success) { System.Console.WriteLine(HDFql.CursorGetChar()); } }
/// <summary> /// Retrieves all of the image data from the .h5 file and /// initializes all of the data attributes. /// </summary> /// <param name="file">The .h5 file specified by the user</param> private void Initialize(string file) { // Get the relative path of the file since only relative paths work as of right now. // TODO: Make absolute paths work. string relativePath = GetRelativePath(file, System.IO.Directory.GetCurrentDirectory()); fileName = file; // Open the .h5 file specified by the user HDFql.Execute("USE FILE " + relativePath); // Create myCursor "myCursor" and use it myCursor = new HDFqlCursor(); HDFql.CursorUse(myCursor); string path = ""; HDFql.Execute("SHOW DATASET LIKE {50e35494-f4dd-4122-96f8-4d47c927abe5}/resultarray/inputdata WHERE DATATYPE IS INT"); if (HDFql.CursorNext() == HDFql.Success) { path = HDFql.CursorGetChar(); } else { HDFql.Execute("SHOW DATASET LIKE inputdata WHERE DATATYPE IS INT"); if (HDFql.CursorNext() == HDFql.Success) { path = HDFql.CursorGetChar(); } else { HDFql.Execute("SHOW DATASET LIKE Cube/resultarray/inputdata WHERE DATATYPE IS INT"); if (HDFql.CursorNext() == HDFql.Success) { path = HDFql.CursorGetChar(); } } } // Populate cursor "myCursor" with size of dataset "example_dataset" and display it if (path == "{50e35494-f4dd-4122-96f8-4d47c927abe5}/resultarray/inputdata") { HDFql.Execute("USE GROUP {50e35494-f4dd-4122-96f8-4d47c927abe5}"); HDFql.Execute("USE GROUP resultarray"); HDFql.Execute("USE DATASET inputdata"); } else if (path == "inputdata") { HDFql.Execute("USE DATASET inputdata"); } else { HDFql.Execute("USE GROUP Cube"); HDFql.Execute("USE GROUP resultarray"); HDFql.Execute("USE DATASET inputdata"); } HDFql.Execute("SHOW SIZE inputdata"); HDFql.CursorFirst(); Console.WriteLine("Dataset size: {0}", HDFql.CursorGetInt()); HDFql.Execute("SHOW DIMENSION inputdata"); HDFql.CursorFirst(); Console.WriteLine("Dataset size: {0}", HDFql.CursorGetInt()); // Console.WriteLine lambda count, should be 78 HDFql.CursorFirst(null); lambdaCount = HDFql.CursorGetInt() != null ? (int)HDFql.CursorGetInt() : 0; Console.WriteLine("inputdata dimension 0 (Λ): " + lambdaCount); // Console.WriteLine the the x and y dimensions of the dataset HDFql.CursorAbsolute(null, 2); int xDimension = HDFql.CursorGetInt() != null ? (int)HDFql.CursorGetInt() : 0; Console.WriteLine("inputdata dimension 2 (X): " + xDimension); HDFql.CursorAbsolute(null, 3); int yDimension = HDFql.CursorGetInt() != null ? (int)HDFql.CursorGetInt() : 0; Console.WriteLine("inputdata dimension 3 (Y): " + yDimension); // Set the size of the data array to be lambdaCount * xDimension * yDimension data = new float[lambdaCount, xDimension, yDimension]; // Register variable "data" for subsequent use (by HDFql) HDFql.VariableRegister(data); // Select (y.e. read) dataset into variable "data" HDFql.Execute("SELECT FROM inputdata INTO MEMORY " + HDFql.VariableGetNumber(data)); // Unregister variable "data" as it is no longer used/needed (by HDFql) HDFql.VariableUnregister(data); // Set the length and width of the textures imageWidth = yDimension; imageHeight = xDimension; FindMinAndMaxValue(); }