OTSOxfordImpl.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #pragma once
  2. #include "..\OTSControl\OTSSingleton.h"
  3. // Load ClientDll
  4. #include "..\OTSControl\Oxford\OxfordImplConst.h"
  5. #include "otsdataconst.h"
  6. #include "Element.h"
  7. #include "BSEImg.h"
  8. #include "PosXray.h"
  9. #include "OTSFeature.h"
  10. //#include "boost\type_traits\is_floating_point.hpp"
  11. #include "boost\noncopyable.hpp"
  12. #include "OxfordWrapper\OxfordController.h"
  13. #include <Bruker\OTSBrukerImpl_const.h>
  14. namespace OTSController
  15. {
  16. using namespace OTSDATA;
  17. typedef enum class __declspec(dllexport) OXFORD_PARAM
  18. {
  19. BUF_LENGTH = 1024,
  20. MAX_SEGMENTS = 8192,
  21. MAX_PIXEL_MICROSECONDS = 32000,
  22. RT_SPECTRUM_BUFFER_SIZE = 64000, // SpectrumBufferSize
  23. RT_SPECTRUM_CHANNELS = 2000, // XANA_CHANNELS = 2000,
  24. RT_SPECTRUM_CHANNELS_LONG = 3000 // RT_SPECTRUM_CHANNELS_LONG = 3000,
  25. } OXFORD_PARAM;
  26. class OxfordImpl : public Singleton<OxfordImpl>, public boost::noncopyable
  27. {
  28. public:
  29. OxfordImpl(void);
  30. ~OxfordImpl(void);
  31. void CloseClient(void);
  32. bool Connect();
  33. bool IsConnected();
  34. bool GetPositionXY(double& a_dPosX, double& a_dPosY);
  35. bool SetPositionXY(double a_dPosX, double a_dPosY);
  36. bool GetWorkingDistance(double& a_dWorkingDistance);
  37. bool SetWorkingDistance(double a_dWorkingDistance);
  38. bool GetMagnification(double& a_dMagnification);
  39. bool SetMagnification(double a_dMagnification);
  40. bool GetHighVoltage(double& a_dHighVoltage);
  41. bool SetHighVoltage(double a_dHighVoltage);
  42. bool GetBeamOn(bool& a_bBeamOn);
  43. bool SetBeamOn(bool a_bBeamOn);
  44. bool GetBeamBlank(bool& a_bBeamBlank);
  45. bool SetBeamBlank(bool a_bBeamBlank);
  46. bool GetExternal(bool& a_bExternal);
  47. bool SetExternal(bool a_bExternal);
  48. bool CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  49. bool CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  50. bool SetBeamPosition(const double a_dPosX, const double a_dPosY);
  51. bool SetScanSpeed(const long a_nMilliseconds);
  52. bool GetImageSize(long& a_nWidth, long& a_nHeight);
  53. bool SetImageSize(const long a_nWidth, const long a_nHeight);
  54. bool CollectImage(BYTE* a_pImageBits);
  55. bool QuantifySpectrum(unsigned char* cResult);
  56. // if do x-ray quantification
  57. BOOL GetQuantificationFlag() { return m_bDoQuantification; }
  58. void SetQuantificationFlag(BOOL a_bDoQuantification) { m_bDoQuantification = a_bDoQuantification; }
  59. // m_bDoQuantification should be set first.
  60. BOOL GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS);
  61. BOOL GetXRayByFeatures(CPosXraysList&a_listXRayPoints, std::vector<std::vector<BrukerSegment>>& a_vFeatures, DWORD a_nXRayAQTime);
  62. protected:
  63. std::shared_ptr<OxfordController> m_oxfordPtr;
  64. bool m_bInit; // initialize flag
  65. BOOL m_bDoQuantification; // if do x-ray quantification
  66. };
  67. //typedef boost::scoped_array<OxfordXrayData> featureData;
  68. } // namespace Controller