Bruker.API.Esprit.cpp 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. /*
  2. Bruker.API.Esprit.cpp
  3. Implementation for Bruker Esprit-Interface
  4. Microsoft Visual Studio 2015
  5. */
  6. #include "stdafx.h"
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include "Bruker.API.Esprit.h"
  10. #include "Bruker.API.CommonFunctions.h"
  11. namespace BrukerDll
  12. {
  13. // type definitions for callback functions
  14. typedef int32_t (WINAPI *PHardwareConnectionGetStatus)(uint32_t CID, int32_t& Status, boolean& WasInterrupted, int32_t& TimeLeftForReconnection);
  15. typedef int32_t (WINAPI *PHardwareConnectionResetErrorFlag)(uint32_t CID);
  16. typedef int32_t (WINAPI *PHardwareConnectionReset)(uint32_t CID);
  17. typedef int32_t (WINAPI *PImageReset)(uint32_t CID);
  18. typedef int32_t (WINAPI *PImageGetConfiguration)(uint32_t CID, uint32_t& Width, uint32_t& Height, uint32_t& Average, bool& Ch1, bool& Ch2);
  19. typedef int32_t (WINAPI *PImageSetConfiguration)(uint32_t CID, uint32_t Width, uint32_t Height, uint32_t Average, bool Ch1, bool Ch2);
  20. typedef int32_t (WINAPI *PImageSetExternalScan)(uint32_t CID, bool UseExternalScan);
  21. typedef int32_t (WINAPI *PImageAquireImage)(uint32_t CID, int32_t Ch, bool ShowProgress, void* Buffer, int32_t& BufSize, PRTImageInfoEx ImgInfo);
  22. typedef int32_t (WINAPI *PImageAquireImageEx)(uint32_t CID, int32_t Ch, void* Buffer, uint32_t Options, int32_t& BufSize, PRTImageInfoEx ImgInfo);
  23. typedef int32_t (WINAPI *PImageGetFieldWidth)(uint32_t CID, double& FieldWidth);
  24. typedef int32_t (WINAPI *PImageSetExternalDriftCorrection)(uint32_t CID, double ShiftX, double ShiftY);
  25. typedef int32_t (WINAPI *PImageGetDriftCorrectionActive)(uint32_t CID, bool& Active);
  26. typedef int32_t (WINAPI *PImageGetLatestKnownScanPosition)(uint32_t CID, int& X, int& Y);
  27. typedef int32_t (WINAPI *PImageGetScannedSegmentsCount)(uint32_t CID, __int64& aCount);
  28. typedef int32_t (WINAPI *PImageSetPoint)(uint32_t CID, uint32_t X, uint32_t Y);
  29. typedef int32_t (WINAPI *PStartPointListMeasurement)(uint32_t CID, int32_t SPU, uint32_t SegmentCount, PSegmentList LineSegments, uint32_t RealTime);
  30. typedef int32_t (WINAPI *PGetPointListSpectrum)(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize);
  31. 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);
  32. typedef int32_t (WINAPI *PSavePointListSpectrum)(uint32_t CID, int32_t Buffer, char* FileName);
  33. typedef int32_t (WINAPI *PStartFeatureListMeasurement)(uint32_t CID, int32_t SPU, uint32_t FeatureCount, PFeatureDataList Features, __int16* PixelTimes);
  34. typedef int32_t (WINAPI *PGetFeatureListSpectrum)(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize);
  35. 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);
  36. typedef int32_t (WINAPI *PSaveFeatureListSpectrum)(uint32_t CID, int32_t Buffer, char* FileName);
  37. typedef int32_t (WINAPI *PSetSEMData)(uint32_t CID, double Magnification, double HighVoltage, double WorkingDistance);
  38. typedef int32_t (WINAPI *PGetSEMData)(uint32_t CID, double& Magnification, double& HighVoltage, double& WorkingDistance);
  39. typedef int32_t (WINAPI *PSetSEMParameter)(uint32_t CID, char* Params, char* ValueIDs, double* Values);
  40. typedef int32_t (WINAPI *PGetSEMParameter)(uint32_t CID, char* Params, char* ValueIDs, double* Values);
  41. typedef int32_t (WINAPI *PGetSEMBCData)(uint32_t CID, double& Brightness, double& Contrast);
  42. typedef int32_t (WINAPI *PSetSEMBCData)(uint32_t CID, double Brightness, double Contrast);
  43. typedef int32_t (WINAPI *PGetSEMProbeCurrent)(uint32_t CID, double& ProbeCurrent);
  44. typedef int32_t (WINAPI *PSetSEMProbeCurrent)(uint32_t CID, double ProbeCurrent);
  45. typedef int32_t (WINAPI *PGetSEMSpotSize)(uint32_t CID, double& SpotSize);
  46. typedef int32_t (WINAPI *PSetSEMSpotSize)(uint32_t CID, double SpotSize);
  47. typedef int32_t (WINAPI *PSetSEMDetector)(uint32_t CID, int Channel, char* DetectorName);
  48. typedef int32_t (WINAPI *PGetSEMDetector)(uint32_t CID, int Channel, char* DetectorName, int32_t BufSize);
  49. typedef int32_t (WINAPI *PSetSEMStageData)(uint32_t CID, double XPos, double YPos, double ZPos, double Tilt, double Rotation);
  50. typedef int32_t (WINAPI *PGetSEMStageData)(uint32_t CID, double& XPos, double& YPos, double& ZPos, double& Tilt, double& Rotation);
  51. 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);
  52. typedef int32_t (WINAPI *PGetSEMStageState)(uint32_t CID, int32_t& State);
  53. typedef int32_t (WINAPI *PGetSEMCapabilities)(uint32_t CID, char* Capabilities, int32_t BufSize);
  54. typedef int32_t (WINAPI *PGetSEMInfo)(uint32_t CID, char* Info, int32_t BufSize);
  55. typedef int32_t (WINAPI *PSetSEMExternalOn)(uint32_t CID);
  56. typedef int32_t (WINAPI *PSetSEMExternalOff)(uint32_t CID);
  57. typedef int32_t (WINAPI *PResetSEMCommunication)(uint32_t CID);
  58. typedef int32_t (WINAPI *PSwitchSEMOff)(uint32_t CID, bool HVOff, bool BeamCurrentOff, bool BeamBlank);
  59. typedef int32_t (WINAPI *PEDSSetDetectorPosition)(uint32_t CID, int32_t Detector, int32_t Position);
  60. typedef int32_t (WINAPI *PEDSGetDetectorPosition)(uint32_t CID, int32_t Detector, int32_t& Position);
  61. typedef int32_t (WINAPI *PHyMapStart)(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime);
  62. typedef int32_t (WINAPI *PHyMapStartEx)(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime, TFeatureData Region);
  63. typedef int32_t (WINAPI *PHyMapStartWithProfile)(uint32_t CID, int32_t SPU, uint32_t PixelTime, TFeatureData Region, char* Profile);
  64. typedef int32_t (WINAPI *PHyMapCreateProfile)(const TRTHyMapProfileSettings& MapSettings, char* Profile, int32_t& BufSize);
  65. typedef int32_t (WINAPI *PSetDataAndProfileToUI)(uint32_t CID, char* DataFileName, char* Profile);
  66. typedef int32_t (WINAPI *PHyMapQuantifyMaxPixelSpectrum)(uint32_t CID, char* MethodName, char* Params, char* ResultBuf, int ResultBufSize);
  67. typedef int32_t (WINAPI *PEBSDGetAcquisitionProfiles)(uint32_t CID, char* Profiles, int32_t BufSize);
  68. typedef int32_t (WINAPI *PEBSDSelectAcquisitionProfile)(uint32_t CID, char* Profile);
  69. typedef int32_t (WINAPI *PEBSDStartAcquisition)(uint32_t CID);
  70. typedef int32_t (WINAPI *PEBSDStartAcquisitionWithProfile)(uint32_t CID, char* Profile);
  71. typedef int32_t (WINAPI *PEBSDStopAcquisition)(uint32_t CID);
  72. typedef int32_t (WINAPI *PEBSDGetAcquisitionState)(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, int32_t& IndexingPercentReady, bool& AcquisitionRunning, bool& IndexingRunning);
  73. typedef int32_t (WINAPI *PEBSDSaveToFile)(uint32_t CID, char* FileName, bool WithEdx, bool WithPatterns);
  74. typedef int32_t (WINAPI *PEBSDExportData)(uint32_t CID, char* BaseFileName, int32_t ExportOptions);
  75. typedef int32_t (WINAPI *PEBSDExportDataBuffer)(uint32_t CID, void* Buffer, int& BufferSize, int ExportOptions);
  76. typedef int32_t (WINAPI *PEBSDExportResults)(uint32_t CID, char* BaseFileName);
  77. typedef int32_t (WINAPI *PEBSDGetDetectorPosition)(uint32_t CID, double& Position);
  78. typedef int32_t (WINAPI *PEBSDSetDetectorPosition)(uint32_t CID, double Position, double Speed);
  79. typedef int32_t (WINAPI *PEBSDImageAcquireEx)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY);
  80. typedef int32_t (WINAPI *PEBSDImageAcquireWithPC)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL);
  81. typedef int32_t (WINAPI *PEBSDImageAcquireRawDataFromPosition)(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int& Width, int& Height, int& PixelBytes);
  82. 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);
  83. 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);
  84. 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);
  85. typedef int32_t (WINAPI *PEBSDStartCalibration)(uint32_t CID, PRTEBSDCalibSettings Settings);
  86. typedef int32_t (WINAPI *PEBSDStopCalibration)(uint32_t CID);
  87. typedef int32_t (WINAPI *PEBSDGetCalibrationState)(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, bool& Running);
  88. typedef int32_t (WINAPI *PEBSDSaveEBSPImageFromPosition)(uint32_t CID, char* aBaseFilename, int32_t X, int32_t Y);
  89. typedef int32_t (WINAPI *PEBSDSetExposureTime)(uint32_t CID, int32_t ExposureTime);
  90. typedef int32_t (WINAPI *PEBSDGetExposureTime)(uint32_t CID, int32_t& ExposureTime);
  91. typedef int32_t (WINAPI *PEBSDGetImageConfiguration)(uint32_t CID, int32_t& Width, int32_t& Height);
  92. typedef int32_t (WINAPI *PEBSDSetGain)(uint32_t CID, int32_t Value);
  93. typedef int32_t (WINAPI *PEBSDGetGain)(uint32_t CID, int32_t& Value);
  94. typedef int32_t (WINAPI *PEBSDGetTilt)(uint32_t CID, double& Value);
  95. typedef int32_t (WINAPI *PEBSDGetAvailablePatternFormatCount)(uint32_t CID, int32_t& Count);
  96. typedef int32_t (WINAPI *PEBSDGetAvailablePatternFormat)(uint32_t CID, const int32_t FormatIndex, int32_t& Width, int32_t& Height);
  97. typedef int32_t (WINAPI *PEBSDSetPatternFormat)(uint32_t CID, const int32_t FormatIndex);
  98. typedef int32_t (WINAPI *PEBSDSetPattern16bitMode)(uint32_t CID, const bool Value);
  99. typedef int32_t (WINAPI *PEBSDGetEstimatedMappingTime)(uint32_t CID, int32_t& Time);
  100. typedef int32_t (WINAPI *PEBSDStartAcquisitionFromPointList)(uint32_t CID, PPointArray PointList, int32_t pointcount);
  101. typedef int32_t (WINAPI *PEBSDGetPointResults)(uint32_t CID, PEBSDIndexingResultArray PointResults, int32_t & pointcount);
  102. // DLL Handle
  103. HMODULE hEspritDllBaseAddress;
  104. // global callback function pointers
  105. PHardwareConnectionGetStatus pHardwareConnectionGetStatus = NULL;
  106. PHardwareConnectionResetErrorFlag pHardwareConnectionResetErrorFlag = NULL;
  107. PHardwareConnectionReset pHardwareConnectionReset = NULL;
  108. PImageReset pImageReset = NULL;
  109. PImageGetConfiguration pImageGetConfiguration = NULL;
  110. PImageSetConfiguration pImageSetConfiguration = NULL;
  111. PImageSetExternalScan pImageSetExternalScan = NULL;
  112. PImageAquireImage pImageAquireImage = NULL;
  113. PImageAquireImageEx pImageAquireImageEx = NULL;
  114. PImageGetFieldWidth pImageGetFieldWidth = NULL;
  115. PImageSetExternalDriftCorrection pImageSetExternalDriftCorrection = NULL;
  116. PImageGetDriftCorrectionActive pImageGetDriftCorrectionActive = NULL;
  117. PImageGetLatestKnownScanPosition pImageGetLatestKnownScanPosition = NULL;
  118. PImageGetScannedSegmentsCount pImageGetScannedSegmentsCount = NULL;
  119. PImageSetPoint pImageSetPoint = NULL;
  120. PStartPointListMeasurement pStartPointListMeasurement = NULL;
  121. PGetPointListSpectrum pGetPointListSpectrum = NULL;
  122. PQuantifyPointListSpectrum pQuantifyPointListSpectrum = NULL;
  123. PSavePointListSpectrum pSavePointListSpectrum = NULL;
  124. PStartFeatureListMeasurement pStartFeatureListMeasurement = NULL;
  125. PGetFeatureListSpectrum pGetFeatureListSpectrum = NULL;
  126. PQuantifyFeatureListSpectrum pQuantifyFeatureListSpectrum = NULL;
  127. PSaveFeatureListSpectrum pSaveFeatureListSpectrum = NULL;
  128. PSetSEMData pSetSEMData = NULL;
  129. PGetSEMData pGetSEMData = NULL;
  130. PSetSEMParameter pSetSEMParameter = NULL;
  131. PGetSEMParameter pGetSEMParameter = NULL;
  132. PGetSEMBCData pGetSEMBCData = NULL;
  133. PSetSEMBCData pSetSEMBCData = NULL;
  134. PGetSEMProbeCurrent pGetSEMProbeCurrent = NULL;
  135. PSetSEMProbeCurrent pSetSEMProbeCurrent = NULL;
  136. PGetSEMSpotSize pGetSEMSpotSize = NULL;
  137. PSetSEMSpotSize pSetSEMSpotSize = NULL;
  138. PSetSEMDetector pSetSEMDetector = NULL;
  139. PGetSEMDetector pGetSEMDetector = NULL;
  140. PSetSEMStageData pSetSEMStageData = NULL;
  141. PGetSEMStageData pGetSEMStageData = NULL;
  142. PGetSEMStageRange pGetSEMStageRange = NULL;
  143. PGetSEMStageState pGetSEMStageState = NULL;
  144. PGetSEMCapabilities pGetSEMCapabilities = NULL;
  145. PGetSEMInfo pGetSEMInfo = NULL;
  146. PSetSEMExternalOn pSetSEMExternalOn = NULL;
  147. PSetSEMExternalOff pSetSEMExternalOff = NULL;
  148. PResetSEMCommunication pResetSEMCommunication = NULL;
  149. PSwitchSEMOff pSwitchSEMOff = NULL;
  150. PEDSSetDetectorPosition pEDSSetDetectorPosition = NULL;
  151. PEDSGetDetectorPosition pEDSGetDetectorPosition = NULL;
  152. PHyMapStart pHyMapStart = NULL;
  153. PHyMapStartEx pHyMapStartEx = NULL;
  154. PHyMapStartWithProfile pHyMapStartWithProfile = NULL;
  155. PHyMapCreateProfile pHyMapCreateProfile = NULL;
  156. PSetDataAndProfileToUI pSetDataAndProfileToUI = NULL;
  157. PHyMapQuantifyMaxPixelSpectrum pHyMapQuantifyMaxPixelSpectrum = NULL;
  158. PEBSDGetAcquisitionProfiles pEBSDGetAcquisitionProfiles = NULL;
  159. PEBSDSelectAcquisitionProfile pEBSDSelectAcquisitionProfile = NULL;
  160. PEBSDStartAcquisition pEBSDStartAcquisition = NULL;
  161. PEBSDStartAcquisitionWithProfile pEBSDStartAcquisitionWithProfile = NULL;
  162. PEBSDStopAcquisition pEBSDStopAcquisition = NULL;
  163. PEBSDGetAcquisitionState pEBSDGetAcquisitionState = NULL;
  164. PEBSDSaveToFile pEBSDSaveToFile = NULL;
  165. PEBSDExportData pEBSDExportData = NULL;
  166. PEBSDExportDataBuffer pEBSDExportDataBuffer = NULL;
  167. PEBSDExportResults pEBSDExportResults = NULL;
  168. PEBSDGetDetectorPosition pEBSDGetDetectorPosition = NULL;
  169. PEBSDSetDetectorPosition pEBSDSetDetectorPosition = NULL;
  170. PEBSDImageAcquireEx pEBSDImageAcquireEx = NULL;
  171. PEBSDImageAcquireWithPC pEBSDImageAcquireWithPC = NULL;
  172. PEBSDImageAcquireRawDataFromPosition pEBSDImageAcquireRawDataFromPosition = NULL;
  173. PEBSDImageAcquireRawDataFromPositionWithPC pEBSDImageAcquireRawDataFromPositionWithPC = NULL;
  174. PEBSDPointListImageAcquireWithPC pEBSDPointListImageAcquireWithPC = NULL;
  175. PEBSDPointListImageAcquireRawDataWithPC pEBSDPointListImageAcquireRawDataWithPC = NULL;
  176. PEBSDStartCalibration pEBSDStartCalibration = NULL;
  177. PEBSDStopCalibration pEBSDStopCalibration = NULL;
  178. PEBSDGetCalibrationState pEBSDGetCalibrationState = NULL;
  179. PEBSDSaveEBSPImageFromPosition pEBSDSaveEBSPImageFromPosition = NULL;
  180. PEBSDSetExposureTime pEBSDSetExposureTime = NULL;
  181. PEBSDGetExposureTime pEBSDGetExposureTime = NULL;
  182. PEBSDGetImageConfiguration pEBSDGetImageConfiguration = NULL;
  183. PEBSDSetGain pEBSDSetGain = NULL;
  184. PEBSDGetGain pEBSDGetGain = NULL;
  185. PEBSDGetTilt pEBSDGetTilt = NULL;
  186. PEBSDGetAvailablePatternFormatCount pEBSDGetAvailablePatternFormatCount = NULL;
  187. PEBSDGetAvailablePatternFormat pEBSDGetAvailablePatternFormat = NULL;
  188. PEBSDSetPatternFormat pEBSDSetPatternFormat = NULL;
  189. PEBSDSetPattern16bitMode pEBSDSetPattern16bitMode = NULL;
  190. PEBSDGetEstimatedMappingTime pEBSDGetEstimatedMappingTime = NULL;
  191. PEBSDStartAcquisitionFromPointList pEBSDStartAcquisitionFromPointList = NULL;
  192. PEBSDGetPointResults pEBSDGetPointResults = NULL;
  193. bool LoadEspritAPI(char* csAPILibFile)
  194. {
  195. /*#ifdef _WIN64
  196. const wchar_t* csAPILibFile = L"Bruker.API.Esprit2.4.DLL";
  197. #else
  198. const wchar_t* csAPILibFile = L"Bruker.API.Esprit.DLL";
  199. #endif*/
  200. LoadCommonFunctions(csAPILibFile);
  201. hEspritDllBaseAddress = LoadLibrary(csAPILibFile);
  202. if (!hEspritDllBaseAddress)
  203. {
  204. DWORD lastError = GetLastError();
  205. TCHAR buf[100];
  206. int j = _stprintf_s(buf, 100, _T("Esprit.cpp: Failed to load DLL %s \n"), csAPILibFile);
  207. j += _stprintf_s(buf + j, 100-j, _T("Esprit.cpp: ErrorCode: %d \n"), lastError);
  208. OutputDebugString(buf);
  209. return false;
  210. }
  211. pHardwareConnectionGetStatus = (PHardwareConnectionGetStatus)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionGetStatus");
  212. if (!pHardwareConnectionGetStatus) OutputDebugString(_T("Failed to load DLL function HardwareConnectionGetStatus\n"));
  213. pHardwareConnectionResetErrorFlag = (PHardwareConnectionResetErrorFlag)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionResetErrorFlag");
  214. if (!pHardwareConnectionResetErrorFlag) OutputDebugString(_T("Failed to load DLL function HardwareConnectionResetErrorFlag\n"));
  215. pHardwareConnectionReset = (PHardwareConnectionReset)GetProcAddress(hEspritDllBaseAddress, "HardwareConnectionReset");
  216. if (!pHardwareConnectionReset) OutputDebugString(_T("Failed to load DLL function HardwareConnectionReset\n"));
  217. pImageReset = (PImageReset)GetProcAddress(hEspritDllBaseAddress, "ImageReset");
  218. if (!pImageReset) OutputDebugString(_T("Failed to load DLL function ImageReset\n"));
  219. pImageGetConfiguration = (PImageGetConfiguration)GetProcAddress(hEspritDllBaseAddress, "ImageGetConfiguration");
  220. if (!pImageGetConfiguration) OutputDebugString(_T("Failed to load DLL function ImageGetConfiguration\n"));
  221. pImageSetConfiguration = (PImageSetConfiguration)GetProcAddress(hEspritDllBaseAddress, "ImageSetConfiguration");
  222. if (!pImageSetConfiguration) OutputDebugString(_T("Failed to load DLL function ImageSetConfiguration\n"));
  223. pImageSetExternalScan = (PImageSetExternalScan)GetProcAddress(hEspritDllBaseAddress, "ImageSetExternalScan");
  224. if (!pImageSetExternalScan) OutputDebugString(_T("Failed to load DLL function ImageSetExternalScan\n"));
  225. pImageAquireImage = (PImageAquireImage)GetProcAddress(hEspritDllBaseAddress, "ImageAquireImage");
  226. if (!pImageAquireImage) OutputDebugString(_T("Failed to load DLL function ImageAquireImage\n"));
  227. pImageAquireImageEx = (PImageAquireImageEx)GetProcAddress(hEspritDllBaseAddress, "ImageAquireImageEx");
  228. if (!pImageAquireImageEx) OutputDebugString(_T("Failed to load DLL function ImageAquireImageEx\n"));
  229. pImageGetFieldWidth = (PImageGetFieldWidth)GetProcAddress(hEspritDllBaseAddress, "ImageGetFieldWidth");
  230. if (!pImageGetFieldWidth) OutputDebugString(_T("Failed to load DLL function ImageGetFieldWidth\n"));
  231. pImageSetExternalDriftCorrection = (PImageSetExternalDriftCorrection)GetProcAddress(hEspritDllBaseAddress, "ImageSetExternalDriftCorrection");
  232. if (!pImageSetExternalDriftCorrection) OutputDebugString(_T("Failed to load DLL function ImageSetExternalDriftCorrection\n"));
  233. pImageGetDriftCorrectionActive = (PImageGetDriftCorrectionActive)GetProcAddress(hEspritDllBaseAddress, "ImageGetDriftCorrectionActive");
  234. if (!pImageGetDriftCorrectionActive) OutputDebugString(_T("Failed to load DLL function ImageGetDriftCorrectionActive\n"));
  235. pImageGetLatestKnownScanPosition = (PImageGetLatestKnownScanPosition)GetProcAddress(hEspritDllBaseAddress, "ImageGetLatestKnownScanPosition");
  236. if (!pImageGetLatestKnownScanPosition) OutputDebugString(_T("Failed to load DLL function ImageGetLatestKnownScanPosition\n"));
  237. pImageGetScannedSegmentsCount = (PImageGetScannedSegmentsCount)GetProcAddress(hEspritDllBaseAddress, "ImageGetScannedSegmentsCount");
  238. if (!pImageGetScannedSegmentsCount) OutputDebugString(_T("Failed to load DLL function ImageGetScannedSegmentsCount\n"));
  239. pImageSetPoint = (PImageSetPoint)GetProcAddress(hEspritDllBaseAddress, "ImageSetPoint");
  240. if (!pImageSetPoint) OutputDebugString(_T("Failed to load DLL function ImageSetPoint\n"));
  241. pStartPointListMeasurement = (PStartPointListMeasurement)GetProcAddress(hEspritDllBaseAddress, "StartPointListMeasurement");
  242. if (!pStartPointListMeasurement) OutputDebugString(_T("Failed to load DLL function StartPointListMeasurement\n"));
  243. pGetPointListSpectrum = (PGetPointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "GetPointListSpectrum");
  244. if (!pGetPointListSpectrum) OutputDebugString(_T("Failed to load DLL function GetPointListSpectrum\n"));
  245. pQuantifyPointListSpectrum = (PQuantifyPointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "QuantifyPointListSpectrum");
  246. if (!pQuantifyPointListSpectrum) OutputDebugString(_T("Failed to load DLL function QuantifyPointListSpectrum\n"));
  247. pSavePointListSpectrum = (PSavePointListSpectrum)GetProcAddress(hEspritDllBaseAddress, "SavePointListSpectrum");
  248. if (!pSavePointListSpectrum) OutputDebugString(_T("Failed to load DLL function SavePointListSpectrum\n"));
  249. pStartFeatureListMeasurement = (PStartFeatureListMeasurement)GetProcAddress(hEspritDllBaseAddress, "StartFeatureListMeasurement");
  250. if (!pStartFeatureListMeasurement) OutputDebugString(_T("Failed to load DLL function StartFeatureListMeasurement\n"));
  251. pGetFeatureListSpectrum = (PGetFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "GetFeatureListSpectrum");
  252. if (!pGetFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function GetFeatureListSpectrum\n"));
  253. pQuantifyFeatureListSpectrum = (PQuantifyFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "QuantifyFeatureListSpectrum");
  254. if (!pQuantifyFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function QuantifyFeatureListSpectrum\n"));
  255. pSaveFeatureListSpectrum = (PSaveFeatureListSpectrum)GetProcAddress(hEspritDllBaseAddress, "SaveFeatureListSpectrum");
  256. if (!pSaveFeatureListSpectrum) OutputDebugString(_T("Failed to load DLL function SaveFeatureListSpectrum\n"));
  257. pSetSEMData = (PSetSEMData)GetProcAddress(hEspritDllBaseAddress, "SetSEMData");
  258. if (!pSetSEMData) OutputDebugString(_T("Failed to load DLL function SetSEMData\n"));
  259. pGetSEMData = (PGetSEMData)GetProcAddress(hEspritDllBaseAddress, "GetSEMData");
  260. if (!pGetSEMData) OutputDebugString(_T("Failed to load DLL function GetSEMData\n"));
  261. pSetSEMParameter = (PSetSEMParameter)GetProcAddress(hEspritDllBaseAddress, "SetSEMParameter");
  262. if (!pSetSEMParameter) OutputDebugString(_T("Failed to load DLL function SetSEMParameter\n"));
  263. pGetSEMParameter = (PGetSEMParameter)GetProcAddress(hEspritDllBaseAddress, "GetSEMParameter");
  264. if (!pGetSEMParameter) OutputDebugString(_T("Failed to load DLL function GetSEMParameter\n"));
  265. pGetSEMBCData = (PGetSEMBCData)GetProcAddress(hEspritDllBaseAddress, "GetSEMBCData");
  266. if (!pGetSEMBCData) OutputDebugString(_T("Failed to load DLL function GetSEMBCData\n"));
  267. pSetSEMBCData = (PSetSEMBCData)GetProcAddress(hEspritDllBaseAddress, "SetSEMBCData");
  268. if (!pSetSEMBCData) OutputDebugString(_T("Failed to load DLL function SetSEMBCData\n"));
  269. pGetSEMProbeCurrent = (PGetSEMProbeCurrent)GetProcAddress(hEspritDllBaseAddress, "GetSEMProbeCurrent");
  270. if (!pGetSEMProbeCurrent) OutputDebugString(_T("Failed to load DLL function GetSEMProbeCurrent\n"));
  271. pSetSEMProbeCurrent = (PSetSEMProbeCurrent)GetProcAddress(hEspritDllBaseAddress, "SetSEMProbeCurrent");
  272. if (!pSetSEMProbeCurrent) OutputDebugString(_T("Failed to load DLL function SetSEMProbeCurrent\n"));
  273. pGetSEMSpotSize = (PGetSEMSpotSize)GetProcAddress(hEspritDllBaseAddress, "GetSEMSpotSize");
  274. if (!pGetSEMSpotSize) OutputDebugString(_T("Failed to load DLL function GetSEMSpotSize\n"));
  275. pSetSEMSpotSize = (PSetSEMSpotSize)GetProcAddress(hEspritDllBaseAddress, "SetSEMSpotSize");
  276. if (!pSetSEMSpotSize) OutputDebugString(_T("Failed to load DLL function SetSEMSpotSize\n"));
  277. pSetSEMDetector = (PSetSEMDetector)GetProcAddress(hEspritDllBaseAddress, "SetSEMDetector");
  278. if (!pSetSEMDetector) OutputDebugString(_T("Failed to load DLL function SetSEMDetector\n"));
  279. pGetSEMDetector = (PGetSEMDetector)GetProcAddress(hEspritDllBaseAddress, "GetSEMDetector");
  280. if (!pGetSEMDetector) OutputDebugString(_T("Failed to load DLL function GetSEMDetector\n"));
  281. pSetSEMStageData = (PSetSEMStageData)GetProcAddress(hEspritDllBaseAddress, "SetSEMStageData");
  282. if (!pSetSEMStageData) OutputDebugString(_T("Failed to load DLL function SetSEMStageData\n"));
  283. pGetSEMStageData = (PGetSEMStageData)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageData");
  284. if (!pGetSEMStageData) OutputDebugString(_T("Failed to load DLL function GetSEMStageData\n"));
  285. pGetSEMStageRange = (PGetSEMStageRange)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageRange");
  286. if (!pGetSEMStageRange) OutputDebugString(_T("Failed to load DLL function GetSEMStageRange\n"));
  287. pGetSEMStageState = (PGetSEMStageState)GetProcAddress(hEspritDllBaseAddress, "GetSEMStageState");
  288. if (!pGetSEMStageState) OutputDebugString(_T("Failed to load DLL function GetSEMStageState\n"));
  289. pGetSEMCapabilities = (PGetSEMCapabilities)GetProcAddress(hEspritDllBaseAddress, "GetSEMCapabilities");
  290. if (!pGetSEMCapabilities) OutputDebugString(_T("Failed to load DLL function GetSEMCapabilities\n"));
  291. pGetSEMInfo = (PGetSEMInfo)GetProcAddress(hEspritDllBaseAddress, "GetSEMInfo");
  292. if (!pGetSEMInfo) OutputDebugString(_T("Failed to load DLL function GetSEMInfo\n"));
  293. pSetSEMExternalOn = (PSetSEMExternalOn)GetProcAddress(hEspritDllBaseAddress, "SetSEMExternalOn");
  294. if (!pSetSEMExternalOn) OutputDebugString(_T("Failed to load DLL function SetSEMExternalOn\n"));
  295. pSetSEMExternalOff = (PSetSEMExternalOff)GetProcAddress(hEspritDllBaseAddress, "SetSEMExternalOff");
  296. if (!pSetSEMExternalOff) OutputDebugString(_T("Failed to load DLL function SetSEMExternalOff\n"));
  297. pResetSEMCommunication = (PResetSEMCommunication)GetProcAddress(hEspritDllBaseAddress, "ResetSEMCommunication");
  298. if (!pResetSEMCommunication) OutputDebugString(_T("Failed to load DLL function ResetSEMCommunication\n"));
  299. pSwitchSEMOff = (PSwitchSEMOff)GetProcAddress(hEspritDllBaseAddress, "SwitchSEMOff");
  300. if (!pSwitchSEMOff) OutputDebugString(_T("Failed to load DLL function SwitchSEMOff\n"));
  301. pEDSSetDetectorPosition = (PEDSSetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EDSSetDetectorPosition");
  302. if (!pEDSSetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EDSSetDetectorPosition\n"));
  303. pEDSGetDetectorPosition = (PEDSGetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EDSGetDetectorPosition");
  304. if (!pEDSGetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EDSGetDetectorPosition\n"));
  305. pHyMapStart = (PHyMapStart)GetProcAddress(hEspritDllBaseAddress, "HyMapStart");
  306. if (!pHyMapStart) OutputDebugString(_T("Failed to load DLL function HyMapStart\n"));
  307. pHyMapStartEx = (PHyMapStartEx)GetProcAddress(hEspritDllBaseAddress, "HyMapStartEx");
  308. if (!pHyMapStartEx) OutputDebugString(_T ("Failed to load DLL function HyMapStartEx\n"));
  309. pHyMapStartWithProfile = (PHyMapStartWithProfile)GetProcAddress(hEspritDllBaseAddress, "HyMapStartWithProfile");
  310. if (!pHyMapStartWithProfile) OutputDebugString(_T("Failed to load DLL function HyMapStartWithProfile\n"));
  311. pHyMapCreateProfile = (PHyMapCreateProfile)GetProcAddress(hEspritDllBaseAddress, "HyMapCreateProfile");
  312. if (!pHyMapCreateProfile) OutputDebugString(_T("Failed to load DLL function HyMapCreateProfile\n"));
  313. pSetDataAndProfileToUI = (PSetDataAndProfileToUI)GetProcAddress(hEspritDllBaseAddress, "SetDataAndProfileToUI");
  314. if (!pSetDataAndProfileToUI) OutputDebugString(_T("Failed to load DLL function SetDataAndProfileToUI\n"));
  315. pHyMapQuantifyMaxPixelSpectrum = (PHyMapQuantifyMaxPixelSpectrum)GetProcAddress(hEspritDllBaseAddress, "HyMapQuantifyMaxPixelSpectrum");
  316. if (!pHyMapQuantifyMaxPixelSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapQuantifyMaxPixelSpectrum\n"));
  317. pEBSDGetAcquisitionProfiles = (PEBSDGetAcquisitionProfiles)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAcquisitionProfiles");
  318. if (!pEBSDGetAcquisitionProfiles) OutputDebugString(_T("Failed to load DLL function EBSDGetAcquisitionProfiles\n"));
  319. pEBSDSelectAcquisitionProfile = (PEBSDSelectAcquisitionProfile)GetProcAddress(hEspritDllBaseAddress, "EBSDSelectAcquisitionProfile");
  320. if (!pEBSDSelectAcquisitionProfile) OutputDebugString(_T("Failed to load DLL function EBSDSelectAcquisitionProfile\n"));
  321. pEBSDStartAcquisition = (PEBSDStartAcquisition)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisition");
  322. if (!pEBSDStartAcquisition) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisition\n"));
  323. pEBSDStartAcquisitionWithProfile = (PEBSDStartAcquisitionWithProfile)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisitionWithProfile");
  324. if (!pEBSDStartAcquisitionWithProfile) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisitionWithProfile\n"));
  325. pEBSDStopAcquisition = (PEBSDStopAcquisition)GetProcAddress(hEspritDllBaseAddress, "EBSDStopAcquisition");
  326. if (!pEBSDStopAcquisition) OutputDebugString(_T("Failed to load DLL function EBSDStopAcquisition\n"));
  327. pEBSDGetAcquisitionState = (PEBSDGetAcquisitionState)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAcquisitionState");
  328. if (!pEBSDGetAcquisitionState) OutputDebugString(_T("Failed to load DLL function EBSDGetAcquisitionState\n"));
  329. pEBSDSaveToFile = (PEBSDSaveToFile)GetProcAddress(hEspritDllBaseAddress, "EBSDSaveToFile");
  330. if (!pEBSDSaveToFile) OutputDebugString(_T("Failed to load DLL function EBSDSaveToFile\n"));
  331. pEBSDExportData = (PEBSDExportData)GetProcAddress(hEspritDllBaseAddress, "EBSDExportData");
  332. if (!pEBSDExportData) OutputDebugString(_T("Failed to load DLL function EBSDExportData\n"));
  333. pEBSDExportDataBuffer = (PEBSDExportDataBuffer)GetProcAddress(hEspritDllBaseAddress, "EBSDExportDataBuffer");
  334. if (!pEBSDExportDataBuffer) OutputDebugString(_T("Failed to load DLL function EBSDExportDataBuffer\n"));
  335. pEBSDExportResults = (PEBSDExportResults)GetProcAddress(hEspritDllBaseAddress, "EBSDExportResults");
  336. if (!pEBSDExportResults) OutputDebugString(_T("Failed to load DLL function EBSDExportResults\n"));
  337. pEBSDGetDetectorPosition = (PEBSDGetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDGetDetectorPosition");
  338. if (!pEBSDGetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EBSDGetDetectorPosition\n"));
  339. pEBSDSetDetectorPosition = (PEBSDSetDetectorPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDSetDetectorPosition");
  340. if (!pEBSDSetDetectorPosition) OutputDebugString(_T("Failed to load DLL function EBSDSetDetectorPosition\n"));
  341. pEBSDImageAcquireEx = (PEBSDImageAcquireEx)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireEx");
  342. if (!pEBSDImageAcquireEx) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireEx\n"));
  343. pEBSDImageAcquireWithPC = (PEBSDImageAcquireWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireWithPC");
  344. if (!pEBSDImageAcquireWithPC) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireWithPC\n"));
  345. pEBSDImageAcquireRawDataFromPosition = (PEBSDImageAcquireRawDataFromPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireRawDataFromPosition");
  346. if (!pEBSDImageAcquireRawDataFromPosition) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireRawDataFromPosition\n"));
  347. pEBSDImageAcquireRawDataFromPositionWithPC = (PEBSDImageAcquireRawDataFromPositionWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDImageAcquireRawDataFromPositionWithPC");
  348. if (!pEBSDImageAcquireRawDataFromPositionWithPC) OutputDebugString(_T("Failed to load DLL function EBSDImageAcquireRawDataFromPositionWithPC\n"));
  349. pEBSDPointListImageAcquireWithPC = (PEBSDPointListImageAcquireWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDPointListImageAcquireWithPC");
  350. if (!pEBSDPointListImageAcquireWithPC) OutputDebugString(_T("Failed to load DLL function EBSDPointListImageAcquireWithPC\n"));
  351. pEBSDPointListImageAcquireRawDataWithPC = (PEBSDPointListImageAcquireRawDataWithPC)GetProcAddress(hEspritDllBaseAddress, "EBSDPointListImageAcquireRawDataWithPC");
  352. if (!pEBSDPointListImageAcquireRawDataWithPC) OutputDebugString(_T("Failed to load DLL function EBSDPointListImageAcquireRawDataWithPC\n"));
  353. pEBSDStartCalibration = (PEBSDStartCalibration)GetProcAddress(hEspritDllBaseAddress, "EBSDStartCalibration");
  354. if (!pEBSDStartCalibration) OutputDebugString(_T("Failed to load DLL function EBSDStartCalibration\n"));
  355. pEBSDStopCalibration = (PEBSDStopCalibration)GetProcAddress(hEspritDllBaseAddress, "EBSDStopCalibration");
  356. if (!pEBSDStopCalibration) OutputDebugString(_T("Failed to load DLL function EBSDStopCalibration\n"));
  357. pEBSDGetCalibrationState = (PEBSDGetCalibrationState)GetProcAddress(hEspritDllBaseAddress, "EBSDGetCalibrationState");
  358. if (!pEBSDGetCalibrationState) OutputDebugString(_T("Failed to load DLL function EBSDGetCalibrationState\n"));
  359. pEBSDSaveEBSPImageFromPosition = (PEBSDSaveEBSPImageFromPosition)GetProcAddress(hEspritDllBaseAddress, "EBSDSaveEBSPImageFromPosition");
  360. if (!pEBSDSaveEBSPImageFromPosition) OutputDebugString(_T("Failed to load DLL function EBSDSaveEBSPImageFromPosition\n"));
  361. pEBSDSetExposureTime = (PEBSDSetExposureTime)GetProcAddress(hEspritDllBaseAddress, "EBSDSetExposureTime");
  362. if (!pEBSDSetExposureTime) OutputDebugString(_T("Failed to load DLL function EBSDSetExposureTime\n"));
  363. pEBSDGetExposureTime = (PEBSDGetExposureTime)GetProcAddress(hEspritDllBaseAddress, "EBSDGetExposureTime");
  364. if (!pEBSDGetExposureTime) OutputDebugString(_T("Failed to load DLL function EBSDGetExposureTime\n"));
  365. pEBSDGetImageConfiguration = (PEBSDGetImageConfiguration)GetProcAddress(hEspritDllBaseAddress, "EBSDGetImageConfiguration");
  366. if (!pEBSDGetImageConfiguration) OutputDebugString(_T("Failed to load DLL function EBSDGetImageConfiguration\n"));
  367. pEBSDSetGain = (PEBSDSetGain)GetProcAddress(hEspritDllBaseAddress, "EBSDSetGain");
  368. if (!pEBSDSetGain) OutputDebugString(_T("Failed to load DLL function EBSDSetGain\n"));
  369. pEBSDGetGain = (PEBSDGetGain)GetProcAddress(hEspritDllBaseAddress, "EBSDGetGain");
  370. if (!pEBSDGetGain) OutputDebugString(_T("Failed to load DLL function EBSDGetGain\n"));
  371. pEBSDGetTilt = (PEBSDGetTilt)GetProcAddress(hEspritDllBaseAddress, "EBSDGetTilt");
  372. if (!pEBSDGetTilt) OutputDebugString(_T("Failed to load DLL function EBSDGetTilt\n"));
  373. pEBSDGetAvailablePatternFormatCount = (PEBSDGetAvailablePatternFormatCount)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAvailablePatternFormatCount");
  374. if (!pEBSDGetAvailablePatternFormatCount) OutputDebugString(_T("Failed to load DLL function EBSDGetAvailablePatternFormatCount\n"));
  375. pEBSDGetAvailablePatternFormat = (PEBSDGetAvailablePatternFormat)GetProcAddress(hEspritDllBaseAddress, "EBSDGetAvailablePatternFormat");
  376. if (!pEBSDGetAvailablePatternFormat) OutputDebugString(_T("Failed to load DLL function EBSDGetAvailablePatternFormat\n"));
  377. pEBSDSetPatternFormat = (PEBSDSetPatternFormat)GetProcAddress(hEspritDllBaseAddress, "EBSDSetPatternFormat");
  378. if (!pEBSDSetPatternFormat) OutputDebugString(_T("Failed to load DLL function EBSDSetPatternFormat\n"));
  379. pEBSDSetPattern16bitMode = (PEBSDSetPattern16bitMode)GetProcAddress(hEspritDllBaseAddress, "EBSDSetPattern16bitMode");
  380. if (!pEBSDSetPattern16bitMode) OutputDebugString(_T("Failed to load DLL function EBSDSetPattern16bitMode\n"));
  381. pEBSDGetEstimatedMappingTime = (PEBSDGetEstimatedMappingTime)GetProcAddress(hEspritDllBaseAddress, "EBSDGetEstimatedMappingTime");
  382. if (!pEBSDGetEstimatedMappingTime) OutputDebugString(_T("Failed to load DLL function EBSDGetEstimatedMappingTime\n"));
  383. pEBSDStartAcquisitionFromPointList = (PEBSDStartAcquisitionFromPointList)GetProcAddress(hEspritDllBaseAddress, "EBSDStartAcquisitionFromPointList");
  384. if (!pEBSDStartAcquisitionFromPointList) OutputDebugString(_T("Failed to load DLL function EBSDStartAcquisitionFromPointList\n"));
  385. pEBSDGetPointResults = (PEBSDGetPointResults)GetProcAddress(hEspritDllBaseAddress, "EBSDGetPointResults");
  386. if (!pEBSDGetPointResults) OutputDebugString(_T("Failed to load DLL function EBSDGetPointResults\n"));
  387. return true;
  388. }
  389. int32_t HardwareConnectionGetStatus(uint32_t CID, int32_t& Status, boolean& WasInterrupted, int32_t& TimeLeftForReconnection)
  390. {
  391. if (pHardwareConnectionGetStatus)
  392. return pHardwareConnectionGetStatus(CID, Status, WasInterrupted, TimeLeftForReconnection);
  393. else return -1;
  394. }
  395. int32_t HardwareConnectionResetErrorFlag(uint32_t CID)
  396. {
  397. if (pHardwareConnectionResetErrorFlag)
  398. return pHardwareConnectionResetErrorFlag(CID);
  399. else return -1;
  400. }
  401. // Initialize connection reset procedure, this will trigger a 'watchdogged' hardware reset in SCU/SGU
  402. int32_t HardwareConnectionReset(uint32_t CID)
  403. {
  404. if (pHardwareConnectionReset)
  405. return pHardwareConnectionReset(CID);
  406. else return -1;
  407. }
  408. // Reset scan hardware, device will have default configuration afterwards, so be sure to re-configure it correctly
  409. int32_t ImageReset(uint32_t CID)
  410. {
  411. if (pImageReset)
  412. return pImageReset(CID);
  413. else return -1;
  414. }
  415. // Read current image device configuration
  416. int32_t ImageGetConfiguration(uint32_t CID, uint32_t& Width, uint32_t& Height, uint32_t& Average, bool& Ch1, bool& Ch2)
  417. {
  418. if (pImageGetConfiguration)
  419. return pImageGetConfiguration(CID, Width, Height, Average, Ch1, Ch2);
  420. else return -1;
  421. }
  422. // Write current image device configuration
  423. int32_t ImageSetConfiguration(uint32_t CID, uint32_t Width, uint32_t Height, uint32_t Average, bool Ch1, bool Ch2)
  424. {
  425. if (pImageSetConfiguration)
  426. return pImageSetConfiguration(CID, Width, Height, Average, Ch1, Ch2);
  427. else return -1;
  428. }
  429. // Use external scan engine which triggers our scan generator trough an external signal
  430. int32_t ImageSetExternalScan(uint32_t CID, bool UseExternalScan)
  431. {
  432. if (pImageSetExternalScan)
  433. return pImageSetExternalScan(CID, UseExternalScan);
  434. else return -1;
  435. }
  436. // Aquire new image and read image data
  437. int32_t ImageAquireImage(uint32_t CID, int32_t Ch, bool ShowProgress, void* Buffer, int32_t& BufSize, PRTImageInfoEx ImgInfo)
  438. {
  439. if (pImageAquireImage)
  440. return pImageAquireImage(CID, Ch, ShowProgress, Buffer, BufSize, ImgInfo);
  441. else return -1;
  442. }
  443. // Aquire new image and read image data
  444. // Options : Bit combination of the following values
  445. // cImgAcq_ShowProgress = 1;
  446. // cImgAcq_UpdateSEMData = 2;
  447. int32_t ImageAquireImageEx(uint32_t CID, int32_t Ch, void* Buffer, uint32_t Options, int32_t& BufSize, PRTImageInfoEx ImgInfo)
  448. {
  449. if (pImageAquireImageEx)
  450. return pImageAquireImageEx(CID, Ch, Buffer, Options, BufSize, ImgInfo);
  451. else return -1;
  452. }
  453. // Read the image field width from scan settings and SEM magnification, microns unit
  454. int32_t ImageGetFieldWidth(uint32_t CID, double& FieldWidth)
  455. {
  456. if (pImageGetFieldWidth)
  457. return pImageGetFieldWidth(CID, FieldWidth);
  458. else return -1;
  459. }
  460. // Set drift correction vector
  461. int32_t ImageSetExternalDriftCorrection(uint32_t CID, double ShiftX, double ShiftY)
  462. {
  463. if (pImageSetExternalDriftCorrection)
  464. return pImageSetExternalDriftCorrection(CID, ShiftX, ShiftY);
  465. else return -1;
  466. }
  467. int32_t ImageGetDriftCorrectionActive(uint32_t CID, bool& Active)
  468. {
  469. if (pImageGetDriftCorrectionActive)
  470. return pImageGetDriftCorrectionActive(CID, Active);
  471. else return -1;
  472. }
  473. int32_t ImageGetLatestKnownScanPosition(uint32_t CID, int& X, int& Y)
  474. {
  475. if (pImageGetLatestKnownScanPosition)
  476. return pImageGetLatestKnownScanPosition(CID, X, Y);
  477. else return -1;
  478. }
  479. int32_t ImageGetScannedSegmentsCount(uint32_t CID, __int64& aCount)
  480. {
  481. if (pImageGetScannedSegmentsCount)
  482. return pImageGetScannedSegmentsCount(CID, aCount);
  483. else return -1;
  484. }
  485. // Set electron beam position in image
  486. int32_t ImageSetPoint(uint32_t CID, uint32_t X, uint32_t Y)
  487. {
  488. if (pImageSetPoint)
  489. return pImageSetPoint(CID, X, Y);
  490. else return -1;
  491. }
  492. // functions to deal with point lists
  493. // CID : connection identifier
  494. // SPU : spectrometer index (1..n)
  495. // SegmentCount,
  496. // LineSegments : description of points to measure
  497. // RealTime : acquisition time in ms
  498. int32_t StartPointListMeasurement(uint32_t CID, int32_t SPU, uint32_t SegmentCount,BrukerDll::PSegmentList LineSegments, uint32_t RealTime)
  499. {
  500. if (pStartPointListMeasurement)
  501. return pStartPointListMeasurement(CID, SPU, SegmentCount, LineSegments, RealTime);
  502. else return -1;
  503. }
  504. // CID : connection identifier
  505. // Index : spectrum index (1..n)
  506. // SpectrumBuf : buffer to hold complete spectrum with header (around 20kB), must be allocated by caller
  507. // BufSize : size of spectrum buffer
  508. int32_t GetPointListSpectrum(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize)
  509. {
  510. if (pGetPointListSpectrum)
  511. return pGetPointListSpectrum(CID, Index, SpectrumBuf, BufSize);
  512. else return -1;
  513. }
  514. int32_t QuantifyPointListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize)
  515. {
  516. if (pQuantifyPointListSpectrum)
  517. return pQuantifyPointListSpectrum(CID, Index, MethodName, Params, ResultBuf, ResultBufSize, SpectrumBuf, BufSize);
  518. else return -1;
  519. }
  520. // CID : connection identifier
  521. // Index : spectrum index (1..n)
  522. // FileName : filename to save to
  523. int32_t SavePointListSpectrum(uint32_t CID, int32_t Buffer, char* FileName)
  524. {
  525. if (pSavePointListSpectrum)
  526. return pSavePointListSpectrum(CID, Buffer, FileName);
  527. else return -1;
  528. }
  529. ///////////////////////////////////////////////////////////
  530. // functions to deal with object lists ///
  531. ///////////////////////////////////////////////////////////
  532. int32_t StartFeatureListMeasurement(uint32_t CID, int32_t SPU, uint32_t FeatureCount, PFeatureDataList Features, __int16* PixelTimes)
  533. {
  534. if (pStartFeatureListMeasurement)
  535. return pStartFeatureListMeasurement(CID, SPU, FeatureCount, Features, PixelTimes);
  536. else return -1;
  537. }
  538. int32_t GetFeatureListSpectrum(uint32_t CID, int32_t Index, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize)
  539. {
  540. if (pGetFeatureListSpectrum)
  541. return pGetFeatureListSpectrum(CID, Index, SpectrumBuf, BufSize);
  542. else return -1;
  543. }
  544. int32_t QuantifyFeatureListSpectrum(uint32_t CID, int32_t Index, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize, PRTSpectrumHeaderRec SpectrumBuf, int32_t BufSize)
  545. {
  546. if (pQuantifyFeatureListSpectrum)
  547. return pQuantifyFeatureListSpectrum(CID, Index, MethodName, Params, ResultBuf, ResultBufSize, SpectrumBuf, BufSize);
  548. else return -1;
  549. }
  550. int32_t SaveFeatureListSpectrum(uint32_t CID, int32_t Buffer, char* FileName)
  551. {
  552. if (pSaveFeatureListSpectrum)
  553. return pSaveFeatureListSpectrum(CID, Buffer, FileName);
  554. else return -1;
  555. }
  556. ///////////////////////////////////////////////////////////
  557. /// functions to communicate with SEM ///
  558. ///////////////////////////////////////////////////////////
  559. int32_t SetSEMData(uint32_t CID, double Magnification, double HighVoltage, double WorkingDistance)
  560. {
  561. if (pSetSEMData)
  562. return pSetSEMData(CID, Magnification, HighVoltage, WorkingDistance);
  563. else return -1;
  564. }
  565. int32_t GetSEMData(uint32_t CID, double& Magnification, double& HighVoltage, double& WorkingDistance)
  566. {
  567. if (pGetSEMData)
  568. return pGetSEMData(CID, Magnification, HighVoltage, WorkingDistance);
  569. else return -1;
  570. }
  571. int32_t SetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values)
  572. {
  573. if (pSetSEMParameter)
  574. return pSetSEMParameter(CID, Params, ValueIDs, Values);
  575. else return -1;
  576. }
  577. int32_t GetSEMParameter(uint32_t CID, char* Params, char* ValueIDs, double* Values)
  578. {
  579. if (pGetSEMParameter)
  580. return pGetSEMParameter(CID, Params, ValueIDs, Values);
  581. else return -1;
  582. }
  583. int32_t GetSEMBCData(uint32_t CID, double& Brightness, double& Contrast)
  584. {
  585. if (pGetSEMBCData)
  586. return pGetSEMBCData(CID, Brightness, Contrast);
  587. else return -1;
  588. }
  589. int32_t SetSEMBCData(uint32_t CID, double Brightness, double Contrast)
  590. {
  591. if (pSetSEMBCData)
  592. return pSetSEMBCData(CID, Brightness, Contrast);
  593. else return -1;
  594. }
  595. int32_t GetSEMProbeCurrent(uint32_t CID, double& ProbeCurrent)
  596. {
  597. if (pGetSEMProbeCurrent)
  598. return pGetSEMProbeCurrent(CID, ProbeCurrent);
  599. else return -1;
  600. }
  601. int32_t SetSEMProbeCurrent(uint32_t CID, double ProbeCurrent)
  602. {
  603. if (pSetSEMProbeCurrent)
  604. return pSetSEMProbeCurrent(CID, ProbeCurrent);
  605. else return -1;
  606. }
  607. int32_t GetSEMSpotSize(uint32_t CID, double& SpotSize)
  608. {
  609. if (pGetSEMSpotSize)
  610. return pGetSEMSpotSize(CID, SpotSize);
  611. else return -1;
  612. }
  613. int32_t SetSEMSpotSize(uint32_t CID, double SpotSize)
  614. {
  615. if (pSetSEMSpotSize)
  616. return pSetSEMSpotSize(CID, SpotSize);
  617. else return -1;
  618. }
  619. int32_t SetSEMDetector(uint32_t CID, int Channel, char* DetectorName)
  620. {
  621. if (pSetSEMDetector)
  622. return pSetSEMDetector(CID, Channel, DetectorName);
  623. else return -1;
  624. }
  625. int32_t GetSEMDetector(uint32_t CID, int Channel, char* DetectorName, int32_t BufSize)
  626. {
  627. if (pGetSEMDetector)
  628. return pGetSEMDetector(CID, Channel, DetectorName, BufSize);
  629. else return -1;
  630. }
  631. int32_t SetSEMStageData(uint32_t CID, double XPos, double YPos, double ZPos, double Tilt, double Rotation)
  632. {
  633. if (pSetSEMStageData)
  634. return pSetSEMStageData(CID, XPos, YPos, ZPos, Tilt, Rotation);
  635. else return -1;
  636. }
  637. int32_t GetSEMStageData(uint32_t CID, double& XPos, double& YPos, double& ZPos, double& Tilt, double& Rotation)
  638. {
  639. if (pGetSEMStageData)
  640. return pGetSEMStageData(CID, XPos, YPos, ZPos, Tilt, Rotation);
  641. else return -1;
  642. }
  643. 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)
  644. {
  645. if (pGetSEMStageRange)
  646. return pGetSEMStageRange(CID, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, Tmin, Tmax, Rmin, Rmax);
  647. else return -1;
  648. }
  649. int32_t GetSEMStageState(uint32_t CID, int32_t& State)
  650. {
  651. if (pGetSEMStageState)
  652. return pGetSEMStageState(CID, State);
  653. else return -1;
  654. }
  655. int32_t GetSEMCapabilities(uint32_t CID, char* Capabilities, int32_t BufSize)
  656. {
  657. if (pGetSEMCapabilities)
  658. return pGetSEMCapabilities(CID, Capabilities, BufSize);
  659. else return -1;
  660. }
  661. int32_t GetSEMInfo(uint32_t CID, char* Info, int32_t BufSize)
  662. {
  663. if (pGetSEMInfo)
  664. return pGetSEMInfo(CID, Info, BufSize);
  665. else return -1;
  666. }
  667. int32_t SetSEMExternalOn(uint32_t CID)
  668. {
  669. if (pSetSEMExternalOn)
  670. return pSetSEMExternalOn(CID);
  671. else return -1;
  672. }
  673. int32_t SetSEMExternalOff(uint32_t CID)
  674. {
  675. if (pSetSEMExternalOff)
  676. return pSetSEMExternalOff(CID);
  677. else return -1;
  678. }
  679. int32_t ResetSEMCommunication(uint32_t CID)
  680. {
  681. if (pResetSEMCommunication)
  682. return pResetSEMCommunication(CID);
  683. else return -1;
  684. }
  685. int32_t SwitchSEMOff(uint32_t CID, bool HVOff, bool BeamCurrentOff, bool BeamBlank)
  686. {
  687. if (pSwitchSEMOff)
  688. return pSwitchSEMOff(CID, HVOff, BeamCurrentOff, BeamBlank);
  689. else return -1;
  690. }
  691. ///////////////////////////////////////////////////////////
  692. /// Move EDS detector ///
  693. ///////////////////////////////////////////////////////////
  694. // Detector : Detector to be moved ( 1 in most cases )
  695. // Position : Position to move to ( 1 = Park position, 2 = Acquisition position )
  696. int32_t EDSSetDetectorPosition(uint32_t CID, int32_t Detector, int32_t Position)
  697. {
  698. if (pEDSSetDetectorPosition)
  699. return pEDSSetDetectorPosition(CID, Detector, Position);
  700. else return -1;
  701. }
  702. // Detector : Detector to ask for position ( 1 in most cases )
  703. // Position : Current position ( 1 = Park position, 2 = Acquisition position )
  704. int32_t EDSGetDetectorPosition(uint32_t CID, int32_t Detector, int32_t& Position)
  705. {
  706. if (pEDSGetDetectorPosition)
  707. return pEDSGetDetectorPosition(CID, Detector, Position);
  708. else return -1;
  709. }
  710. ///////////////////////////////////////////////////////////
  711. /// Mapping functions ///
  712. ///////////////////////////////////////////////////////////
  713. // PixelTime : Dwell time per Pixel in microseconds
  714. // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan
  715. int32_t HyMapStart(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime)
  716. {
  717. if (pHyMapStart)
  718. return pHyMapStart(CID, SPU, PixelTime, RealTime);
  719. else return -1;
  720. }
  721. // PixelTime : Dwell time per Pixel in microseconds
  722. // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan
  723. // Region : Image region to be mapped
  724. int32_t HyMapStartEx(uint32_t CID, int32_t SPU, uint32_t PixelTime, uint32_t RealTime, TFeatureData Region)
  725. {
  726. if (pHyMapStartEx)
  727. return pHyMapStartEx(CID, SPU, PixelTime, RealTime, Region);
  728. else return -1;
  729. }
  730. // PixelTime : Dwell time per Pixel in microseconds
  731. // RealTime : Acquisition time in s, RealTime=0 does exactly 1 scan
  732. // Region : Image region to be mapped
  733. // Profile : XML serialized profile
  734. int32_t HyMapStartWithProfile(uint32_t CID, int32_t SPU, uint32_t PixelTime, TFeatureData Region, char* Profile)
  735. {
  736. if (pHyMapStartWithProfile)
  737. return pHyMapStartWithProfile(CID, SPU, PixelTime, Region, Profile);
  738. else return -1;
  739. }
  740. // MapSettings : Map settings
  741. // Profile : XML serialized profile
  742. // BufSize : Size of buffer
  743. int32_t HyMapCreateProfile(const TRTHyMapProfileSettings& MapSettings, char* Profile, int32_t& BufSize)
  744. {
  745. if (pHyMapCreateProfile)
  746. return pHyMapCreateProfile(MapSettings, Profile, BufSize);
  747. else return -1;
  748. }
  749. // DataFileName: complete name of existing mapping data file
  750. // Profile : XML serialized EDS map profile
  751. int32_t SetDataAndProfileToUI(uint32_t CID, char* DataFileName, char* Profile)
  752. {
  753. if (pSetDataAndProfileToUI)
  754. return pSetDataAndProfileToUI(CID, DataFileName, Profile);
  755. else return -1;
  756. }
  757. int32_t HyMapQuantifyMaxPixelSpectrum(uint32_t CID, char* MethodName, char* Params, char* ResultBuf, int ResultBufSize)
  758. {
  759. if (pHyMapQuantifyMaxPixelSpectrum)
  760. return pHyMapQuantifyMaxPixelSpectrum(CID, MethodName, Params, ResultBuf, ResultBufSize);
  761. else return -1;
  762. }
  763. ///////////////////////////////////////////////////////////
  764. /// EBSD functions ///
  765. ///////////////////////////////////////////////////////////
  766. // Retrieve the list of predefined acquisition setups
  767. // Profiles : buffer to store the list information
  768. // BufSize : Size of buffer
  769. int32_t EBSDGetAcquisitionProfiles(uint32_t CID, char* Profiles, int32_t BufSize)
  770. {
  771. if (pEBSDGetAcquisitionProfiles)
  772. return pEBSDGetAcquisitionProfiles(CID, Profiles, BufSize);
  773. else return -1;
  774. }
  775. // Load a predefined acquisition setup
  776. // Profile : buffer with profile name to select
  777. int32_t EBSDSelectAcquisitionProfile(uint32_t CID, char* Profile)
  778. {
  779. if (pEBSDSelectAcquisitionProfile)
  780. return pEBSDSelectAcquisitionProfile(CID, Profile);
  781. else return -1;
  782. }
  783. // Start EBSD acquisition with selected setup
  784. int32_t EBSDStartAcquisition(uint32_t CID)
  785. {
  786. if (pEBSDStartAcquisition)
  787. return pEBSDStartAcquisition(CID);
  788. else return -1;
  789. }
  790. // Start EBSD acquisition with defined profile data
  791. int32_t EBSDStartAcquisitionWithProfile(uint32_t CID, char* Profile)
  792. {
  793. if (pEBSDStartAcquisitionWithProfile)
  794. return pEBSDStartAcquisitionWithProfile(CID, Profile);
  795. else return -1;
  796. }
  797. // Stop EBSD acquisition
  798. int32_t EBSDStopAcquisition(uint32_t CID)
  799. {
  800. if (pEBSDStopAcquisition)
  801. return pEBSDStopAcquisition(CID);
  802. else return -1;
  803. }
  804. // Retrieve EBSD acquisition state
  805. // CurrentLine : current acquisition Y -position
  806. // PercentReady : Current state of Acquisition in %
  807. // IndexingPercentReady : Current State of Indexing in %
  808. // AcquisitionRunning : Is just giving the running state of the Acquisition
  809. // IndexingRunning : Is just giving the running state of the Indexing
  810. int32_t EBSDGetAcquisitionState(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, int32_t& IndexingPercentReady, bool& AcquisitionRunning, bool& IndexingRunning)
  811. {
  812. if (pEBSDGetAcquisitionState)
  813. return pEBSDGetAcquisitionState(CID, CurrentLine, PercentReady, IndexingPercentReady, AcquisitionRunning, IndexingRunning);
  814. else return -1;
  815. }
  816. // Save EBSD acquisition data to file in Bruker format
  817. // FileName : File name for the file to store information (*.bcf)
  818. // SaveOptions : Bit flags to specify which information has to be stored (frames, detected lines?
  819. int32_t EBSDSaveToFile(uint32_t CID, char* FileName, bool WithEdx, bool WithPatterns)
  820. {
  821. if (pEBSDSaveToFile)
  822. return pEBSDSaveToFile(CID, FileName, WithEdx, WithPatterns);
  823. else return -1;
  824. }
  825. // BaseFileName : Base file name for the result files to export (map images?
  826. // ExportOptions: Integer representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6)
  827. int32_t EBSDExportData(uint32_t CID, char* BaseFileName, int32_t ExportOptions)
  828. {
  829. if (pEBSDExportData)
  830. return pEBSDExportData(CID, BaseFileName, ExportOptions);
  831. else return -1;
  832. }
  833. // Buffer:Pointer
  834. // BufferSize:integer
  835. // ExportOptions: longint representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6)
  836. int32_t EBSDExportDataBuffer(uint32_t CID, void* Buffer, int& BufferSize, int ExportOptions)
  837. {
  838. if (pEBSDExportDataBuffer)
  839. return pEBSDExportDataBuffer(CID, Buffer, BufferSize, ExportOptions);
  840. else return -1;
  841. }
  842. // BaseFileName : Base file name for the result list (ctf-file) to export
  843. int32_t EBSDExportResults(uint32_t CID, char* BaseFileName)
  844. {
  845. if (pEBSDExportResults)
  846. return pEBSDExportResults(CID, BaseFileName);
  847. else return -1;
  848. }
  849. // Retrieve EBSD detector position
  850. // Position : Detector position in mm
  851. int32_t EBSDGetDetectorPosition(uint32_t CID, double& Position)
  852. {
  853. if (pEBSDGetDetectorPosition)
  854. return pEBSDGetDetectorPosition(CID, Position);
  855. else return -1;
  856. }
  857. // Move EBSD detector to specified position
  858. // Position : Detector position in mm
  859. // Speed : Detector speed in mm/s:
  860. int32_t EBSDSetDetectorPosition(uint32_t CID, double Position, double Speed)
  861. {
  862. if (pEBSDSetDetectorPosition)
  863. return pEBSDSetDetectorPosition(CID, Position, Speed);
  864. else return -1;
  865. }
  866. int32_t EBSDImageAcquireEx(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY)
  867. {
  868. if (pEBSDImageAcquireEx)
  869. return pEBSDImageAcquireEx(CID, Buffer, BufSize, PosX, PosY);
  870. else return -1;
  871. }
  872. int32_t EBSDImageAcquireWithPC(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int NFrameAvg, double& PCX, double& PCY, double& PCL)
  873. {
  874. if (pEBSDImageAcquireWithPC)
  875. return pEBSDImageAcquireWithPC(CID, Buffer, BufSize, PosX, PosY, NFrameAvg, PCX, PCY, PCL);
  876. else return -1;
  877. }
  878. // Acquire pattern images, Buffer returns raw data
  879. int32_t EBSDImageAcquireRawDataFromPosition(uint32_t CID, void* Buffer, int& BufSize, int PosX, int PosY, int& Width, int& Height, int& PixelBytes)
  880. {
  881. if (pEBSDImageAcquireRawDataFromPosition)
  882. return pEBSDImageAcquireRawDataFromPosition(CID, Buffer, BufSize, PosX, PosY, Width, Height, PixelBytes);
  883. else return -1;
  884. }
  885. 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)
  886. {
  887. if (pEBSDImageAcquireRawDataFromPositionWithPC)
  888. return pEBSDImageAcquireRawDataFromPositionWithPC(CID, Buffer, BufSize, PosX, PosY, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes);
  889. else return -1;
  890. }
  891. 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)
  892. {
  893. if (pEBSDPointListImageAcquireWithPC)
  894. return pEBSDPointListImageAcquireWithPC(CID, Buffer, BufSize, PointCount, Points, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes);
  895. else return -1;
  896. }
  897. 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)
  898. {
  899. if (pEBSDPointListImageAcquireRawDataWithPC)
  900. return pEBSDPointListImageAcquireRawDataWithPC(CID, Buffer, BufSize, PointCount, Points, NFrameAvg, PCX, PCY, PCL, Width, Height, PixelBytes);
  901. else return -1;
  902. }
  903. // Settings include:
  904. // TiltAngle of the Detector
  905. // TiltAzimuthAngle of the Detector;
  906. // ScanRotation
  907. // WD
  908. // DetectorAxis
  909. // DetectorTilt
  910. // PhosphorSize
  911. int32_t EBSDStartCalibration(uint32_t CID, PRTEBSDCalibSettings Settings)
  912. {
  913. if (pEBSDStartCalibration)
  914. return pEBSDStartCalibration(CID, Settings);
  915. else return -1;
  916. }
  917. // Stop EBSD Calibration
  918. int32_t EBSDStopCalibration(uint32_t CID)
  919. {
  920. if (pEBSDStopCalibration)
  921. return pEBSDStopCalibration(CID);
  922. else return -1;
  923. }
  924. // CurrentLine : not yet in use
  925. // PercentReady : Calibration state in %
  926. // Running : Running state of calibration
  927. int32_t EBSDGetCalibrationState(uint32_t CID, int32_t& CurrentLine, int32_t& PercentReady, bool& Running)
  928. {
  929. if (pEBSDGetCalibrationState)
  930. return pEBSDGetCalibrationState(CID, CurrentLine, PercentReady, Running);
  931. else return -1;
  932. }
  933. int32_t EBSDSaveEBSPImageFromPosition(uint32_t CID, char* aBaseFilename, int32_t X, int32_t Y)
  934. {
  935. if (pEBSDSaveEBSPImageFromPosition)
  936. return pEBSDSaveEBSPImageFromPosition(CID, aBaseFilename, X, Y);
  937. else return -1;
  938. }
  939. int32_t EBSDSetExposureTime(uint32_t CID, int32_t ExposureTime)
  940. {
  941. if (pEBSDSetExposureTime)
  942. return pEBSDSetExposureTime(CID, ExposureTime);
  943. else return -1;
  944. }
  945. int32_t EBSDGetExposureTime(uint32_t CID, int32_t& ExposureTime)
  946. {
  947. if (pEBSDGetExposureTime)
  948. return pEBSDGetExposureTime(CID, ExposureTime);
  949. else return -1;
  950. }
  951. // Width: Current camera width
  952. // Height: Current camera height
  953. int32_t EBSDGetImageConfiguration(uint32_t CID, int32_t& Width, int32_t& Height)
  954. {
  955. if (pEBSDGetImageConfiguration)
  956. return pEBSDGetImageConfiguration(CID, Width, Height);
  957. else return -1;
  958. }
  959. int32_t EBSDSetGain(uint32_t CID, int32_t Value)
  960. {
  961. if (pEBSDSetGain)
  962. return pEBSDSetGain(CID, Value);
  963. else return -1;
  964. }
  965. int32_t EBSDGetGain(uint32_t CID, int32_t& Value)
  966. {
  967. if (pEBSDGetGain)
  968. return pEBSDGetGain(CID, Value);
  969. else return -1;
  970. }
  971. int32_t EBSDGetTilt(uint32_t CID, double& Value)
  972. {
  973. if (pEBSDGetTilt)
  974. return pEBSDGetTilt(CID, Value);
  975. else return -1;
  976. }
  977. //Count : returns the amount of image format (binning)
  978. int32_t EBSDGetAvailablePatternFormatCount(uint32_t CID, int32_t& Count)
  979. {
  980. if (pEBSDGetAvailablePatternFormatCount)
  981. return pEBSDGetAvailablePatternFormatCount(CID, Count);
  982. else return -1;
  983. }
  984. //FormatIndex: Seletion index of image format
  985. //Width: Camera Width
  986. //Height: Camera Height
  987. int32_t EBSDGetAvailablePatternFormat(uint32_t CID, const int32_t FormatIndex, int32_t& Width, int32_t& Height)
  988. {
  989. if (pEBSDGetAvailablePatternFormat)
  990. return pEBSDGetAvailablePatternFormat(CID, FormatIndex, Width, Height);
  991. else return -1;
  992. }
  993. //FormatIndex: The choosen Index for Camera Format
  994. int32_t EBSDSetPatternFormat(uint32_t CID, const int32_t FormatIndex)
  995. {
  996. if (pEBSDSetPatternFormat)
  997. return pEBSDSetPatternFormat(CID, FormatIndex);
  998. else return -1;
  999. }
  1000. //Value: true (16bit Mode), false (8 bit Mode)
  1001. int32_t EBSDSetPattern16bitMode(uint32_t CID, const bool Value)
  1002. {
  1003. if (pEBSDSetPattern16bitMode)
  1004. return pEBSDSetPattern16bitMode(CID, Value);
  1005. else return -1;
  1006. }
  1007. int32_t EBSDGetEstimatedMappingTime(uint32_t CID, int32_t& Time)
  1008. {
  1009. if (pEBSDGetEstimatedMappingTime)
  1010. return pEBSDGetEstimatedMappingTime(CID, Time);
  1011. else return -1;
  1012. }
  1013. int32_t EBSDStartAcquisitionFromPointList(uint32_t CID, PPointArray PointList, int32_t pointcount)
  1014. {
  1015. if(pEBSDStartAcquisitionFromPointList)
  1016. return pEBSDStartAcquisitionFromPointList(CID, PointList, pointcount);
  1017. else
  1018. return -1;
  1019. }
  1020. int32_t EBSDGetPointResults(uint32_t CID, PEBSDIndexingResultArray PointResults, int32_t & pointcount)
  1021. {
  1022. if(pEBSDGetPointResults)
  1023. return pEBSDGetPointResults(CID, PointResults, pointcount);
  1024. else
  1025. return -1;
  1026. }
  1027. }