/* Bruker.API.Esprit.cpp Implementation for Bruker Esprit-Interface Microsoft Visual Studio 2015 */ #include "stdafx.h" #include #include #include "Bruker.API.Esprit.h" #include "Bruker.API.CommonFunctions.h" namespace BrukerDll { // type definitions for callback functions typedef int32_t (WINAPI *PHardwareConnectionGetStatus)(uint32_t CID, int32_t& Status, boolean& WasInterrupted, int32_t& TimeLeftForReconnection); typedef int32_t (WINAPI *PHardwareConnectionResetErrorFlag)(uint32_t CID); typedef int32_t (WINAPI *PHardwareConnectionReset)(uint32_t CID); typedef int32_t (WINAPI *PImageReset)(uint32_t CID); typedef int32_t (WINAPI *PImageGetConfiguration)(uint32_t CID, uint32_t& Width, uint32_t& Height, uint32_t& Average, bool& Ch1, bool& Ch2); typedef int32_t (WINAPI *PImageSetConfiguration)(uint32_t CID, uint32_t Width, uint32_t Height, uint32_t Average, bool Ch1, bool Ch2); typedef int32_t (WINAPI *PImageSetExternalScan)(uint32_t CID, bool UseExternalScan); typedef int32_t (WINAPI *PImageAquireImage)(uint32_t CID, int32_t Ch, bool ShowProgress, void* Buffer, int32_t& BufSize, PRTImageInfoEx ImgInfo); typedef int32_t (WINAPI *PImageAquireImageEx)(uint32_t CID, int32_t Ch, void* Buffer, uint32_t Options, int32_t& BufSize, PRTImageInfoEx ImgInfo); typedef int32_t (WINAPI *PImageGetFieldWidth)(uint32_t CID, double& FieldWidth); typedef int32_t (WINAPI *PImageSetExternalDriftCorrection)(uint32_t CID, double ShiftX, double ShiftY); typedef int32_t (WINAPI *PImageGetDriftCorrectionActive)(uint32_t CID, bool& Active); typedef int32_t (WINAPI *PImageGetLatestKnownScanPosition)(uint32_t CID, int& X, int& Y); typedef int32_t (WINAPI *PImageGetScannedSegmentsCount)(uint32_t CID, __int64& aCount); typedef int32_t (WINAPI *PImageSetPoint)(uint32_t CID, uint32_t X, uint32_t Y); typedef int32_t (WINAPI *PStartPointListMeasurement)(uint32_t CID, int32_t SPU, uint32_t SegmentCount, PSegmentList LineSegments, uint32_t RealTime); typedef int32_t (WINAPI *PGetPointListSpectrum)(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); typedef int32_t (WINAPI *PQuantifyPointListSpectrum)(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); typedef int32_t (WINAPI *PSavePointListSpectrum)(uint32_t CID, int32_t Buffer, char* FileName); typedef int32_t (WINAPI *PStartFeatureListMeasurement)(uint32_t CID, int32_t SPU, uint32_t FeatureCount, PFeatureDataList Features, __int16* PixelTimes); typedef int32_t (WINAPI *PGetFeatureListSpectrum)(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); typedef int32_t (WINAPI *PQuantifyFeatureListSpectrum)(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize); typedef int32_t (WINAPI *PSaveFeatureListSpectrum)(uint32_t CID, int32_t Buffer, char* FileName); typedef int32_t (WINAPI *PSetSEMData)(uint32_t CID, double Magnification, double HighVoltage, double WorkingDistance); typedef int32_t (WINAPI *PGetSEMData)(uint32_t CID, double& Magnification, double& HighVoltage, double& WorkingDistance); typedef int32_t (WINAPI *PSetSEMParameter)(uint32_t CID, char* Params, char* ValueIDs, double* Values); typedef int32_t (WINAPI *PGetSEMParameter)(uint32_t CID, char* Params, char* ValueIDs, double* Values); typedef int32_t (WINAPI *PGetSEMBCData)(uint32_t CID, double& Brightness, double& Contrast); typedef int32_t (WINAPI *PSetSEMBCData)(uint32_t CID, double Brightness, double Contrast); typedef int32_t (WINAPI *PGetSEMProbeCurrent)(uint32_t CID, double& ProbeCurrent); typedef int32_t (WINAPI *PSetSEMProbeCurrent)(uint32_t CID, double ProbeCurrent); typedef int32_t (WINAPI *PGetSEMSpotSize)(uint32_t CID, double& SpotSize); typedef int32_t (WINAPI *PSetSEMSpotSize)(uint32_t CID, double SpotSize); typedef int32_t (WINAPI *PSetSEMDetector)(uint32_t CID, int Channel, char* DetectorName); typedef int32_t (WINAPI *PGetSEMDetector)(uint32_t CID, int Channel, char* DetectorName, int32_t BufSize); typedef int32_t (WINAPI *PSetSEMStageData)(uint32_t CID, double XPos, double YPos, double ZPos, double Tilt, double Rotation); typedef int32_t (WINAPI *PGetSEMStageData)(uint32_t CID, double& XPos, double& YPos, double& ZPos, double& Tilt, double& Rotation); typedef int32_t (WINAPI *PGetSEMStageRange)(uint32_t CID, double& Xmin, double& Xmax, double& Ymin, double& Ymax, double& Zmin, double& Zmax, double& Tmin, double& Tmax, double& Rmin, double& Rmax); typedef int32_t (WINAPI *PGetSEMStageState)(uint32_t CID, int32_t& State); typedef int32_t (WINAPI *PGetSEMCapabilities)(uint32_t CID, char* Capabilities, int32_t BufSize); typedef int32_t (WINAPI *PGetSEMInfo)(uint32_t CID, char* Info, int32_t BufSize); typedef int32_t (WINAPI *PSetSEMExternalOn)(uint32_t CID); typedef int32_t (WINAPI *PSetSEMExternalOff)(uint32_t CID); typedef int32_t (WINAPI *PResetSEMCommunication)(uint32_t CID); typedef int32_t (WINAPI *PSwitchSEMOff)(uint32_t CID, bool HVOff, bool BeamCurrentOff, bool BeamBlank); typedef int32_t (WINAPI *PEDSSetDetectorPosition)(uint32_t CID, int32_t Detector, int32_t Position); typedef int32_t (WINAPI *PEDSGetDetectorPosition)(uint32_t CID, int32_t Detector, int32_t& Position); typedef int32_t (WINAPI *PHyMapStart)(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime); typedef int32_t (WINAPI *PHyMapStartEx)(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime, TFeatureData Region); typedef int32_t (WINAPI *PHyMapStartWithProfile)(uint32_t CID, int32_t SPU, uint32_t PixelTime, TFeatureData Region, char* Profile); typedef int32_t (WINAPI *PHyMapCreateProfile)(const TRTHyMapProfileSettings& MapSettings, char* Profile, int32_t& BufSize); typedef int32_t (WINAPI *PSetDataAndProfileToUI)(uint32_t CID, char* DataFileName, char* Profile); typedef int32_t (WINAPI *PHyMapQuantifyMaxPixelSpectrum)(uint32_t CID, char* MethodName, char* Params, char* ResultBuf, int ResultBufSize); typedef int32_t (WINAPI *PEBSDGetAcquisitionProfiles)(uint32_t CID, char* Profiles, int32_t BufSize); typedef int32_t (WINAPI *PEBSDSelectAcquisitionProfile)(uint32_t CID, char* Profile); typedef int32_t (WINAPI *PEBSDStartAcquisition)(uint32_t CID); typedef int32_t (WINAPI *PEBSDStartAcquisitionWithProfile)(uint32_t CID, char* Profile); typedef int32_t (WINAPI *PEBSDStopAcquisition)(uint32_t CID); typedef int32_t (WINAPI *PEBSDGetAcquisitionState)(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, int32_t& IndexingPercentReady, bool& AcquisitionRunning, bool& IndexingRunning); typedef int32_t (WINAPI *PEBSDSaveToFile)(uint32_t CID, char* FileName, bool WithEdx, bool WithPatterns); typedef int32_t (WINAPI *PEBSDExportData)(uint32_t CID, char* BaseFileName, int32_t ExportOptions); typedef int32_t (WINAPI *PEBSDExportDataBuffer)(uint32_t CID, void* Buffer, int& BufferSize, int ExportOptions); typedef int32_t (WINAPI *PEBSDExportResults)(uint32_t CID, char* BaseFileName); typedef int32_t (WINAPI *PEBSDGetDetectorPosition)(uint32_t CID, double& Position); typedef int32_t (WINAPI *PEBSDSetDetectorPosition)(uint32_t CID, double Position, double Speed); typedef int32_t (WINAPI *PEBSDImageAcquireEx)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY); typedef int32_t (WINAPI *PEBSDImageAcquireWithPC)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL); typedef int32_t (WINAPI *PEBSDImageAcquireRawDataFromPosition)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int& Width, int& Height, int& PixelBytes); typedef int32_t (WINAPI *PEBSDImageAcquireRawDataFromPositionWithPC)(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); typedef int32_t (WINAPI *PEBSDPointListImageAcquireWithPC)(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); typedef int32_t (WINAPI *PEBSDPointListImageAcquireRawDataWithPC)(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); typedef int32_t (WINAPI *PEBSDStartCalibration)(uint32_t CID, PRTEBSDCalibSettings Settings); typedef int32_t (WINAPI *PEBSDStopCalibration)(uint32_t CID); typedef int32_t (WINAPI *PEBSDGetCalibrationState)(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, bool& Running); typedef int32_t (WINAPI *PEBSDSaveEBSPImageFromPosition)(uint32_t CID, char* aBaseFilename, int32_t X, int32_t Y); typedef int32_t (WINAPI *PEBSDSetExposureTime)(uint32_t CID, int32_t ExposureTime); typedef int32_t (WINAPI *PEBSDGetExposureTime)(uint32_t CID, int32_t& ExposureTime); typedef int32_t (WINAPI *PEBSDGetImageConfiguration)(uint32_t CID, int32_t& Width, int32_t& Height); typedef int32_t (WINAPI *PEBSDSetGain)(uint32_t CID, int32_t Value); typedef int32_t (WINAPI *PEBSDGetGain)(uint32_t CID, int32_t& Value); typedef int32_t (WINAPI *PEBSDGetTilt)(uint32_t CID, double& Value); typedef int32_t (WINAPI *PEBSDGetAvailablePatternFormatCount)(uint32_t CID, int32_t& Count); typedef int32_t (WINAPI *PEBSDGetAvailablePatternFormat)(uint32_t CID, const int32_t FormatIndex, int32_t& Width, int32_t& Height); typedef int32_t (WINAPI *PEBSDSetPatternFormat)(uint32_t CID, const int32_t FormatIndex); typedef int32_t (WINAPI *PEBSDSetPattern16bitMode)(uint32_t CID, const bool Value); typedef int32_t (WINAPI *PEBSDGetEstimatedMappingTime)(uint32_t CID, int32_t& Time); typedef int32_t (WINAPI *PEBSDStartAcquisitionFromPointList)(uint32_t CID, PPointArray PointList, int32_t pointcount); typedef int32_t (WINAPI *PEBSDGetPointResults)(uint32_t CID, PEBSDIndexingResultArray PointResults, int32_t & pointcount); // DLL Handle HMODULE hEspritDllBaseAddress; // global callback function pointers PHardwareConnectionGetStatus pHardwareConnectionGetStatus = NULL; PHardwareConnectionResetErrorFlag pHardwareConnectionResetErrorFlag = NULL; PHardwareConnectionReset pHardwareConnectionReset = NULL; PImageReset pImageReset = NULL; PImageGetConfiguration pImageGetConfiguration = NULL; PImageSetConfiguration pImageSetConfiguration = NULL; PImageSetExternalScan pImageSetExternalScan = NULL; PImageAquireImage pImageAquireImage = NULL; PImageAquireImageEx pImageAquireImageEx = NULL; PImageGetFieldWidth pImageGetFieldWidth = NULL; PImageSetExternalDriftCorrection pImageSetExternalDriftCorrection = NULL; PImageGetDriftCorrectionActive pImageGetDriftCorrectionActive = NULL; PImageGetLatestKnownScanPosition pImageGetLatestKnownScanPosition = NULL; PImageGetScannedSegmentsCount pImageGetScannedSegmentsCount = NULL; PImageSetPoint pImageSetPoint = NULL; PStartPointListMeasurement pStartPointListMeasurement = NULL; PGetPointListSpectrum pGetPointListSpectrum = NULL; PQuantifyPointListSpectrum pQuantifyPointListSpectrum = NULL; PSavePointListSpectrum pSavePointListSpectrum = NULL; PStartFeatureListMeasurement pStartFeatureListMeasurement = NULL; PGetFeatureListSpectrum pGetFeatureListSpectrum = NULL; PQuantifyFeatureListSpectrum pQuantifyFeatureListSpectrum = NULL; PSaveFeatureListSpectrum pSaveFeatureListSpectrum = NULL; PSetSEMData pSetSEMData = NULL; PGetSEMData pGetSEMData = NULL; PSetSEMParameter pSetSEMParameter = NULL; PGetSEMParameter pGetSEMParameter = NULL; PGetSEMBCData pGetSEMBCData = NULL; PSetSEMBCData pSetSEMBCData = NULL; PGetSEMProbeCurrent pGetSEMProbeCurrent = NULL; PSetSEMProbeCurrent pSetSEMProbeCurrent = NULL; PGetSEMSpotSize pGetSEMSpotSize = NULL; PSetSEMSpotSize pSetSEMSpotSize = NULL; PSetSEMDetector pSetSEMDetector = NULL; PGetSEMDetector pGetSEMDetector = NULL; PSetSEMStageData pSetSEMStageData = NULL; PGetSEMStageData pGetSEMStageData = NULL; PGetSEMStageRange pGetSEMStageRange = NULL; PGetSEMStageState pGetSEMStageState = NULL; PGetSEMCapabilities pGetSEMCapabilities = NULL; PGetSEMInfo pGetSEMInfo = NULL; PSetSEMExternalOn pSetSEMExternalOn = NULL; PSetSEMExternalOff pSetSEMExternalOff = NULL; PResetSEMCommunication pResetSEMCommunication = NULL; PSwitchSEMOff pSwitchSEMOff = NULL; PEDSSetDetectorPosition pEDSSetDetectorPosition = NULL; PEDSGetDetectorPosition pEDSGetDetectorPosition = NULL; PHyMapStart pHyMapStart = NULL; PHyMapStartEx pHyMapStartEx = NULL; PHyMapStartWithProfile pHyMapStartWithProfile = NULL; PHyMapCreateProfile pHyMapCreateProfile = NULL; PSetDataAndProfileToUI pSetDataAndProfileToUI = NULL; PHyMapQuantifyMaxPixelSpectrum pHyMapQuantifyMaxPixelSpectrum = NULL; PEBSDGetAcquisitionProfiles pEBSDGetAcquisitionProfiles = NULL; PEBSDSelectAcquisitionProfile pEBSDSelectAcquisitionProfile = NULL; PEBSDStartAcquisition pEBSDStartAcquisition = NULL; PEBSDStartAcquisitionWithProfile pEBSDStartAcquisitionWithProfile = NULL; PEBSDStopAcquisition pEBSDStopAcquisition = NULL; PEBSDGetAcquisitionState pEBSDGetAcquisitionState = NULL; PEBSDSaveToFile pEBSDSaveToFile = NULL; PEBSDExportData pEBSDExportData = NULL; PEBSDExportDataBuffer pEBSDExportDataBuffer = NULL; PEBSDExportResults pEBSDExportResults = NULL; PEBSDGetDetectorPosition pEBSDGetDetectorPosition = NULL; PEBSDSetDetectorPosition pEBSDSetDetectorPosition = NULL; PEBSDImageAcquireEx pEBSDImageAcquireEx = NULL; PEBSDImageAcquireWithPC pEBSDImageAcquireWithPC = NULL; PEBSDImageAcquireRawDataFromPosition pEBSDImageAcquireRawDataFromPosition = NULL; PEBSDImageAcquireRawDataFromPositionWithPC pEBSDImageAcquireRawDataFromPositionWithPC = NULL; PEBSDPointListImageAcquireWithPC pEBSDPointListImageAcquireWithPC = NULL; PEBSDPointListImageAcquireRawDataWithPC pEBSDPointListImageAcquireRawDataWithPC = NULL; PEBSDStartCalibration pEBSDStartCalibration = NULL; PEBSDStopCalibration pEBSDStopCalibration = NULL; PEBSDGetCalibrationState pEBSDGetCalibrationState = NULL; PEBSDSaveEBSPImageFromPosition pEBSDSaveEBSPImageFromPosition = NULL; PEBSDSetExposureTime pEBSDSetExposureTime = NULL; PEBSDGetExposureTime pEBSDGetExposureTime = NULL; PEBSDGetImageConfiguration pEBSDGetImageConfiguration = NULL; PEBSDSetGain pEBSDSetGain = NULL; PEBSDGetGain pEBSDGetGain = NULL; PEBSDGetTilt pEBSDGetTilt = NULL; PEBSDGetAvailablePatternFormatCount pEBSDGetAvailablePatternFormatCount = NULL; PEBSDGetAvailablePatternFormat pEBSDGetAvailablePatternFormat = NULL; PEBSDSetPatternFormat pEBSDSetPatternFormat = NULL; PEBSDSetPattern16bitMode pEBSDSetPattern16bitMode = NULL; PEBSDGetEstimatedMappingTime pEBSDGetEstimatedMappingTime = NULL; PEBSDStartAcquisitionFromPointList pEBSDStartAcquisitionFromPointList = NULL; PEBSDGetPointResults pEBSDGetPointResults = NULL; bool LoadEspritAPI(char* csAPILibFile) { /*#ifdef _WIN64 const wchar_t* csAPILibFile = L"Bruker.API.Esprit2.4.DLL"; #else const wchar_t* csAPILibFile = L"Bruker.API.Esprit.DLL"; #endif*/ LoadCommonFunctions(csAPILibFile); hEspritDllBaseAddress = LoadLibrary(csAPILibFile); if (!hEspritDllBaseAddress) { DWORD lastError = GetLastError(); TCHAR buf[100]; int j = _stprintf_s(buf, 100, _T("Esprit.cpp: Failed to load DLL %s \n"), csAPILibFile); j += _stprintf_s(buf + j, 100-j, _T("Esprit.cpp: ErrorCode: %d \n"), lastError); OutputDebugString(buf); return false; } pHardwareConnectionGetStatus = (PHardwareConnectionGetStatus)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionGetStatus"); if (!pHardwareConnectionGetStatus) OutputDebugString(_T("Failed to load DLL function HardwareConnectionGetStatus\n")); pHardwareConnectionResetErrorFlag = (PHardwareConnectionResetErrorFlag)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionResetErrorFlag"); if (!pHardwareConnectionResetErrorFlag) OutputDebugString(_T("Failed to load DLL function HardwareConnectionResetErrorFlag\n")); pHardwareConnectionReset = (PHardwareConnectionReset)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionReset"); if (!pHardwareConnectionReset) OutputDebugString(_T("Failed to load DLL function HardwareConnectionReset\n")); pImageReset = (PImageReset)GetProcAddress(hEspritDllBaseAddress, "ImageReset"); if (!pImageReset) OutputDebugString(_T("Failed to load DLL function ImageReset\n")); pImageGetConfiguration = (PImageGetConfiguration)GetProcAddress(hEspritDllBaseAddress, "ImageGetConfiguration"); if (!pImageGetConfiguration) OutputDebugString(_T("Failed to load DLL function ImageGetConfiguration\n")); pImageSetConfiguration = (PImageSetConfiguration)GetProcAddress(hEspritDllBaseAddress, "ImageSetConfiguration"); if (!pImageSetConfiguration) OutputDebugString(_T("Failed to load DLL function ImageSetConfiguration\n")); pImageSetExternalScan = (PImageSetExternalScan)GetProcAddress(hEspritDllBaseAddress, "ImageSetExternalScan"); if (!pImageSetExternalScan) OutputDebugString(_T("Failed to load DLL function ImageSetExternalScan\n")); pImageAquireImage = (PImageAquireImage)GetProcAddress(hEspritDllBaseAddress, "ImageAquireImage"); if (!pImageAquireImage) OutputDebugString(_T("Failed to load DLL function ImageAquireImage\n")); pImageAquireImageEx = (PImageAquireImageEx)GetProcAddress(hEspritDllBaseAddress, "ImageAquireImageEx"); if (!pImageAquireImageEx) OutputDebugString(_T("Failed to load DLL function ImageAquireImageEx\n")); pImageGetFieldWidth = (PImageGetFieldWidth)GetProcAddress(hEspritDllBaseAddress, "ImageGetFieldWidth"); if (!pImageGetFieldWidth) OutputDebugString(_T("Failed to load DLL function ImageGetFieldWidth\n")); pImageSetExternalDriftCorrection = (PImageSetExternalDriftCorrection)GetProcAddress(hEspritDllBaseAddress, "ImageSetExternalDriftCorrection"); if (!pImageSetExternalDriftCorrection) OutputDebugString(_T("Failed to load DLL function ImageSetExternalDriftCorrection\n")); pImageGetDriftCorrectionActive = (PImageGetDriftCorrectionActive)GetProcAddress(hEspritDllBaseAddress, "ImageGetDriftCorrectionActive"); if (!pImageGetDriftCorrectionActive) OutputDebugString(_T("Failed to load DLL function ImageGetDriftCorrectionActive\n")); pImageGetLatestKnownScanPosition = (PImageGetLatestKnownScanPosition)GetProcAddress(hEspritDllBaseAddress, "ImageGetLatestKnownScanPosition"); if (!pImageGetLatestKnownScanPosition) OutputDebugString(_T("Failed to load DLL function ImageGetLatestKnownScanPosition\n")); pImageGetScannedSegmentsCount = (PImageGetScannedSegmentsCount)GetProcAddress(hEspritDllBaseAddress, "ImageGetScannedSegmentsCount"); if (!pImageGetScannedSegmentsCount) OutputDebugString(_T("Failed to load DLL function ImageGetScannedSegmentsCount\n")); pImageSetPoint = (PImageSetPoint)GetProcAddress(hEspritDllBaseAddress, "ImageSetPoint"); if (!pImageSetPoint) OutputDebugString(_T("Failed to load DLL function ImageSetPoint\n")); pStartPointListMeasurement = (PStartPointListMeasurement)GetProcAddress(hEspritDllBaseAddress, "StartPointListMeasurement"); if (!pStartPointListMeasurement) OutputDebugString(_T("Failed to load DLL function StartPointListMeasurement\n")); pGetPointListSpectrum = (PGetPointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "GetPointListSpectrum"); if (!pGetPointListSpectrum) OutputDebugString(_T("Failed to load DLL function GetPointListSpectrum\n")); pQuantifyPointListSpectrum = (PQuantifyPointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "QuantifyPointListSpectrum"); if (!pQuantifyPointListSpectrum) OutputDebugString(_T("Failed to load DLL function QuantifyPointListSpectrum\n")); pSavePointListSpectrum = (PSavePointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "SavePointListSpectrum"); if (!pSavePointListSpectrum) OutputDebugString(_T("Failed to load DLL function SavePointListSpectrum\n")); pStartFeatureListMeasurement = (PStartFeatureListMeasurement)GetProcAddress(hEspritDllBaseAddress, "StartFeatureListMeasurement"); if (!pStartFeatureListMeasurement) OutputDebugString(_T("Failed to load DLL function StartFeatureListMeasurement\n")); pGetFeatureListSpectrum = (PGetFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "GetFeatureListSpectrum"); if (!pGetFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function GetFeatureListSpectrum\n")); pQuantifyFeatureListSpectrum = (PQuantifyFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "QuantifyFeatureListSpectrum"); if (!pQuantifyFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function QuantifyFeatureListSpectrum\n")); pSaveFeatureListSpectrum = (PSaveFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "SaveFeatureListSpectrum"); if (!pSaveFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function SaveFeatureListSpectrum\n")); pSetSEMData = (PSetSEMData)GetProcAddress(hEspritDllBaseAddress, "SetSEMData"); if (!pSetSEMData) OutputDebugString(_T("Failed to load DLL function SetSEMData\n")); pGetSEMData = (PGetSEMData)GetProcAddress(hEspritDllBaseAddress, "GetSEMData"); if (!pGetSEMData) OutputDebugString(_T("Failed to load DLL function GetSEMData\n")); pSetSEMParameter = (PSetSEMParameter)GetProcAddress(hEspritDllBaseAddress, "SetSEMParameter"); if (!pSetSEMParameter) OutputDebugString(_T("Failed to load DLL function SetSEMParameter\n")); pGetSEMParameter = (PGetSEMParameter)GetProcAddress(hEspritDllBaseAddress, "GetSEMParameter"); if (!pGetSEMParameter) OutputDebugString(_T("Failed to load DLL function GetSEMParameter\n")); pGetSEMBCData = (PGetSEMBCData)GetProcAddress(hEspritDllBaseAddress, "GetSEMBCData"); if (!pGetSEMBCData) OutputDebugString(_T("Failed to load DLL function GetSEMBCData\n")); pSetSEMBCData = (PSetSEMBCData)GetProcAddress(hEspritDllBaseAddress, "SetSEMBCData"); if (!pSetSEMBCData) OutputDebugString(_T("Failed to load DLL function SetSEMBCData\n")); pGetSEMProbeCurrent = (PGetSEMProbeCurrent)GetProcAddress(hEspritDllBaseAddress, "GetSEMProbeCurrent"); if (!pGetSEMProbeCurrent) OutputDebugString(_T("Failed to load DLL function GetSEMProbeCurrent\n")); pSetSEMProbeCurrent = (PSetSEMProbeCurrent)GetProcAddress(hEspritDllBaseAddress, "SetSEMProbeCurrent"); if (!pSetSEMProbeCurrent) OutputDebugString(_T("Failed to load DLL function SetSEMProbeCurrent\n")); pGetSEMSpotSize = (PGetSEMSpotSize)GetProcAddress(hEspritDllBaseAddress, "GetSEMSpotSize"); if (!pGetSEMSpotSize) OutputDebugString(_T("Failed to load DLL function GetSEMSpotSize\n")); pSetSEMSpotSize = (PSetSEMSpotSize)GetProcAddress(hEspritDllBaseAddress, "SetSEMSpotSize"); if (!pSetSEMSpotSize) OutputDebugString(_T("Failed to load DLL function SetSEMSpotSize\n")); pSetSEMDetector = (PSetSEMDetector)GetProcAddress(hEspritDllBaseAddress, "SetSEMDetector"); if (!pSetSEMDetector) OutputDebugString(_T("Failed to load DLL function SetSEMDetector\n")); pGetSEMDetector = (PGetSEMDetector)GetProcAddress(hEspritDllBaseAddress, "GetSEMDetector"); if (!pGetSEMDetector) OutputDebugString(_T("Failed to load DLL function GetSEMDetector\n")); pSetSEMStageData = (PSetSEMStageData)GetProcAddress(hEspritDllBaseAddress, "SetSEMStageData"); if (!pSetSEMStageData) OutputDebugString(_T("Failed to load DLL function SetSEMStageData\n")); pGetSEMStageData = (PGetSEMStageData)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageData"); if (!pGetSEMStageData) OutputDebugString(_T("Failed to load DLL function GetSEMStageData\n")); pGetSEMStageRange = (PGetSEMStageRange)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageRange"); if (!pGetSEMStageRange) OutputDebugString(_T("Failed to load DLL function GetSEMStageRange\n")); pGetSEMStageState = (PGetSEMStageState)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageState"); if (!pGetSEMStageState) OutputDebugString(_T("Failed to load DLL function GetSEMStageState\n")); pGetSEMCapabilities = (PGetSEMCapabilities)GetProcAddress(hEspritDllBaseAddress, "GetSEMCapabilities"); if (!pGetSEMCapabilities) OutputDebugString(_T("Failed to load DLL function GetSEMCapabilities\n")); pGetSEMInfo = (PGetSEMInfo)GetProcAddress(hEspritDllBaseAddress, "GetSEMInfo"); if (!pGetSEMInfo) OutputDebugString(_T("Failed to load DLL function GetSEMInfo\n")); pSetSEMExternalOn = (PSetSEMExternalOn)GetProcAddress(hEspritDllBaseAddress, "SetSEMExternalOn"); if (!pSetSEMExternalOn) OutputDebugString(_T("Failed to load DLL function SetSEMExternalOn\n")); pSetSEMExternalOff = (PSetSEMExternalOff)GetProcAddress(hEspritDllBaseAddress, "SetSEMExternalOff"); if (!pSetSEMExternalOff) OutputDebugString(_T("Failed to load DLL function SetSEMExternalOff\n")); pResetSEMCommunication = (PResetSEMCommunication)GetProcAddress(hEspritDllBaseAddress, "ResetSEMCommunication"); if (!pResetSEMCommunication) OutputDebugString(_T("Failed to load DLL function ResetSEMCommunication\n")); pSwitchSEMOff = (PSwitchSEMOff)GetProcAddress(hEspritDllBaseAddress, "SwitchSEMOff"); if (!pSwitchSEMOff) OutputDebugString(_T("Failed to load DLL function SwitchSEMOff\n")); pEDSSetDetectorPosition = (PEDSSetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EDSSetDetectorPosition"); if (!pEDSSetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EDSSetDetectorPosition\n")); pEDSGetDetectorPosition = (PEDSGetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EDSGetDetectorPosition"); if (!pEDSGetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EDSGetDetectorPosition\n")); pHyMapStart = (PHyMapStart)GetProcAddress(hEspritDllBaseAddress, "HyMapStart"); if (!pHyMapStart) OutputDebugString(_T("Failed to load DLL function HyMapStart\n")); pHyMapStartEx = (PHyMapStartEx)GetProcAddress(hEspritDllBaseAddress, "HyMapStartEx"); if (!pHyMapStartEx) OutputDebugString(_T ("Failed to load DLL function HyMapStartEx\n")); pHyMapStartWithProfile = (PHyMapStartWithProfile)GetProcAddress(hEspritDllBaseAddress, "HyMapStartWithProfile"); if (!pHyMapStartWithProfile) OutputDebugString(_T("Failed to load DLL function HyMapStartWithProfile\n")); pHyMapCreateProfile = (PHyMapCreateProfile)GetProcAddress(hEspritDllBaseAddress, "HyMapCreateProfile"); if (!pHyMapCreateProfile) OutputDebugString(_T("Failed to load DLL function HyMapCreateProfile\n")); pSetDataAndProfileToUI = (PSetDataAndProfileToUI)GetProcAddress(hEspritDllBaseAddress, "SetDataAndProfileToUI"); if (!pSetDataAndProfileToUI) OutputDebugString(_T("Failed to load DLL function SetDataAndProfileToUI\n")); pHyMapQuantifyMaxPixelSpectrum = (PHyMapQuantifyMaxPixelSpectrum)GetProcAddress(hEspritDllBaseAddress, "HyMapQuantifyMaxPixelSpectrum"); if (!pHyMapQuantifyMaxPixelSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapQuantifyMaxPixelSpectrum\n")); pEBSDGetAcquisitionProfiles = (PEBSDGetAcquisitionProfiles)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAcquisitionProfiles"); if (!pEBSDGetAcquisitionProfiles) OutputDebugString(_T("Failed to load DLL function EBSDGetAcquisitionProfiles\n")); pEBSDSelectAcquisitionProfile = (PEBSDSelectAcquisitionProfile)GetProcAddress(hEspritDllBaseAddress, "EBSDSelectAcquisitionProfile"); if (!pEBSDSelectAcquisitionProfile) OutputDebugString(_T("Failed to load DLL function EBSDSelectAcquisitionProfile\n")); pEBSDStartAcquisition = (PEBSDStartAcquisition)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisition"); if (!pEBSDStartAcquisition) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisition\n")); pEBSDStartAcquisitionWithProfile = (PEBSDStartAcquisitionWithProfile)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisitionWithProfile"); if (!pEBSDStartAcquisitionWithProfile) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisitionWithProfile\n")); pEBSDStopAcquisition = (PEBSDStopAcquisition)GetProcAddress(hEspritDllBaseAddress, "EBSDStopAcquisition"); if (!pEBSDStopAcquisition) OutputDebugString(_T("Failed to load DLL function EBSDStopAcquisition\n")); pEBSDGetAcquisitionState = (PEBSDGetAcquisitionState)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAcquisitionState"); if (!pEBSDGetAcquisitionState) OutputDebugString(_T("Failed to load DLL function EBSDGetAcquisitionState\n")); pEBSDSaveToFile = (PEBSDSaveToFile)GetProcAddress(hEspritDllBaseAddress, "EBSDSaveToFile"); if (!pEBSDSaveToFile) OutputDebugString(_T("Failed to load DLL function EBSDSaveToFile\n")); pEBSDExportData = (PEBSDExportData)GetProcAddress(hEspritDllBaseAddress, "EBSDExportData"); if (!pEBSDExportData) OutputDebugString(_T("Failed to load DLL function EBSDExportData\n")); pEBSDExportDataBuffer = (PEBSDExportDataBuffer)GetProcAddress(hEspritDllBaseAddress, "EBSDExportDataBuffer"); if (!pEBSDExportDataBuffer) OutputDebugString(_T("Failed to load DLL function EBSDExportDataBuffer\n")); pEBSDExportResults = (PEBSDExportResults)GetProcAddress(hEspritDllBaseAddress, "EBSDExportResults"); if (!pEBSDExportResults) OutputDebugString(_T("Failed to load DLL function EBSDExportResults\n")); pEBSDGetDetectorPosition = (PEBSDGetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDGetDetectorPosition"); if (!pEBSDGetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EBSDGetDetectorPosition\n")); pEBSDSetDetectorPosition = (PEBSDSetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDSetDetectorPosition"); if (!pEBSDSetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EBSDSetDetectorPosition\n")); pEBSDImageAcquireEx = (PEBSDImageAcquireEx)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireEx"); if (!pEBSDImageAcquireEx) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireEx\n")); pEBSDImageAcquireWithPC = (PEBSDImageAcquireWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireWithPC"); if (!pEBSDImageAcquireWithPC) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireWithPC\n")); pEBSDImageAcquireRawDataFromPosition = (PEBSDImageAcquireRawDataFromPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireRawDataFromPosition"); if (!pEBSDImageAcquireRawDataFromPosition) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireRawDataFromPosition\n")); pEBSDImageAcquireRawDataFromPositionWithPC = (PEBSDImageAcquireRawDataFromPositionWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireRawDataFromPositionWithPC"); if (!pEBSDImageAcquireRawDataFromPositionWithPC) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireRawDataFromPositionWithPC\n")); pEBSDPointListImageAcquireWithPC = (PEBSDPointListImageAcquireWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDPointListImageAcquireWithPC"); if (!pEBSDPointListImageAcquireWithPC) OutputDebugString(_T("Failed to load DLL function EBSDPointListImageAcquireWithPC\n")); pEBSDPointListImageAcquireRawDataWithPC = (PEBSDPointListImageAcquireRawDataWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDPointListImageAcquireRawDataWithPC"); if (!pEBSDPointListImageAcquireRawDataWithPC) OutputDebugString(_T("Failed to load DLL function EBSDPointListImageAcquireRawDataWithPC\n")); pEBSDStartCalibration = (PEBSDStartCalibration)GetProcAddress(hEspritDllBaseAddress, "EBSDStartCalibration"); if (!pEBSDStartCalibration) OutputDebugString(_T("Failed to load DLL function EBSDStartCalibration\n")); pEBSDStopCalibration = (PEBSDStopCalibration)GetProcAddress(hEspritDllBaseAddress, "EBSDStopCalibration"); if (!pEBSDStopCalibration) OutputDebugString(_T("Failed to load DLL function EBSDStopCalibration\n")); pEBSDGetCalibrationState = (PEBSDGetCalibrationState)GetProcAddress(hEspritDllBaseAddress, "EBSDGetCalibrationState"); if (!pEBSDGetCalibrationState) OutputDebugString(_T("Failed to load DLL function EBSDGetCalibrationState\n")); pEBSDSaveEBSPImageFromPosition = (PEBSDSaveEBSPImageFromPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDSaveEBSPImageFromPosition"); if (!pEBSDSaveEBSPImageFromPosition) OutputDebugString(_T("Failed to load DLL function EBSDSaveEBSPImageFromPosition\n")); pEBSDSetExposureTime = (PEBSDSetExposureTime)GetProcAddress(hEspritDllBaseAddress, "EBSDSetExposureTime"); if (!pEBSDSetExposureTime) OutputDebugString(_T("Failed to load DLL function EBSDSetExposureTime\n")); pEBSDGetExposureTime = (PEBSDGetExposureTime)GetProcAddress(hEspritDllBaseAddress, "EBSDGetExposureTime"); if (!pEBSDGetExposureTime) OutputDebugString(_T("Failed to load DLL function EBSDGetExposureTime\n")); pEBSDGetImageConfiguration = (PEBSDGetImageConfiguration)GetProcAddress(hEspritDllBaseAddress, "EBSDGetImageConfiguration"); if (!pEBSDGetImageConfiguration) OutputDebugString(_T("Failed to load DLL function EBSDGetImageConfiguration\n")); pEBSDSetGain = (PEBSDSetGain)GetProcAddress(hEspritDllBaseAddress, "EBSDSetGain"); if (!pEBSDSetGain) OutputDebugString(_T("Failed to load DLL function EBSDSetGain\n")); pEBSDGetGain = (PEBSDGetGain)GetProcAddress(hEspritDllBaseAddress, "EBSDGetGain"); if (!pEBSDGetGain) OutputDebugString(_T("Failed to load DLL function EBSDGetGain\n")); pEBSDGetTilt = (PEBSDGetTilt)GetProcAddress(hEspritDllBaseAddress, "EBSDGetTilt"); if (!pEBSDGetTilt) OutputDebugString(_T("Failed to load DLL function EBSDGetTilt\n")); pEBSDGetAvailablePatternFormatCount = (PEBSDGetAvailablePatternFormatCount)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAvailablePatternFormatCount"); if (!pEBSDGetAvailablePatternFormatCount) OutputDebugString(_T("Failed to load DLL function EBSDGetAvailablePatternFormatCount\n")); pEBSDGetAvailablePatternFormat = (PEBSDGetAvailablePatternFormat)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAvailablePatternFormat"); if (!pEBSDGetAvailablePatternFormat) OutputDebugString(_T("Failed to load DLL function EBSDGetAvailablePatternFormat\n")); pEBSDSetPatternFormat = (PEBSDSetPatternFormat)GetProcAddress(hEspritDllBaseAddress, "EBSDSetPatternFormat"); if (!pEBSDSetPatternFormat) OutputDebugString(_T("Failed to load DLL function EBSDSetPatternFormat\n")); pEBSDSetPattern16bitMode = (PEBSDSetPattern16bitMode)GetProcAddress(hEspritDllBaseAddress, "EBSDSetPattern16bitMode"); if (!pEBSDSetPattern16bitMode) OutputDebugString(_T("Failed to load DLL function EBSDSetPattern16bitMode\n")); pEBSDGetEstimatedMappingTime = (PEBSDGetEstimatedMappingTime)GetProcAddress(hEspritDllBaseAddress, "EBSDGetEstimatedMappingTime"); if (!pEBSDGetEstimatedMappingTime) OutputDebugString(_T("Failed to load DLL function EBSDGetEstimatedMappingTime\n")); pEBSDStartAcquisitionFromPointList = (PEBSDStartAcquisitionFromPointList)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisitionFromPointList"); if (!pEBSDStartAcquisitionFromPointList) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisitionFromPointList\n")); pEBSDGetPointResults = (PEBSDGetPointResults)GetProcAddress(hEspritDllBaseAddress, "EBSDGetPointResults"); if (!pEBSDGetPointResults) OutputDebugString(_T("Failed to load DLL function EBSDGetPointResults\n")); return true; } int32_t HardwareConnectionGetStatus(uint32_t CID, int32_t& Status, boolean& WasInterrupted, int32_t& TimeLeftForReconnection) { if (pHardwareConnectionGetStatus) return pHardwareConnectionGetStatus(CID, Status, WasInterrupted, TimeLeftForReconnection); else return -1; } int32_t HardwareConnectionResetErrorFlag(uint32_t CID) { if (pHardwareConnectionResetErrorFlag) return pHardwareConnectionResetErrorFlag(CID); else return -1; } // Initialize connection reset procedure, this will trigger a 'watchdogged' hardware reset in SCU/SGU int32_t HardwareConnectionReset(uint32_t CID) { if (pHardwareConnectionReset) return pHardwareConnectionReset(CID); else return -1; } // Reset scan hardware, device will have default configuration afterwards, so be sure to re-configure it correctly int32_t ImageReset(uint32_t CID) { if (pImageReset) return pImageReset(CID); else return -1; } // Read current image device configuration int32_t ImageGetConfiguration(uint32_t CID, uint32_t& Width, uint32_t& Height, uint32_t& Average, bool& Ch1, bool& Ch2) { if (pImageGetConfiguration) return pImageGetConfiguration(CID, Width, Height, Average, Ch1, Ch2); else return -1; } // Write current image device configuration int32_t ImageSetConfiguration(uint32_t CID, uint32_t Width, uint32_t Height, uint32_t Average, bool Ch1, bool Ch2) { if (pImageSetConfiguration) return pImageSetConfiguration(CID, Width, Height, Average, Ch1, Ch2); else return -1; } // Use external scan engine which triggers our scan generator trough an external signal int32_t ImageSetExternalScan(uint32_t CID, bool UseExternalScan) { if (pImageSetExternalScan) return pImageSetExternalScan(CID, UseExternalScan); else return -1; } // 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) { if (pImageAquireImage) return pImageAquireImage(CID, Ch, ShowProgress, Buffer, BufSize, ImgInfo); else return -1; } // 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) { if (pImageAquireImageEx) return pImageAquireImageEx(CID, Ch, Buffer, Options, BufSize, ImgInfo); else return -1; } // Read the image field width from scan settings and SEM magnification, microns unit int32_t ImageGetFieldWidth(uint32_t CID, double& FieldWidth) { if (pImageGetFieldWidth) return pImageGetFieldWidth(CID, FieldWidth); else return -1; } // Set drift correction vector int32_t ImageSetExternalDriftCorrection(uint32_t CID, double ShiftX, double ShiftY) { if (pImageSetExternalDriftCorrection) return pImageSetExternalDriftCorrection(CID, ShiftX, ShiftY); else return -1; } int32_t ImageGetDriftCorrectionActive(uint32_t CID, bool& Active) { if (pImageGetDriftCorrectionActive) return pImageGetDriftCorrectionActive(CID, Active); else return -1; } int32_t ImageGetLatestKnownScanPosition(uint32_t CID, int& X, int& Y) { if (pImageGetLatestKnownScanPosition) return pImageGetLatestKnownScanPosition(CID, X, Y); else return -1; } int32_t ImageGetScannedSegmentsCount(uint32_t CID, __int64& aCount) { if (pImageGetScannedSegmentsCount) return pImageGetScannedSegmentsCount(CID, aCount); else return -1; } // Set electron beam position in image int32_t ImageSetPoint(uint32_t CID, uint32_t X, uint32_t Y) { if (pImageSetPoint) return pImageSetPoint(CID, X, Y); else return -1; } // 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,BrukerDll::PSegmentList LineSegments, uint32_t RealTime) { if (pStartPointListMeasurement) return pStartPointListMeasurement(CID, SPU, SegmentCount, LineSegments, RealTime); else return -1; } // 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) { if (pGetPointListSpectrum) return pGetPointListSpectrum(CID, Index, SpectrumBuf, BufSize); else return -1; } int32_t QuantifyPointListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize) { if (pQuantifyPointListSpectrum) return pQuantifyPointListSpectrum(CID, Index, MethodName, Params, ResultBuf, ResultBufSize, SpectrumBuf, BufSize); else return -1; } // CID : connection identifier // Index : spectrum index (1..n) // FileName : filename to save to int32_t SavePointListSpectrum(uint32_t CID, int32_t Buffer, char* FileName) { if (pSavePointListSpectrum) return pSavePointListSpectrum(CID, Buffer, FileName); else return -1; } /////////////////////////////////////////////////////////// // functions to deal with object lists /// /////////////////////////////////////////////////////////// int32_t StartFeatureListMeasurement(uint32_t CID, int32_t SPU, uint32_t FeatureCount, PFeatureDataList Features, __int16* PixelTimes) { if (pStartFeatureListMeasurement) return pStartFeatureListMeasurement(CID, SPU, FeatureCount, Features, PixelTimes); else return -1; } int32_t GetFeatureListSpectrum(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize) { if (pGetFeatureListSpectrum) return pGetFeatureListSpectrum(CID, Index, SpectrumBuf, BufSize); else return -1; } int32_t QuantifyFeatureListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize) { if (pQuantifyFeatureListSpectrum) return pQuantifyFeatureListSpectrum(CID, Index, MethodName, Params, ResultBuf, ResultBufSize, SpectrumBuf, BufSize); else return -1; } int32_t SaveFeatureListSpectrum(uint32_t CID, int32_t Buffer, char* FileName) { if (pSaveFeatureListSpectrum) return pSaveFeatureListSpectrum(CID, Buffer, FileName); else return -1; } /////////////////////////////////////////////////////////// /// functions to communicate with SEM /// /////////////////////////////////////////////////////////// int32_t SetSEMData(uint32_t CID, double Magnification, double HighVoltage, double WorkingDistance) { if (pSetSEMData) return pSetSEMData(CID, Magnification, HighVoltage, WorkingDistance); else return -1; } int32_t GetSEMData(uint32_t CID, double& Magnification, double& HighVoltage, double& WorkingDistance) { if (pGetSEMData) return pGetSEMData(CID, Magnification, HighVoltage, WorkingDistance); else return -1; } int32_t SetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values) { if (pSetSEMParameter) return pSetSEMParameter(CID, Params, ValueIDs, Values); else return -1; } int32_t GetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values) { if (pGetSEMParameter) return pGetSEMParameter(CID, Params, ValueIDs, Values); else return -1; } int32_t GetSEMBCData(uint32_t CID, double& Brightness, double& Contrast) { if (pGetSEMBCData) return pGetSEMBCData(CID, Brightness, Contrast); else return -1; } int32_t SetSEMBCData(uint32_t CID, double Brightness, double Contrast) { if (pSetSEMBCData) return pSetSEMBCData(CID, Brightness, Contrast); else return -1; } int32_t GetSEMProbeCurrent(uint32_t CID, double& ProbeCurrent) { if (pGetSEMProbeCurrent) return pGetSEMProbeCurrent(CID, ProbeCurrent); else return -1; } int32_t SetSEMProbeCurrent(uint32_t CID, double ProbeCurrent) { if (pSetSEMProbeCurrent) return pSetSEMProbeCurrent(CID, ProbeCurrent); else return -1; } int32_t GetSEMSpotSize(uint32_t CID, double& SpotSize) { if (pGetSEMSpotSize) return pGetSEMSpotSize(CID, SpotSize); else return -1; } int32_t SetSEMSpotSize(uint32_t CID, double SpotSize) { if (pSetSEMSpotSize) return pSetSEMSpotSize(CID, SpotSize); else return -1; } int32_t SetSEMDetector(uint32_t CID, int Channel, char* DetectorName) { if (pSetSEMDetector) return pSetSEMDetector(CID, Channel, DetectorName); else return -1; } int32_t GetSEMDetector(uint32_t CID, int Channel, char* DetectorName, int32_t BufSize) { if (pGetSEMDetector) return pGetSEMDetector(CID, Channel, DetectorName, BufSize); else return -1; } int32_t SetSEMStageData(uint32_t CID, double XPos, double YPos, double ZPos, double Tilt, double Rotation) { if (pSetSEMStageData) return pSetSEMStageData(CID, XPos, YPos, ZPos, Tilt, Rotation); else return -1; } int32_t GetSEMStageData(uint32_t CID, double& XPos, double& YPos, double& ZPos, double& Tilt, double& Rotation) { if (pGetSEMStageData) return pGetSEMStageData(CID, XPos, YPos, ZPos, Tilt, Rotation); else return -1; } 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) { if (pGetSEMStageRange) return pGetSEMStageRange(CID, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, Tmin, Tmax, Rmin, Rmax); else return -1; } int32_t GetSEMStageState(uint32_t CID, int32_t& State) { if (pGetSEMStageState) return pGetSEMStageState(CID, State); else return -1; } int32_t GetSEMCapabilities(uint32_t CID, char* Capabilities, int32_t BufSize) { if (pGetSEMCapabilities) return pGetSEMCapabilities(CID, Capabilities, BufSize); else return -1; } int32_t GetSEMInfo(uint32_t CID, char* Info, int32_t BufSize) { if (pGetSEMInfo) return pGetSEMInfo(CID, Info, BufSize); else return -1; } int32_t SetSEMExternalOn(uint32_t CID) { if (pSetSEMExternalOn) return pSetSEMExternalOn(CID); else return -1; } int32_t SetSEMExternalOff(uint32_t CID) { if (pSetSEMExternalOff) return pSetSEMExternalOff(CID); else return -1; } int32_t ResetSEMCommunication(uint32_t CID) { if (pResetSEMCommunication) return pResetSEMCommunication(CID); else return -1; } int32_t SwitchSEMOff(uint32_t CID, bool HVOff, bool BeamCurrentOff, bool BeamBlank) { if (pSwitchSEMOff) return pSwitchSEMOff(CID, HVOff, BeamCurrentOff, BeamBlank); else return -1; } /////////////////////////////////////////////////////////// /// 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) { if (pEDSSetDetectorPosition) return pEDSSetDetectorPosition(CID, Detector, Position); else return -1; } // 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) { if (pEDSGetDetectorPosition) return pEDSGetDetectorPosition(CID, Detector, Position); else return -1; } /////////////////////////////////////////////////////////// /// 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) { if (pHyMapStart) return pHyMapStart(CID, SPU, PixelTime, RealTime); else return -1; } // 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) { if (pHyMapStartEx) return pHyMapStartEx(CID, SPU, PixelTime, RealTime, Region); else return -1; } // 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) { if (pHyMapStartWithProfile) return pHyMapStartWithProfile(CID, SPU, PixelTime, Region, Profile); else return -1; } // MapSettings : Map settings // Profile : XML serialized profile // BufSize : Size of buffer int32_t HyMapCreateProfile(const TRTHyMapProfileSettings& MapSettings, char* Profile, int32_t& BufSize) { if (pHyMapCreateProfile) return pHyMapCreateProfile(MapSettings, Profile, BufSize); else return -1; } // DataFileName: complete name of existing mapping data file // Profile : XML serialized EDS map profile int32_t SetDataAndProfileToUI(uint32_t CID, char* DataFileName, char* Profile) { if (pSetDataAndProfileToUI) return pSetDataAndProfileToUI(CID, DataFileName, Profile); else return -1; } int32_t HyMapQuantifyMaxPixelSpectrum(uint32_t CID, char* MethodName, char* Params, char* ResultBuf, int ResultBufSize) { if (pHyMapQuantifyMaxPixelSpectrum) return pHyMapQuantifyMaxPixelSpectrum(CID, MethodName, Params, ResultBuf, ResultBufSize); else return -1; } /////////////////////////////////////////////////////////// /// 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) { if (pEBSDGetAcquisitionProfiles) return pEBSDGetAcquisitionProfiles(CID, Profiles, BufSize); else return -1; } // Load a predefined acquisition setup // Profile : buffer with profile name to select int32_t EBSDSelectAcquisitionProfile(uint32_t CID, char* Profile) { if (pEBSDSelectAcquisitionProfile) return pEBSDSelectAcquisitionProfile(CID, Profile); else return -1; } // Start EBSD acquisition with selected setup int32_t EBSDStartAcquisition(uint32_t CID) { if (pEBSDStartAcquisition) return pEBSDStartAcquisition(CID); else return -1; } // Start EBSD acquisition with defined profile data int32_t EBSDStartAcquisitionWithProfile(uint32_t CID, char* Profile) { if (pEBSDStartAcquisitionWithProfile) return pEBSDStartAcquisitionWithProfile(CID, Profile); else return -1; } // Stop EBSD acquisition int32_t EBSDStopAcquisition(uint32_t CID) { if (pEBSDStopAcquisition) return pEBSDStopAcquisition(CID); else return -1; } // 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) { if (pEBSDGetAcquisitionState) return pEBSDGetAcquisitionState(CID, CurrentLine, PercentReady, IndexingPercentReady, AcquisitionRunning, IndexingRunning); else return -1; } // Save EBSD acquisition data to file in Bruker format // FileName : File name for the file to store information (*.bcf) // SaveOptions : Bit flags to specify which information has to be stored (frames, detected lines? int32_t EBSDSaveToFile(uint32_t CID, char* FileName, bool WithEdx, bool WithPatterns) { if (pEBSDSaveToFile) return pEBSDSaveToFile(CID, FileName, WithEdx, WithPatterns); else return -1; } // 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) { if (pEBSDExportData) return pEBSDExportData(CID, BaseFileName, ExportOptions); else return -1; } // 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) { if (pEBSDExportDataBuffer) return pEBSDExportDataBuffer(CID, Buffer, BufferSize, ExportOptions); else return -1; } // BaseFileName : Base file name for the result list (ctf-file) to export int32_t EBSDExportResults(uint32_t CID, char* BaseFileName) { if (pEBSDExportResults) return pEBSDExportResults(CID, BaseFileName); else return -1; } // Retrieve EBSD detector position // Position : Detector position in mm int32_t EBSDGetDetectorPosition(uint32_t CID, double& Position) { if (pEBSDGetDetectorPosition) return pEBSDGetDetectorPosition(CID, Position); else return -1; } // 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) { if (pEBSDSetDetectorPosition) return pEBSDSetDetectorPosition(CID, Position, Speed); else return -1; } int32_t EBSDImageAcquireEx(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY) { if (pEBSDImageAcquireEx) return pEBSDImageAcquireEx(CID, Buffer, BufSize, PosX, PosY); else return -1; } int32_t EBSDImageAcquireWithPC(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL) { if (pEBSDImageAcquireWithPC) return pEBSDImageAcquireWithPC(CID, Buffer, BufSize, PosX, PosY, NFrameAvg, PCX, PCY, PCL); else return -1; } // 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) { if (pEBSDImageAcquireRawDataFromPosition) return pEBSDImageAcquireRawDataFromPosition(CID, Buffer, BufSize, PosX, PosY, Width, Height, PixelBytes); else return -1; } 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) { if (pEBSDImageAcquireRawDataFromPositionWithPC) return pEBSDImageAcquireRawDataFromPositionWithPC(CID, Buffer, BufSize, PosX, PosY, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes); else return -1; } 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) { if (pEBSDPointListImageAcquireWithPC) return pEBSDPointListImageAcquireWithPC(CID, Buffer, BufSize, PointCount, Points, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes); else return -1; } 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) { if (pEBSDPointListImageAcquireRawDataWithPC) return pEBSDPointListImageAcquireRawDataWithPC(CID, Buffer, BufSize, PointCount, Points, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes); else return -1; } // Settings include: // TiltAngle of the Detector // TiltAzimuthAngle of the Detector; // ScanRotation // WD // DetectorAxis // DetectorTilt // PhosphorSize int32_t EBSDStartCalibration(uint32_t CID, PRTEBSDCalibSettings Settings) { if (pEBSDStartCalibration) return pEBSDStartCalibration(CID, Settings); else return -1; } // Stop EBSD Calibration int32_t EBSDStopCalibration(uint32_t CID) { if (pEBSDStopCalibration) return pEBSDStopCalibration(CID); else return -1; } // 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) { if (pEBSDGetCalibrationState) return pEBSDGetCalibrationState(CID, CurrentLine, PercentReady, Running); else return -1; } int32_t EBSDSaveEBSPImageFromPosition(uint32_t CID, char* aBaseFilename, int32_t X, int32_t Y) { if (pEBSDSaveEBSPImageFromPosition) return pEBSDSaveEBSPImageFromPosition(CID, aBaseFilename, X, Y); else return -1; } int32_t EBSDSetExposureTime(uint32_t CID, int32_t ExposureTime) { if (pEBSDSetExposureTime) return pEBSDSetExposureTime(CID, ExposureTime); else return -1; } int32_t EBSDGetExposureTime(uint32_t CID, int32_t& ExposureTime) { if (pEBSDGetExposureTime) return pEBSDGetExposureTime(CID, ExposureTime); else return -1; } // Width: Current camera width // Height: Current camera height int32_t EBSDGetImageConfiguration(uint32_t CID, int32_t& Width, int32_t& Height) { if (pEBSDGetImageConfiguration) return pEBSDGetImageConfiguration(CID, Width, Height); else return -1; } int32_t EBSDSetGain(uint32_t CID, int32_t Value) { if (pEBSDSetGain) return pEBSDSetGain(CID, Value); else return -1; } int32_t EBSDGetGain(uint32_t CID, int32_t& Value) { if (pEBSDGetGain) return pEBSDGetGain(CID, Value); else return -1; } int32_t EBSDGetTilt(uint32_t CID, double& Value) { if (pEBSDGetTilt) return pEBSDGetTilt(CID, Value); else return -1; } //Count : returns the amount of image format (binning) int32_t EBSDGetAvailablePatternFormatCount(uint32_t CID, int32_t& Count) { if (pEBSDGetAvailablePatternFormatCount) return pEBSDGetAvailablePatternFormatCount(CID, Count); else return -1; } //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) { if (pEBSDGetAvailablePatternFormat) return pEBSDGetAvailablePatternFormat(CID, FormatIndex, Width, Height); else return -1; } //FormatIndex: The choosen Index for Camera Format int32_t EBSDSetPatternFormat(uint32_t CID, const int32_t FormatIndex) { if (pEBSDSetPatternFormat) return pEBSDSetPatternFormat(CID, FormatIndex); else return -1; } //Value: true (16bit Mode), false (8 bit Mode) int32_t EBSDSetPattern16bitMode(uint32_t CID, const bool Value) { if (pEBSDSetPattern16bitMode) return pEBSDSetPattern16bitMode(CID, Value); else return -1; } int32_t EBSDGetEstimatedMappingTime(uint32_t CID, int32_t& Time) { if (pEBSDGetEstimatedMappingTime) return pEBSDGetEstimatedMappingTime(CID, Time); else return -1; } int32_t EBSDStartAcquisitionFromPointList(uint32_t CID, PPointArray PointList, int32_t pointcount) { if(pEBSDStartAcquisitionFromPointList) return pEBSDStartAcquisitionFromPointList(CID, PointList, pointcount); else return -1; } int32_t EBSDGetPointResults(uint32_t CID, PEBSDIndexingResultArray PointResults, int32_t & pointcount) { if(pEBSDGetPointResults) return pEBSDGetPointResults(CID, PointResults, pointcount); else return -1; } }