OxfordScanController.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. 
  2. using OINA.Extender.Data.Image;
  3. using OTSCLRINTERFACE;
  4. using OxfordExtenderWrapper;
  5. using OTSModelSharp.ServiceCenter;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Runtime.Remoting.Channels.Ipc;
  13. using System.Runtime.Remoting.Channels;
  14. using OTSMeasureApp.ServiceCenter.OxfordExtender;
  15. namespace OTSMeasureApp.ServiceCenter
  16. {
  17. class OxfordScanController : IScanController
  18. {
  19. int imageWidth = 0;
  20. int imageHeight = 0;
  21. double dwelltime = 0;
  22. ExtenderIpcUI iExtender;
  23. ImageInputSources imagesourceType;
  24. //private APIClass ApiClass = null;
  25. public OxfordScanController(ImageInputSources sourceType)
  26. {
  27. iExtender = ExtenderWrapperIpc.GetExtenderWrapper();
  28. imagesourceType = sourceType;
  29. }
  30. public CBSEImgClr AcquireBSEImage()
  31. {
  32. Rectangle r = new Rectangle();
  33. CBSEImgClr bse = new CBSEImgClr(r);
  34. bse.InitImageData(imageWidth, imageHeight);
  35. //byte[] imgData = new byte[imageWidth * imageHeight];
  36. ImageAquistionParam p = new ImageAquistionParam();
  37. p.width = imageWidth;
  38. p.height = imageHeight;
  39. p.DwellTime = dwelltime;
  40. p.sourceType = imagesourceType;
  41. iExtender.AquisitionImage(ref p);
  42. bse.SetImageData(p.ImageData, imageWidth, imageHeight);
  43. return bse;
  44. }
  45. public bool Init()
  46. {
  47. //string FEIIP = FileHelper.GetXMLInformations("FEIIP");
  48. //string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
  49. //if (FEIIP == "" || FEIPORT == "")
  50. //{
  51. // NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
  52. // return false;
  53. //}
  54. //if (ApiClass.isConnect())
  55. //{
  56. // return true;
  57. //}
  58. //return ApiClass.Connect(FEIIP, FEIPORT);
  59. return true;
  60. }
  61. public bool SetDwellTime(double val)
  62. {
  63. dwelltime = val;
  64. return true;
  65. }
  66. public bool SetImageSize(int nWidth, int nHeight)
  67. {
  68. imageWidth = nWidth;
  69. imageHeight = nHeight;
  70. //return iExtender.set.SetResolution(imageWidth, imageHeight); ;
  71. return true;
  72. }
  73. }
  74. }