Skip to content

Commit 5dba974

Browse files
committed
update
1 parent a63da90 commit 5dba974

10 files changed

Lines changed: 240 additions & 193 deletions

File tree

Crystallography.Controls/Crystallography.Controls.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<OutputType>Library</OutputType>
55
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
7-
<AssemblyVersion>2025.11.11.0229</AssemblyVersion>
8-
<FileVersion>2025.11.11.0229</FileVersion>
7+
<AssemblyVersion>2025.12.12.0143</AssemblyVersion>
8+
<FileVersion>2025.12.12.0143</FileVersion>
99
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
1010
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
1111
<ApplicationVisualStyles>true</ApplicationVisualStyles>

Crystallography.OpenGL/Crystallography.OpenGL.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<OutputType>Library</OutputType>
55
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
7-
<AssemblyVersion>2025.10.29.0156</AssemblyVersion>
8-
<FileVersion>2025.10.29.0156</FileVersion>
7+
<AssemblyVersion>2025.12.12.0143</AssemblyVersion>
8+
<FileVersion>2025.12.12.0143</FileVersion>
99
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
1010
<Platforms>AnyCPU;x64</Platforms>
1111
<TieredCompilation>false</TieredCompilation>

Crystallography/Crystallography.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<OutputType>Library</OutputType>
55
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
7-
<AssemblyVersion>2025.11.11.0229</AssemblyVersion>
8-
<FileVersion>2025.11.11.0229</FileVersion>
7+
<AssemblyVersion>2025.12.12.0143</AssemblyVersion>
8+
<FileVersion>2025.12.12.0143</FileVersion>
99
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
1010
<Platforms>AnyCPU;x64</Platforms>
1111
<PublishReadyToRun>true</PublishReadyToRun>

Crystallography/Images/DigitalMicrograph.cs

Lines changed: 162 additions & 159 deletions
Large diffs are not rendered by default.

