소스 검색

加入日志

jeremy 10 달 전
부모
커밋
134c2546b2

+ 113 - 0
URMAnalysis/Program.cs

@@ -0,0 +1,113 @@
+using URMPackage.URM.URMAnalysis;
+using Vinno.Infrastructure;
+
+namespace URMAnalysis
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            // args = new string[] { "E:\\URM\\2.dat", "1,2,128,474", @"D:\WingProjects\HealthExam2024\WingCloudServer\src\bin\Debug\net6.0\URMTemp\abc" };
+            if (args != null && args.Length == 3)
+            {
+                var origialFile = args[0];
+                var pos = args[1];
+                var outputFolder = args[2];
+                if (!Directory.Exists(outputFolder))
+                {
+                    Directory.CreateDirectory(outputFolder);
+                }
+                var readmeFile = Path.Combine(outputFolder, "readme.txt");
+                File.WriteAllText(readmeFile, string.Join("\n", args));
+
+                URMAnalysisProcess _urmAnalysisProcess = null;
+                try
+                {
+                    File.AppendAllLines(readmeFile, new string[] { "", $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess AppendEnvironmentPath" });
+                    AppendEnvironmentPath();
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess AppendEnvironmentPath success" });
+
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess start" });
+                    _urmAnalysisProcess = new URMAnalysisProcess();
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess init success" });
+
+                    bool success = _urmAnalysisProcess.URMAnalysis($"\"UrmDatapath\":\"{origialFile}\",\"VecLens\":\"474\",\"Mlas\":\"128\",\"VectorStartForMid\":\"9\",\"FramesGot\":\"1200\",\"CenterFrequencyMHz\":\"3.8\",\"Prf\":\"10313\",\"Angles\":\"29\",\"SupersonicSpeed\":\"1540\",\"PulseNum\":\"3\",\"FrequencyMin\":\"5\",\"FMUint\":\"MHz\",\"FrameRateDisplay\":\"101.9\",\"FDUnit\":\"Hz\",\"ScaleOfPixel_x\":\"0.212260852677748\",\"ScaleOfPixel_y\":\"0.493506493506494\",\"ULMCount\":\"400\",\"PacketsNum\":\"200\",\"Res\":\"2.5\",\"MaxLinkingDistance\":\"2\",\"MinLength\":\"5\",\"MaxGapClosing\":\"2\",\"LocMethod\":\"radial\",\"ButterCuttofFreqLow\":\"30\",\"NLocalMax\":\"3\",\"SVDCutoffLow\":\"30\",\"Fwhm\":\"3\",\"MOCOYN\":\"0\",\"MOCOLevel\":\"4\",\"MOCOThresh1\":\"0.05\",\"MOCOThresh2\":\"0.05\",\"MOCOThresh3\":\"5\",\"LocaFixmethod\":\"fixgray\",\"LocFixThresh\":\"25\",\"RefNum\":\"1\",\"MotionCorrThresh\":\"0.5\",\"Pos\":\" {pos} \",\"FilterDeci\":\"1\",\"PSFNum\":\"10\",\"PSFCorr\":\"0.5\",\"Depth\":\"0\",\"X0\":\"0\",\"Z0\":\"0\",\"ProbeType\":\"1\",\"Decifactorx\":\"1\",\"Decifactory\":\"1\",\"SizeScan\":\"474\",\"MotionAngleThresh\":\"2\",\"TrackInterpFactor\":\"0.8\"", outputFolder, WriteLog);
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess success:{success}" });
+                    Console.WriteLine($"URMAnalysisProcess result:{success}");
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine($"URMAnalysisProcess error, ex:{ex}");
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess error, ex:{ex}" });
+                }
+                finally
+                {
+                    _urmAnalysisProcess?.Release();
+                    File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] URMAnalysis URMAnalysisProcess finished" });
+                }
+            }
+        }
+
+        private static void WriteLog(string outputFolder, string message)
+        {
+            var readmeFile = Path.Combine(outputFolder, "readme.txt");
+            File.AppendAllLines(readmeFile, new string[] { $"[{DateTime.Now.ToString("HH:mm:ss")}] {message}" });
+        }
+
+        private static void AppendEnvironmentPath()
+        {
+            var privatePath = @"C:\VinnoApp\Depends;C:\VinnoApp\ipp_2018;AIMeasure;AI;Depends;DicomMpeg;Syncfusion;RemoteDiagnosis;vCloud;Test;VFetus";
+            bool enforcePentiumMode = false;
+            string workPathPerCPU = string.Empty;
+            string workPathForGPU = string.Empty;
+            workPathPerCPU = Path.Combine(ServiceManager.RootPath, "NON_PENTIUM");
+
+            privatePath = privatePath + ";" + workPathPerCPU + ";";
+
+            string gpuName = string.Empty;
+
+            workPathForGPU = Path.Combine(ServiceManager.RootPath, "NVIDIA");
+
+            if (!string.IsNullOrEmpty(workPathForGPU))
+            {
+                privatePath = privatePath + workPathForGPU + ";";
+            }
+
+            if (!string.IsNullOrEmpty(privatePath))
+            {
+                string path = Environment.GetEnvironmentVariable("PATH");
+                string newPath = string.Empty;
+                if (path != null)
+                {
+                    string upperPath = path.ToUpper();
+                    var subPathes = privatePath.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
+                    foreach (var subPath in subPathes)
+                    {
+                        VinnoDirectoryInfo dir = null;
+                        if (Path.IsPathRooted(subPath))
+                        {
+                            dir = new VinnoDirectoryInfo(subPath);
+                        }
+                        else
+                        {
+                            dir = new VinnoDirectoryInfo(Path.Combine(ServiceManager.RootPath, subPath));
+                        }
+                        if (dir.Exists)
+                        {
+                            var fullName = dir.FullName;
+                            if (!upperPath.Contains(fullName.ToUpper()))
+                            {
+                                newPath += ";" + fullName;
+                            }
+                        }
+                    }
+
+                    if (!string.IsNullOrEmpty(newPath))
+                    {
+                        Environment.SetEnvironmentVariable("PATH", newPath + ";" + path, EnvironmentVariableTarget.Process);
+                    }
+                }
+            }
+        }
+    }
+}

