Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Oct 7, 2023
1 parent 11794f4 commit 2869585
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class FormPeriodicTable : Form
public string[] ExcludesStr => Excludes.Select(i => i.ToString("000")).ToArray();


private readonly List<Button> button = new List<Button>();
private readonly List<Button> button = new();

private readonly Color ExcludeColor = Color.LightCoral;
private readonly Color IncludeColor = Color.LightBlue;
Expand Down
6 changes: 3 additions & 3 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.7.1.0845</AssemblyVersion>
<FileVersion>2023.7.1.0845</FileVersion>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand All @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IronPython" Version="3.4.0" />
<PackageReference Include="IronPython" Version="3.4.1" />
<PackageReference Include="SimdLinq" Version="1.3.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/ScalablePictureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private void pictureBox_MouseDown(object sender, MouseEventArgs e)
_Center = ConvertToSrcPt(e.Location);//イベントを起こさないように小文字のcenterに代入
Zoom *= 0.5f;
}
else if (e.Button == MouseButtons.Left && e.Clicks == 1)
else if ((e.Button == MouseButtons.Left||e.Button== MouseButtons.Middle) && e.Clicks == 1)
{
justBeforePoint = e.Location;
}
Expand Down Expand Up @@ -538,7 +538,7 @@ private void pictureBox_MouseMove(object sender, MouseEventArgs e)
mouseRangeEnd = e.Location;
pictureBox.Refresh();
}
else if (e.Button == MouseButtons.Left && MouseTranslation && justBeforePoint != e.Location)
else if ((e.Button == MouseButtons.Left||e.Button == MouseButtons.Middle) && MouseTranslation && justBeforePoint != e.Location)
{
Center = new PointD(Center.X + (justBeforePoint.X - e.Location.X) / Zoom, Center.Y + (justBeforePoint.Y - e.Location.Y) / Zoom);
justBeforePoint = e.Location;
Expand Down
7 changes: 5 additions & 2 deletions Crystallography/Crystal/ConvertCrystalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private static Crystal2 ConvertFromAmc(string[] str)

var AuthorName = str[n];//著者の名前
n++; if (str.Length <= n) return null;
while (str[n][^1] < '.' || str[n][^1] > '9')
while ((str[n][^1] < '.' || str[n][^1] > '9') && !str[n].Contains("doi.org") && !str[n].Contains("DOI: "))//行の最後の文字が数字ではないとき (ただし、"doi.org"の文字列が存在するときは除外)
{
AuthorName += ", " + str[n];
n++; if (str.Length <= n) return null;
Expand Down Expand Up @@ -522,6 +522,9 @@ private static Crystal2 CellParamForAmc(string str)
return null;
try
{
for (int i = 0; i < 6; i++) if (s[i].EndsWith(',')) s[i] = s[i].TrimEnd(','); //最後に','が入っているときは削除


if (Miscellaneous.IsDecimalPointComma)
for (int i = 0; i < 6; i++) s[i] = s[i].Replace('.', ',');
else
Expand Down Expand Up @@ -561,7 +564,7 @@ private static Crystal2 CellParamForAmc(string str)
else if (SgName == "Im3m") SgName = "Im-3m";
else if (SgName == "Ia3d") SgName = "Ia-3d";

else if (SgName == "I2sub1/a-3") SgName = "Ia3";
else if (SgName == "I2sub1/a-3") SgName = "Ia-3";

else if (SgName == "R-32/c") SgName = "R-3c";

Expand Down
6 changes: 3 additions & 3 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.7.1.0845</AssemblyVersion>
<FileVersion>2023.7.1.0845</FileVersion>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -27,7 +27,7 @@
<PackageReference Include="MemoryPack" Version="1.9.16" />
<PackageReference Include="OpenTK" Version="3.3.3" />
<PackageReference Include="SimdLinq" Version="1.3.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.3" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
</ItemGroup>

<ItemGroup>
Expand Down
36 changes: 18 additions & 18 deletions Crystallography/Detector/Ring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,58 +226,58 @@ public enum ImageTypeEnum
}

//public static WaitDlg wd;
public static Size SrcImgSize = new Size();
public static Size SrcImgSize;

public static double[] R2;
public static List<double> Intensity = new List<double>();
public static List<double> IntensityOriginal = new List<double>();
public static Size SrcImgSizeOriginal = new Size();
public static List<double> Intensity = new();
public static List<double> IntensityOriginal = new();
public static Size SrcImgSizeOriginal;

//バックグラウンド演算で使用
public static List<double> Background = new List<double>();
public static List<double> Background = new();

public static double BackgroundCoeff = 1;

//SequentialImage(*.his,*.h5)で利用する変数
public static List<List<double>> SequentialImageIntensities = new List<List<double>>();
public static List<List<double>> SequentialImageIntensities = new();

public static List<string> SequentialImageNames = new List<string>();
public static List<string> SequentialImageNames = new();

//HDF *h5ファイルでのみに使用する
public static List<double> SequentialImageEnergy = new List<double>();
public static List<double> SequentialImageEnergy = new();

public static List<double> SequentialImagePulsePower = new List<double>();
public static List<double> SequentialImagePulsePower = new();
public static bool PulsePowerNormarized = false;
public static List<List<double>> SequentialImageEnergySpectrum = new List<List<double>>();
public static List<List<double>> SequentialImageEnergySpectrum = new();

public static SortedList<uint, int> Frequency = new SortedList<uint, int>();
public static SortedList<uint, int> Frequency = new();

public static ImageTypeEnum ImageType = ImageTypeEnum.Unknown;

public static List<bool> IsValid = new List<bool>();//有効な(マスクされていない点かどうか)
public static List<bool> IsValid = new ();//有効な(マスクされていない点かどうか)
//public static ParallelQuery<bool> IsValidP;

public static List<bool> IsSpots = new List<bool>();//スポット状の点かどうか
public static List<bool> IsSpots = new ();//スポット状の点かどうか
//public static ParallelQuery<bool> IsSpotsP;

public static List<bool> IsThresholdOver = new List<bool>();
public static List<bool> IsThresholdOver = new ();
//public static ParallelQuery<bool> IsThresholdOverP;

public static List<bool> IsThresholdUnder = new List<bool>();//飽和しているかどうか
public static List<bool> IsThresholdUnder = new ();//飽和しているかどうか
//public static ParallelQuery<bool> IsThresholdUnderP;


/// <summary>
/// 指定された積分領域(矩形、セクター)の範囲外の場合はtrue
/// </summary>
public static List<bool> IsOutsideOfIntegralRegion = new List<bool>();//積分エリアの外(或いは選択領域の外)
public static List<bool> IsOutsideOfIntegralRegion = new();//積分エリアの外(或いは選択領域の外)
//public static ParallelQuery<bool> IsOutsideOfIntegralRegionP;


/// <summary>
/// 指定された積分対象角度の範囲外の場合はtrue
/// </summary>
public static List<bool> IsOutsideOfIntegralProperty = new List<bool>();//エリアの外(或いは選択領域の外)
public static List<bool> IsOutsideOfIntegralProperty = new ();//エリアの外(或いは選択領域の外)
//public static ParallelQuery<bool> IsOutsideOfIntegralPropertyP;


Expand Down Expand Up @@ -361,7 +361,7 @@ public static void CalcFreq()
lock (lockObj)
{
foreach (uint j in freq.Keys)
if (Frequency.ContainsKey(j))
if ( Frequency.ContainsKey(j))
Frequency[j] += freq[j];
else
Frequency.Add(j, freq[j]);
Expand Down
29 changes: 22 additions & 7 deletions Crystallography/Images/ImageIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,15 @@ public static bool HDF5(string str, bool? normarize = null)
else//佐野さんから依頼された検出器
{
(var data_size, _) = hdf.GetValue1<float>(groupID2name + "/detector_2d_1/detector_info/data_scale(XYZT)");
Ring.IP.PixSizeX = data_size[0] * 0.001;
Ring.IP.PixSizeY = data_size[1] * 0.001;
if (data_size != null)
{
Ring.IP.PixSizeX = data_size[0] * 0.001;
Ring.IP.PixSizeY = data_size[1] * 0.001;
}
else
{
Ring.IP.PixSizeX = Ring.IP.PixSizeY = 0.05;
}
}

//tag番号を調べる
Expand All @@ -834,10 +841,11 @@ public static bool HDF5(string str, bool? normarize = null)

(float[][] dataImageRight, _) = hdf.GetValue2<float>($"{groupID2name}/detector_2d_{rightDetector}/{tag[i]}/detector_data");

Ring.SequentialImageIntensities.Add(new List<double>());


if (dataImageLeft != null && dataImageRight != null)
{
Ring.SequentialImageIntensities.Add(new List<double>(imageHeight * imageWidth));
for (int h = 0; h < imageHeight; h++)
{
for (int w = 0; w < imageWidth / 2; w++)
Expand All @@ -849,11 +857,15 @@ public static bool HDF5(string str, bool? normarize = null)
else if (dataImageLeft != null)
{
imageWidth = 512;
Ring.SequentialImageIntensities.Add(new List<double>(imageHeight * imageWidth));

for (int h = 0; h < imageHeight; h++)
for (int w = 0; w < imageWidth; w++)
Ring.SequentialImageIntensities[i].Add(dataImageLeft[h][w]);

}
else
Ring.SequentialImageIntensities.Add(new List<double>());

//強度をノーマライズする場合
if (normarize == null)
normarize = MessageBox.Show("Normarize intensities by pulse power?", "HDF file option", MessageBoxButtons.YesNo) == DialogResult.Yes;
Expand All @@ -863,9 +875,12 @@ public static bool HDF5(string str, bool? normarize = null)

Ring.PulsePowerNormarized = normarize == true;

Ring.Intensity.Clear();
for (int j = 0; j < imageHeight * imageWidth; j++)
Ring.Intensity.Add(Ring.SequentialImageIntensities[0][j]);
if (i == 0)
{
Ring.Intensity.Clear();
for (int j = 0; j < imageHeight * imageWidth; j++)
Ring.Intensity.Add(Ring.SequentialImageIntensities[0][j]);
}

Ring.SequentialImageNames.Add(tag[i].Replace("tag_", ""));
}
Expand Down
20 changes: 12 additions & 8 deletions PDIndexer/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1817,14 +1817,7 @@ private void pictureBoxMain_MouseDown(object sender, System.Windows.Forms.MouseE
Draw();
}

if (e.Button == MouseButtons.Middle)
{
MouseMovingMode = true;
mouseMovingStartPt = pt;
pictureBoxMain.Cursor = Cursors.SizeAll;
return;
}


if (e.Button == MouseButtons.Right)
{
MouseRangingMode = true;
Expand All @@ -1847,7 +1840,18 @@ private void pictureBoxMain_MouseDown(object sender, System.Windows.Forms.MouseE
if (i[0] >= 0)
SelectedMaskingBoundaryIndex = i;
formProfile.SelectedMaskIndex = SelectedMaskingBoundaryIndex[0];
return;
}


if (e.Button == MouseButtons.Middle || e.Button == MouseButtons.Left)
{
MouseMovingMode = true;
mouseMovingStartPt = pt;
pictureBoxMain.Cursor = Cursors.SizeAll;
return;
}

}


Expand Down
4 changes: 2 additions & 2 deletions PDIndexer/PDIndexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.7.1.0845</AssemblyVersion>
<FileVersion>2023.7.1.0845</FileVersion>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
<ApplicationIcon>App.ico</ApplicationIcon>
</PropertyGroup>

Expand Down
Binary file modified PDIndexer/StdDb.cdb3
Binary file not shown.
1 change: 1 addition & 0 deletions PDIndexer/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static public string RecentHistory
/// </summary>
public const string History =
"History" +
"\r\n ver4.441(2023/10/07) Fixed minor bugs." +
"\r\n ver4.441(2023/07/01) Fixed a bug on loading *.pdi2 format files." +
"\r\n ver4.440(2023/05/24) Improved registry read/write.The registry is cleared the first time this version is launched." +
"\r\n ver4.439(2023/05/23) Fixed bugs on loading txt-format profiles." +
Expand Down

0 comments on commit 2869585

Please sign in to comment.