### Setup Image2D Header and Properties Demonstrates setting up an e57::Image2D object with various properties including name, description, GUID, acquisition time, sensor details, pose, and image dimensions. This code is specific to C++ and assumes the availability of relevant data structures and variables. ```C++ e57::Image2D imageHeader; imageHeader.name = (char*) bstrName; imageHeader.description = (char*) bstrDesc; imageHeader.guid = (char*) bstrImageGuid; imageHeader.associatedData3DGuid = (char*) bstrScanGuid; imageHeader.acquisitionDateTime.SetCurrentGPSTime(); //set current time. imageHeader.sensorSerialNumber = (char*) bstrSerial; imageHeader.sensorVendor = (char*) bstrVendor; imageHeader.sensorModel = (char*) bstrModel; imageHeader.pose.rotation.w = rotation.w(); imageHeader.pose.rotation.x = rotation.x(); imageHeader.pose.rotation.y = rotation.y(); imageHeader.pose.rotation.z = rotation.z(); imageHeader.pose.translation.x = translation.x(); imageHeader.pose.translation.y = translation.y(); imageHeader.pose.translation.z = translation.z(); imageHeader.sphericalRepresentation.imageHeight = imageHeight; imageHeader.sphericalRepresentation.imageWidth = imageWidth; imageHeader.sphericalRepresentation.pixelHeight = pixelHeight; imageHeader.sphericalRepresentation.pixelWidth = pixelWidth; ``` -------------------------------- ### C++: Setup Buffers for Reading Scan Points with Simple API Illustrates how to determine the size of scan data (rows, columns, points, groups) and set up appropriate buffers for reading point data, including Cartesian coordinates (X, Y, Z) and invalid data flags. It also shows the setup for intensity data if present. ```cpp int64_t nColumn = 0; int64_t nRow = 0; int64_t nPointsSize = 0; //Number of points int64_t nGroupsSize = 0; //Number of groups int64_t nCountSize = 0; //Number of points per group bool bColumnIndex = false; //indicates that idElementName is "columnIndex" eReader.GetData3DSizes( scanIndex, nRow, nColumn, nPointsSize, nGroupsSize, nCountSize, bColumnIndex); int64_t nSize = nRow; if(nSize == 0) nSize = 1024; // choose a chunk size int8_t * isInvalidData = NULL; if(scanHeader.pointFields.cartesianInvalidStateField) isInvalidData = new int8_t[nSize]; double * xData = NULL; if(scanHeader.pointFields.cartesianXField) xData = new double[nSize]; double * yData = NULL; if(scanHeader.pointFields.cartesianYField) yData = new double[nSize]; double * zData = NULL; if(scanHeader.pointFields.cartesianZField) zData = new double[nSize]; double * intData = NULL; bool bIntensity = false; double intRange = 0; double intOffset = 0; if(scanHeader.pointFields.intensityField) { bIntensity = true; intData = new double[nSize]; intRange = scanHeader.pointFields.intensityMaximum - scanHeader.pointFields.intensityMinimum; intOffset = scanHeader.pointFields.intensityMinimum; } ``` -------------------------------- ### Setup GroupByLine Buffers in C++ Allocates memory for buffers that store group-by-line information, including element values, start point indices, and point counts. It checks if there are any groups to process and reads this data using the eReader. If reading fails, the group size is reset to zero. ```cpp { idElementValue = new int64_t[nGroupsSize]; startPointIndex = new int64_t[nGroupsSize]; pointCount = new int64_t[nGroupsSize]; if(!eReader.ReadData3DGroupsData(scanIndex, nGroupsSize, idElementValue, startPointIndex, pointCount)) nGroupsSize = 0; } ``` -------------------------------- ### Doxygen Class Definitions with Inheritance Example C++ class definitions demonstrating various inheritance types (public, protected, private) and template usage, as interpreted by Doxygen for graph generation. These examples illustrate how Doxygen visually represents class structures and relationships. ```cpp /*! Invisible class because of truncation */ class Invisible { }; /*! Truncated class, inheritance relation is hidden */ class Truncated : public Invisible { }; /* Class not documented with doxygen comments */ class Undocumented { }; /*! Class that is inherited using public inheritance */ class PublicBase : public Truncated { }; /*! A template class */ template class Templ { }; /*! Class that is inherited using protected inheritance */ class ProtectedBase { }; /*! Class that is inherited using private inheritance */ class PrivateBase { }; /*! Class that is used by the Inherited class */ class Used { }; /*! Super class that inherits a number of other classes */ class Inherited : public PublicBase, protected ProtectedBase, private PrivateBase, public Undocumented, public Templ { private: Used *m_usedClass; }; ``` -------------------------------- ### Write E57 File with Scan Data using C++ This C++ code demonstrates the process of creating and writing an E57 file using the E57 Simple API. It covers initializing the writer, setting up scan header information including name, description, GUID, acquisition times, bounds, point grouping, and optional pose rotation and translation. It also includes setting up scanner details if exporting them. ```cpp try { _bstr_t bsFile = sFile; //converts Unicode to UTF-8 e57::Writer eWriter( (char*) bsFile); if(!eWriter.IsOpen()) //test for being open return false; e57::Data3D scanHeader; scanHeader.name = (char*) bstrName; scanHeader.description = (char*) bstrDesc; GUID guid; //Window's GUID pScan->GetGuid(&guid); OLECHAR wbuffer[64]; StringFromGUID2(guid,&wbuffer[0],64); _bstr_t bstrScanGuid = &wbuffer[0]; scanHeader.guid = (char*) bstrScanGuid; scanHeader.acquisitionStart.SetCurrentGPSTime(); //use real time scanHeader.acquisitionEnd.SetCurrentGPSTime(); scanHeader.indexBounds.rowMaximum = nRow - 1; scanHeader.indexBounds.rowMinimum = 0; scanHeader.indexBounds.columnMaximum = nColumn - 1; scanHeader.indexBounds.columnMinimum = 0; scanHeader.indexBounds.returnMaximum = 0; scanHeader.indexBounds.returnMinimum = 0; scanHeader.pointGroupingSchemes.groupingByLine.groupsSize = nColumn; scanHeader.pointGroupingSchemes.groupingByLine.pointCountSize = nRow; scanHeader.pointGroupingSchemes.groupingByLine.idElementName = "columnIndex"; scanHeader.pointsSize = (nColumn * nRow); if(exportStatistics) { //because we are using scaled integers for the data, we must adjust our bounds scanHeader.cartesianBounds.xMaximum = floor(pStat->GetMaxX()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.cartesianBounds.xMinimum = floor(pStat->GetMinX()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.cartesianBounds.yMaximum = floor(pStat->GetMaxY()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.cartesianBounds.yMinimum = floor(pStat->GetMinY()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.cartesianBounds.zMaximum = floor(pStat->GetMaxZ()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.cartesianBounds.zMinimum = floor(pStat->GetMinZ()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.sphericalBounds.rangeMaximum = floor(pStat->GetMaxRange()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.sphericalBounds.rangeMinimum = floor(pStat->GetMinRange()/DATA_SCALE_FACTOR +0.5) * DATA_SCALE_FACTOR; scanHeader.sphericalBounds.azimuthEnd = pStat->GetMaxAzimuth(); scanHeader.sphericalBounds.azimuthStart = pStat->GetMinAzimuth(); scanHeader.sphericalBounds.elevationMaximum = pStat->GetMaxPolar(); scanHeader.sphericalBounds.elevationMinimum = pStat->GetMinPolar(); } if(exportMatrix) { scanHeader.pose.rotation.w = rotation.w(); scanHeader.pose.rotation.x = rotation.x(); scanHeader.pose.rotation.y = rotation.y(); scanHeader.pose.rotation.z = rotation.z(); scanHeader.pose.translation.x = translation.x(); scanHeader.pose.translation.y = translation.y(); scanHeader.pose.translation.z = translation.z(); } if(exportScanner) { scanHeader.sensorSerialNumber = (char*) bstrSerial; scanHeader.sensorVendor = (char*) bstrVendor; scanHeader.sensorModel = (char*) bstrModel; scanHeader.sensorSoftwareVersion = (char*) bstrSoftware; } // Further steps to write scan data would follow here... } catch (...) { return false; } ``` -------------------------------- ### C++: Access Scan Data Header Information with Simple API Shows how to get the number of 3D scans in an E57 file, select a specific scan, and read its header. The header contains details like name, GUID, description, pose (translation and rotation), sensor information, and environmental data. ```cpp int scanIndex = 0; e57::Data3D scanHeader; eReader.ReadData3D( scanIndex, scanHeader); _bstr_t bstrName = scanHeader.name.c_str(); _bstr_t bstrGuid = scanHeader.guid.c_str(); _bstr_t bstrDesc = scanHeader.description.c_str(); double startGPSTime = rootHeader.acquisitionStart; double endGPSTime = rootHeader.acquisitionEnd; ISI::Point translation; translation.x(scanHeader.pose.translation.x); translation.y(scanHeader.pose.translation.y); translation.z(scanHeader.pose.translation.z); ISI::Quat rotation; rotation.w(scanHeader.pose.rotation.w); rotation.x(scanHeader.pose.rotation.x); rotation.y(scanHeader.pose.rotation.y); rotation.z(scanHeader.pose.rotation.z); _bstr_t bstrSerial = scanHeader.sensorSerialNumber.c_str(); _bstr_t bstrVendor = scanHeader.sensorVendor.c_str(); _bstr_t bstrModel = scanHeader.sensorModel.c_str(); _bstr_t bstrSoftware = scanHeader.sensorSoftwareVersion.c_str(); _bstr_t bstrFirmware = scanHeader.sensorFirmwareVersion.c_str(); _bstr_t bstrHardware = scanHeader.sensorHardwareVersion.c_str(); double temperature = scanHeader.temperature; double humidity = scanHeader.relativeHumidity; double airPressure = scanHeader.atmosphericPressure; ``` -------------------------------- ### Initialize Scan Data Variables Initializes variables required for writing scan data, including vectors to store element values, start point indices, and point counts, along with group and start point counters. ```C++ vector idElementValue; vector startPointIndex; vector pointCount; int group = 0; int startPoint = 0; ``` -------------------------------- ### Setup Intensity Field for Scan Header Configures the intensity field for scan data export. It allocates memory for intensity data and sets the minimum and maximum limits for intensity values. ```C++ double * intData = NULL; if(exportIntensity) { scanHeader.pointFields.intensityField = true; intData = new double[nRow]; header.intensityLimits.intensityMaximum = 1.; headerintensityLimits.intensityMinimum = 0.; header.pointFields.intensityScaledInteger = 0.; } ``` -------------------------------- ### Setup Intensity Buffers in C++ Initializes buffers for intensity data. It sets a boolean flag for intensity, creates a double array for intensity data, and calculates the range and offset from scan header limits. This is essential for processing lidar return intensity values. ```cpp { bIntensity = true; intData = new double[nSize]; intRange = scanHeader.intensityLimits.intensityMaximum - scanHeader.intensityLimits.intensityMinimum; intOffset = scanHeader.intensityLimits.intensityMinimum; } ``` -------------------------------- ### Setup Data Buffers for 3D Points using E57 Writer Configures and sets up data buffers for writing 3D point data to an E57 file. It takes the scan index, buffer size, and pointers to various data arrays as input. ```C++ e57::CompressedVectorWriter dataWriter = eWriter.SetUpData3DPointsData( scanIndex, nRow, xData, yData, zData, isInvalidData, intData, NULL, redData, greenData, blueData, NULL ); ``` -------------------------------- ### Setup Color Buffers in C++ Initializes buffers for color data (red, green, blue) if color fields are present in the header. It allocates memory for color data arrays and calculates the range and offset for each color channel based on header limits. This is used when the E57 file contains color information for points. ```cpp { bColor = true; redData = new uint16_t[nSize]; greenData = new uint16_t[nSize]; blueData = new uint16_t[nSize]; colorRedRange = header.colorLimits.colorRedMaximum - header.colorLimits.colorRedMinimum; colorRedOffset = header.colorLimits.colorRedMinimum; colorGreenRange = header.colorLimits.colorGreenMaximum - header.colorLimits.colorGreenMinimum; colorGreenOffset = header.colorLimits.colorGreenMinimum; colorBlueRange = header.colorLimits.colorBlueMaximum - header.colorLimits.colorBlueMinimum; colorBlueOffset = header.colorLimits.colorBlueMinimum; } ``` -------------------------------- ### Open and Read E57 File with C++ Reader Source: https://context7.com/context7/libe57_simpleapi_html/llms.txt Demonstrates how to open an E57 file using the `e57::Reader` class, check if the file is open, read the root header information (GUID, creation date), and count the number of 3D scans and images. Includes error handling for `e57::E57Exception` and standard exceptions. The reader is closed after operations. ```cpp #include "E57Simple.h" try { // Open E57 file e57::Reader reader("/path/to/scan.e57"); if (!reader.IsOpen()) { std::cerr << "Failed to open E57 file" << std::endl; return false; } // Read root header e57::E57Root root; reader.GetE57Root(root); std::cout << "File GUID: " << root.guid << std::endl; std::cout << "Creation date: " << root.creationDateTime.dateTimeValue << std::endl; std::cout << "Number of scans: " << reader.GetData3DCount() << std::endl; std::cout << "Number of images: " << reader.GetImage2DCount() << std::endl; reader.Close(); } catch(e57::E57Exception& ex) { ex.report(__FILE__, __LINE__, __FUNCTION__); return false; } catch (std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return false; } ``` -------------------------------- ### Setup Color Fields for Scan Header Configures the color fields (Red, Green, Blue) for scan data export. It allocates memory for color data buffers and sets the minimum and maximum limits for color values. ```C++ uint16_t * redData = NULL; uint16_t * greenData = NULL; uint16_t * blueData = NULL; if(exportColor) { scanHeader.pointFields.colorRedField = true; redData = new uint16_t[nRow]; scanHeader.pointFields.colorGreenField = true; greenData = new uint16_t[nRow]; scanHeader.pointFields.colorBlueField = true; blueData = new uint16_t[nRow]; scanheader.colorLimits.colorRedMinimum = e57::E57_UINT8_MIN; scanheader.colorLimits.colorRedMaximum = e57::E57_UINT8_MAX; scanheader.colorLimits.colorGreenMinimum = e57::E57_UINT8_MIN; scanheader.colorLimits.colorGreenMaximum = e57::E57_UINT8_MAX; scanheader.colorLimits.colorBlueMinimum = e57::E57_UINT8_MIN; scanheader.colorLimits.colorBlueMaximum = e57::E57_UINT8_MAX; } ``` -------------------------------- ### Setup PointRecord Fields for Scan Header Configures the PointRecord fields within a scan header, including Cartesian coordinates and invalid data flags. It involves allocating memory for associated data buffers. ```C++ scanHeader.pointFields.cartesianInvalidStateField = true; int8_t * isInvalidData = new int8_t[nRow]; scanHeader.pointFields.cartesianXField = true; double * xData = new double[nRow]; scanHeader.pointFields.cartesianYField = true; double * yData = new double[nRow]; scanHeader.pointFields.cartesianZField = true; double * zData = new double[nRow]; ``` -------------------------------- ### Create New Scan and Get Index using E57 Writer Initiates a new 3D scan using an E57 writer and retrieves the assigned scan index. This index is used for subsequent data operations. ```C++ int scanIndex = eWriter.NewData3D(scanHeader); ``` -------------------------------- ### Setup Row and Column Index Buffers in C++ Allocates memory for row and column index buffers if these fields are present in the scan header. The rowIndex buffer is allocated based on the total number of points (nSize), while the columnIndex buffer is allocated based on the number of rows (nRow). ```cpp { rowIndex = new int32_t[nSize]; } if(scanHeader.pointFields.columnIndexField) columnIndex = new int32_t[nRow]; ``` -------------------------------- ### C++: Open and Read E57 File with Simple API Demonstrates how to open an E57 file using the e57::Reader and retrieve the root header information. This includes accessing file GUID and creation timestamp. It utilizes the _bstr_t type for string conversions. ```cpp try { _bstr_t bsFile = sFile; //converts Unicode to UTF-8 e57::Reader eReader( (char*) bsFile); e57::E57Root rootHeader; eReader.GetE57Root( rootHeader); char* fileGuid = rootHeader.guid.c_str(); double fileGPSTime = rootHeader.creationDateTime; } ``` -------------------------------- ### Get Image2D Sizes in C++ Retrieves detailed size and projection information for a specified 2D image (Image2D) by its index. It outputs parameters for image projection, type, dimensions, size in bytes, and mask/visual types. Returns true on success, false otherwise. ```cpp bool Reader::GetImage2DSizes(int32_t _imageIndex_, e57::Image2DProjection& _imageProjection_, e57::Image2DType& _imageType_, int64_t& _imageWidth_, int64_t& _imageHeight_, int64_t& _imageSize_, e57::Image2DType& _imageMaskType_, e57::Image2DType& _imageVisualType_) const ``` -------------------------------- ### Access 2D Image Header Metadata in C++ Extracts metadata from the 2D image header, including name, GUID, description, and GPS time. Uses `_bstr_t` for string conversions, likely for COM compatibility. ```cpp _bstr_t bstrName = imageHeader.name.c_str(); _bstr_t bstrGuid = imageHeader.guid.c_str(); _bstr_t bstrDesc = imageHeader.description.c_str(); double imageGPSTime = rootHeader.acquisitionDateTime; ``` -------------------------------- ### Read E57 Scan Headers and Metadata with C++ Source: https://context7.com/context7/libe57_simpleapi_html/llms.txt Shows how to read scan headers and metadata from an already opened E57 file using the `e57::Reader`. It retrieves the number of 3D scans, reads the header for a specific scan, and extracts information such as scan name, GUID, description, sensor details (vendor, model, serial number), environmental conditions (temperature, humidity, pressure), spatial bounds (X, Y, Z ranges), and pose transformation (translation and rotation quaternion). ```cpp // Get scan count and read first scan header int scanCount = reader.GetData3DCount(); int scanIndex = 0; e57::Data3D scanHeader; if (!reader.ReadData3D(scanIndex, scanHeader)) { std::cerr << "Failed to read scan header" << std::endl; return false; } // Access scan metadata std::cout << "Scan name: " << scanHeader.name << std::endl; std::cout << "Scan GUID: " << scanHeader.guid << std::endl; std::cout << "Description: " << scanHeader.description << std::endl; // Sensor information std::cout << "Sensor vendor: " << scanHeader.sensorVendor << std::endl; std::cout << "Sensor model: " << scanHeader.sensorModel << std::endl; std::cout << "Serial number: " << scanHeader.sensorSerialNumber << std::endl; // Environmental conditions std::cout << "Temperature: " << scanHeader.temperature << " C" << std::endl; std::cout << "Humidity: " << scanHeader.relativeHumidity << " %" << std::endl; std::cout << "Pressure: " << scanHeader.atmosphericPressure << " Pa" << std::endl; // Spatial bounds std::cout << "X range: [" << scanHeader.cartesianBounds.xMinimum << ", " << scanHeader.cartesianBounds.xMaximum << "]" << std::endl; std::cout << "Y range: [" << scanHeader.cartesianBounds.yMinimum << ", " << scanHeader.cartesianBounds.yMaximum << "]" << std::endl; std::cout << "Z range: [" << scanHeader.cartesianBounds.zMinimum << ", " << scanHeader.cartesianBounds.zMaximum << "]" << std::endl; // Pose transformation (rotation quaternion and translation) std::cout << "Pose translation: (" << scanHeader.pose.translation.x << ", " << scanHeader.pose.translation.y << ", " << scanHeader.pose.translation.z << ")" << std::endl; std::cout << "Pose rotation (w,x,y,z): (" << scanHeader.pose.rotation.w << ", " << scanHeader.pose.rotation.x << ", " << scanHeader.pose.rotation.y << ", " << scanHeader.pose.rotation.z << ")" << std::endl; ``` -------------------------------- ### Read 2D Image Headers and Data from E57 Files (C++) Source: https://context7.com/context7/libe57_simpleapi_html/llms.txt This snippet demonstrates how to read 2D image headers and associated metadata from an E57 file using the libe57_simpleapi in C++. It retrieves image counts, names, GUIDs, sensor information, pose data, dimensions, projection types, and image formats. It also includes logic for reading the raw image data buffer, which can then be processed further (e.g., decoding or saving). ```cpp // Get image count int imageCount = reader.GetImage2DCount(); std::cout << "Number of images: " << imageCount << std::endl; for (int imageIndex = 0; imageIndex < imageCount; imageIndex++) { // Read image header e57::Image2D imageHeader; if (!reader.ReadImage2D(imageIndex, imageHeader)) { std::cerr << "Failed to read image " << imageIndex << std::endl; continue; } std::cout << "Image name: " << imageHeader.name << std::endl; std::cout << "Image GUID: " << imageHeader.guid << std::endl; std::cout << "Associated scan GUID: " << imageHeader.associatedData3DGuid << std::endl; // Camera sensor info std::cout << "Camera vendor: " << imageHeader.sensorVendor << std::endl; std::cout << "Camera model: " << imageHeader.sensorModel << std::endl; // Pose std::cout << "Camera position: (" << imageHeader.pose.translation.x << ", " << imageHeader.pose.translation.y << ", " << imageHeader.pose.translation.z << ")" << std::endl; // Get image sizes and format e57::Image2DProjection projection; e57::Image2DType imageType; int64_t width = 0, height = 0, imageSize = 0; e57::Image2DType maskType, visualType; reader.GetImage2DSizes(imageIndex, projection, imageType, width, height, imageSize, maskType, visualType); std::cout << "Image dimensions: " << width << " x " << height << std::endl; std::cout << "Image size: " << imageSize << " bytes" << std::endl; // Projection type if (projection == e57::E57_SPHERICAL) { std::cout << "Spherical projection" << std::endl; std::cout << "Pixel width: " << imageHeader.sphericalRepresentation.pixelWidth << std::endl; std::cout << "Pixel height: " << imageHeader.sphericalRepresentation.pixelHeight << std::endl; } else if (projection == e57::E57_PINHOLE) { std::cout << "Pinhole projection" << std::endl; std::cout << "Focal length: " << imageHeader.pinholeRepresentation.focalLength << std::endl; } else if (projection == e57::E57_CYLINDRICAL) { std::cout << "Cylindrical projection" << std::endl; } // Image format const char* formatName = "Unknown"; if (imageType == e57::E57_JPEG_IMAGE) formatName = "JPEG"; else if (imageType == e57::E57_PNG_IMAGE) formatName = "PNG"; std::cout << "Image format: " << formatName << std::endl; // Read image data void* imageBuffer = new char[imageSize]; int64_t bytesRead = reader.ReadImage2DData(imageIndex, projection, imageType, imageBuffer, 0, imageSize); if (bytesRead == imageSize) { std::cout << "Successfully read image data" << std::endl; // Process image buffer (decode JPEG/PNG, save to file, etc.) } delete[] static_cast(imageBuffer); } ``` -------------------------------- ### Writer::NewData3D Sets up a new Data3D header and prepares for binary data insertion. ```APIDOC ## POST /websites/libe57_simpleapi_html/Writer/NewData3D ### Description This function sets up the Data3D header and positions the cursor for the binary data. ### Method POST ### Endpoint /websites/libe57_simpleapi_html/Writer/NewData3D ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **data3DHeader** (Data3D &) - Pointer to the Data3D structure to receive the image information. ### Request Example ```json { "data3DHeader": { ... } } ``` ### Response #### Success Response (200) - **dataIndex** (int32_t) - The index of the new scan's data3D block. #### Response Example ```json { "dataIndex": 0 } ``` ``` -------------------------------- ### Reader::SetUpData3DPointsData Sets up the point data fields for reading. Returns true if successful, false otherwise. ```APIDOC ## Reader::SetUpData3DPointsData ### Description Sets up the point data fields. All non-NULL buffers in the call below have the number of elements equal to `pointCount`. Call `CompressedVectorReader::read()` until all data is read. ### Method POST (Assumed, as it modifies state by setting up readers) ### Endpoint /websites/libe57_simpleapi_html/Reader/SetUpData3DPointsData ### Parameters #### Path Parameters - **_dataIndex_** (int32_t) - Required - Data block index given by the NewData3D. - **_pointCount_** (int64_t) - Required - Size of each element buffer. #### Query Parameters None #### Request Body - **_cartesianX_** (double *) - Optional - Pointer to a buffer with the X coordinate (in meters) of the point in Cartesian coordinates. - **_cartesianY_** (double *) - Optional - Pointer to a buffer with the Y coordinate (in meters) of the point in Cartesian coordinates. - **_cartesianZ_** (double *) - Optional - Pointer to a buffer with the Z coordinate (in meters) of the point in Cartesian coordinates. - **_cartesianInvalidState_** (int8_t *) - Optional - Value = 0 if the point is considered valid, 1 otherwise. - **_intensity_** (double *) - Optional - Pointer to a buffer with the Point response intensity. Unit is unspecified. - **_isIntensityInvalid_** (int8_t *) - Optional - Value = 0 if the intensity is considered valid, 1 otherwise. - **_colorRed_** (uint16_t *) - Optional - Pointer to a buffer with the Red color coefficient. Unit is unspecified. - **_colorGreen_** (uint16_t *) - Optional - Pointer to a buffer with the Green color coefficient. Unit is unspecified. - **_colorBlue_** (uint16_t *) - Optional - Pointer to a buffer with the Blue color coefficient. Unit is unspecified. - **_isColorInvalid_** (int8_t *) - Optional - Value = 0 if the color is considered valid, 1 otherwise. - **_sphericalRange_** (double *) - Optional - Pointer to a buffer with the range (in meters) of points in spherical coordinates. Shall be non-negative. - **_sphericalAzimuth_** (double *) - Optional - Pointer to a buffer with the Azimuth angle (in radians) of point in spherical coordinates. - **_sphericalElevation_** (double *) - Optional - Pointer to a buffer with the Elevation angle (in radians) of point in spherical coordinates. - **_sphericalInvalidState_** (int8_t *) - Optional - Value = 0 if the range is considered valid, 1 otherwise. - **_rowIndex_** (int32_t *) - Optional - Pointer to a buffer with the row number of point (zero based). This is useful for data that is stored in a regular grid. Shall be in the interval (0, 2^31). - **_columnIndex_** (int32_t *) - Optional - Pointer to a buffer with the column number of point (zero based). This is useful for data that is stored in a regular grid. Shall be in the interval (0, 2^31). - **_returnIndex_** (int8_t *) - Optional - Pointer to a buffer with the number of this return (zero based). That is, 0 is the first return, 1 is the second, and so on. Shall be in the interval (0, returnCount). Only for multi-return sensors. - **_returnCount_** (int8_t *) - Optional - Pointer to a buffer with the total number of returns for the pulse that this corresponds to. Shall be in the interval (0, 2^7). Only for multi-return sensors. - **_timeStamp_** (double *) - Optional - Pointer to a buffer with the time (in seconds) since the start time for the data, which is given by acquisitionStart in the parent Data3D Structure. Shall be non-negative. - **_isTimeStampInvalid_** (int8_t *) - Optional - Value = 0 if the timeStamp is considered valid, 1 otherwise. ### Request Example ```json { "pointCount": 1000, "cartesianX": [1.0, 2.0, ...], "cartesianY": [3.0, 4.0, ...], "cartesianZ": [5.0, 6.0, ...] } ``` ### Response #### Success Response (200) - **success** (bool) - Return true if successful, false otherwise. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Create New E57 File with C++ Writer Source: https://context7.com/context7/libe57_simpleapi_html/llms.txt Illustrates how to create a new E57 file using the `e57::Writer` class, specifying the output path and coordinate system. It checks if the file was successfully opened for writing and includes error handling for `e57::E57Exception` and standard exceptions. The writer is closed after creation. ```cpp #include "E57Simple.h" try { // Create new E57 file e57::Writer writer("/path/to/output.e57", "WGS84 coordinate system"); if (!writer.IsOpen()) { std::cerr << "Failed to create E57 file" << std::endl; return false; } // File operations will be added below // ... writer.Close(); std::cout << "E57 file created successfully" << std::endl; } catch(e57::E57Exception& ex) { ex.report(__FILE__, __LINE__, __FUNCTION__); return false; } catch (std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return false; } ``` -------------------------------- ### E57 Reader Class Documentation Documentation for the E57 Reader class, including its constructor and methods for file operations, data retrieval, and size information. ```APIDOC ## Reader Class ### Description This is the E57 Reader class. It provides methods to read data from E57 files. ### Constructor #### Reader(const ustring &filePath) - **filePath** (ustring) - Required - The path to the E57 file. ### Member Functions #### bool IsOpen(void) const - **Description**: This function returns true if the file is open. - **Method**: GET #### bool Close(void) const - **Description**: This function closes the file. - **Method**: POST #### bool GetE57Root(E57Root &fileHeader) const - **Description**: This function returns the file header information. - **Method**: GET #### int32_t GetImage2DCount(void) const - **Description**: This function returns the total number of Picture Blocks. - **Method**: GET #### bool ReadImage2D(int32_t imageIndex, Image2D &image2DHeader) const - **Description**: This function returns the image2D header and positions the cursor. - **Method**: GET - **Path Parameters**: - **imageIndex** (int32_t) - Required - The index of the image to read. #### bool GetImage2DSizes(int32_t imageIndex, e57::Image2DProjection &imageProjection, e57::Image2DType &imageType, int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize, e57::Image2DType &imageMaskType, e57::Image2DType &imageVisualType) const - **Description**: This function returns the size of the image data. - **Method**: GET - **Path Parameters**: - **imageIndex** (int32_t) - Required - The index of the image. #### int64_t ReadImage2DData(int32_t imageIndex, e57::Image2DProjection imageProjection, e57::Image2DType imageType, void *pBuffer, int64_t start, int64_t count) const - **Description**: This function reads the image data block. - **Method**: GET - **Path Parameters**: - **imageIndex** (int32_t) - Required - The index of the image. - **imageProjection** (e57::Image2DProjection) - Required - The projection type of the image. - **imageType** (e57::Image2DType) - Required - The type of the image data. - **pBuffer** (void *) - Required - Pointer to the buffer to store the image data. - **start** (int64_t) - Required - The starting position for reading data. - **count** (int64_t) - Required - The number of bytes to read. #### int32_t GetData3DCount(void) const - **Description**: This function returns the total number of Data3D Blocks. - **Method**: GET #### bool ReadData3D(int32_t dataIndex, Data3D &data3DHeader) const - **Description**: This function returns the Data3D header and positions the cursor. - **Method**: GET - **Path Parameters**: - **dataIndex** (int32_t) - Required - The index of the Data3D block. #### bool GetData3DSizes(int32_t dataIndex, int64_t &rowMax, int64_t &columnMax, int64_t &pointsSize, int64_t &groupsSize, int64_t &countSize, bool &bColumnIndex) const - **Description**: This function returns the size of the point data. - **Method**: GET - **Path Parameters**: - **dataIndex** (int32_t) - Required - The index of the Data3D block. #### bool ReadData3DGroupsData(int32_t dataIndex, int32_t groupCount, int64_t *idElementValue, int64_t *startPointIndex, int64_t *pointCount) const - **Description**: This function writes out the group data. - **Method**: GET - **Path Parameters**: - **dataIndex** (int32_t) - Required - The index of the Data3D block. - **groupCount** (int32_t) - Required - The number of groups. - **idElementValue** (int64_t *) - Required - Pointer to store element IDs. - **startPointIndex** (int64_t *) - Required - Pointer to store start point indices. - **pointCount** (int64_t *) - Required - Pointer to store point counts. #### CompressedVectorReader SetUpData3DPointsData(...) const - **Description**: This function sets up the point data fields for reading. - **Method**: POST - **Path Parameters**: - **dataIndex** (int32_t) - Required - The index of the Data3D block. - **pointCount** (int64_t) - Required - The number of points to set up. - **cartesianX**, **cartesianY**, **cartesianZ** (double *) - Required - Pointers for Cartesian coordinates. - **cartesianInvalidState** (int8_t *) - Optional - Pointer for Cartesian invalid state. - **intensity** (double *) - Optional - Pointer for intensity values. - **isIntensityInvalid** (int8_t *) - Optional - Pointer for intensity invalid state. - **colorRed**, **colorGreen**, **colorBlue** (uint16_t *) - Optional - Pointers for RGB color values. - **isColorInvalid** (int8_t *) - Optional - Pointer for color invalid state. - **sphericalRange**, **sphericalAzimuth**, **sphericalElevation** (double *) - Optional - Pointers for spherical coordinates. - **sphericalInvalidState** (int8_t *) - Optional - Pointer for spherical invalid state. - **rowIndex**, **columnIndex** (int32_t *) - Optional - Pointers for row and column indices. - **returnIndex**, **returnCount** (int8_t *) - Optional - Pointers for return index and count. - **timeStamp** (double *) - Optional - Pointer for timestamp. - **isTimeStampInvalid** (int8_t *) - Optional - Pointer for timestamp invalid state. #### StructureNode GetRawE57Root(void) - **Description**: This function returns the file raw E57Root Structure Node. - **Method**: GET #### VectorNode GetRawData3D(void) - **Description**: This function returns the raw Data3D Vector Node. - **Method**: GET #### VectorNode GetRawImages2D(void) - **Description**: This function returns the raw Image2D Vector Node. - **Method**: GET ``` -------------------------------- ### Get Data3D Count in C++ Retrieves the total number of Data3D blocks available in the E57 file. This function does not take any parameters and returns an integer representing the count. ```cpp int32_t Reader::GetData3DCount(void) const ``` -------------------------------- ### E57Simple.cpp - E57 Simple API Implementation The E57Simple.cpp file provides the concrete implementation for the functions declared in E57Simple.h. It handles the low-level details of interacting with the E57 file format, including reading and writing point cloud data. This file relies on the E57 file format library for its operations. ```cpp #include "E57Simple.h" #include "E57Foundation.h" // Assuming this is the underlying E57 library header #include // Constructor E57Simple::E57Simple() { // Initialize E57 file handle or other members std::cout << "E57Simple object created." << std::endl; } // Destructor E57Simple::~E57Simple() { close(); // Ensure file is closed std::cout << "E57Simple object destroyed." << std::endl; } // Open E57 file bool E57Simple::open(const std::string& filePath, const std::string& mode) { // Implementation to open the E57 file using the underlying library // Example: e57_handle = E57_Open(filePath.c_str(), mode.c_str()); std::cout << "Opening E57 file: " << filePath << " in mode: " << mode << std::endl; // Return true if successful, false otherwise return true; } // Close E57 file void E57Simple::close() { // Implementation to close the E57 file std::cout << "Closing E57 file." << std::endl; } // Get number of points size_t E57Simple::getNumberOfPoints() const { // Implementation to get the total number of points std::cout << "Getting number of points." << std::endl; return 0; // Placeholder } // Read a single point by index bool E57Simple::readPoint(size_t index, E57Point& point) const { // Implementation to read a point at a specific index std::cout << "Reading point at index: " << index << std::endl; // Populate point data point = {0.0, 0.0, 0.0}; return true; // Placeholder } // Read all points from the file std::vector E57Simple::readAllPoints() const { // Implementation to read all points std::vector allPoints; size_t numPoints = getNumberOfPoints(); for (size_t i = 0; i < numPoints; ++i) { E57Point p; if (readPoint(i, p)) { allPoints.push_back(p); } } std::cout << "Read " << allPoints.size() << " points." << std::endl; return allPoints; } // Write a single point to the file bool E57Simple::writePoint(const E57Point& point) { // Implementation to write a point std::cout << "Writing point: (" << point.x << ", " << point.y << ", " << point.z << ")" << std::endl; // Return true if successful, false otherwise return true; // Placeholder } ``` -------------------------------- ### Get Raw Images2D Vector in C++ Returns a VectorNode containing the raw Image2D elements. This provides low-level access to the image data structures within the E57 file. ```cpp VectorNode Reader::GetRawImages2D(void) ``` -------------------------------- ### Get Image2D Count in C++ Returns the total number of Image2D blocks (picture blocks) present in the E57 file. This function requires no arguments and returns an integer count. ```cpp int32_t Reader::GetImage2DCount(void) const ``` -------------------------------- ### Writer::IsOpen Checks if the E57 file is open and ready for operations. ```APIDOC ## GET /websites/libe57_simpleapi_html/Writer/IsOpen ### Description This function returns true if the file is open. ### Method GET ### Endpoint /websites/libe57_simpleapi_html/Writer/IsOpen ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **isOpen** (boolean) - True if the file is open and ready. #### Response Example ```json { "isOpen": true } ``` ```