Просмотр исходного кода

使用牛津的能谱控件保存图像

HaoShuang 5 лет назад
Родитель
Сommit
7464d46c61
3 измененных файлов с 54 добавлено и 12 удалено
  1. 34 12
      ExtenderControl/Extender.cs
  2. 3 0
      ExtenderControl/ExtenderInterface.cs
  3. 17 0
      ExtenderControl/HOZExtender.csproj

+ 34 - 12
ExtenderControl/Extender.cs

@@ -26,6 +26,15 @@ using OINA.Extender.Processing.Quant;
 using System.ComponentModel;
 using OINA.Extender.Data.Ed;
 using System.Threading;
+
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Runtime.Serialization;
+using OINA.Extender.Controls;
+using OINA.Extender.Controls.Common;
+using OINA.Extender.Controls.Image;
+using OINA.Extender.Controls.Spectrum;
+
 namespace Extender
 {
     enum OxfordCommand
@@ -109,11 +118,11 @@ namespace Extender
 
     public struct PointXrayParam
     {
-      public  double dMilliSecondsTime;
-        public     int x;
-          public  int y;
-        public     long[] XrayData;
-          public   Dictionary<string, double> listElement;
+        public  double dMilliSecondsTime;
+        public  int x;
+        public  int y;
+        public  long[] XrayData;
+        public  Dictionary<string, double> listElement;
 
     }
     public struct AreaXrayParam
@@ -160,7 +169,7 @@ namespace Extender
         {
             if (myExtender != null)
             {
-            myExtender.CloseExtender();
+                myExtender.CloseExtender();
                 currentCommand.commandType = OxfordCommand.Exit;
                 startEvent.Set();
             }
@@ -506,13 +515,17 @@ namespace Extender
                 return false;
             }
         }
+
+        public Boolean SaveXrayImageandExcel(string sPath)
+        {
+            return true;
+        }
     }
     public class Extender : IExtenderControl
-    {
-       
-        
-    //构造函数
-    public Extender()
+    {    
+
+        //构造函数
+        public Extender()
         {
             InitMicroscopeController();
             InitImageAcquisition();
@@ -527,6 +540,7 @@ namespace Extender
             CloaseXrayAcquistion();
         }
 
+        private IEdSpectrum edSpectrum;
         #region 电镜控制、样品台
         //控制电镜
         private IMicroscopeController microscopeController = null;
@@ -1509,7 +1523,7 @@ namespace Extender
                 edSpectrumAcquisitionController.EndMultipleAcquisition();                
             }
 
-            IEdSpectrum edSpectrum = e.Value;
+            edSpectrum = e.Value;
 
             if (!ReadXrayData(edSpectrum, out m_XrayData, XRayChannelLength))
             {
@@ -1762,5 +1776,13 @@ namespace Extender
 
         #endregion
 
+        public Boolean SaveXrayImageandExcel(string sPath)
+        {
+
+            SpectrumView control_Spectrumview = new SpectrumView(edSpectrum);
+            control_Spectrumview.ExportTiff(sPath);
+            return true;
+        }
     }
+    
 }

+ 3 - 0
ExtenderControl/ExtenderInterface.cs

@@ -161,5 +161,8 @@ namespace Extender
         //面采集
         Boolean XrayAreaCollectiong(double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement);
         void CloseExtender();
+
+        //保存图像数据和表格
+        Boolean SaveXrayImageandExcel(string sPath);
     }
 }

+ 17 - 0
ExtenderControl/HOZExtender.csproj

@@ -43,20 +43,32 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\bin\Debug\OINA.Extender.dll</HintPath>
     </Reference>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xaml" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
+    <Reference Include="UIAutomationProvider" />
+    <Reference Include="WindowsBase" />
+    <Reference Include="WindowsFormsIntegration" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Extender.cs" />
     <Compile Include="ExtenderInterface.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SpectrumView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SpectrumView.Designer.cs">
+      <DependentUpon>SpectrumView.cs</DependentUpon>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <Content Include="C:\Program Files (x86)\Oxford Instruments NanoAnalysis\Extender\apidsp_windows.dll">
@@ -96,6 +108,11 @@
     <None Include="App.config" />
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="SpectrumView.resx">
+      <DependentUpon>SpectrumView.cs</DependentUpon>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>