Crystallography/Images/ImageIO.cs

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -470,19 +470,23 @@ public static bool RadIcon(string str)
470470
#region DigitalMicrograph
471471
private static bool DM(string str)
472472
{
473-
try
473+
// try
474474
{
475475
Ring.Comments = "";
476476
var t = new DigitalMicrograph.Loader(str);
477477

478478
double pixelScale = (float)t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Calibrations"].Tag["Dimension"].Tag["0"].Tag["Scale"].Values[0];
479479

480480
double accVol = 200000;
481-
var test = t.Tag["ImageList"].Tag["1"].Tag["ImageTags"].Tag["Microscope Info"].Tag["Voltage"].Values[0];
482-
if (test is float accF)
483-
accVol = (double)accF;
484-
else if (test is double accD)
485-
accVol = accD;
481+
try
482+
{
483+
var test = t.Tag["ImageList"].Tag["1"].Tag["ImageTags"].Tag["Microscope Info"].Tag["Voltage"].Values[0];
484+
if (test is float accF)
485+
accVol = (double)accF;
486+
else if (test is double accD)
487+
accVol = accD;
488+
}
489+
catch { }
486490

487491
var pixelSize = 0.1;
488492
//CCDカメラの場合
@@ -507,17 +511,52 @@ private static bool DM(string str)
507511
int imageWidth = (int)(uint)t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Dimensions"].Tag["0"].Values[0];
508512
int imageHeight = (int)(uint)t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Dimensions"].Tag["1"].Values[0];
509513
Ring.SrcImgSize = new Size(imageWidth, imageHeight);
510-
511-
dynamic intensity;
512-
if (t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values != null && t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values.Length != 0)
514+
515+
var obj = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values;
516+
if (obj != null && obj.Length != 0)
513517
{
514-
object o = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values[0];
515-
if (o.GetType() == typeof(float))
516-
intensity = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values.Select(v => (float)v).ToArray();
517-
else if (o.GetType() == typeof(uint))
518-
intensity = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values.Select(v => (uint)v).ToArray();
519-
else if (o.GetType() == typeof(int))
520-
intensity = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values.Select(v => (int)v).ToArray();
518+
dynamic intensity;
519+
520+
//object o = t.Tag["ImageList"].Tag["1"].Tag["ImageData"].Tag["Data"].Values[0];
521+
if (obj[0].GetType() == typeof(float))
522+
{
523+
if (obj.Length == imageHeight * imageWidth)//実数データの時
524+
intensity = obj.Select(v => (float)v).ToArray();
525+
else //複素数データの時 20251210土山さんメール参照
526+
{
527+
Ring.DigitalMicrographProperty.IsFFT = true;
528+
var tmp1 = obj.Select(v => (float)v).ToArray();
529+
intensity = new double[imageHeight * imageWidth];
530+
531+
for (int i = 0; i < tmp1.Length; i += 2)
532+
{
533+
int row = (i / 2) / (imageWidth / 2 + 1);
534+
int col = (i / 2) % (imageWidth / 2 + 1);
535+
var magnitude = Math.Sqrt(tmp1[i] * tmp1[i] + tmp1[i + 1] * tmp1[i + 1]);
536+
if (col == 0)
537+
intensity[row * imageWidth + imageWidth / 2] = magnitude;
538+
else if (imageWidth % 2 == 0 && col == imageWidth / 2)
539+
intensity[row * imageWidth] = magnitude;
540+
else if (imageHeight % 2 == 0 && row == 0)
541+
{
542+
intensity[imageWidth / 2 + col] = magnitude;
543+
intensity[imageWidth / 2 - col] = magnitude;
544+
}
545+
else
546+
{
547+
intensity[row * imageWidth + imageWidth / 2 + col] = magnitude;
548+
if (imageHeight % 2 == 0)
549+
intensity[(imageHeight - row) * imageWidth + imageWidth / 2 - col] = magnitude;
550+
else
551+
intensity[(imageHeight - row -1) * imageWidth + imageWidth / 2 - col] = magnitude;
552+
}
553+
}
554+
}
555+
}
556+
else if (obj[0].GetType() == typeof(uint))
557+
intensity = obj.Select(v => (uint)v).ToArray();
558+
else if (obj[0].GetType() == typeof(int))
559+
intensity = obj.Select(v => (int)v).ToArray();
521560
else
522561
return false;
523562

@@ -529,11 +568,11 @@ private static bool DM(string str)
529568
//Ring.BitsPerPixels = t.BitsPerSampleGray;
530569
Ring.ImageType = Ring.ImageTypeEnum.DM;
531570
}
532-
catch (Exception e)
533-
{
534-
MessageBox.Show(e.Message);
535-
return false;
536-
}
571+
//catch (Exception e)
572+
//{
573+
// MessageBox.Show(e.Message);
574+
// return false;
575+
//}
537576
return true;
538577
}
539578
#endregion

Crystallography/ProgramUpdates.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using System.Net;
6+
using System.Reflection;
67
using System.Windows.Forms;
78

89
namespace Crystallography;

ReciPro/AMCSD.cdb3

1.32 KB
Binary file not shown.

ReciPro/ReciPro.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
7-
<AssemblyVersion>2025.10.29.0156</AssemblyVersion>
8-
<FileVersion>2025.10.29.0156</FileVersion>
7+
<AssemblyVersion>2025.12.12.0143</AssemblyVersion>
8+
<FileVersion>2025.12.12.0143</FileVersion>
99
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
1010
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1111
<ApplicationIcon>App.ico</ApplicationIcon>

ReciPro/SpotID/FormSpotIDV2.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,16 @@ private void readImage(string fileName)
117117
{//DigitalMicroGraphデータであればスケールの情報などを取得
118118
if (Ring.DigitalMicrographProperty.PixelUnit == LengthUnitEnum.NanoMeterInverse)
119119
{
120-
radioButtonPixelSizeUnitReal.Checked = true;
120+
//radioButtonPixelSizeUnitReal.Checked = true;
121+
//waveLengthControl1.WaveSource = WaveSource.Electron;
122+
//waveLengthControl1.Energy = Ring.DigitalMicrographProperty.AccVoltage / 1000.0;
123+
//PixelSize = Ring.DigitalMicrographProperty.PixelSizeInMicron / 1000.0;
124+
//CameraLength = Ring.DigitalMicrographProperty.PixelSizeInMicron / 1000 / Math.Tan(2 * Math.Asin(waveLengthControl1.WaveLength * Ring.DigitalMicrographProperty.PixelScale / 2));
125+
121126
waveLengthControl1.WaveSource = WaveSource.Electron;
122127
waveLengthControl1.Energy = Ring.DigitalMicrographProperty.AccVoltage / 1000.0;
123-
PixelSize = Ring.DigitalMicrographProperty.PixelSizeInMicron / 1000.0;
124-
CameraLength = Ring.DigitalMicrographProperty.PixelSizeInMicron / 1000 / Math.Tan(2 * Math.Asin(waveLengthControl1.WaveLength * Ring.DigitalMicrographProperty.PixelScale / 2));
125-
//var pixelSize = Ring.DigitalMicrographProperty.PixelSizeInMicron;
126-
//var scale = Ring.DigitalMicrographProperty.PixelScale;
128+
radioButtonPixelSizeUnitInverse.Checked = true;
129+
numericBoxPixelSize.Value = Ring.DigitalMicrographProperty.PixelScale;
127130
}
128131
}
129132
else if (fileName.EndsWith("mrc"))

ReciPro/Version.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal static class Version
77

88
public const string History =
99
"History" +
10+
"\r\n ver4.913(2025/12/12) Fixed bugs on program update and crysta database functions." +
1011
"\r\n ver4.912(2025/12/10) Updated AMCSD database. Improved to run on Windows on ARM64." +
1112
"\r\n ver4.910(2025/11/26) Updated: .Net Desktop Runtime 9 to 10. Fixed minor bugs." +
1213
"\r\n ver4.909(2025/10/29) Fixed a minor bug." +

0 commit comments

Comments
 (0)