+ 20 - 0
URMAnalysis/URMAnalysis.csproj

@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\URMPakcage\URMPakcage.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Reference Include="Vinno.Core">
+      <HintPath>..\URMPakcage\libs\Vinno.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+
+</Project>

+ 6 - 0
URMAnalysisFramework/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+    </startup>
+</configuration>

+ 118 - 0
URMAnalysisFramework/Program.cs

@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using URMPackage.URM.URMAnalysis;
+using Vinno.Infrastructure;
+
+namespace URMAnalysisFramework
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            // args = new string[] { "E:\\URM\\2.dat", "1,2,128,474", @"D:\WingProjects\HealthExam2024\WingCloudServer\src\bin\Debug\net6.0\URMTemp\abc" };
+            if (args != null && args.Length == 3)
+            {
+                var origialFile = args[0];
+                var pos = args[1];
+                var outputFolder = args[2];
+                if (!Directory.Exists(outputFolder))
+                {
+                    Directory.CreateDirectory(outputFolder);
+                }
+                var readmeFile = Path.Combine(outputFolder, "readme.txt");
+                File.WriteAllText(readmeFile, string.Join("\n", args));
+
+                URMAnalysisProcess _urmAnalysisProcess = null;
+                try
+                {
+                    File.AppendAllLines(readmeFile, new string[] { "URMAnalysis URMAnalysisProcess AppendEnvironmentPath" });
+                    AppendEnvironmentPath();
+                    File.AppendAllLines(readmeFile, new string[] { "URMAnalysis URMAnalysisProcess AppendEnvironmentPath success" });
+
+                    File.AppendAllLines(readmeFile, new string[] { "URMAnalysis URMAnalysisProcess start" });
+                    _urmAnalysisProcess = new URMAnalysisProcess();
+                    File.AppendAllLines(readmeFile, new string[] { "URMAnalysis URMAnalysisProcess init success" });
+                    bool success = _urmAnalysisProcess.URMAnalysis($"\"UrmDatapath\":\"{origialFile}\",\"VecLens\":\"474\",\"Mlas\":\"128\",\"VectorStartForMid\":\"9\",\"FramesGot\":\"1200\",\"CenterFrequencyMHz\":\"3.8\",\"Prf\":\"10313\",\"Angles\":\"29\",\"SupersonicSpeed\":\"1540\",\"PulseNum\":\"3\",\"FrequencyMin\":\"5\",\"FMUint\":\"MHz\",\"FrameRateDisplay\":\"101.9\",\"FDUnit\":\"Hz\",\"ScaleOfPixel_x\":\"0.212260852677748\",\"ScaleOfPixel_y\":\"0.493506493506494\",\"ULMCount\":\"400\",\"PacketsNum\":\"200\",\"Res\":\"2.5\",\"MaxLinkingDistance\":\"2\",\"MinLength\":\"5\",\"MaxGapClosing\":\"2\",\"LocMethod\":\"radial\",\"ButterCuttofFreqLow\":\"30\",\"NLocalMax\":\"3\",\"SVDCutoffLow\":\"30\",\"Fwhm\":\"3\",\"MOCOYN\":\"0\",\"MOCOLevel\":\"4\",\"MOCOThresh1\":\"0.05\",\"MOCOThresh2\":\"0.05\",\"MOCOThresh3\":\"5\",\"LocaFixmethod\":\"fixgray\",\"LocFixThresh\":\"25\",\"RefNum\":\"1\",\"MotionCorrThresh\":\"0.5\",\"Pos\":\" {pos} \",\"FilterDeci\":\"1\",\"PSFNum\":\"10\",\"PSFCorr\":\"0.5\",\"Depth\":\"0\",\"X0\":\"0\",\"Z0\":\"0\",\"ProbeType\":\"1\",\"Decifactorx\":\"1\",\"Decifactory\":\"1\",\"SizeScan\":\"474\",\"MotionAngleThresh\":\"2\",\"TrackInterpFactor\":\"0.8\"", outputFolder, WriteLog);
+                    File.AppendAllLines(readmeFile, new string[] { $"URMAnalysis URMAnalysisProcess success:{success}" });
+                    Console.WriteLine($"URMAnalysisProcess result:{success}");
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine($"URMAnalysisProcess error, ex:{ex}");
+                    File.AppendAllLines(readmeFile, new string[] { $"URMAnalysis URMAnalysisProcess error, ex:{ex}" });
+                }
+                finally
+                {
+                    _urmAnalysisProcess?.Release();
+                    File.AppendAllLines(readmeFile, new string[] { $"URMAnalysis URMAnalysisProcess finished" });
+                }
+            }
+        }
+
+        private static void WriteLog(string outputFolder, string message)
+        {
+            var readmeFile = Path.Combine(outputFolder, "readme.txt");
+            File.AppendAllLines(readmeFile, new string[] { message });
+        }
+
+        private static void AppendEnvironmentPath()
+        {
+            var privatePath = @"C:\VinnoApp\Depends;C:\VinnoApp\ipp_2018;AIMeasure;AI;Depends;DicomMpeg;Syncfusion;RemoteDiagnosis;vCloud;Test;VFetus";
+            bool enforcePentiumMode = false;
+            string workPathPerCPU = string.Empty;
+            string workPathForGPU = string.Empty;
+            workPathPerCPU = Path.Combine(ServiceManager.RootPath, "NON_PENTIUM");
+
+            privatePath = privatePath + ";" + workPathPerCPU + ";";
+
+            string gpuName = string.Empty;
+
+            workPathForGPU = Path.Combine(ServiceManager.RootPath, "NVIDIA");
+
+            if (!string.IsNullOrEmpty(workPathForGPU))
+            {
+                privatePath = privatePath + workPathForGPU + ";";
+            }
+
+            if (!string.IsNullOrEmpty(privatePath))
+            {
+                string path = Environment.GetEnvironmentVariable("PATH");
+                string newPath = string.Empty;
+                if (path != null)
+                {
+                    string upperPath = path.ToUpper();
+                    var subPathes = privatePath.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
+                    foreach (var subPath in subPathes)
+                    {
+                        VinnoDirectoryInfo dir = null;
+                        if (Path.IsPathRooted(subPath))
+                        {
+                            dir = new VinnoDirectoryInfo(subPath);
+                        }
+                        else
+                        {
+                            dir = new VinnoDirectoryInfo(Path.Combine(ServiceManager.RootPath, subPath));
+                        }
+                        if (dir.Exists)
+                        {
+                            var fullName = dir.FullName;
+                            if (!upperPath.Contains(fullName.ToUpper()))
+                            {
+                                newPath += ";" + fullName;
+                            }
+                        }
+                    }
+
+                    if (!string.IsNullOrEmpty(newPath))
+                    {
+                        Environment.SetEnvironmentVariable("PATH", newPath + ";" + path, EnvironmentVariableTarget.Process);
+                    }
+                }
+            }
+        }
+    }
+}

