OxfordScanController.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. public OxfordScanController(ImageInputSources sourceType)
  25. {
  26. iExtender = ExtenderWrapperIpc.GetExtenderWrapper();
  27. imagesourceType = sourceType;
  28. }
  29. public CBSEImgClr AcquireBSEImage()
  30. {
  31. Rectangle r = new Rectangle();
  32. CBSEImgClr bse = new CBSEImgClr(r);
  33. bse.InitImageData(imageWidth, imageHeight);
  34. ImageAquistionParam p = new ImageAquistionParam();
  35. p.width = imageWidth;
  36. p.height = imageHeight;
  37. p.DwellTime = dwelltime;
  38. p.sourceType = imagesourceType;
  39. NLog.LogManager.GetCurrentClassLogger().Info("Begin to acquire BSE image!");
  40. iExtender.AquisitionImage(ref p);
  41. NLog.LogManager.GetCurrentClassLogger().Info("End acquiring BSE image!");
  42. bse.SetImageData(p.ImageData, imageWidth, imageHeight);
  43. return bse;
  44. }
  45. public bool Init()
  46. {
  47. return true;
  48. }
  49. public bool SetDwellTime(double val)
  50. {
  51. dwelltime = val;
  52. return true;
  53. }
  54. public bool SetImageSize(int nWidth, int nHeight)
  55. {
  56. imageWidth = nWidth;
  57. imageHeight = nHeight;
  58. return true;
  59. }
  60. }
  61. }