/* Bruker.API.Esprit.h Header File for Bruker Esprit-Interface Microsoft Visual Studio 2015 */ #pragma once #include #include #include "Bruker.API.CommonFunctions.h" #include "Bruker.API.CommonStructures.h" namespace BrukerDll { struct TFeatureData; struct TRTEBSDCalibSettings; struct TRTElementRegion; struct TRTHyMapProfileSettings; struct TRTImageInfoEx; struct TSegment; #pragma pack(push, 1) struct TRTEBSDCalibSettings { int32_t TiltAngle; int32_t TiltAzimuthAngle; int32_t ScanRotation; int32_t WD; int32_t DetectorAxis; int32_t DetectorTilt; int32_t PhosphorSize; }; #pragma pack(pop) typedef TRTEBSDCalibSettings* PRTEBSDCalibSettings; #pragma pack(push, 1) struct TRTImageInfoEx { int32_t Magnification; double PixelSizeX; // µm per Pixel double PixelSizeY; double HighVoltage; // kV double WorkingDistance; // mm }; #pragma pack(pop) typedef TRTImageInfoEx* PRTImageInfoEx; #pragma pack(push, 1) // describes 1 scan feature struct TFeatureData { int32_t SegmentCount; PSegmentList Segments; }; #pragma pack(pop) typedef TFeatureData* PFeatureDataList; bool LoadEspritAPI(char* csAPILibFile); //---------------------------------------------------------------------------------- // Interface functions of Bruker.API.Esprit.DLL //---------------------------------------------------------------------------------- // Ask for SGU/SCU/SBU device connection status // Status: 0 = connected, 1 = wait for reconnection, 2 = reconnecting // TimeLeftForReconnection in ms int32_t HardwareConnectionGetStatus(uint32_t CID, int32_t& Status, boolean& WasInterrupted, int32_t& TimeLeftForReconnection); // Reset connection error flag 'WasInterrupted' from above once detected int32_t HardwareConnectionResetErrorFlag(uint32_t CID); // Initialize connection reset procedure, this will trigger a 'watchdogged' hardware reset in SCU/SGU int32_t HardwareConnectionReset(uint32_t CID); // Reset scan hardware, device will have default configuration afterwards, so be sure to re-configure it correctly int32_t ImageReset(uint32_t CID); // Read current image device configuration int32_t ImageGetConfiguration(uint32_t CID, uint32_t& Width, uint32_t& Height, uint32_t& Average, bool& Ch1, bool& Ch2); // Write current image device configuration int32_t ImageSetConfiguration(uint32_t CID, uint32_t Width, uint32_t Height, uint32_t Average, bool Ch1, bool Ch2); // Use external scan engine which triggers our scan generator trough an external signal int32_t ImageSetExternalScan(uint32_t CID, bool UseExternalScan); // Aquire new image and read image data int32_t ImageAquireImage(uint32_t CID, int32_t Ch, bool ShowProgress, void* Buffer, int32_t& BufSize, PRTImageInfoEx ImgInfo); // Aquire new image and read image data // Options : Bit combination of the following values // cImgAcq_ShowProgress = 1; // cImgAcq_UpdateSEMData = 2; int32_t ImageAquireImageEx(uint32_t CID, int32_t Ch, void* Buffer, uint32_t Options, int32_t& BufSize, PRTImageInfoEx ImgInfo); // Read the image field width from scan settings and SEM magnification, microns unit int32_t ImageGetFieldWidth(uint32_t CID, double& FieldWidth); // Set drift correction vector int32_t ImageSetExternalDriftCorrection(uint32_t CID, double ShiftX, double ShiftY); int32_t ImageGetDriftCorrectionActive(uint32_t CID, bool& Active); int32_t ImageGetLatestKnownScanPosition(uint32_t CID, int& X, int& Y); int32_t ImageGetScannedSegmentsCount(uint32_t CID, __int64& aCount); // Set electron beam position in image int32_t ImageSetPoint(uint32_t CID, uint32_t X, uint32_t Y); // functions to deal with point lists // CID : connection identifier // SPU : spectrometer index (1..n) // SegmentCount, // LineSegments : description of points to measure // RealTime: : acquisition time in ms int32_t StartPointListMeasurement(uint32_t CID, int32_t SPU, uint32_t SegmentCount, PSegmentList LineSegments, uint32_t RealTime); // CID : connection identifier // Index : spectrum index (1..n) // SpectrumBuf : buffer to hold complete spectrum with header (around 20kB), must be allocated by caller // BufSize : size of spectrum buffer int32_t GetPointListSpectrum(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); int32_t QuantifyPointListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); // CID : connection identifier // Index : spectrum index (1..n) // FileName : filename to save to int32_t SavePointListSpectrum(uint32_t CID, int32_t Buffer, char* FileName); /////////////////////////////////////////////////////////// // functions to deal with object lists /// /////////////////////////////////////////////////////////// int32_t StartFeatureListMeasurement(uint32_t CID, int32_t SPU, uint32_t FeatureCount, PFeatureDataList Features, __int16* PixelTimes); int32_t GetFeatureListSpectrum(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); int32_t QuantifyFeatureListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); int32_t SaveFeatureListSpectrum(uint32_t CID, int32_t Buffer, char* FileName); /////////////////////////////////////////////////////////// /// functions to communicate with SEM /// /////////////////////////////////////////////////////////// int32_t SetSEMData(uint32_t CID, double Magnification, double HighVoltage, double WorkingDistance); int32_t GetSEMData(uint32_t CID, double& Magnification, double& HighVoltage, double& WorkingDistance); int32_t SetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values); int32_t GetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values); int32_t GetSEMBCData(uint32_t CID, double& Brightness, double& Contrast); int32_t SetSEMBCData(uint32_t CID, double Brightness, double Contrast); int32_t GetSEMProbeCurrent(uint32_t CID, double& ProbeCurrent); int32_t SetSEMProbeCurrent(uint32_t CID, double ProbeCurrent); int32_t GetSEMSpotSize(uint32_t CID, double& SpotSize); int32_t SetSEMSpotSize(uint32_t CID, double SpotSize); int32_t SetSEMDetector(uint32_t CID, int Channel, char* DetectorName); int32_t GetSEMDetector(uint32_t CID, int Channel, char* DetectorName, int32_t BufSize); int32_t SetSEMStageData(uint32_t CID, double XPos, double YPos, double ZPos, double Tilt, double Rotation); int32_t GetSEMStageData(uint32_t CID, double& XPos, double& YPos, double& ZPos, double& Tilt, double& Rotation); int32_t GetSEMStageRange(uint32_t CID, double& Xmin, double& Xmax, double& Ymin, double& Ymax, double& Zmin, double& Zmax, double& Tmin, double& Tmax, double& Rmin, double& Rmax); int32_t GetSEMStageState(uint32_t CID, int32_t& State); int32_t GetSEMCapabilities(uint32_t CID, char* Capabilities, int32_t BufSize); int32_t GetSEMInfo(uint32_t CID, char* Info, int32_t BufSize); int32_t SetSEMExternalOn(uint32_t CID); int32_t SetSEMExternalOff(uint32_t CID); int32_t ResetSEMCommunication(uint32_t CID); int32_t SwitchSEMOff(uint32_t CID, bool HVOff, bool BeamCurrentOff, bool BeamBlank); /////////////////////////////////////////////////////////// /// Move EDS detector /// /////////////////////////////////////////////////////////// // Detector : Detector to be moved ( 1 in most cases ) // Position : Position to move to ( 1 = Park position, 2 = Acquisition position ) int32_t EDSSetDetectorPosition(uint32_t CID, int32_t Detector, int32_t Position); // Detector : Detector to ask for position ( 1 in most cases ) // Position : Current position ( 1 = Park position, 2 = Acquisition position ) int32_t EDSGetDetectorPosition(uint32_t CID, int32_t Detector, int32_t& Position); /////////////////////////////////////////////////////////// /// Mapping functions /// /////////////////////////////////////////////////////////// // PixelTime : Dwell time per Pixel in microseconds // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan int32_t HyMapStart(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime); // PixelTime : Dwell time per Pixel in microseconds // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan // Region : Image region to be mapped int32_t HyMapStartEx(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime, TFeatureData Region); // PixelTime : Dwell time per Pixel in microseconds // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan // Region : Image region to be mapped // Profile : XML serialized profile int32_t HyMapStartWithProfile(uint32_t CID, int32_t SPU, uint32_t PixelTime, TFeatureData Region, char* Profile); // MapSettings : Map settings // Profile : XML serialized profile // BufSize : Size of buffer int32_t HyMapCreateProfile(const TRTHyMapProfileSettings& MapSettings, char* Profile, int32_t& BufSize); // DataFileName: complete name of existing mapping data file // Profile : XML serialized EDS map profile int32_t SetDataAndProfileToUI(uint32_t CID, char* DataFileName, char* Profile); /////////////////////////////////////////////////////////// /// EBSD functions /// /////////////////////////////////////////////////////////// // Retrieve the list of predefined acquisition setups // Profiles : buffer to store the list information // BufSize : Size of buffer int32_t EBSDGetAcquisitionProfiles(uint32_t CID, char* Profiles, int32_t BufSize); // Load a predefined acquisition setup // Profile : buffer with profile name to select int32_t EBSDSelectAcquisitionProfile(uint32_t CID, char* Profile); // Start EBSD acquisition with selected setup int32_t EBSDStartAcquisition(uint32_t CID); // Start EBSD acquisition with defined profile data int32_t EBSDStartAcquisitionWithProfile(uint32_t CID, char* Profile); // Stop EBSD acquisition int32_t EBSDStopAcquisition(uint32_t CID); // Retrieve EBSD acquisition state // CurrentLine : current acquisition Y -position // PercentReady: Current state of Acquisition in % // IndexingPercentReady : Current State of Indexing in % // AcquisitionRunning : Is just giving the running state of the Acquisition // IndexingRunning : Is just giving the running state of the Indexing int32_t EBSDGetAcquisitionState(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, int32_t& IndexingPercentReady, bool& AcquisitionRunning, bool& IndexingRunning); // Save EBSD acquisition data to file in Bruker format // FileName : File name for the file to store information (*.bcf) // WithEdx : Saves EDX Data // WithPatterns: Saves Patterns int32_t EBSDSaveToFile(uint32_t CID, char* FileName, bool WithEdx, bool WithPatterns); // BaseFileName: Base file name for the result files to export (map images? // ExportOptions: Integer representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6) int32_t EBSDExportData(uint32_t CID, char* BaseFileName, int32_t ExportOptions); // Buffer:Pointer // BufferSize:integer // ExportOptions: longint representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6) int32_t EBSDExportDataBuffer(uint32_t CID, void* Buffer, int& BufferSize, int ExportOptions); // BaseFileName: Base file name for the result list (ctf-file) to export int32_t EBSDExportResults(uint32_t CID, char* BaseFileName); // Retrieve EBSD detector position // Position : Detector position in mm int32_t EBSDGetDetectorPosition(uint32_t CID, double& Position); // Move EBSD detector to specified position // Position : Detector position in mm // Speed : Detector speed in mm/s: int32_t EBSDSetDetectorPosition(uint32_t CID, double Position, double Speed); // Acquire pattern images, Buffer returns bitmap stream structure int32_t EBSDImageAcquireEx(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY); int32_t EBSDImageAcquireWithPC(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL); // Acquire pattern images, Buffer returns raw data int32_t EBSDImageAcquireRawDataFromPosition(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int& Width, int& Height, int& PixelBytes); int32_t EBSDImageAcquireRawDataFromPositionWithPC(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL, int& Width, int& Height, int& PixelBytes); // Acquire pattern images for multiple points, Buffer returns Bitmap image buffer int32_t EBSDPointListImageAcquireWithPC(uint32_t CID, void* Buffer, int& BufSize, uint32_t PointCount, PMultiPointList Points, int NFrameAvg, double& PCX, double& PCY, double& PCL, int& Width, int& Height, int& PixelBytes); // Acquire pattern images for multiple points, Buffer returns raw data buffer int32_t EBSDPointListImageAcquireRawDataWithPC(uint32_t CID, void* Buffer, int& BufSize, uint32_t PointCount, PMultiPointList Points, int NFrameAvg, double& PCX, double& PCY, double& PCL, int& Width, int& Height, int& PixelBytes); // Settings include: // TiltAngle of the Detector // TiltAzimuthAngle of the Detector; // ScanRotation // WD // DetectorAxis // DetectorTilt // PhosphorSize int32_t EBSDStartCalibration(uint32_t CID, PRTEBSDCalibSettings Settings); // Stop EBSD Calibration int32_t EBSDStopCalibration(uint32_t CID); //CurrentLine : not yet in use //PercentReady : Calibration state in % //Running : Running state of calibration int32_t EBSDGetCalibrationState(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, bool& Running); int32_t EBSDSaveEBSPImageFromPosition(uint32_t CID, char* aBaseFilename, int32_t X, int32_t Y); int32_t EBSDSetExposureTime(uint32_t CID, int32_t ExposureTime); int32_t EBSDGetExposureTime(uint32_t CID, int32_t& ExposureTime); //Width: Current camera width //Height: Current camera height int32_t EBSDGetImageConfiguration(uint32_t CID, int32_t& Width, int32_t& Height); int32_t EBSDSetGain(uint32_t CID, int32_t Value); int32_t EBSDGetGain(uint32_t CID, int32_t& Value); int32_t EBSDGetTilt(uint32_t CID, double& Value); //Count : returns the amount of image format (binning) int32_t EBSDGetAvailablePatternFormatCount(uint32_t CID, int32_t& Count); //FormatIndex: Seletion index of image format //Width: Camera Width //Height: Camera Height int32_t EBSDGetAvailablePatternFormat(uint32_t CID, const int32_t FormatIndex, int32_t& Width, int32_t& Height); //FormatIndex: The choosen Index for Camera Format int32_t EBSDSetPatternFormat(uint32_t CID, const int32_t FormatIndex); //Value: true (16bit Mode), false (8 bit Mode) int32_t EBSDSetPattern16bitMode(uint32_t CID, const bool Value); int32_t EBSDGetEstimatedMappingTime(uint32_t CID, int32_t& Time); //PointList: array of points to be measured //PointCount: number of points to be measured int32_t EBSDStartAcquisitionFromPointList(uint32_t CID, PPointArray PointList, int32_t pointcount); //PointResults: all results of the measured map //pointcount: number of available results //Call with PointResults == NULL and pointcount==0 to get number of results (for reserving sufficient space) int32_t EBSDGetPointResults(uint32_t CID, PEBSDIndexingResultArray PointResults, int32_t & pointcount); }