+ 36 - 0
URMAnalysisFramework/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("URMAnalysisFramework")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("URMAnalysisFramework")]
+[assembly: AssemblyCopyright("Copyright ©  2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("810618d8-b1fc-453d-80bb-e1a1168daba7")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 96 - 0
URMAnalysisFramework/URMAnalysisFramework.csproj

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{810618D8-B1FC-453D-80BB-E1A1168DABA7}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>URMAnalysisFramework</RootNamespace>
+    <AssemblyName>URMAnalysisFramework</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>x64</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>2</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Vinno.Core, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\URMPakcage\libs\Vinno.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\URMPakcage\URMPakcage.csproj">
+      <Project>{9293b9c5-2079-4dec-8ddf-1e4805ed2508}</Project>
+      <Name>URMPakcage</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.8">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.8 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 12 - 0
URMDemo.sln

@@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "URMDemo", "URMDemo\URMDemo.
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "URMPakcage", "URMPakcage\URMPakcage.csproj", "{9293B9C5-2079-4DEC-8DDF-1E4805ED2508}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "URMAnalysis", "URMAnalysis\URMAnalysis.csproj", "{90FE0644-7674-44CB-92A0-C4E9FFD72460}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "URMAnalysisFramework", "URMAnalysisFramework\URMAnalysisFramework.csproj", "{810618D8-B1FC-453D-80BB-E1A1168DABA7}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -21,6 +25,14 @@ Global
 		{9293B9C5-2079-4DEC-8DDF-1E4805ED2508}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9293B9C5-2079-4DEC-8DDF-1E4805ED2508}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{9293B9C5-2079-4DEC-8DDF-1E4805ED2508}.Release|Any CPU.Build.0 = Release|Any CPU
+		{90FE0644-7674-44CB-92A0-C4E9FFD72460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{90FE0644-7674-44CB-92A0-C4E9FFD72460}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{90FE0644-7674-44CB-92A0-C4E9FFD72460}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{90FE0644-7674-44CB-92A0-C4E9FFD72460}.Release|Any CPU.Build.0 = Release|Any CPU
+		{810618D8-B1FC-453D-80BB-E1A1168DABA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{810618D8-B1FC-453D-80BB-E1A1168DABA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{810618D8-B1FC-453D-80BB-E1A1168DABA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{810618D8-B1FC-453D-80BB-E1A1168DABA7}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 81 - 16
URMPakcage/URM/URMAnalysisProcess.cs

@@ -123,7 +123,7 @@ namespace URMPackage.URM.URMAnalysis
         private int AvicolormapLength;
 
 
-        public bool URMAnalysis(string urmFold, string outputFolder)
+        public bool URMAnalysis(string urmFold, string outputFolder, Action<string, string> funWriteLog)
         {
 
             if (urmAnalysis == null)
@@ -132,7 +132,9 @@ namespace URMPackage.URM.URMAnalysis
 
                 return false;
             }
+            funWriteLog.Invoke(outputFolder, "LoadColorBarParams start");
             LoadColorBarParams();
+            funWriteLog.Invoke(outputFolder, "LoadColorBarParams end");
 
             int urmStabilizer = 0;
             MWArray folder = urmFold;
@@ -142,6 +144,7 @@ namespace URMPackage.URM.URMAnalysis
             //}
             //urmStabilizer = (int)_mode.Parameters.GetItem<FloatParameter>(RecordParams.URMStabilizer).Value;
             RecordNativeArray maskArray = new RecordNativeArray(0);
+            funWriteLog.Invoke(outputFolder, $"urmStabilizer:{urmStabilizer}");
             if (urmStabilizer < 2)
             {
                 var MatOuts = new List<float[,]>();
@@ -149,11 +152,14 @@ namespace URMPackage.URM.URMAnalysis
                 var MatOutVels = new List<float[,]>();
                 var PointList = new List<object[,]>();
                 initSrMain = false;
+                funWriteLog.Invoke(outputFolder, $"urmAnalysis.SR_Main start");
                 var results = (MWCellArray)urmAnalysis.SR_Main(folder);
+                funWriteLog.Invoke(outputFolder, $"urmAnalysis.SR_Main end");
                 object[,] resultArrays = (object[,])results.ToArray();
                 int packets = resultArrays.GetLength(1);
                 for (int i = 0; i < packets; i++)
                 {
+                    funWriteLog.Invoke(outputFolder, $"packets1:{i}/{packets}");
                     object[,,] curresult = (object[,,])resultArrays[0, i];
                     float[,] curMat = (float[,])curresult[0, 0, 0];
                     float[,] curMatdir = (float[,])curresult[1, 0, 0];
@@ -200,14 +206,16 @@ namespace URMPackage.URM.URMAnalysis
                     PointList.Add(curPoints);
 
                 }
+                funWriteLog.Invoke(outputFolder, $"packets1 end");
                 RecordNativeArray matout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
                 RecordNativeArray matdirout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
                 RecordNativeArray matvelout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
-                Console.WriteLine("Akio:_urmBeams is {0},_urmSamples is {1},packets is {2}", _urmwidth, _urmheight, packets);
+                // Console.WriteLine("Akio:_urmBeams is {0},_urmSamples is {1},packets is {2}", _urmwidth, _urmheight, packets);
                 long nativelength = (long)_urmwidth * (long)_urmheight * 4L * (long)packets;
                 NativeArray matOutNatveArray = new NativeArray(nativelength);
                 NativeArray matOutDirNatveArray = new NativeArray(nativelength);
                 NativeArray matOutVelNatveArray = new NativeArray(nativelength);
+                funWriteLog.Invoke(outputFolder, $"unsafe 1");
                 unsafe
                 {
                     float* matOutNatveArrayPtr = (float*)matOutNatveArray.Start.ToPointer();
@@ -215,6 +223,7 @@ namespace URMPackage.URM.URMAnalysis
                     float* matOutVelNatveArrayPtr = (float*)matOutVelNatveArray.Start.ToPointer();
                     for (int i = 0; i < packets; i++)
                     {
+                        funWriteLog.Invoke(outputFolder, $"packets2:{i}/{packets}");
                         float* curmatOutNatveArrayPtr = matOutNatveArrayPtr + (long)i * (_urmwidth * _urmheight);
                         float* curmatOutDirNatveArrayPtr = matOutDirNatveArrayPtr + (long)i * (_urmwidth * _urmheight);
                         float* curmatOutVelNatveArrayPtr = matOutVelNatveArrayPtr + (long)i * (_urmwidth * _urmheight);
@@ -237,14 +246,17 @@ namespace URMPackage.URM.URMAnalysis
                             }
                         }
                     }
+                    funWriteLog.Invoke(outputFolder, $"packets2 end");
                     MatOuts.Clear();
                     MatOutDirs.Clear();
                     MatOutVels.Clear();
 
 
 
+                    funWriteLog.Invoke(outputFolder, $"PIA_URMGetLastResultFromPackets start");
                     PIA_URMGetLastResultFromPackets(_handle, matOutNatveArray.Start, matOutDirNatveArray.Start, matOutVelNatveArray.Start, packets, _urmwidth,
                             _urmheight, matout.Start, matdirout.Start, matvelout.Start);
+                    funWriteLog.Invoke(outputFolder, $"PIA_URMGetLastResultFromPackets end");
 
                     matOutNatveArray.Dispose();
                     matOutDirNatveArray.Dispose();
@@ -254,40 +266,51 @@ namespace URMPackage.URM.URMAnalysis
                     SrcHeight = _urmheight;
                     srcArray?.Dispose();
                     srcArray = new NativeArray(SrcWidth * SrcHeight * 8);
+                    funWriteLog.Invoke(outputFolder, $"NativeArray init end");
                     unsafe
                     {
+                        funWriteLog.Invoke(outputFolder, $"unsafe srcArray");
                         double* img = (double*)srcArray.Start.ToPointer();
                         double* matSrc = (double*)matout.Start.ToPointer();
+                        funWriteLog.Invoke(outputFolder, $"SrcWidth * SrcHeight 1:{SrcWidth * SrcHeight}");
                         for (int i = 0; i < SrcWidth * SrcHeight; i++)
                         {
                             img[i] = matSrc[i];
                         }
                     }
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArray.bin start");
                     WriteArrayToFile(Path.Combine(outputFolder, "./srcArray.bin"), srcArray, SrcWidth * SrcHeight);
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArray.bin end");
                     srcArraydir?.Dispose();
                     srcArraydir = new NativeArray(SrcWidth * SrcHeight * 8);
                     unsafe
                     {
                         double* img = (double*)srcArraydir.Start.ToPointer();
                         double* matSrc = (double*)matdirout.Start.ToPointer();
+                        funWriteLog.Invoke(outputFolder, $"SrcWidth * SrcHeight 2:{SrcWidth * SrcHeight}");
                         for (int i = 0; i < SrcWidth * SrcHeight; i++)
                         {
                             img[i] = matSrc[i];
                         }
                     }
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArraydir.bin start");
                     WriteArrayToFile(Path.Combine(outputFolder, "./srcArraydir.bin"), srcArraydir, SrcWidth * SrcHeight);
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArraydir.bin end");
                     srcArrayvel?.Dispose();
                     srcArrayvel = new NativeArray(SrcWidth * SrcHeight * 8);
                     unsafe
                     {
                         double* img = (double*)srcArrayvel.Start.ToPointer();
                         double* matSrc = (double*)matvelout.Start.ToPointer();
+                        funWriteLog.Invoke(outputFolder, $"SrcWidth * SrcHeight 3:{SrcWidth * SrcHeight}");
                         for (int i = 0; i < SrcWidth * SrcHeight; i++)
                         {
                             img[i] = matSrc[i];
                         }
                     }
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArrayvel.bin start");
                     WriteArrayToFile(Path.Combine(outputFolder, "./srcArrayvel.bin"), srcArrayvel, SrcWidth * SrcHeight);
+                    funWriteLog.Invoke(outputFolder, $"WriteArrayToFile srcArrayvel.bin end");
 
                     //_urmModeRecord.SetParameter(RecordParams.URMDenArray, matout, TimeStamp.ErrorTime);
                     //_urmModeRecord.SetParameter(RecordParams.URMDirArray, matdirout, TimeStamp.ErrorTime);
@@ -304,10 +327,12 @@ namespace URMPackage.URM.URMAnalysis
                 //List<URMPoint> pointsList = new List<URMPoint>();
                 for (int i = 0; i < aviFrames; i++)
                 {
+                    funWriteLog.Invoke(outputFolder, $"aviFrames:{i}/{aviFrames}");
                     int PointNum = 0;
                     List<SrPoint> curPointsList = new List<SrPoint>();
                     for (int j = 0; j < PointList.Count; j++)
                     {
+                        funWriteLog.Invoke(outputFolder, $"PointList:{j}/{PointList.Count}");
                         object[,] curpointArray = PointList[j];
                         if (curpointArray[0, i] is double[,])
                         {
@@ -361,6 +386,7 @@ namespace URMPackage.URM.URMAnalysis
             else
             {
 
+                funWriteLog.Invoke(outputFolder, $"urmAnalysis.SR_Main:start");
                 var result = (MWStructArray)urmAnalysis.SR_Main(folder);
                 var MatOut = (MWNumericArray)result.GetField("MatOut");
                 var MatOut_zdir = (MWNumericArray)result.GetField("MatOut_zdir");
@@ -385,6 +411,7 @@ namespace URMPackage.URM.URMAnalysis
                 double[,] MatOutVelArray = (double[,])MatOut_vel.ToArray();
                 _urmwidth = MatOutArray.GetLength(1);
                 _urmheight = MatOutArray.GetLength(0);
+                funWriteLog.Invoke(outputFolder, $"RecordNativeArray:start");
                 RecordNativeArray matout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
                 RecordNativeArray matdirout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
                 RecordNativeArray matvelout = new RecordNativeArray(_urmwidth * _urmheight * sizeof(double));
@@ -397,8 +424,10 @@ namespace URMPackage.URM.URMAnalysis
                     byte* maskArrayPtr = (byte*)maskArray.Start.ToPointer();
                     for (int i = 0; i < _urmheight; i++)
                     {
+                        funWriteLog.Invoke(outputFolder, $"_urmheight:{i}/{_urmheight}");
                         for (int j = 0; j < _urmwidth; j++)
                         {
+                            funWriteLog.Invoke(outputFolder, $"_urmwidth:{j}/{_urmwidth}");
                             var vel = MatOutArray[i, j];
                             matOutNatveArrayPtr[j + i * _urmwidth] = vel;
                             var veldir = MatOutDirArray[i, j];
@@ -417,11 +446,13 @@ namespace URMPackage.URM.URMAnalysis
                 int[] PointNumList = new int[aviFrames];
                 for (int i = 0; i < aviFrames; i++)
                 {
+                    funWriteLog.Invoke(outputFolder, $"aviFrames2:{i}/{aviFrames}");
 
                     float[,] CurPointsArray = (float[,])pointArray[0, i];
                     var curPointsCount = CurPointsArray.GetLength(0);
                     for (int k = 0; k < curPointsCount; k++)
                     {
+                        funWriteLog.Invoke(outputFolder, $"curPointsCount2:{k}/{curPointsCount}");
                         //URMPoint curPoint = new URMPoint();
                         //curPoint.X = CurPointsArray[k, 0];
                         //curPoint.Y = CurPointsArray[k, 1];
@@ -460,9 +491,12 @@ namespace URMPackage.URM.URMAnalysis
 
             double tempmax = 0;
             double tempmin = 0;
+            funWriteLog.Invoke(outputFolder, $"NativeArray48 start");
             NativeArray dstArray = new NativeArray(4 * dstwidth * dstheight);
             NativeArray dstArrayu = new NativeArray(8 * dstwidth * dstheight); //需要保存的原始八位数据
+            funWriteLog.Invoke(outputFolder, $"GetSRColorMap start");
             GetSRColorMap(DensityColorParam.ColorMap, ref Densitycolormap, out Densitycolormaplength);
+            funWriteLog.Invoke(outputFolder, $"GetSRColorMap end");
 
             var srParams = new SrParams();
             srParams.Res = 1;
@@ -470,48 +504,68 @@ namespace URMPackage.URM.URMAnalysis
             srParams.ScaleOfPixel_y = temp_ScaleOfPixel_y;
             srParams.DownsampleIndex = 1;
 
+            funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SetSrParam start");
             URMAnalysisProcessV1.PIA_SetSrParam(_handle_v1, srParams);
+            funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SetSrParam end");
 
 
             try
             {
+                funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SRGetDensityImg start");
                 bool success = URMAnalysisProcessV1.PIA_SRGetDensityImg(_handle_v1, srcArray.Start, srcwidth, srcheight, dstArray.Start, dstArrayu.Start, dstwidth, dstheight, Densitycolormap.Start, Densitycolormaplength, lambda1, ref tempmax, ref tempmin, 1);
-                Console.WriteLine("PIA_SRGetDensityImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SRGetDensityImg end");
+
+                // Console.WriteLine("PIA_SRGetDensityImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"SaveDstImg.den start");
                 SaveDstImg(dstwidth, dstheight, dstArray, "den", outputFolder);
+                funWriteLog.Invoke(outputFolder, $"SaveDstImg.den end");
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             /// Direction
             var DirectionColorParam = srColorBarParams["Direction"];
+            funWriteLog.Invoke(outputFolder, $"GetSRColorMap Directioncolormap Directioncolormaplength start");
             GetSRColorMap(DirectionColorParam.ColorMap, ref Directioncolormap, out Directioncolormaplength);
+            funWriteLog.Invoke(outputFolder, $"GetSRColorMap Directioncolormap Directioncolormaplength end");
             dstArrayu = new NativeArray(dstwidth * dstheight);
             try
             {
+                funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SRGetDirectionImg 123 start");
                 bool success = URMAnalysisProcessV1.PIA_SRGetDirectionImg(_handle_v1, srcArraydir.Start, srcArray.Start, srcwidth, srcheight, dstArray.Start, dstArrayu.Start, dstwidth, dstheight, Directioncolormap.Start, Directioncolormaplength, lambda1, ref tempmax, ref tempmin, 5);
-                Console.WriteLine("PIA_SRGetDirectionImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"URMAnalysisProcessV1.PIA_SRGetDirectionImg 123 end");
+                // Console.WriteLine("PIA_SRGetDirectionImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"SaveDstImg。dir 123 start");
                 SaveDstImg(dstwidth, dstheight, dstArray, "dir", outputFolder);
+                funWriteLog.Invoke(outputFolder, $"SaveDstImg。dir 123 end");
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             /// Vel
             var VelColorParam = srColorBarParams["Vel"];
+            funWriteLog.Invoke(outputFolder, $"1");
             GetSRColorMap(VelColorParam.ColorMap, ref Velcolormap, out Velcolormaplength);
+            funWriteLog.Invoke(outputFolder, $"2");
             dstArrayu = new NativeArray(8 * dstwidth * dstheight);
+            funWriteLog.Invoke(outputFolder, $"3");
             try
             {
+                funWriteLog.Invoke(outputFolder, $"4");
                 bool success = URMAnalysisProcessV1.PIA_SRGetVelImg(_handle_v1, srcArrayvel.Start, srcArray.Start, srcwidth, srcheight, dstArray.Start, dstArrayu.Start, dstwidth, dstheight, Velcolormap.Start, Velcolormaplength, lambda1, ref tempmax, ref tempmin, 1);
-                Console.WriteLine("PIA_SRGetVelImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"5");
+                // Console.WriteLine("PIA_SRGetVelImg: " + success);
+                funWriteLog.Invoke(outputFolder, $"6");
                 SaveDstImg(dstwidth, dstheight, dstArray, "vel", outputFolder);
+                funWriteLog.Invoke(outputFolder, $"7");
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             // 生成 avi
@@ -520,7 +574,9 @@ namespace URMPackage.URM.URMAnalysis
             //int dstheightback = (int)(srcheight * srParams.DownsampleIndexVideo / srParams.Res + 0.5);
             int dstwidthback = srcwidth;
             int dstheightback = srcheight;
+            funWriteLog.Invoke(outputFolder, $"8");
             URMAnalysisProcessV1.PIA_CalBackgroundImg(_handle_v1, srcArray.Start, srcArraydir.Start, srcwidth, srcheight, dstwidthback, dstheightback);
+            funWriteLog.Invoke(outputFolder, $"9");
             int aviwidth = srcwidth;
             int aviheight = srcheight;
             aviwidth += (aviwidth % 2);
@@ -528,13 +584,16 @@ namespace URMPackage.URM.URMAnalysis
 
             int[] pointlengths = analysisDataPointNumList;
             var frams = pointlengths.Length;
+            funWriteLog.Invoke(outputFolder, $"10");
             NativeArray dstMats = new NativeArray((long)aviheight * aviwidth * 4 * frams);//所有的图都保存在这个段内存中
+            funWriteLog.Invoke(outputFolder, $"11");
             unsafe
             {
                 SrPoint*[] DrawPoints = new SrPoint*[frams];
                 List<List<SrPoint>> CombPoints = analysisDataPointNumListPoints;
                 for (int i = 0; i < frams; i++)
                 {
+                    funWriteLog.Invoke(outputFolder, $"12 {i}/{frams}");
                     SrPoint[] curPoints = CombPoints[i].ToArray();
                     if (curPoints == null || curPoints.Length == 0)
                     {
@@ -549,14 +608,18 @@ namespace URMPackage.URM.URMAnalysis
                     }
                 }
 
+                funWriteLog.Invoke(outputFolder, $"13");
                 fixed (SrPoint** AllPointsPtr = &DrawPoints[0])
                 {
                     fixed (int* pointlengthsptr = &pointlengths[0])
                     {
                         var AviColorParam = srColorBarParams["SRAvi"];
+                        funWriteLog.Invoke(outputFolder, $"14");
                         GetSRColorMap(AviColorParam.ColorMap, ref Avicolormap, out AvicolormapLength);
+                        funWriteLog.Invoke(outputFolder, $"15");
                         URMAnalysisProcessV1.PIA_CalSrAvi(_handle_v1, AllPointsPtr, frams, pointlengthsptr, dstMats.Start, aviwidth,
                             aviheight, Avicolormap.Start, AvicolormapLength);
+                        funWriteLog.Invoke(outputFolder, $"16");
                     }
                 }
             }
@@ -564,9 +627,11 @@ namespace URMPackage.URM.URMAnalysis
             var aviframesize = aviwidth * aviheight * 4;
             var curptr = dstMats.Start;
             // 获取当前时间戳
+            funWriteLog.Invoke(outputFolder, $"17");
             string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");
             for (var i = 0; i < frams; i++)
             {
+                funWriteLog.Invoke(outputFolder, $"18 {i}/{frams}");
                 var curMatptr = curptr;
                 SaveDstImgByPtr(aviwidth, aviheight, curMatptr, i.ToString(), outputFolder);
                 curptr = curMatptr + aviframesize;
@@ -589,7 +654,7 @@ namespace URMPackage.URM.URMAnalysis
             lambda = 0.4;
             if (!File.Exists("./srcArray.bin"))
             {
-                Console.WriteLine("Error: File not found - " + "srcArray.bin");
+                // Console.WriteLine("Error: File not found - " + "srcArray.bin");
                 return false;
             }
             srcArray = ReadArrayFromFile("./srcArray.bin", SrcWidth * SrcHeight);
@@ -636,12 +701,12 @@ namespace URMPackage.URM.URMAnalysis
                 byte[] dstMatu = new byte[8 * dstwidth * dstheight];
                 Marshal.Copy(dstArrayu.Start, dstMatu, 0, 8 * dstwidth * dstheight);
                 WriteByteArrayToFile("./urmMeasureData.bin", dstMatu);
-                Console.WriteLine("PIA_SRGetDensityImg: " + success);
+                // Console.WriteLine("PIA_SRGetDensityImg: " + success);
                 SaveDstImg(dstwidth, dstheight, dstArray, "den", outputFolder);
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             /// Direction
@@ -651,12 +716,12 @@ namespace URMPackage.URM.URMAnalysis
             try
             {
                 bool success = URMAnalysisProcessV1.PIA_SRGetDirectionImg(_handle_v1, srcArraydir.Start, srcArray.Start, srcwidth, srcheight, dstArray.Start, dstArrayu.Start, dstwidth, dstheight, Directioncolormap.Start, Directioncolormaplength, lambda1, ref tempmax, ref tempmin, 5);
-                Console.WriteLine("PIA_SRGetDirectionImg: " + success);
+                // Console.WriteLine("PIA_SRGetDirectionImg: " + success);
                 SaveDstImg(dstwidth, dstheight, dstArray, "dir", outputFolder);
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             /// Vel
@@ -666,12 +731,12 @@ namespace URMPackage.URM.URMAnalysis
             try
             {
                 bool success = URMAnalysisProcessV1.PIA_SRGetVelImg(_handle_v1, srcArrayvel.Start, srcArray.Start, srcwidth, srcheight, dstArray.Start, dstArrayu.Start, dstwidth, dstheight, Velcolormap.Start, Velcolormaplength, lambda1, ref tempmax, ref tempmin, 1);
-                Console.WriteLine("PIA_SRGetVelImg: " + success);
+                // Console.WriteLine("PIA_SRGetVelImg: " + success);
                 SaveDstImg(dstwidth, dstheight, dstArray, "vel", outputFolder);
             }
             catch (Exception e)
             {
-                Console.WriteLine("An error occurred: " + e.Message);
+                // Console.WriteLine("An error occurred: " + e.Message);
             }
 
             // 生成 avi
@@ -826,7 +891,7 @@ namespace URMPackage.URM.URMAnalysis
                 {
                     // 将数据编码为Base64字符串并打印
                     var base64String = Convert.ToBase64String(data.ToArray());
-                    Console.WriteLine(base64String);
+                    // Console.WriteLine(base64String);
                     // 获取当前时间戳
                     string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");