From 499e868fd9c5f6e58671ce63a73c7ca700749a79 Mon Sep 17 00:00:00 2001 From: seto Date: Tue, 15 Dec 2020 16:03:31 +0900 Subject: [PATCH] update --- .../Properties/AssemblyInfo.cs | 4 +- Crystallography/Properties/AssemblyInfo.cs | 4 +- IPAnalyzer/FormMain.Designer.cs | 27 +- IPAnalyzer/FormMain.cs | 2625 ++++++++--------- IPAnalyzer/FormMain.resx | 1317 ++++----- IPAnalyzer/FormSaveImage.Designer.cs | 24 +- IPAnalyzer/IPAnalyzer.csproj | 24 +- IPAnalyzer/Properties/AssemblyInfo.cs | 4 +- 8 files changed, 1990 insertions(+), 2039 deletions(-) diff --git a/Crystallography.Controls/Properties/AssemblyInfo.cs b/Crystallography.Controls/Properties/AssemblyInfo.cs index d3f0da1..15ff9b0 100644 --- a/Crystallography.Controls/Properties/AssemblyInfo.cs +++ b/Crystallography.Controls/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2020.12.11.0535")] -[assembly: AssemblyFileVersion("2020.12.11.0535")] \ No newline at end of file +[assembly: AssemblyVersion("2020.12.14.1152")] +[assembly: AssemblyFileVersion("2020.12.14.1152")] \ No newline at end of file diff --git a/Crystallography/Properties/AssemblyInfo.cs b/Crystallography/Properties/AssemblyInfo.cs index 4c9d93d..abaa836 100644 --- a/Crystallography/Properties/AssemblyInfo.cs +++ b/Crystallography/Properties/AssemblyInfo.cs @@ -26,7 +26,7 @@ // ɂ悤ɁA'*' gāAׂĂ̒lw肷邩A // rhуrWԍlɂ邱Ƃł܂B -[assembly: AssemblyVersion("2020.12.11.0535")] +[assembly: AssemblyVersion("2020.12.14.1152")] // // AZuɏɂ́AgpL[w肵Ȃ΂Ȃ܂B @@ -57,5 +57,5 @@ [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] [assembly: ComVisibleAttribute(true)] -[assembly: AssemblyFileVersion("2020.12.11.0535")] +[assembly: AssemblyFileVersion("2020.12.14.1152")] diff --git a/IPAnalyzer/FormMain.Designer.cs b/IPAnalyzer/FormMain.Designer.cs index 5f599da..a8b9d2e 100644 --- a/IPAnalyzer/FormMain.Designer.cs +++ b/IPAnalyzer/FormMain.Designer.cs @@ -188,6 +188,7 @@ private void InitializeComponent() this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemReadMask = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemSaveMask = new System.Windows.Forms.ToolStripMenuItem(); + this.clearMaskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -235,7 +236,6 @@ private void InitializeComponent() this.helpProvider = new System.Windows.Forms.HelpProvider(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.process1 = new System.Diagnostics.Process(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.RightToolStripPanel.SuspendLayout(); @@ -300,8 +300,8 @@ private void InitializeComponent() // toolStripContainer1.TopToolStripPanel // this.toolStripContainer1.TopToolStripPanel.BackColor = System.Drawing.SystemColors.Control; - this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip); + this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2); this.helpProvider.SetShowHelp(this.toolStripContainer1.TopToolStripPanel, ((bool)(resources.GetObject("toolStripContainer1.TopToolStripPanel.ShowHelp")))); // // statusStrip1 @@ -1133,7 +1133,7 @@ private void InitializeComponent() // this.resetToolStripMenuItem.Name = "resetToolStripMenuItem"; resources.ApplyResources(this.resetToolStripMenuItem, "resetToolStripMenuItem"); - this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click); + this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetBackgroundToolStripMenuItem_Click); // // toolStripMenuItem4 // @@ -1314,7 +1314,6 @@ private void InitializeComponent() resources.GetString("toolStripComboBoxManualSpotSize.Items7"), resources.GetString("toolStripComboBoxManualSpotSize.Items8")}); this.toolStripComboBoxManualSpotSize.Name = "toolStripComboBoxManualSpotSize"; - this.toolStripComboBoxManualSpotSize.Paint += new System.Windows.Forms.PaintEventHandler(this.toolStripComboBoxManualSpotSize_Paint); this.toolStripComboBoxManualSpotSize.TextChanged += new System.EventHandler(this.toolStripComboBoxManualSpotSize_TextChanged); // // toolStripSeparator2 @@ -1504,6 +1503,7 @@ private void InitializeComponent() this.toolStripSeparator13, this.toolStripMenuItemReadMask, this.toolStripMenuItemSaveMask, + this.clearMaskToolStripMenuItem, this.toolStripSeparator4, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; @@ -1576,6 +1576,12 @@ private void InitializeComponent() resources.ApplyResources(this.toolStripMenuItemSaveMask, "toolStripMenuItemSaveMask"); this.toolStripMenuItemSaveMask.Click += new System.EventHandler(this.toolStripMenuItemSaveMask_Click); // + // clearMaskToolStripMenuItem + // + this.clearMaskToolStripMenuItem.Name = "clearMaskToolStripMenuItem"; + resources.ApplyResources(this.clearMaskToolStripMenuItem, "clearMaskToolStripMenuItem"); + this.clearMaskToolStripMenuItem.Click += new System.EventHandler(this.clearMaskToolStripMenuItem_Click); + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; @@ -1890,17 +1896,6 @@ private void InitializeComponent() // this.toolTip.IsBalloon = true; // - // process1 - // - this.process1.StartInfo.Domain = ""; - this.process1.StartInfo.LoadUserProfile = false; - this.process1.StartInfo.Password = null; - this.process1.StartInfo.StandardErrorEncoding = null; - this.process1.StartInfo.StandardOutputEncoding = null; - this.process1.StartInfo.UserName = ""; - this.process1.SynchronizingObject = this; - this.process1.Exited += new System.EventHandler(this.process1_Exited); - // // FormMain // this.AllowDrop = true; @@ -2142,7 +2137,6 @@ private void InitializeComponent() private Label label21; private Label label15; private TextBox textBoxStatisticsSelectedAreaSequential; - private System.Diagnostics.Process process1; private ToolStripMenuItem macroToolStripMenuItem; private ToolStripMenuItem editorToolStripMenuItem; private ToolStripSeparator toolStripSeparator27; @@ -2164,6 +2158,7 @@ private void InitializeComponent() private ToolStripSeparator toolStripSeparator29; private TrackBarAdvanced trackBarAdvancedMinInt; private TrackBarAdvanced trackBarAdvancedMaxInt; + private ToolStripMenuItem clearMaskToolStripMenuItem; //private ScalablePictureBox scalablePictureBox; diff --git a/IPAnalyzer/FormMain.cs b/IPAnalyzer/FormMain.cs index 98f5193..ad46a71 100644 --- a/IPAnalyzer/FormMain.cs +++ b/IPAnalyzer/FormMain.cs @@ -1,14 +1,10 @@ using System; using System.Drawing; -using System.Collections; -using System.ComponentModel; using System.Windows.Forms; -using System.Data; using System.IO; using System.Text; using System.Drawing.Imaging; using System.Drawing.Drawing2D; -using System.Runtime.InteropServices; using System.Threading; using Crystallography; using Crystallography.Controls; @@ -17,7 +13,6 @@ using System.Linq; using System.Reflection; using IronPython.Hosting; -using System.Threading.Tasks; using System.Numerics; using System.Diagnostics; using System.Net; @@ -27,7 +22,7 @@ namespace IPAnalyzer /// /// Form1 の概要の説明です。 /// - public partial class FormMain : System.Windows.Forms.Form + public partial class FormMain : Form { #region プロパティ、フィールド public bool IsFlatPanelMode => FormProperty.radioButtonFlatPanel.Checked; @@ -113,9 +108,13 @@ public bool SequentialImageMode //public string ImageFilterString = "FujiBAS2000/2500; R-AXIS4/5; ITEX; Bruker CCD; IP Display; IPAimage; Fuji FDL; Rayonix; Marresearch; Perkin Elmer; ADSC; RadIcon; general image" // + "|*.img;*.stl;*.ccd;*.ipf;*.ipa;*.0???;*.gel;*.osc;*.mar*;*.mccd; *.his; *.h5; *.raw; *.bmp;*.jpg;*.tif"; - + double maxIntensity = uint.MinValue; + double sumOfIntensity = 0; + double sumOfSquare = 0; + double variance = 0; #endregion + #region コンストラクタ、ロード、クローズ public FormMain() { ip = new Progress<(long, long, long, string)>(o => reportProgress(o));//IReport @@ -133,12 +132,11 @@ public FormMain() InitializeComponent(); - + //splitContainer2.SplitterDistance = scalablePictureBoxThumbnail.Height + splitContainer2.SplitterDistance - scalablePictureBoxThumbnail.Width; } - #region フォームロード&クローズ public void SaveRegistry() { @@ -877,7 +875,6 @@ private void FormMain_FormClosing(object sender, FormClosingEventArgs e) #endregion - #region 描画関数 private void scalablePictureBox_Draw() {//scalablePictureBoxから描画要求が出されたとき @@ -1104,8 +1101,6 @@ private void DrawThumnail() #endregion - - //ここよりピクチャーボックスのマウスイベント関係 #region マウスイベント //マウスボタンダウン @@ -1573,6 +1568,7 @@ private bool scalablePictureBox_MouseWheel2(object sender, MouseEventArgs e, Poi #endregion + #region リサイズ イベント public void FormMain_Resize(object sender, System.EventArgs e) { Draw(); @@ -1582,6 +1578,7 @@ private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) { FormMain_Resize(new object(), new EventArgs()); } + #endregion #region 輝度調節関係 public bool SkipMax = false; @@ -1630,52 +1627,6 @@ private bool trackBarAdvancedMinInt_ValueChanged(object sender, double value) return true; } - - - /* - //TrackBarpseudBitmap.MaxValueスクロール時 - private void trackBarMaxInt_Scroll(object sender, System.EventArgs e) - { - if (!IsImageReady || SkipMax) return; - SkipMax = true; - numericUpDownMaxInt.Value = (int)Math.Pow((double)numericUpDownMaxInt.Maximum, (double)trackBarMaxInt.Value / (double)trackBarMaxInt.Maximum); - pseudoBitmap.MaxValue = (uint)numericUpDownMaxInt.Value; - if (pseudoBitmap.MaxValue <= pseudoBitmap.MinValue) - numericUpDownMinInt.Value = numericUpDownMaxInt.Value - 1; - - if (graphControlFrequency.LineList != null && graphControlFrequency.LineList.Length == 2) - { - graphControlFrequency.LineList[graphControlFrequency.LineList[0].X < graphControlFrequency.LineList[1].X ? 1 : 0].X = (double)numericUpDownMaxInt.Value; - graphControlFrequency.Draw(); - } - - SkipMax = false; - - Draw(); - - } - //TrackBarpseudBitmap.MinValueスクロール時 - private void trackBarMinInt_Scroll(object sender, System.EventArgs e) - { - if (!IsImageReady || SkipMin) return; - SkipMin = true; - numericUpDownMinInt.Value = (int)Math.Pow((double)numericUpDownMinInt.Maximum, (double)trackBarMinInt.Value / (double)trackBarMinInt.Maximum); - pseudoBitmap.MinValue = (uint)numericUpDownMinInt.Value; - if (pseudoBitmap.MaxValue <= pseudoBitmap.MinValue) - numericUpDownMaxInt.Value = numericUpDownMinInt.Value + 1; - - if (graphControlFrequency.LineList != null && graphControlFrequency.LineList.Length == 2) - { - graphControlFrequency.LineList[graphControlFrequency.LineList[0].X < graphControlFrequency.LineList[1].X ? 0 : 1].X = (double)numericUpDownMinInt.Value; - graphControlFrequency.Draw(); - } - - SkipMin = false; - - Draw(); - } - */ - //AutoAdjustボタンクリック時 public void buttonAutoLevel_Click(object sender, System.EventArgs e) { @@ -1701,6 +1652,7 @@ private void buttonReset_Click(object sender, System.EventArgs e) } #endregion + #region ドラッグドロップ private void FormMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) @@ -1740,18 +1692,26 @@ private void FormMain_DragDrop(object sender, DragEventArgs e) } } + #endregion - //ここよりメニューアイテム ファイル + #region File メニュー イメージの読み書き public int filterIndex; public string initialImageDirectory = ""; + + /// + /// Read Image ボタン + /// + /// + /// private void readImageToolStripMenuItem_Click(object sender, EventArgs e) { - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = ImageIO.FilterString; + var dlg = new OpenFileDialog { Filter = ImageIO.FilterString }; + + dlg.FilterIndex = filterIndex; + if (initialImageDirectory != "") dlg.InitialDirectory = initialImageDirectory; - dlg.FilterIndex = filterIndex; if (dlg.ShowDialog() == DialogResult.OK) { @@ -1762,6 +1722,11 @@ private void readImageToolStripMenuItem_Click(object sender, EventArgs e) } delegate void ReadImageCallBack(string str, bool? flag = null); + /// + /// 画像を読み込む + /// + /// + /// public void ReadImage(string str, bool? flag = null) { if (str != "ClipBoard.ipa" && !File.Exists(str)) return; // ファイルの有無をチェック @@ -2114,6 +2079,8 @@ private void saveImageAsPng(string filename = "") bmp.Save(filename, ImageFormat.Png); } + + private void ipaToolStripMenuItem_Click(object sender, EventArgs e) { if (SrcImgSize == null || SrcImgSize.Width == 0) return; @@ -2121,600 +2088,536 @@ private void ipaToolStripMenuItem_Click(object sender, EventArgs e) FormSaveImage.Visible = true; } + #endregion - public void SetIntegralProperty() + #region File メニュー パラメータの読み書き + + private void toolStripMenuItemReadParameter_Click(object sender, EventArgs e) + { + var dialog = new OpenFileDialog { Filter = "*.prm[Parameter File]|*.prm" }; + if (initialParameterDirectory != "") + dialog.InitialDirectory = initialParameterDirectory; + if (dialog.ShowDialog() == DialogResult.OK) + { + ReadParameter(dialog.FileName, ((ToolStripMenuItem)sender).Name.Contains("Interactively")); + initialParameterDirectory = Path.GetDirectoryName(dialog.FileName); + } + } + + private void toolStripMenuItemSaveParameter_Click(object sender, EventArgs e) + { + var dialog = new SaveFileDialog() { Filter = "*.prm[Parameter File]|*.prm" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + SaveParameter(dialog.FileName, ((ToolStripMenuItem)sender).Name.Contains("Fully")); + initialParameterDirectory = Path.GetDirectoryName(dialog.FileName); + } + } + + + public string initialParameterDirectory; + public void SaveParameter(string filename, bool fullySave = true) { + if (filename == "") + { + var dlg = new OpenFileDialog() { Filter = "*.prm[Parameter File]|*.prm" }; + if (dlg.ShowDialog() == DialogResult.OK) + filename = dlg.FileName; + else + return; + } + if (!filename.EndsWith("prm")) + filename += ".prm"; + + + fullySave = false; try { - IP.Camera = FormProperty.radioButtonFlatPanel.Checked ? IntegralProperty.CameraEnum.FlatPanel : IntegralProperty.CameraEnum.Gandolfi; - IP.GandolfiRadius = FormProperty.numericBoxGandlfiRadius.Value; + DiffractionOptics.Parameter prm = new DiffractionOptics.Parameter(); - IP.SrcWidth = SrcImgSize.Width; ;//ソース画像の幅 - IP.SrcHeight = SrcImgSize.Height; ;//ソース画像の高さ - IP.CenterX = FormProperty.numericBoxCenterPositionX.Value;//センターのx位置 - IP.CenterY = FormProperty.numericBoxCenterPositionY.Value;//センターのy位置 - IP.PixSizeX = FormProperty.numericBoxPixelSizeX.Value; - IP.PixSizeY = FormProperty.numericBoxPixelSizeY.Value;//ピクセルサイズ - IP.ksi = FormProperty.numericalTextBoxPixelKsi.RadianValue; + if (!fullySave) + { + FormParameterOption.Text = "Save checked parameters"; + if (FormParameterOption.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) + return; + } + else + FormParameterOption.AllCheck(); - IP.SpericalRadiusInverse = FormProperty.numericalTextBoxSphericalCorections.Value / 1000; + prm.SACLA_EH5 = (FormProperty.checkBoxSACLA.Checked) ? "True" : null; - IP.WaveLength = FormProperty.WaveLength; + if (FormProperty.checkBoxSACLA.Checked) + { + prm.SACLA_EH5_CameraLength2 = FormProperty.saclaControl.CameraLength2.ToString(); + prm.SACLA_EH5_Phi = FormProperty.saclaControl.PhiDegree.ToString(); + prm.SACLA_EH5_Tau = FormProperty.saclaControl.TauDegree.ToString(); + prm.SACLA_EH5_PixelHeight = FormProperty.saclaControl.PixelHeight.ToString(); + prm.SACLA_EH5_PixelWidth = FormProperty.saclaControl.PixelWidth.ToString(); + prm.SACLA_EH5_PixleSize = FormProperty.saclaControl.PixelSize.ToString(); + prm.SACLA_EH5_FootX = FormProperty.saclaControl.Foot.X.ToString(); + prm.SACLA_EH5_FootY = FormProperty.saclaControl.Foot.Y.ToString(); + } - IP.ThresholdMax = (int)FormProperty.numericUpDownThresholdOfIntensityMax.Value; - IP.ThresholdMin = (int)FormProperty.numericUpDownThresholdOfIntensityMin.Value; + prm.cameraMode = (FormParameterOption.CameraModeChecked) ? (FormProperty.radioButtonFlatPanel.Checked ? "FlatPanel" : "Gandolfi") : null; - IP.Edge = (int)FormProperty.numericUpDownEdge.Value; - IP.DoesExcludeEdge = FormProperty.checkBoxMaskEdge.Checked; + prm.waveSource = (FormParameterOption.WaveLengthChecked) ? ((int)FormProperty.waveLengthControl.WaveSource).ToString() : null; + prm.waveLength = (FormParameterOption.WaveLengthChecked) ? FormProperty.WaveLengthText : null; - IP.ConcentricMode = FormProperty.radioButtonConcentric.Checked; + prm.xRayElement = (FormParameterOption.WaveLengthChecked) ? FormProperty.waveLengthControl.XrayWaveSourceElementNumber.ToString() : null; + prm.xRayLine = (FormParameterOption.WaveLengthChecked) ? ((int)FormProperty.waveLengthControl.XrayWaveSourceLine).ToString() : null; + prm.cameraLength = (FormParameterOption.CameraLengthChecked) ? FormProperty.CameraLengthText : null; + prm.pixSizeX = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericBoxPixelSizeX.Text : null; + prm.pixSizeY = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericBoxPixelSizeY.Text : null; + prm.pixKsi = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericalTextBoxPixelKsi.Text : null; - if (IP.ConcentricMode) - {//コンセントリックモードのとき - if (FormProperty.radioButtonConcentricAngle.Checked) - { - IP.StartAngle = (double)(FormProperty.numericBoxConcentricStart.Value) * Math.PI / 180.0; - IP.EndAngle = (double)FormProperty.numericBoxConcentricEnd.Value * Math.PI / 180.0; ; - IP.StepAngle = (double)FormProperty.numericBoxConcentricStep.Value * Math.PI / 180.0; ; - IP.Mode = HorizontalAxis.Angle; - } - else if (FormProperty.radioButtonConcentricLength.Checked) - { - IP.StartLength = FormProperty.numericBoxConcentricStart.Value; - IP.EndLength = FormProperty.numericBoxConcentricEnd.Value; - IP.StepLength = FormProperty.numericBoxConcentricStep.Value; - IP.Mode = HorizontalAxis.Length; - } - else - { - IP.StartDspacing = FormProperty.numericBoxConcentricStart.Value / 10.0; - IP.EndDspacing = FormProperty.numericBoxConcentricEnd.Value / 10.0;//角度もしくはピクセルの上限値、下限値 - IP.StepDspacing =FormProperty.numericBoxConcentricStep.Value / 10.0;//角度もしくはピクセルのステップ - IP.Mode = HorizontalAxis.d; - } - } - else - {//ラディアルモードのとき - if (FormProperty.radioButtonRadialAngle.Checked) - { - IP.RadialRadiusAngle = FormProperty.numericBoxRadialRadius.Value * Math.PI / 180.0; - IP.RadialRadiusAngleRange = FormProperty.numericBoxRadialRange.Value * Math.PI / 180.0; - IP.Mode = HorizontalAxis.Angle; - } - else - { - IP.RadialRadiusDspacing = FormProperty.numericBoxRadialRadius.Value / 10.0; - IP.RadialRadiusDspacingRange = FormProperty.numericBoxRadialRange.Value / 10.0; - IP.Mode = HorizontalAxis.d; - } - IP.RadialSectorAngle = FormProperty.numericBoxRadialStep.Value; - } + prm.tiltPhi = (FormParameterOption.TiltCorrectionChecked) ? FormProperty.numericBoxTiltCorrectionPhi.Text : null; + prm.tiltTau = (FormParameterOption.TiltCorrectionChecked) ? FormProperty.numericBoxTiltCorrectionTau.Text : null; + prm.centerX = (FormParameterOption.CenterPositionChecked) ? FormProperty.numericBoxCenterPositionX.Text : null; + prm.centerY = (FormParameterOption.CenterPositionChecked) ? FormProperty.numericBoxCenterPositionY.Text : null; - IP.FilmDistance = FormProperty.CameraLength;//カメラ長 - IP.phi = FormProperty.numericBoxTiltCorrectionPhi.RadianValue; //IPの角度Tilt - IP.tau = FormProperty.numericBoxTiltCorrectionTau.RadianValue; ;//IPの角度Azumuth; + prm.sphericalRadiusInverse = (FormParameterOption.SphericalCorrectionChecked) ? FormProperty.numericalTextBoxSphericalCorections.Text : null; - if (FormProperty.radioButtonRectangle.Checked) IP.IsRectangle = true;//RectangleかSectorか - else IP.IsRectangle = false; + prm.GandolfiRadius = (FormParameterOption.GandolfiRadiusChecked) ? FormProperty.numericBoxGandlfiRadius.Text : null; - //Rectangleモードのとき - if ((string)FormProperty.comboBoxRectangleDirection.SelectedItem == "Full") IP.IsFull = true; else IP.IsFull = false; - IP.RectangleBand = (double)FormProperty.numericUpDownRectangleBand.Value;//バンドの太さ - IP.RectangleAngle = (double)FormProperty.numericUpDownRectangleAngle.Value * Math.PI / 180.0; //角度 - IP.RectangleIsBothSide = FormProperty.checkBoxRectangleIsBothSide.Checked;//半直線かどうか - //Sectorモードのとき - IP.SectorStartAngle = (double)FormProperty.numericUpDownSectorStartAngle.Value * Math.PI / 180.0; //開始角度 - IP.SectorEndAngle = (double)FormProperty.numericUpDownSectorEndAngle.Value * Math.PI / 180.0; ;//終了角度 + //IntegralRegion + if (FormParameterOption.IntegralRegionChecked) + { + prm.RegionMode = FormProperty.radioButtonRectangle.Checked ? "Rectangle" : "Sector"; - IP.IsTiltCorrection = FormProperty.checkBoxTiltCorrection.Checked; + prm.RectangleDirection = FormProperty.comboBoxRectangleDirection.SelectedIndex.ToString(); + prm.RectangleBothSide = FormProperty.checkBoxRectangleIsBothSide.Checked ? "True" : "False"; + prm.RectangleBandWidth = FormProperty.numericUpDownRectangleBand.Value.ToString(); + prm.RectangleAngle = FormProperty.numericUpDownRectangleAngle.Value.ToString(); - IP.IsBraggBrentanoMode = FormProperty.radioButtonBraggBrentano.Checked; - } - catch - { - MessageBox.Show("適切に入力されていない項目があります"); - return; - } - Ring.IP = IP; - } + prm.SectorStart = FormProperty.numericUpDownSectorStartAngle.Value.ToString(); + prm.SectorEnd = FormProperty.numericUpDownSectorEndAngle.Value.ToString(); + } - #region 画像演算ボタン - //FindCenterボタン - public void toolStripSplitButtonFindCenter_ButtonClick(object sender, EventArgs e) - { - if (!IsImageReady) return; - - sw.Restart(); - if (!FormDrawRing.Visible)//通常モードの時 - { - toolStripSplitButtonFindCenter.Enabled = false; - for (int i = 0; i < 1; i++) + //IntegralRegion + if (FormParameterOption.IntegralPropertyChecked) { - SetIntegralProperty(); - if (IP.CenterX < 0 || IP.CenterX > IP.SrcWidth || IP.CenterY < 0 || IP.CenterY > IP.SrcHeight) - return; + prm.IntegrationMode = FormProperty.radioButtonConcentric.Checked ? "Concentric" : "Radial"; - PointD center = Ring.FindCenter(IP, (int)FormProperty.numericBoxFindCenterSearchArea.Value, FormProperty.checkBoxExcludeMaskedPixels.Checked ? Ring.IsSpots : null); - FormProperty.ImageCenter = center; + prm.ConcentricUnit = FormProperty.radioButtonConcentricAngle.Checked ? "Angle" : FormProperty.radioButtonConcentricLength.Checked ? "Length" : "d-spacing"; + prm.ConcentricStart = FormProperty.numericBoxConcentricStart.Text; + prm.ConcentricEnd = FormProperty.numericBoxConcentricEnd.Text; + prm.ConcentricStep = FormProperty.numericBoxConcentricStep.Text; + + prm.RadialUnit = FormProperty.radioButtonRadialAngle.Checked ? "Angle" : "d-spacing"; + prm.RadialRadius = FormProperty.numericBoxRadialRadius.Text; + prm.RadialWidth = FormProperty.numericBoxRadialRange.Text; + prm.RadialStep = FormProperty.numericBoxRadialStep.Text; } - toolStripSplitButtonFindCenter.Enabled = true; - this.toolStripStatusLabel.Text = "Calculating Time (Find Center): " + (sw.ElapsedMilliseconds).ToString() + "ms"; - FormProperty.ImageTypeParameters[(int)Ring.ImageType].CenterPosX = FormProperty.ImageCenter.X; - FormProperty.ImageTypeParameters[(int)Ring.ImageType].CenterPosY = FormProperty.ImageCenter.Y; + System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(DiffractionOptics.Parameter)); + System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Create); + serializer.Serialize(fs, prm); + fs.Close(); - if (FormFindParameter.Visible) - { - - if (FormFindParameter.textBoxPrimaryFileName.Text.EndsWith(FileName) && (!SequentialImageMode||FormSequentialImage.SelectedIndex == FormFindParameter.numericBoxPrimaryImageNum.ValueInteger )) - { - FormFindParameter.numericalTextBoxPrimaryCenterPositionX.Text = FormProperty.ImageCenter.X.ToString("f8"); - FormFindParameter.numericTextBoxPrimaryCenterPositionY.Text = FormProperty.ImageCenter.Y.ToString("f8"); - } - else - { - FormFindParameter.numericTextBoxSecondaryCenterPositionX.Text = FormProperty.ImageCenter.X.ToString("f8"); - FormFindParameter.numericTextBoxSecondaryCenterPositionY.Text = FormProperty.ImageCenter.Y.ToString("f8"); - } - } } - else if (FormDrawRing.Visible && FormDrawRing.R>0)//デバイリングから、中心位置を検索する時 - { - this.Enabled = false; - tabControl1.SelectedIndex = 1; - FormProperty.radioButtonConcentric.Checked = true; - FormProperty.radioButtonConcentricAngle.Checked = true; - var concentricStart = FormProperty.numericBoxConcentricStart.Value; - var concentricEnd = FormProperty.numericBoxConcentricEnd.Value; - - var fittingRange = FormProperty.numericBoxFindCenterPeakFittingRange.Value; - FormProperty.numericBoxConcentricStart.Value = FormDrawRing.TwoTheta / Math.PI * 180 - fittingRange*5; - FormProperty.numericBoxConcentricEnd.Value = FormDrawRing.TwoTheta / Math.PI * 180 + fittingRange*5; + catch { MessageBox.Show("Failed to save the file. Sorry."); } - var pf = new PeakFunction(FormDrawRing.TwoTheta / Math.PI * 180, fittingRange/2, fittingRange, PeakFunctionForm.PseudoVoigt); - FormProperty.radioButtonSector.Checked = true; - for (int n = 0; n < 3; n++) - { - var pts = new List(); - var angleStep = 20; - for (int i = 0; i < 360 / angleStep; i++) - { - Skip = true; - FormProperty.numericUpDownSectorStartAngle.Value = (decimal)(angleStep * i - angleStep / 2); - Skip = false; - FormProperty.numericUpDownSectorEndAngle.Value = (decimal)(angleStep * i + angleStep / 2); - var profile = Ring.GetProfile(IP); + } - FittingPeak.FitPeakThread(profile.Pt.ToArray(), true, 0, ref pf); - graphControlProfile.Profile = profile; - graphControlProfile.Peaks = new PeakFunction[] { pf }; - if (!double.IsNaN(pf.X) && pf.X != 0) - pts.Add(new PointD( - IP.FilmDistance * Math.Tan(Math.PI / 180 * pf.X) * Math.Sin(Math.PI / 180 * angleStep * i), - -IP.FilmDistance * Math.Tan(Math.PI / 180 * pf.X) * Math.Cos(Math.PI / 180 * angleStep * i))); - Application.DoEvents(); - } - var centerOffset = Geometriy.GetEllipseCenter(pts.ToArray()); - if (double.IsNaN(centerOffset.X)) - break; - double centerX = centerOffset.X / IP.PixSizeX + IP.CenterX; - double centerY = centerOffset.Y / IP.PixSizeY + IP.CenterY; - FormProperty.ImageCenter = new PointD(centerX, centerY); - } + public void ReadParameter(string filename, bool fullyRead = true) + { + if (filename == "") + { + var dlg = new OpenFileDialog { Filter = "*.prm[Parameter File]|*.prm" }; + if (dlg.ShowDialog() == DialogResult.OK) + filename = dlg.FileName; + else + return; + } - FormProperty.radioButtonRectangle.Checked = true; - FormProperty.numericBoxConcentricStart.Value = concentricStart; - FormProperty.numericBoxConcentricEnd.Value = concentricEnd; - this.Enabled = true; - } - Draw(); - } + fullyRead = false; + //イベントをスキップ + skipSelectedAreaChangedEvent = true; + Skip = true; + try + { + DiffractionOptics.Parameter prm = DiffractionOptics.Read(filename); - //FindSpotsボタン - public void toolStripSplitButtonFindSpots_ButtonClick(object sender, EventArgs e) - { - if (!IsImageReady) return; + if (!fullyRead) + { + FormParameterOption.Text = "Read checked parameters"; + FormParameterOption.Location = new Point(this.Location.X + 100, this.Location.Y + 100); + if (FormParameterOption.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) + return; + } + else + FormParameterOption.AllCheck(); - this.Cursor = Cursors.WaitCursor; - toolStripSplitButtonFindSpots.Enabled = false; - int d = Environment.TickCount; - SetIntegralProperty(); - Ring.FindSpots(IP, (double)FormProperty.numericUpDownFindSpotsDeviation.Value); - Draw(); - this.Cursor = Cursors.Default; - toolStripSplitButtonFindSpots.Enabled = true; - this.toolStripStatusLabel.Text = "Calculating Time (Find Spots): " + (Environment.TickCount - d).ToString() + "ms"; - } + FormProperty.checkBoxSACLA.Checked = prm.SACLA_EH5 == "True"; + if (prm.SACLA_EH5 == "True") + { + if (prm.SACLA_EH5_CameraLength2 != null) + FormProperty.saclaControl.CameraLength2 = Convert.ToDouble(prm.SACLA_EH5_CameraLength2); + else + FormProperty.saclaControl.CameraLength2 = Convert.ToDouble(prm.SACLA_EH5_Distance); + FormProperty.saclaControl.PixelHeight = Convert.ToDouble(prm.SACLA_EH5_PixelHeight); + FormProperty.saclaControl.PixelWidth = Convert.ToDouble(prm.SACLA_EH5_PixelWidth); + FormProperty.saclaControl.PixelSize = Convert.ToDouble(prm.SACLA_EH5_PixleSize); + FormProperty.saclaControl.Foot = new PointD(Convert.ToDouble(prm.SACLA_EH5_FootX), Convert.ToDouble(prm.SACLA_EH5_FootY)); - #region Maskボタン関連 - //ClearSpotsボタン - public void toolStripMenuItemClearSpots_Click(object sender, EventArgs e) - { - if (!IsImageReady) return; - for (int i = 0; i < Ring.IsSpots.Count; i++) - Ring.IsSpots[i] = false; + if (prm.SACLA_EH5_Phi != null) + { + FormProperty.saclaControl.PhiDegree = Convert.ToDouble(prm.SACLA_EH5_Phi); + FormProperty.saclaControl.TauDegree = Convert.ToDouble(prm.SACLA_EH5_Tau); + } + else + { + FormProperty.saclaControl.PhiDegree = 0; + FormProperty.saclaControl.TauDegree = Convert.ToDouble(prm.SACLA_EH5_TwoTheta); + } + } - Draw(); - } + //Camera Mode + if (FormParameterOption.CameraModeChecked) + { + if (prm.cameraMode == null || prm.cameraMode == "FlatPanel") + { + FormProperty.radioButtonFlatPanel.Checked = true; + FormProperty.radioButtonGandlfi.Checked = false; + } + else + { + FormProperty.radioButtonFlatPanel.Checked = false; + FormProperty.radioButtonGandlfi.Checked = true; + } + } - private void inverseMaskToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!IsImageReady) return; - for (int i = 0; i < Ring.IsSpots.Count; i++) - Ring.IsSpots[i] = !Ring.IsSpots[i]; - Draw(); - } + //WaveProperty + if (FormParameterOption.WaveLengthChecked) + { + if (prm.waveSource != null) + FormProperty.waveLengthControl.WaveSource = (WaveSource)Convert.ToInt32(prm.waveSource); - private void toolStripMenuItemMaskAll_Click(object sender, EventArgs e) - { - if (!IsImageReady) return; - for (int i = 0; i < Ring.IsSpots.Count; i++) - Ring.IsSpots[i] = true; - Draw(); - } - #endregion + if (prm.xRayElement != null) + FormProperty.waveLengthControl.XrayWaveSourceElementNumber = Convert.ToInt32(prm.xRayElement); + if (prm.xRayLine != null) + FormProperty.waveLengthControl.XrayWaveSourceLine = (Crystallography.XrayLine)Convert.ToInt32(prm.xRayLine); + if (prm.waveLength != null && (FormProperty.waveLengthControl.WaveSource == WaveSource.Electron || FormProperty.waveLengthControl.XrayWaveSourceElementNumber == 0)) + FormProperty.WaveLengthText = prm.waveLength; + } - //GetIntensityボタン - public void toolStripSplitButtonGetProfile_ButtonClick(object sender, EventArgs e) - { - GetProfile(); - } - public void GetProfile(string fileName = "") - { - if (!IsImageReady) return; - this.Cursor = Cursors.WaitCursor; - toolStripSplitButtonGetProfile.Enabled = false; - int d = Environment.TickCount; - SetIntegralProperty(); + if (FormParameterOption.CameraLengthChecked && prm.cameraLength != null) + FormProperty.CameraLengthText = prm.cameraLength; - //パラメータをイメージ種ごとに保存 - FormProperty.SaveParameterForEachImageType(Ring.ImageType); + if (FormParameterOption.PixelShapeChecked) + { + if (prm.pixSizeX != null) + { + FormProperty.numericBoxPixelSizeX.Text = prm.pixSizeX; + FormProperty.numericBoxPixelSizeY.Text = prm.pixSizeY; + } + else if (prm.pixSize != null) + { + FormProperty.numericBoxPixelSizeX.Text = prm.pixSize; + FormProperty.numericBoxPixelSizeY.Text = (Convert.ToDouble(prm.pixSize) * Convert.ToDouble(prm.aspectRatio)).ToString(); + } + if (prm.pixKsi != null) + FormProperty.numericalTextBoxPixelKsi.Text = prm.pixKsi; - if (findCenterBeforeGetProfileToolStripMenuItem.Checked == true && toolStripButtonFixCenter.Checked == false) - { - toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); - toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); - } - if (findSpotsBeforeGetProfileToolStripMenuItem.Checked == true && toolStripButtonManualSpotMode.Checked == false) - toolStripSplitButtonFindSpots_ButtonClick(new object(), new EventArgs()); + } - if (FormProperty.radioButtonConcentricAngle.Checked) - IP.Mode = HorizontalAxis.Angle; - else - IP.Mode = HorizontalAxis.d; + //CenterPorition + if (FormParameterOption.CenterPositionChecked && prm.centerX != null) + { + FormProperty.numericBoxCenterPositionX.Text = prm.centerX; + FormProperty.numericBoxCenterPositionY.Text = prm.centerY; + } - //通常積分モード - if (!toolStripMenuItemDividedByAngleStep.Checked) - { - try + //TiltCorrection + if (FormParameterOption.TiltCorrectionChecked && prm.tiltPhi != null) { - SetMask(); + FormProperty.numericBoxTiltCorrectionPhi.Text = prm.tiltPhi; + FormProperty.numericBoxTiltCorrectionTau.Text = prm.tiltTau; + } - diffractionProfile.SrcAxisMode = IP.Mode; - diffractionProfile.SrcWaveLength = IP.WaveLength; - diffractionProfile.Mode = FormProperty.radioButtonConcentric.Checked ? DiffractionProfileMode.Concentric : DiffractionProfileMode.Radial; + //SphericalRadius + if (FormParameterOption.TiltCorrectionChecked && prm.sphericalRadiusInverse != null) + FormProperty.numericalTextBoxSphericalCorections.Text = prm.sphericalRadiusInverse; - int[] targets = new int[1]; - //シーケンシャルモードの時の処理 - if (toolStripButtonImageSequence.Enabled) - { - if (toolStripMenuItemAllSequentialImages.Checked) - { - targets = new int[FormSequentialImage.MaximumNumber]; + //GandolfiRadius + if (FormParameterOption.GandolfiRadiusChecked && prm.GandolfiRadius != null) + FormProperty.numericBoxGandlfiRadius.Text = prm.GandolfiRadius; - for (int n = 0; n < FormSequentialImage.MaximumNumber; n++) - targets[n] = n; - } - else if (toolStripMenuItemSelectedSequentialImages.Checked) - targets = FormSequentialImage.SelectedIndices; - } - List dpList = new List(); - for (int i = 0; i < targets.Length; i++) - { - //シーケンシャルモードの時の処理 - if (toolStripButtonImageSequence.Enabled && (toolStripMenuItemAllSequentialImages.Checked || toolStripMenuItemSelectedSequentialImages.Checked)) - { - FormSequentialImage.SkipCalcFreq = i != targets.Length - 1; - FormSequentialImage.AverageMode = false; - FormSequentialImage.SelectedIndex = targets[i]; - if (Ring.ImageType == Ring.ImageTypeEnum.HDF5) - diffractionProfile.SrcWaveLength = UniversalConstants.Convert.EnergyToXrayWaveLength(Ring.SequentialImageEnergy[targets[i]]); - } - - diffractionProfile.Name = FileName; - if (toolStripButtonImageSequence.Enabled) - diffractionProfile.Name += " " + FileNameSub; + //IntegralRegion + if (FormParameterOption.IntegralRegionChecked) + { + if (prm.RegionMode != null) + { + FormProperty.radioButtonRectangle.Checked = prm.RegionMode == "Rectangle"; + FormProperty.radioButtonSector.Checked = prm.RegionMode == "Sector"; + } - diffractionProfile.OriginalProfile = Ring.GetProfile(IP); + if (prm.RectangleDirection != null) + FormProperty.comboBoxRectangleDirection.SelectedIndex = Convert.ToInt32(prm.RectangleDirection); + if (prm.RectangleBothSide != null) + FormProperty.checkBoxRectangleIsBothSide.Checked = prm.RectangleBothSide == "True"; + if (prm.RectangleBandWidth != null) + FormProperty.numericUpDownRectangleBand.Value = Convert.ToDecimal(prm.RectangleBandWidth); + if (prm.RectangleAngle != null) + FormProperty.numericUpDownRectangleAngle.Value = Convert.ToDecimal(prm.RectangleAngle); - //必要であればKalpha2を除去 - if(FormProperty.checkBoxTest.Checked) - { - if (FormProperty.waveLengthControl.XrayWaveSourceElementNumber > 10 && FormProperty.waveLengthControl.XrayWaveSourceLine == XrayLine.Ka1) - { - double alpha1 = AtomConstants.CharacteristicXrayWavelength(FormProperty.waveLengthControl.XrayWaveSourceElementNumber, Crystallography.XrayLine.Ka1); - double alpha2 = AtomConstants.CharacteristicXrayWavelength(FormProperty.waveLengthControl.XrayWaveSourceElementNumber, Crystallography.XrayLine.Ka2); - double ratio = FormProperty.numericBoxTest.Value; - diffractionProfile.OriginalProfile= DiffractionProfile.RemoveKalpha2(diffractionProfile.OriginalProfile,alpha1,alpha2,ratio); - } - } - //Unrolled Imageの作成 - if (FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked) - { - double sectorStep = Math.PI * 1.0 / 180.0; - double xStart = IP.StartAngle; - double xEnd = IP.EndAngle; - double xStep = IP.StepAngle; - double[] temp = Ring.GetUnrolledImageArray(IP, sectorStep, xStart, xEnd, xStep); - diffractionProfile.ImageArray = new double[temp.Length]; - for (int j = 0; j < temp.Length; j++) - diffractionProfile.ImageArray[j] = temp[j]; - diffractionProfile.ImageScale = 1; - diffractionProfile.ImageWidth = (int)((xEnd - xStart) / xStep); - diffractionProfile.ImageHeight = (int)(2 * Math.PI / sectorStep); - } - else - diffractionProfile.ImageArray = null; + if (prm.SectorStart != null) + FormProperty.numericUpDownSectorStartAngle.Value = Convert.ToDecimal(prm.SectorStart); + if (prm.SectorEnd != null) + FormProperty.numericUpDownSectorEndAngle.Value = Convert.ToDecimal(prm.SectorEnd); + } - dpList.Add((DiffractionProfile)diffractionProfile.Clone()); + //IntegralProperty + if (FormParameterOption.IntegralPropertyChecked) + { + if (prm.IntegrationMode != null) + { + FormProperty.radioButtonConcentric.Checked = prm.IntegrationMode == "Concentric"; + FormProperty.radioButtonRadial.Checked = prm.IntegrationMode == "Radial"; } - //PDIndexerへの送信 - if (FormProperty.checkBoxSendProfileToPDIndexer.Checked) + if (prm.ConcentricUnit != null) { - using Mutex clipboard = new Mutex(false, "ClipboardOperation"); - if (clipboard.WaitOne(500, false)) - { - Clipboard.SetDataObject(dpList.ToArray()); - clipboard.ReleaseMutex(); - } - clipboard.Close(); + FormProperty.radioButtonConcentricAngle.Checked = prm.ConcentricUnit == "Angle"; + FormProperty.radioButtonConcentricLength.Checked = prm.ConcentricUnit == "Length"; + FormProperty.radioButtonConcentricDspacing.Checked = prm.ConcentricUnit == "d-spacing"; } - //ファイル保存 - if (FormProperty.checkBoxSaveFile.Checked) - SaveProfile(diffractionProfile,fileName); + if (prm.ConcentricStart != null) + FormProperty.numericBoxConcentricStart.Text = prm.ConcentricStart; + if (prm.ConcentricEnd != null) + FormProperty.numericBoxConcentricEnd.Text = prm.ConcentricEnd; + if (prm.ConcentricStep != null) + FormProperty.numericBoxConcentricStep.Text = prm.ConcentricStep; - graphControlProfile.Profile = diffractionProfile.OriginalProfile; + if (prm.RadialUnit != null) + { + FormProperty.radioButtonRadialAngle.Checked = prm.RadialUnit == "Angle"; + FormProperty.radioButtonRadialDspacing.Checked = prm.RadialUnit == "d-spacing"; + } - toolStripSplitButtonGetProfile.Enabled = true; - this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; + if (prm.RadialRadius != null) + FormProperty.numericBoxRadialRadius.Text = prm.RadialRadius; + if (prm.RadialWidth != null) + FormProperty.numericBoxRadialRange.Text = prm.RadialWidth; + if (prm.RadialStep != null) + FormProperty.numericBoxRadialStep.Text = prm.RadialStep; } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - MessageBox.Show("正常にデータを送信できませんでした。"); - this.Cursor = Cursors.Default; - toolStripSplitButtonGetProfile.Enabled = true; - return; - } + } - else //LPOモードのとき - { - #region - try - { - List dpList = new List(); + catch { MessageBox.Show("Failed to read the file. Sorry."); } + //イベントスキップを解除 + skipSelectedAreaChangedEvent = false; + Skip = false; + IntegralArea_Changed(new object(), new EventArgs()); - toolStripSplitButtonGetProfile.Enabled = false; + FormProperty.SaveParameterForEachImageType(Ring.ImageType); + } - double anglestep; - try { anglestep = Convert.ToDouble(toolStripComboBoxAngleStep.Text); } - catch { return; } + /* + [Serializable()] + public class Parameter + { + /// + /// "FlatPanel" か "Gandolfi" + /// + public string cameraMode; - FormProperty.radioButtonRectangle.Checked = true; ; - FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; + public string SACLA_EH5; + public string SACLA_EH5_PixelWidth; + public string SACLA_EH5_PixelHeight; + public string SACLA_EH5_PixleSize; + public string SACLA_EH5_TwoTheta; + public string SACLA_EH5_Distance; + public string SACLA_EH5_FootX; + public string SACLA_EH5_FootY; - diffractionProfile.OriginalProfile = Ring.GetProfile(IP); - diffractionProfile.Name = FileName + " - whole"; - diffractionProfile.SrcAxisMode = FormProperty.radioButtonConcentricAngle.Checked ? HorizontalAxis.Angle : HorizontalAxis.Length; - diffractionProfile.SrcWaveLength = IP.WaveLength; - diffractionProfile.IsLPOmain = true; - diffractionProfile.IsLPOchild = false; + public string waveSource; + public string electronEnergy; - this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; + public string xRayElement; + public string xRayLine; + public string waveLength; - dpList.Add((DiffractionProfile)diffractionProfile.Clone()); + public string cameraLength; + public string pixSize; + public string pixSizeX; + public string pixSizeY; + public string pixKsi; + public string aspectRatio; + public string tiltPhi; + public string tiltTau; + public string centerX; + public string centerY; + public string sphericalRadiusInverse; + public string GandolfiRadius; - string tempFilename = ""; - if (FormProperty.checkBoxSaveFile.Checked) - { - if (FormProperty.radioButtonSetDirectoryEachTime.Checked) - { - string extension = FormProperty.radioButtonAsPDIformat.Checked ? ".pdi" : ".csv"; - SaveFileDialog dlg = new SaveFileDialog(); - dlg.FileName = FileName; - dlg.Filter = extension + "|" + extension; + /// + /// Concentric か Radial + /// + public string IntegrationMode; - if (dlg.ShowDialog() != DialogResult.OK) - throw new Exception(); + public string ConcentricStart; + public string ConcentricEnd; + public string ConcentricStep; + /// + /// Angle, Length, d-spacing + /// + public string ConcentricUnit; - tempFilename = dlg.FileName; - tempFilename = tempFilename.Remove(tempFilename.LastIndexOf(".")); - SaveProfile(diffractionProfile,tempFilename + "-whole" + extension); - } - else - SaveProfile(diffractionProfile,fileName); - } + public string RadialRadius; + public string RadialWidth; + public string RadialStep; + /// + /// Angle, d-spacing + /// + public string RadialUnit; - graphControlProfile.Profile = diffractionProfile.Profile; + //Rectangle or Sector + public string RegionMode; + public string RectangleDirection; + public string RectangleBandWidth; + public string RectangleBothSide; + public string RectangleAngle; - FormProperty.radioButtonSector.Checked = true; - for (int i = 0; i < 360 / anglestep; i++) - { - Skip = true; - FormProperty.numericUpDownSectorStartAngle.Value = (decimal)(anglestep * i - anglestep / 2); - Skip = false; - FormProperty.numericUpDownSectorEndAngle.Value = (decimal)(anglestep * i + anglestep / 2); - Application.DoEvents(); - //SetMask(); - diffractionProfile.OriginalProfile = Ring.GetProfile(IP); - diffractionProfile.Name = FileName + " - " + (i * anglestep).ToString("000"); - diffractionProfile.SrcAxisMode = FormProperty.radioButtonConcentricAngle.Checked ? HorizontalAxis.Angle : HorizontalAxis.Length; - diffractionProfile.SrcTakeoffAngle = IP.WaveLength; - diffractionProfile.IsLPOmain = false; - diffractionProfile.IsLPOchild = true; + public string SectorStart; + public string SectorEnd; - this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; - //toolStripSplitButtonGetProfile.Enabled = true; + public string ExceptMaskedSpots; + public string ExceptEdges; + public string ExceptOver; + public string ExceptUnder; - dpList.Add((DiffractionProfile)diffractionProfile.Clone()); - if (FormProperty.checkBoxSaveFile.Checked) - { - if (FormProperty.radioButtonSetDirectoryEachTime.Checked) - SaveProfile( diffractionProfile,tempFilename + "-" + (i * anglestep).ToString("000")); - else - SaveProfile(diffractionProfile); - } - } - if (FormProperty.checkBoxSendProfileToPDIndexer.Checked) + + + } + */ + + #endregion + + #region File メニュー Maskファイルの読み書き + public string initialMaskDirectory; + private void toolStripMenuItemReadMask_Click(object sender, EventArgs e) + { + var dlg = new OpenFileDialog() { Filter = "Mask file; *.mas|*.mas" }; + if (initialMaskDirectory != "") + dlg.InitialDirectory = initialMaskDirectory; + if (dlg.ShowDialog() == DialogResult.OK) + { + ReadMask(dlg.FileName); + initialMaskDirectory = Path.GetDirectoryName(dlg.FileName); + } + } + + public void ReadMask(string filename) + { + if (filename == "") + { + var dlg = new SaveFileDialog { Filter = "*.mas|*.mas" }; + if (dlg.ShowDialog() == DialogResult.OK) + filename = dlg.FileName; + else + return; + } + + try + { + var br = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.ReadWrite)); + var mask = new bool[br.ReadInt32()]; + int n = 0; + for (int i = 0; i < mask.Length / 8; i++) + { + byte b = br.ReadByte(); + for (int j = 0; j < 8; j++) { - using (Mutex clipboard = new Mutex(false, "ClipboardOperation")) - { - if (clipboard.WaitOne(5000, false)) - { - Clipboard.SetDataObject(dpList.ToArray()); - clipboard.ReleaseMutex(); - } - clipboard.Close(); - } + mask[n++] = (b & 1) == 1; + b >>= 1; } - FormProperty.radioButtonRectangle.Checked = true; ; - FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; - toolStripSplitButtonGetProfile.Enabled = true; } - catch + br.Close(); + if (Ring.IsSpots != null && mask != null && mask.Length == Ring.IsSpots.Count) { - toolStripSplitButtonGetProfile.Enabled = true; - FormProperty.radioButtonRectangle.Checked = true; - FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; + for (int i = 0; i < mask.Length; i++) + Ring.IsSpots[i] = mask[i]; - MessageBox.Show("正常にデータを送信できませんでした。"); - this.Cursor = Cursors.Default; - return; + SetMask(); + Draw(); } - #endregion } - - this.Cursor = Cursors.Default; + catch { } } - private void toolStripMenuItemProperty_Click(object sender, EventArgs e) + public void toolStripMenuItemSaveMask_Click(object sender, EventArgs e) { - FormProperty.Visible = true; + var dlg = new SaveFileDialog { Filter = "Mask file; *.mas|*.mas" }; + if (dlg.ShowDialog() == DialogResult.OK) + SaveMask(dlg.FileName); } - private void toolStripMenuItemWaveSource_Click(object sender, EventArgs e) + public void SaveMask(string fileName) { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 0; - } + if (fileName == "") + { + var dlg = new OpenFileDialog { Filter = "*.mas|*.mas" }; + if (dlg.ShowDialog() == DialogResult.OK) + fileName = dlg.FileName; + else + return; + if (!fileName.EndsWith("mas")) + fileName += ".mas"; + } - private void toolStripMenuItemIPCondition_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; + var br = new BinaryWriter(new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite)); + br.Write(Ring.IsSpots.Count); + int n = 0; + for (int i = 0; i < Ring.IsSpots.Count / 8; i++) + { + byte b = 0; + byte m = 1; + for (int j = 0; j < 8; j++) + { + if (Ring.IsSpots[n++]) + b += m; + m *= 2; + } + br.Write(b); + + } + br.Close(); - FormProperty.tabControl.SelectedIndex = 1; - } - private void toolStripMenuItemIntegralRegion_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 2; - } - private void toolStripMenuItemIntegralProperty_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 3; - } - private void toolStripMenuItemManualMaskMode_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 4; - } - private void toolStripMenuItemAfterGetProfile_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 5; - } - private void toolStripMenuItemUnrolledImage_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 6; - } - private void toolStripMenuItemAssociatedExtensions_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 7; } - private void toolStripMenuItemMiscellaneous_Click(object sender, EventArgs e) + + private void clearMaskToolStripMenuItem_Click(object sender, EventArgs e) { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 8; + ClearMask(); } - #endregion - - private void SaveProfile(DiffractionProfile dp, string filename="") + public void ClearMask() { - string extension = FormProperty.radioButtonAsPDIformat.Checked ? ".pdi" : ".csv"; - if (FormProperty.radioButtonSetDirectoryEachTime.Checked) - { - var dialog = new SaveFileDialog(); - dialog.Filter = extension + "|" + extension; - dialog.FileName = dp.Name.Substring(0, dp.Name.LastIndexOf('.')); - if (dialog.ShowDialog() == DialogResult.OK) - filename = dialog.FileName; - else return; - } - else if(filename=="") - filename = FilePath + dp.Name.Substring(0, dp.Name.LastIndexOf('.')) + extension; - + if (!IsImageReady) return; + for (int i = 0; i < Ring.IsSpots.Count; i++) + Ring.IsSpots[i] = false; - if (FormProperty.radioButtonAsPDIformat.Checked) - { - if (!filename.EndsWith(".pdi")) - filename += ".pdi"; - XYFile.SavePdiFile(new DiffractionProfile[] { dp }, filename); - } - else if (FormProperty.radioButtonAsCSVformat.Checked) - { - if (!filename.EndsWith(".csv")) - filename += ".csv"; - StreamWriter sw = new StreamWriter(filename); - for (int i = 0; i < dp.OriginalProfile.Pt.Count; i++) - sw.WriteLine($"{dp.OriginalProfile.Pt[i].X},{dp.OriginalProfile.Pt[i].Y},{dp.OriginalProfile.Err[i].Y}"); - sw.Close(); - } - else if (FormProperty.radioButtonAsTSVformat.Checked) - { - if (!filename.EndsWith(".tsv")) - filename += ".tsv"; - StreamWriter sw = new StreamWriter(filename); - for (int i = 0; i < dp.OriginalProfile.Pt.Count; i++) - sw.WriteLine($"{dp.OriginalProfile.Pt[i].X}\t{dp.OriginalProfile.Pt[i].Y}\t{dp.OriginalProfile.Err[i].Y}"); - sw.Close(); - } + Draw(); } - // private void SaveProfile(string filename, DiffractionProfile dp) - public void SetMask() { //ここを呼び出す時には @@ -2723,857 +2626,916 @@ public void SetMask() Ring.SetMask(FormProperty.checkBoxOmitSpots.Checked, FormProperty.checkBoxThresholdMin.Checked, FormProperty.checkBoxThresholdMax.Checked); } - //public bool Skip = false; - public void IntegralArea_Changed(object sender, EventArgs e) - { - if (!IsImageReady || Skip) return; - - SetIntegralProperty(); - - System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); - sw.Start(); + private void exitToolStripMenuItem_Click(object sender, EventArgs e) => Close(); - if (FormFindParameter.Visible && FormFindParameter.backgroundWorkerRefine.IsBusy) - Ring.SetInsideArea(IP, true, false, false); - else - Ring.SetInsideArea(IP); + #endregion - this.toolStripStatusLabel.Text = "Calculating Time (SetIntegralArea): " + sw.ElapsedMilliseconds.ToString() + "ms"; + #region Tool メニュー + private void resetFrequencyProfileToolStripMenuItem_Click(object sender, EventArgs e) + { + SetFrequencyProfile(); + } - SetMask(); - Draw(); + private void calibrateRaxisImageToolStripMenuItem_Click(object sender, EventArgs e) + { + FormCalibrateIntensity.Show(); } - #region 子フォームの立ち上げ、終了 + #endregion - private void toolStripButtonIntensityTable_CheckedChanged(object sender, EventArgs e) + #region Property メニュー + private void toolStripMenuItemProperty_Click(object sender, EventArgs e) { - FormIntTable.Visible = toolStripButtonIntensityTable.Checked; + FormProperty.Visible = true; } - private void toolStripButtonAutoProcedure_CheckedChanged(object sender, EventArgs e) + private void toolStripMenuItemWaveSource_Click(object sender, EventArgs e) { - FormAutoProc.Visible = toolStripButtonAutoProcedure.Checked; + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 0; } - private void toolStripButtonRing_CheckedChanged(object sender, EventArgs e) + private void toolStripMenuItemIPCondition_Click(object sender, EventArgs e) { - var loc = FormDrawRing.Location; - - FormDrawRing.Visible = toolStripButtonRing.Checked; + FormProperty.Visible = true; - FormDrawRing.Location = loc; - + FormProperty.tabControl.SelectedIndex = 1; } - - private void toolStripButtonFindParameter_CheckedChanged(object sender, EventArgs e) + private void toolStripMenuItemIntegralRegion_Click(object sender, EventArgs e) { - FormFindParameter.Visible = toolStripButtonFindParameter.Checked; + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 2; } - - private void toolStripButtonImageSequence_CheckedChanged(object sender, EventArgs e) + private void toolStripMenuItemIntegralProperty_Click(object sender, EventArgs e) { - FormSequentialImage.Visible = toolStripButtonImageSequence.Checked; - FormSequentialImage.Location = new Point(this.Location.X + 50, this.Location.Y + 50); + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 3; } - - #endregion - - #region View関連 - private void toolStripComboBoxScale_SelectedIndexChanged(object sender, EventArgs e) + private void toolStripMenuItemManualMaskMode_Click(object sender, EventArgs e) { - setScale(); - Draw(); + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 4; } - - private void toolStripComboBoxScale2_SelectedIndexChanged(object sender, EventArgs e) + private void toolStripMenuItemAfterGetProfile_Click(object sender, EventArgs e) { - setScale(); - Draw(); + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 5; } - - private void comboBoxGradient_SelectedIndexChanged_1(object sender, EventArgs e) + private void toolStripMenuItemUnrolledImage_Click(object sender, EventArgs e) { - setScale(); - Draw(); + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 6; } - private void setScale() + private void toolStripMenuItemAssociatedExtensions_Click(object sender, EventArgs e) { - pseudoBitmap.IsNegative = comboBoxGradient.SelectedIndex == 1; - - //スケールをセット - if (comboBoxScale1.SelectedIndex == 0)//ログスケール - if (comboBoxScale2.SelectedIndex == 0)//グレー - { - pseudoBitmap.ScaleR = pseudoBitmap.ScaleG = pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLog; - pseudoBitmap.GrayScale = true; - } - else - { - pseudoBitmap.ScaleR = PseudoBitmap.BrightnessScaleLogColorR; - pseudoBitmap.ScaleG = PseudoBitmap.BrightnessScaleLogColorG; - pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLogColorB; - pseudoBitmap.GrayScale = false; - } - else//リニア - if (comboBoxScale2.SelectedIndex == 0)//グレー - { - pseudoBitmap.ScaleR = pseudoBitmap.ScaleG = pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLiner; - pseudoBitmap.GrayScale = true; - } - else//color - { - pseudoBitmap.ScaleR = PseudoBitmap.BrightnessScaleLinerColorR; - pseudoBitmap.ScaleG = PseudoBitmap.BrightnessScaleLinerColorG; - pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLinerColorB; - pseudoBitmap.GrayScale = false; - } - trackBarAdvancedMaxInt_ValueChanged(new object(), 0); - trackBarAdvancedMinInt_ValueChanged(new object(),0); + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 7; + } + private void toolStripMenuItemMiscellaneous_Click(object sender, EventArgs e) + { + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 8; } #endregion + #region Option メニュー + private void flipHorizontallyToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + => FlipRotate_Pollalization_Background(); + + private void flipVerticallyToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + => FlipRotate_Pollalization_Background(); + + private void toolStripComboBoxRotate_SelectedIndexChanged(object sender, EventArgs e) + => FlipRotate_Pollalization_Background(); + + private void ngenCompileToolStripMenuItem_Click(object sender, EventArgs e) => Ngen.Compile(); + #endregion - private void textBoxNumOnly_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) + #region Help メニュー + private void hintToolStripMenuItem_Click(object sender, EventArgs e) { - if ((e.KeyChar < '.' || e.KeyChar > '9') && e.KeyChar != '\b') - e.Handled = true; + InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.Hint; + InitialDialog.Visible = true; } - private void aboutMeToolStripMenuItem_Click(object sender, EventArgs e) + private void licenseToolStripMenuItem_Click(object sender, EventArgs e) { - FormAboutMe formAboutMe = new FormAboutMe(); - formAboutMe.ShowDialog(); + InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.License; + InitialDialog.Visible = true; } - #region パラメータの読み書き - - private void toolStripMenuItemReadParameter_Click(object sender, EventArgs e) + private void versionHistoryToolStripMenuItem_Click(object sender, EventArgs e) { - var dialog = new OpenFileDialog { Filter = "*.prm[Parameter File]|*.prm" }; - if (initialParameterDirectory != "") - dialog.InitialDirectory = initialParameterDirectory; - if (dialog.ShowDialog() == DialogResult.OK) - { - ReadParameter(dialog.FileName, ((ToolStripMenuItem)sender).Name.Contains("Interactively")); - initialParameterDirectory = Path.GetDirectoryName(dialog.FileName); - } + InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.History; + InitialDialog.Visible = true; } - private void toolStripMenuItemSaveParameter_Click(object sender, EventArgs e) + private void webPageToolStripMenuItem_Click(object sender, EventArgs e) { - var dialog = new SaveFileDialog() { Filter = "*.prm[Parameter File]|*.prm" }; - if (dialog.ShowDialog() == DialogResult.OK) + try { - SaveParameter(dialog.FileName, ((ToolStripMenuItem)sender).Name.Contains("Fully")); - initialParameterDirectory = Path.GetDirectoryName(dialog.FileName); + if (Thread.CurrentThread.CurrentUICulture.ToString().Contains("ja")) + System.Diagnostics.Process.Start("http://pmsl.planet.sci.kobe-u.ac.jp/~seto/software/IPAnalyzer/ja/IPAnalyzerHelp.html"); + else + System.Diagnostics.Process.Start("http://pmsl.planet.sci.kobe-u.ac.jp/~seto/software/IPAnalyzer/en/IPAnalyzerHelp.html"); + + } + catch { } } + #endregion - - public string initialParameterDirectory; - public void SaveParameter(string filename, bool fullySave = true) + #region Macro メニュー マクロ関連 + public void SetMacroToMenu(string[] name) { - if (filename == "") - { - var dlg = new OpenFileDialog() { Filter = "*.prm[Parameter File]|*.prm" }; - if (dlg.ShowDialog() == DialogResult.OK) - filename = dlg.FileName; - else - return; - } - if (!filename.EndsWith("prm")) - filename += ".prm"; + if (macroToolStripMenuItem.DropDownItems.Count == 1) + macroToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); + for (int i = macroToolStripMenuItem.DropDownItems.Count - 1; i > 1; i--) + macroToolStripMenuItem.DropDownItems.RemoveAt(i); - fullySave = false; - try + for (int i = 0; i < name.Length; i++) { - DiffractionOptics.Parameter prm = new DiffractionOptics.Parameter(); - - if (!fullySave) - { - FormParameterOption.Text = "Save checked parameters"; - if (FormParameterOption.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) - return; - } - else - FormParameterOption.AllCheck(); + var item = new ToolStripMenuItem(name[i]); + item.Name = name[i]; + item.Click += macroMenuItem_Click; + macroToolStripMenuItem.DropDownItems.Add(item); + } + } - prm.SACLA_EH5 = (FormProperty.checkBoxSACLA.Checked) ? "True" : null; + void macroMenuItem_Click(object sender, EventArgs e) + { + FormMacro.RunMacroName(((ToolStripMenuItem)sender).Name, false); + } - if (FormProperty.checkBoxSACLA.Checked) - { - prm.SACLA_EH5_CameraLength2 = FormProperty.saclaControl.CameraLength2.ToString(); - prm.SACLA_EH5_Phi = FormProperty.saclaControl.PhiDegree.ToString(); - prm.SACLA_EH5_Tau = FormProperty.saclaControl.TauDegree.ToString(); - prm.SACLA_EH5_PixelHeight = FormProperty.saclaControl.PixelHeight.ToString(); - prm.SACLA_EH5_PixelWidth = FormProperty.saclaControl.PixelWidth.ToString(); - prm.SACLA_EH5_PixleSize = FormProperty.saclaControl.PixelSize.ToString(); - prm.SACLA_EH5_FootX = FormProperty.saclaControl.Foot.X.ToString(); - prm.SACLA_EH5_FootY = FormProperty.saclaControl.Foot.Y.ToString(); - } + - prm.cameraMode = (FormParameterOption.CameraModeChecked) ? (FormProperty.radioButtonFlatPanel.Checked ? "FlatPanel" : "Gandolfi") : null; + private void ToolStripMenuItemReferenceBackground_Click(object sender, EventArgs e) + { + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 9; + } + private void editorToolStripMenuItem_Click(object sender, EventArgs e) => FormMacro.Visible = true; + #endregion - prm.waveSource = (FormParameterOption.WaveLengthChecked) ? ((int)FormProperty.waveLengthControl.WaveSource).ToString() : null; - prm.waveLength = (FormParameterOption.WaveLengthChecked) ? FormProperty.WaveLengthText : null; + #region Language メニュー + private void languageToolStripMenuItem_Click(object sender, EventArgs e) + { + englishToolStripMenuItem.Checked = ((ToolStripMenuItem)sender).Name.Contains("english"); + japaneseToolStripMenuItem.Checked = !englishToolStripMenuItem.Checked; + Thread.CurrentThread.CurrentUICulture = englishToolStripMenuItem.Checked ? new System.Globalization.CultureInfo("en") : new System.Globalization.CultureInfo("ja"); + Language.Change(this); + } - prm.xRayElement = (FormParameterOption.WaveLengthChecked) ? FormProperty.waveLengthControl.XrayWaveSourceElementNumber.ToString() : null; - prm.xRayLine = (FormParameterOption.WaveLengthChecked) ? ((int)FormProperty.waveLengthControl.XrayWaveSourceLine).ToString() : null; + #endregion - prm.cameraLength = (FormParameterOption.CameraLengthChecked) ? FormProperty.CameraLengthText : null; + #region SetIntegralProperty パラメータをフォームから読み取り、IPのフィールドにセットする + public void SetIntegralProperty() + { + try + { + IP.Camera = FormProperty.radioButtonFlatPanel.Checked ? IntegralProperty.CameraEnum.FlatPanel : IntegralProperty.CameraEnum.Gandolfi; + IP.GandolfiRadius = FormProperty.numericBoxGandlfiRadius.Value; - prm.pixSizeX = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericBoxPixelSizeX.Text : null; - prm.pixSizeY = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericBoxPixelSizeY.Text : null; - prm.pixKsi = (FormParameterOption.PixelShapeChecked) ? FormProperty.numericalTextBoxPixelKsi.Text : null; + IP.SrcWidth = SrcImgSize.Width; ;//ソース画像の幅 + IP.SrcHeight = SrcImgSize.Height; ;//ソース画像の高さ + IP.CenterX = FormProperty.numericBoxCenterPositionX.Value;//センターのx位置 + IP.CenterY = FormProperty.numericBoxCenterPositionY.Value;//センターのy位置 + IP.PixSizeX = FormProperty.numericBoxPixelSizeX.Value; + IP.PixSizeY = FormProperty.numericBoxPixelSizeY.Value;//ピクセルサイズ + IP.ksi = FormProperty.numericalTextBoxPixelKsi.RadianValue; - prm.tiltPhi = (FormParameterOption.TiltCorrectionChecked) ? FormProperty.numericBoxTiltCorrectionPhi.Text : null; - prm.tiltTau = (FormParameterOption.TiltCorrectionChecked) ? FormProperty.numericBoxTiltCorrectionTau.Text : null; + IP.SpericalRadiusInverse = FormProperty.numericalTextBoxSphericalCorections.Value / 1000; - prm.centerX = (FormParameterOption.CenterPositionChecked) ? FormProperty.numericBoxCenterPositionX.Text : null; - prm.centerY = (FormParameterOption.CenterPositionChecked) ? FormProperty.numericBoxCenterPositionY.Text : null; + IP.WaveLength = FormProperty.WaveLength; - prm.sphericalRadiusInverse = (FormParameterOption.SphericalCorrectionChecked) ? FormProperty.numericalTextBoxSphericalCorections.Text : null; + IP.ThresholdMax = (int)FormProperty.numericUpDownThresholdOfIntensityMax.Value; + IP.ThresholdMin = (int)FormProperty.numericUpDownThresholdOfIntensityMin.Value; + + IP.Edge = (int)FormProperty.numericUpDownEdge.Value; + IP.DoesExcludeEdge = FormProperty.checkBoxMaskEdge.Checked; - prm.GandolfiRadius = (FormParameterOption.GandolfiRadiusChecked) ? FormProperty.numericBoxGandlfiRadius.Text : null; + IP.ConcentricMode = FormProperty.radioButtonConcentric.Checked; - //IntegralRegion - if (FormParameterOption.IntegralRegionChecked) - { - prm.RegionMode = FormProperty.radioButtonRectangle.Checked ? "Rectangle" : "Sector"; - prm.RectangleDirection = FormProperty.comboBoxRectangleDirection.SelectedIndex.ToString(); - prm.RectangleBothSide = FormProperty.checkBoxRectangleIsBothSide.Checked ? "True" : "False"; - prm.RectangleBandWidth = FormProperty.numericUpDownRectangleBand.Value.ToString(); - prm.RectangleAngle = FormProperty.numericUpDownRectangleAngle.Value.ToString(); - prm.SectorStart = FormProperty.numericUpDownSectorStartAngle.Value.ToString(); - prm.SectorEnd = FormProperty.numericUpDownSectorEndAngle.Value.ToString(); + if (IP.ConcentricMode) + {//コンセントリックモードのとき + if (FormProperty.radioButtonConcentricAngle.Checked) + { + IP.StartAngle = (double)(FormProperty.numericBoxConcentricStart.Value) * Math.PI / 180.0; + IP.EndAngle = (double)FormProperty.numericBoxConcentricEnd.Value * Math.PI / 180.0; ; + IP.StepAngle = (double)FormProperty.numericBoxConcentricStep.Value * Math.PI / 180.0; ; + IP.Mode = HorizontalAxis.Angle; + } + else if (FormProperty.radioButtonConcentricLength.Checked) + { + IP.StartLength = FormProperty.numericBoxConcentricStart.Value; + IP.EndLength = FormProperty.numericBoxConcentricEnd.Value; + IP.StepLength = FormProperty.numericBoxConcentricStep.Value; + IP.Mode = HorizontalAxis.Length; + } + else + { + IP.StartDspacing = FormProperty.numericBoxConcentricStart.Value / 10.0; + IP.EndDspacing = FormProperty.numericBoxConcentricEnd.Value / 10.0;//角度もしくはピクセルの上限値、下限値 + IP.StepDspacing =FormProperty.numericBoxConcentricStep.Value / 10.0;//角度もしくはピクセルのステップ + IP.Mode = HorizontalAxis.d; + } + } + else + {//ラディアルモードのとき + if (FormProperty.radioButtonRadialAngle.Checked) + { + IP.RadialRadiusAngle = FormProperty.numericBoxRadialRadius.Value * Math.PI / 180.0; + IP.RadialRadiusAngleRange = FormProperty.numericBoxRadialRange.Value * Math.PI / 180.0; + IP.Mode = HorizontalAxis.Angle; + } + else + { + IP.RadialRadiusDspacing = FormProperty.numericBoxRadialRadius.Value / 10.0; + IP.RadialRadiusDspacingRange = FormProperty.numericBoxRadialRange.Value / 10.0; + IP.Mode = HorizontalAxis.d; + } + IP.RadialSectorAngle = FormProperty.numericBoxRadialStep.Value; } - //IntegralRegion - if (FormParameterOption.IntegralPropertyChecked) - { - prm.IntegrationMode = FormProperty.radioButtonConcentric.Checked ? "Concentric" : "Radial"; - prm.ConcentricUnit = FormProperty.radioButtonConcentricAngle.Checked ? "Angle" : FormProperty.radioButtonConcentricLength.Checked ? "Length" : "d-spacing"; - prm.ConcentricStart = FormProperty.numericBoxConcentricStart.Text; - prm.ConcentricEnd = FormProperty.numericBoxConcentricEnd.Text; - prm.ConcentricStep = FormProperty.numericBoxConcentricStep.Text; + IP.FilmDistance = FormProperty.CameraLength;//カメラ長 + IP.phi = FormProperty.numericBoxTiltCorrectionPhi.RadianValue; //IPの角度Tilt + IP.tau = FormProperty.numericBoxTiltCorrectionTau.RadianValue; ;//IPの角度Azumuth; - prm.RadialUnit = FormProperty.radioButtonRadialAngle.Checked ? "Angle" : "d-spacing"; - prm.RadialRadius = FormProperty.numericBoxRadialRadius.Text; - prm.RadialWidth = FormProperty.numericBoxRadialRange.Text; - prm.RadialStep = FormProperty.numericBoxRadialStep.Text; - } + if (FormProperty.radioButtonRectangle.Checked) IP.IsRectangle = true;//RectangleかSectorか + else IP.IsRectangle = false; - System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(DiffractionOptics.Parameter)); - System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Create); - serializer.Serialize(fs, prm); - fs.Close(); + //Rectangleモードのとき + if ((string)FormProperty.comboBoxRectangleDirection.SelectedItem == "Full") IP.IsFull = true; else IP.IsFull = false; + IP.RectangleBand = (double)FormProperty.numericUpDownRectangleBand.Value;//バンドの太さ + IP.RectangleAngle = (double)FormProperty.numericUpDownRectangleAngle.Value * Math.PI / 180.0; //角度 + IP.RectangleIsBothSide = FormProperty.checkBoxRectangleIsBothSide.Checked;//半直線かどうか + //Sectorモードのとき + IP.SectorStartAngle = (double)FormProperty.numericUpDownSectorStartAngle.Value * Math.PI / 180.0; //開始角度 + IP.SectorEndAngle = (double)FormProperty.numericUpDownSectorEndAngle.Value * Math.PI / 180.0; ;//終了角度 - } - catch { MessageBox.Show("Failed to save the file. Sorry."); } + IP.IsTiltCorrection = FormProperty.checkBoxTiltCorrection.Checked; + IP.IsBraggBrentanoMode = FormProperty.radioButtonBraggBrentano.Checked; + } + catch + { + MessageBox.Show("適切に入力されていない項目があります"); + return; + } + Ring.IP = IP; } + #endregion - public void ReadParameter(string filename, bool fullyRead = true) + #region Backgroundボタン + private void resetBackgroundToolStripMenuItem_Click(object sender, EventArgs e) { - if (filename == "") + Draw(); + } + + public void toolStripSplitButtonBackground_ButtonClick(object sender, EventArgs e) + { + if (!IsImageReady) return; + SetIntegralProperty(); + try { - var dlg = new OpenFileDialog { Filter = "*.prm[Parameter File]|*.prm" }; - if (dlg.ShowDialog() == DialogResult.OK) - filename = dlg.FileName; - else - return; + double upper = Convert.ToDouble(toolStripComboBoxBackgroundUpper.Text) * 0.01; + double lower = Convert.ToDouble(toolStripComboBoxBackgroundLower.Text) * 0.01; + Draw(); } + catch + { return; } + } - fullyRead = false; - //イベントをスキップ - skipSelectedAreaChangedEvent = true; - Skip = true; - - try + private void fourierToolStripMenuItem_Click(object sender, EventArgs e) + { + double[][] valueGray = new double[Ring.SrcImgSize.Height][]; + int n = 0; + for (int y = 0; y < Ring.SrcImgSize.Height; y++) { - DiffractionOptics.Parameter prm = DiffractionOptics.Read(filename); - - if (!fullyRead) - { - FormParameterOption.Text = "Read checked parameters"; - FormParameterOption.Location = new Point(this.Location.X+100,this.Location.Y+100); - if (FormParameterOption.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) - return; - } - else - FormParameterOption.AllCheck(); + valueGray[y] = new double[Ring.SrcImgSize.Width]; + for (int x = 0; x < Ring.SrcImgSize.Width; x++) + valueGray[y][x] = Ring.Intensity[n++]; + } + Complex[][] reverse = Fourier.FFT(valueGray); + //return new PseudoBitmap(, scale, scale, scale, normarize, false); + byte[] scale = new byte[256]; + for (int i = 0; i < 256; i++) + scale[i] = (byte)i; + pseudoBitmap = new PseudoBitmap(reverse, scale, scale, scale, false, false); + scalablePictureBox.PseudoBitmap = pseudoBitmap; + scalablePictureBoxThumbnail.PseudoBitmap = pseudoBitmap; + Draw(); + } - FormProperty.checkBoxSACLA.Checked = prm.SACLA_EH5 == "True"; - if (prm.SACLA_EH5 == "True") - { - if (prm.SACLA_EH5_CameraLength2 != null) - FormProperty.saclaControl.CameraLength2 = Convert.ToDouble(prm.SACLA_EH5_CameraLength2); - else - FormProperty.saclaControl.CameraLength2 = Convert.ToDouble(prm.SACLA_EH5_Distance); + #endregion - FormProperty.saclaControl.PixelHeight = Convert.ToDouble(prm.SACLA_EH5_PixelHeight); - FormProperty.saclaControl.PixelWidth = Convert.ToDouble(prm.SACLA_EH5_PixelWidth); - FormProperty.saclaControl.PixelSize = Convert.ToDouble(prm.SACLA_EH5_PixleSize); - FormProperty.saclaControl.Foot = new PointD(Convert.ToDouble(prm.SACLA_EH5_FootX), Convert.ToDouble(prm.SACLA_EH5_FootY)); + #region FindCenterボタン関連 + // + public void toolStripSplitButtonFindCenter_ButtonClick(object sender, EventArgs e) + { + if (!IsImageReady) return; + + sw.Restart(); + if (!FormDrawRing.Visible)//通常モードの時 + { + toolStripSplitButtonFindCenter.Enabled = false; + for (int i = 0; i < 1; i++) + { + SetIntegralProperty(); + if (IP.CenterX < 0 || IP.CenterX > IP.SrcWidth || IP.CenterY < 0 || IP.CenterY > IP.SrcHeight) + return; - if (prm.SACLA_EH5_Phi != null) - { - FormProperty.saclaControl.PhiDegree = Convert.ToDouble(prm.SACLA_EH5_Phi); - FormProperty.saclaControl.TauDegree = Convert.ToDouble(prm.SACLA_EH5_Tau); - } - else - { - FormProperty.saclaControl.PhiDegree = 0; - FormProperty.saclaControl.TauDegree = Convert.ToDouble(prm.SACLA_EH5_TwoTheta); - } + PointD center = Ring.FindCenter(IP, (int)FormProperty.numericBoxFindCenterSearchArea.Value, FormProperty.checkBoxExcludeMaskedPixels.Checked ? Ring.IsSpots : null); + FormProperty.ImageCenter = center; } + toolStripSplitButtonFindCenter.Enabled = true; + this.toolStripStatusLabel.Text = "Calculating Time (Find Center): " + (sw.ElapsedMilliseconds).ToString() + "ms"; - //Camera Mode - if (FormParameterOption.CameraModeChecked) + FormProperty.ImageTypeParameters[(int)Ring.ImageType].CenterPosX = FormProperty.ImageCenter.X; + FormProperty.ImageTypeParameters[(int)Ring.ImageType].CenterPosY = FormProperty.ImageCenter.Y; + + if (FormFindParameter.Visible) { - if (prm.cameraMode == null || prm.cameraMode == "FlatPanel") + + if (FormFindParameter.textBoxPrimaryFileName.Text.EndsWith(FileName) && (!SequentialImageMode||FormSequentialImage.SelectedIndex == FormFindParameter.numericBoxPrimaryImageNum.ValueInteger )) { - FormProperty.radioButtonFlatPanel.Checked = true; - FormProperty.radioButtonGandlfi.Checked = false; + FormFindParameter.numericalTextBoxPrimaryCenterPositionX.Text = FormProperty.ImageCenter.X.ToString("f8"); + FormFindParameter.numericTextBoxPrimaryCenterPositionY.Text = FormProperty.ImageCenter.Y.ToString("f8"); } else { - FormProperty.radioButtonFlatPanel.Checked = false; - FormProperty.radioButtonGandlfi.Checked = true; + FormFindParameter.numericTextBoxSecondaryCenterPositionX.Text = FormProperty.ImageCenter.X.ToString("f8"); + FormFindParameter.numericTextBoxSecondaryCenterPositionY.Text = FormProperty.ImageCenter.Y.ToString("f8"); } } + } + else if (FormDrawRing.Visible && FormDrawRing.R>0)//デバイリングから、中心位置を検索する時 + { + this.Enabled = false; + tabControl1.SelectedIndex = 1; + FormProperty.radioButtonConcentric.Checked = true; + FormProperty.radioButtonConcentricAngle.Checked = true; + var concentricStart = FormProperty.numericBoxConcentricStart.Value; + var concentricEnd = FormProperty.numericBoxConcentricEnd.Value; - //WaveProperty - if (FormParameterOption.WaveLengthChecked) - { - if (prm.waveSource != null) - FormProperty.waveLengthControl.WaveSource = (WaveSource)Convert.ToInt32(prm.waveSource); - - if (prm.xRayElement != null) - FormProperty.waveLengthControl.XrayWaveSourceElementNumber = Convert.ToInt32(prm.xRayElement); - if (prm.xRayLine != null) - FormProperty.waveLengthControl.XrayWaveSourceLine = (Crystallography.XrayLine)Convert.ToInt32(prm.xRayLine); - - if (prm.waveLength != null && (FormProperty.waveLengthControl.WaveSource == WaveSource.Electron || FormProperty.waveLengthControl.XrayWaveSourceElementNumber == 0)) - FormProperty.WaveLengthText = prm.waveLength; - } - - if (FormParameterOption.CameraLengthChecked && prm.cameraLength != null) - FormProperty.CameraLengthText = prm.cameraLength; + var fittingRange = FormProperty.numericBoxFindCenterPeakFittingRange.Value; + FormProperty.numericBoxConcentricStart.Value = FormDrawRing.TwoTheta / Math.PI * 180 - fittingRange*5; + FormProperty.numericBoxConcentricEnd.Value = FormDrawRing.TwoTheta / Math.PI * 180 + fittingRange*5; - if (FormParameterOption.PixelShapeChecked) + var pf = new PeakFunction(FormDrawRing.TwoTheta / Math.PI * 180, fittingRange/2, fittingRange, PeakFunctionForm.PseudoVoigt); + FormProperty.radioButtonSector.Checked = true; + for (int n = 0; n < 3; n++) { - if (prm.pixSizeX != null) - { - FormProperty.numericBoxPixelSizeX.Text = prm.pixSizeX; - FormProperty.numericBoxPixelSizeY.Text = prm.pixSizeY; - } - else if (prm.pixSize != null) + var pts = new List(); + var angleStep = 20; + for (int i = 0; i < 360 / angleStep; i++) { - FormProperty.numericBoxPixelSizeX.Text = prm.pixSize; - FormProperty.numericBoxPixelSizeY.Text = (Convert.ToDouble(prm.pixSize) * Convert.ToDouble(prm.aspectRatio)).ToString(); + Skip = true; + FormProperty.numericUpDownSectorStartAngle.Value = (decimal)(angleStep * i - angleStep / 2); + Skip = false; + FormProperty.numericUpDownSectorEndAngle.Value = (decimal)(angleStep * i + angleStep / 2); + var profile = Ring.GetProfile(IP); + + FittingPeak.FitPeakThread(profile.Pt.ToArray(), true, 0, ref pf); + + graphControlProfile.Profile = profile; + graphControlProfile.Peaks = new PeakFunction[] { pf }; + if (!double.IsNaN(pf.X) && pf.X != 0) + pts.Add(new PointD( + IP.FilmDistance * Math.Tan(Math.PI / 180 * pf.X) * Math.Sin(Math.PI / 180 * angleStep * i), + -IP.FilmDistance * Math.Tan(Math.PI / 180 * pf.X) * Math.Cos(Math.PI / 180 * angleStep * i))); + Application.DoEvents(); } - if (prm.pixKsi != null) - FormProperty.numericalTextBoxPixelKsi.Text = prm.pixKsi; + var centerOffset = Geometriy.GetEllipseCenter(pts.ToArray()); + if (double.IsNaN(centerOffset.X)) + break; + double centerX = centerOffset.X / IP.PixSizeX + IP.CenterX; + double centerY = centerOffset.Y / IP.PixSizeY + IP.CenterY; + FormProperty.ImageCenter = new PointD(centerX, centerY); } - //CenterPorition - if (FormParameterOption.CenterPositionChecked && prm.centerX != null) - { - FormProperty.numericBoxCenterPositionX.Text = prm.centerX; - FormProperty.numericBoxCenterPositionY.Text = prm.centerY; - } + FormProperty.radioButtonRectangle.Checked = true; + FormProperty.numericBoxConcentricStart.Value = concentricStart; + FormProperty.numericBoxConcentricEnd.Value = concentricEnd; - //TiltCorrection - if (FormParameterOption.TiltCorrectionChecked && prm.tiltPhi != null) - { - FormProperty.numericBoxTiltCorrectionPhi.Text = prm.tiltPhi; - FormProperty.numericBoxTiltCorrectionTau.Text = prm.tiltTau; - } + this.Enabled = true; + } + Draw(); + } - //SphericalRadius - if (FormParameterOption.TiltCorrectionChecked && prm.sphericalRadiusInverse != null) - FormProperty.numericalTextBoxSphericalCorections.Text = prm.sphericalRadiusInverse; + private void toolStripButtonFixCenter_Click(object sender, EventArgs e) + { + FormProperty.checkBoxFixCenter.Checked = !FormProperty.checkBoxFixCenter.Checked; + } - //GandolfiRadius - if (FormParameterOption.GandolfiRadiusChecked && prm.GandolfiRadius != null) - FormProperty.numericBoxGandlfiRadius.Text = prm.GandolfiRadius; + private void toolStripButtonFixCenter_CheckedChanged(object sender, EventArgs e) + { + if (toolStripButtonFixCenter.Checked) + { + toolStripButtonFixCenter.ForeColor = Color.Red; + toolStripSplitButtonFindCenter.Enabled = false; + } + else + { + toolStripButtonFixCenter.ForeColor = Color.Gray; + toolStripSplitButtonFindCenter.Enabled = true; + } + } - //IntegralRegion - if (FormParameterOption.IntegralRegionChecked) - { - if (prm.RegionMode != null) - { - FormProperty.radioButtonRectangle.Checked = prm.RegionMode == "Rectangle"; - FormProperty.radioButtonSector.Checked = prm.RegionMode == "Sector"; - } + #endregion - if (prm.RectangleDirection != null) - FormProperty.comboBoxRectangleDirection.SelectedIndex = Convert.ToInt32(prm.RectangleDirection); - if (prm.RectangleBothSide != null) - FormProperty.checkBoxRectangleIsBothSide.Checked = prm.RectangleBothSide == "True"; - if (prm.RectangleBandWidth != null) - FormProperty.numericUpDownRectangleBand.Value = Convert.ToDecimal(prm.RectangleBandWidth); - if (prm.RectangleAngle != null) - FormProperty.numericUpDownRectangleAngle.Value = Convert.ToDecimal(prm.RectangleAngle); + #region FindSpotsボタン関連 + public void toolStripSplitButtonFindSpots_ButtonClick(object sender, EventArgs e) + { + if (!IsImageReady) return; - if (prm.SectorStart != null) - FormProperty.numericUpDownSectorStartAngle.Value = Convert.ToDecimal(prm.SectorStart); - if (prm.SectorEnd != null) - FormProperty.numericUpDownSectorEndAngle.Value = Convert.ToDecimal(prm.SectorEnd); - } + this.Cursor = Cursors.WaitCursor; + toolStripSplitButtonFindSpots.Enabled = false; + int d = Environment.TickCount; + SetIntegralProperty(); + Ring.FindSpots(IP, (double)FormProperty.numericUpDownFindSpotsDeviation.Value); + Draw(); + this.Cursor = Cursors.Default; + toolStripSplitButtonFindSpots.Enabled = true; + this.toolStripStatusLabel.Text = "Calculating Time (Find Spots): " + (Environment.TickCount - d).ToString() + "ms"; + } + #endregion - //IntegralProperty - if (FormParameterOption.IntegralPropertyChecked) - { - if (prm.IntegrationMode != null) - { - FormProperty.radioButtonConcentric.Checked = prm.IntegrationMode == "Concentric"; - FormProperty.radioButtonRadial.Checked = prm.IntegrationMode == "Radial"; - } + #region Maskボタン関連 + //ClearSpotsボタン + public void toolStripMenuItemClearSpots_Click(object sender, EventArgs e) + { + ClearMask(); + } - if (prm.ConcentricUnit != null) - { - FormProperty.radioButtonConcentricAngle.Checked = prm.ConcentricUnit == "Angle"; - FormProperty.radioButtonConcentricLength.Checked = prm.ConcentricUnit == "Length"; - FormProperty.radioButtonConcentricDspacing.Checked = prm.ConcentricUnit == "d-spacing"; - } - if (prm.ConcentricStart != null) - FormProperty.numericBoxConcentricStart.Text = prm.ConcentricStart; - if (prm.ConcentricEnd != null) - FormProperty.numericBoxConcentricEnd.Text = prm.ConcentricEnd; - if (prm.ConcentricStep != null) - FormProperty.numericBoxConcentricStep.Text = prm.ConcentricStep; + private void inverseMaskToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!IsImageReady) return; + for (int i = 0; i < Ring.IsSpots.Count; i++) + Ring.IsSpots[i] = !Ring.IsSpots[i]; + Draw(); + } - if (prm.RadialUnit != null) - { - FormProperty.radioButtonRadialAngle.Checked = prm.RadialUnit == "Angle"; - FormProperty.radioButtonRadialDspacing.Checked = prm.RadialUnit == "d-spacing"; - } + private void toolStripMenuItemMaskAll_Click(object sender, EventArgs e) + { + if (!IsImageReady) return; + for (int i = 0; i < Ring.IsSpots.Count; i++) + Ring.IsSpots[i] = true; + Draw(); + } - if (prm.RadialRadius != null) - FormProperty.numericBoxRadialRadius.Text = prm.RadialRadius; - if (prm.RadialWidth != null) - FormProperty.numericBoxRadialRange.Text = prm.RadialWidth; - if (prm.RadialStep != null) - FormProperty.numericBoxRadialStep.Text = prm.RadialStep; - } + //マニュアルモードボタンがクリックされた時の反応 + private void toolStripButtonManualSpotMode_Click(object sender, EventArgs e) + { + FormProperty.Visible = !toolStripButtonManualSpotMode.Checked; + toolStripButtonManualSpotMode.Checked = !toolStripButtonManualSpotMode.Checked; + } - + //マニュアルモードボタンのチェック状態が変更したとき + private void toolStripButtonManualSpotMode_CheckedChanged(object sender, EventArgs e) + { + toolStripComboBoxManualSpotSize.Visible = toolStripButtonManualSpotMode.Checked && FormProperty.radioButtonManualSpot.Checked; + + if (toolStripButtonManualSpotMode.Checked) + { + toolStripButtonManualSpotMode.ForeColor = Color.Red; + toolStripSplitButtonFindSpots.Enabled = false; + FormProperty.tabControl.SelectedIndex = 4; + FormProperty.checkBoxManualMaskMode.Checked = true; } - catch { MessageBox.Show("Failed to read the file. Sorry."); } - //イベントスキップを解除 - skipSelectedAreaChangedEvent = false; - Skip = false; - IntegralArea_Changed(new object(),new EventArgs()); + else + { + toolStripButtonManualSpotMode.ForeColor = Color.Gray; + toolStripSplitButtonFindSpots.Enabled = true; + FormProperty.checkBoxManualMaskMode.Checked = false; + } + } - FormProperty.SaveParameterForEachImageType(Ring.ImageType); + private void toolStripComboBoxManualSpotSize_TextChanged(object sender, EventArgs e) + { + if (FormProperty.textBoxManualSpotSize.Text != toolStripComboBoxManualSpotSize.Text) + FormProperty.textBoxManualSpotSize.Text = toolStripComboBoxManualSpotSize.Text; } - /* - [Serializable()] - public class Parameter + #endregion + + #region GetI Profileボタン関連 + private void toolStripMenuItemAngleSetting_Click(object sender, EventArgs e) { - /// - /// "FlatPanel" か "Gandolfi" - /// - public string cameraMode; + FormProperty.Visible = true; + FormProperty.tabControl.SelectedIndex = 3; - public string SACLA_EH5; - public string SACLA_EH5_PixelWidth; - public string SACLA_EH5_PixelHeight; - public string SACLA_EH5_PixleSize; - public string SACLA_EH5_TwoTheta; - public string SACLA_EH5_Distance; - public string SACLA_EH5_FootX; - public string SACLA_EH5_FootY; + } - public string waveSource; - public string electronEnergy; + private void toolStripMenuItemConcenctricIntegration_Click(object sender, EventArgs e) + { + FormProperty.Visible = true; + FormProperty.radioButtonConcentric.Checked = true; + FormProperty.tabControl.SelectedIndex = 3; + FormProperty.Visible = true; - public string xRayElement; - public string xRayLine; - public string waveLength; + } - public string cameraLength; - public string pixSize; - public string pixSizeX; - public string pixSizeY; - public string pixKsi; - public string aspectRatio; - public string tiltPhi; - public string tiltTau; - public string centerX; - public string centerY; - public string sphericalRadiusInverse; - public string GandolfiRadius; + private void toolStripMenuItemRadialIntegration_Click(object sender, EventArgs e) + { - /// - /// Concentric か Radial - /// - public string IntegrationMode; + FormProperty.radioButtonRadial.Checked = true; + FormProperty.tabControl.SelectedIndex = 3; + FormProperty.Visible = true; - public string ConcentricStart; - public string ConcentricEnd; - public string ConcentricStep; - /// - /// Angle, Length, d-spacing - /// - public string ConcentricUnit; - public string RadialRadius; - public string RadialWidth; - public string RadialStep; - /// - /// Angle, d-spacing - /// - public string RadialUnit; + } + public void toolStripSplitButtonGetProfile_ButtonClick(object sender, EventArgs e) + { + GetProfile(); + } + public void GetProfile(string fileName = "") + { + if (!IsImageReady) return; + this.Cursor = Cursors.WaitCursor; + toolStripSplitButtonGetProfile.Enabled = false; + int d = Environment.TickCount; + SetIntegralProperty(); + + //パラメータをイメージ種ごとに保存 + FormProperty.SaveParameterForEachImageType(Ring.ImageType); + + if (findCenterBeforeGetProfileToolStripMenuItem.Checked == true && toolStripButtonFixCenter.Checked == false) + { + toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); + toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); + } + if (findSpotsBeforeGetProfileToolStripMenuItem.Checked == true && toolStripButtonManualSpotMode.Checked == false) + toolStripSplitButtonFindSpots_ButtonClick(new object(), new EventArgs()); - //Rectangle or Sector - public string RegionMode; + if (FormProperty.radioButtonConcentricAngle.Checked) + IP.Mode = HorizontalAxis.Angle; + else + IP.Mode = HorizontalAxis.d; - public string RectangleDirection; - public string RectangleBandWidth; - public string RectangleBothSide; - public string RectangleAngle; + //通常積分モード + if (!toolStripMenuItemDividedByAngleStep.Checked) + { + try + { + SetMask(); - public string SectorStart; - public string SectorEnd; + diffractionProfile.SrcAxisMode = IP.Mode; + diffractionProfile.SrcWaveLength = IP.WaveLength; + diffractionProfile.Mode = FormProperty.radioButtonConcentric.Checked ? DiffractionProfileMode.Concentric : DiffractionProfileMode.Radial; - public string ExceptMaskedSpots; - public string ExceptEdges; - public string ExceptOver; - public string ExceptUnder; + int[] targets = new int[1]; + //シーケンシャルモードの時の処理 + if (toolStripButtonImageSequence.Enabled) + { + if (toolStripMenuItemAllSequentialImages.Checked) + { + targets = new int[FormSequentialImage.MaximumNumber]; + + for (int n = 0; n < FormSequentialImage.MaximumNumber; n++) + targets[n] = n; + } + else if (toolStripMenuItemSelectedSequentialImages.Checked) + targets = FormSequentialImage.SelectedIndices; + } + List dpList = new List(); + for (int i = 0; i < targets.Length; i++) + { + //シーケンシャルモードの時の処理 + if (toolStripButtonImageSequence.Enabled && (toolStripMenuItemAllSequentialImages.Checked || toolStripMenuItemSelectedSequentialImages.Checked)) + { + FormSequentialImage.SkipCalcFreq = i != targets.Length - 1; + FormSequentialImage.AverageMode = false; + FormSequentialImage.SelectedIndex = targets[i]; + if (Ring.ImageType == Ring.ImageTypeEnum.HDF5) + diffractionProfile.SrcWaveLength = UniversalConstants.Convert.EnergyToXrayWaveLength(Ring.SequentialImageEnergy[targets[i]]); + } + diffractionProfile.Name = FileName; + if (toolStripButtonImageSequence.Enabled) + diffractionProfile.Name += " " + FileNameSub; - } - */ + diffractionProfile.OriginalProfile = Ring.GetProfile(IP); - #endregion + //必要であればKalpha2を除去 + if(FormProperty.checkBoxTest.Checked) + { + if (FormProperty.waveLengthControl.XrayWaveSourceElementNumber > 10 && FormProperty.waveLengthControl.XrayWaveSourceLine == XrayLine.Ka1) + { + double alpha1 = AtomConstants.CharacteristicXrayWavelength(FormProperty.waveLengthControl.XrayWaveSourceElementNumber, Crystallography.XrayLine.Ka1); + double alpha2 = AtomConstants.CharacteristicXrayWavelength(FormProperty.waveLengthControl.XrayWaveSourceElementNumber, Crystallography.XrayLine.Ka2); + double ratio = FormProperty.numericBoxTest.Value; + diffractionProfile.OriginalProfile= DiffractionProfile.RemoveKalpha2(diffractionProfile.OriginalProfile,alpha1,alpha2,ratio); + } + } + //Unrolled Imageの作成 + if (FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked) + { + double sectorStep = Math.PI * 1.0 / 180.0; + double xStart = IP.StartAngle; + double xEnd = IP.EndAngle; + double xStep = IP.StepAngle; + double[] temp = Ring.GetUnrolledImageArray(IP, sectorStep, xStart, xEnd, xStep); + diffractionProfile.ImageArray = new double[temp.Length]; + for (int j = 0; j < temp.Length; j++) + diffractionProfile.ImageArray[j] = temp[j]; + diffractionProfile.ImageScale = 1; + diffractionProfile.ImageWidth = (int)((xEnd - xStart) / xStep); + diffractionProfile.ImageHeight = (int)(2 * Math.PI / sectorStep); + } + else + diffractionProfile.ImageArray = null; + dpList.Add((DiffractionProfile)diffractionProfile.Clone()); + } + //PDIndexerへの送信 + if (FormProperty.checkBoxSendProfileToPDIndexer.Checked) + { + using Mutex clipboard = new Mutex(false, "ClipboardOperation"); + if (clipboard.WaitOne(500, false)) + { + Clipboard.SetDataObject(dpList.ToArray()); + clipboard.ReleaseMutex(); + } + clipboard.Close(); + } + //ファイル保存 + if (FormProperty.checkBoxSaveFile.Checked) + SaveProfile(diffractionProfile,fileName); - private void webPageToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - if (Thread.CurrentThread.CurrentUICulture.ToString().Contains("ja")) - System.Diagnostics.Process.Start("http://pmsl.planet.sci.kobe-u.ac.jp/~seto/software/IPAnalyzer/ja/IPAnalyzerHelp.html"); - else - System.Diagnostics.Process.Start("http://pmsl.planet.sci.kobe-u.ac.jp/~seto/software/IPAnalyzer/en/IPAnalyzerHelp.html"); + graphControlProfile.Profile = diffractionProfile.OriginalProfile; + toolStripSplitButtonGetProfile.Enabled = true; + this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + MessageBox.Show("正常にデータを送信できませんでした。"); + this.Cursor = Cursors.Default; + toolStripSplitButtonGetProfile.Enabled = true; + return; + } } - catch { } - } + else //LPOモードのとき + { + #region + try + { + List dpList = new List(); - public bool thumbnailmode = false; - private void radioButton1_CheckedChanged(object sender, EventArgs e) - { - thumbnailmode = !thumbnailmode; - Draw(); - } + toolStripSplitButtonGetProfile.Enabled = false; + double anglestep; + try { anglestep = Convert.ToDouble(toolStripComboBoxAngleStep.Text); } + catch { return; } - public void toolStripSplitButtonBackground_ButtonClick(object sender, EventArgs e) - { - if (!IsImageReady) return; - SetIntegralProperty(); - try - { - double upper = Convert.ToDouble(toolStripComboBoxBackgroundUpper.Text) * 0.01; - double lower = Convert.ToDouble(toolStripComboBoxBackgroundLower.Text) * 0.01; - Draw(); - } - catch - { return; } + FormProperty.radioButtonRectangle.Checked = true; ; + FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; - } + diffractionProfile.OriginalProfile = Ring.GetProfile(IP); + diffractionProfile.Name = FileName + " - whole"; + diffractionProfile.SrcAxisMode = FormProperty.radioButtonConcentricAngle.Checked ? HorizontalAxis.Angle : HorizontalAxis.Length; + diffractionProfile.SrcWaveLength = IP.WaveLength; + diffractionProfile.IsLPOmain = true; + diffractionProfile.IsLPOchild = false; - private void resetToolStripMenuItem_Click(object sender, EventArgs e) - { - Draw(); - } + this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; + dpList.Add((DiffractionProfile)diffractionProfile.Clone()); + string tempFilename = ""; + if (FormProperty.checkBoxSaveFile.Checked) + { + if (FormProperty.radioButtonSetDirectoryEachTime.Checked) + { + string extension = FormProperty.radioButtonAsPDIformat.Checked ? ".pdi" : ".csv"; + SaveFileDialog dlg = new SaveFileDialog(); + dlg.FileName = FileName; + dlg.Filter = extension + "|" + extension; - private void FormMain_KeyDown(object sender, KeyEventArgs e) - { - if (e.Control && e.Shift && e.KeyCode == Keys.C) - toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); - else if (e.Control && e.Shift && e.KeyCode == Keys.S) - toolStripSplitButtonFindSpots_ButtonClick(new object(), new EventArgs()); - else if (e.Control && e.Shift && e.KeyCode == Keys.G) - toolStripSplitButtonGetProfile_ButtonClick(new object(), new EventArgs()); - else if (e.Control && e.Shift && e.KeyCode == Keys.B) - toolStripSplitButtonBackground_ButtonClick(new object(), new EventArgs()); - else if (e.Control && e.Shift && e.KeyCode == Keys.M) - FormProperty.checkBoxManualMaskMode.Checked = !FormProperty.checkBoxManualMaskMode.Checked; - else if (e.Control && scalablePictureBox.Focused) - { - IsManualSpotMode = true; - FormProperty.checkBoxManualMaskMode.Checked = true; - Draw(); - } - else if (e.Control && e.KeyCode == Keys.Left && toolStripButtonImageSequence.Enabled && FormSequentialImage.SelectedIndex > 0) - FormSequentialImage.SelectedIndex--; - else if (e.Control && e.KeyCode == Keys.Right && toolStripButtonImageSequence.Enabled && FormSequentialImage.SelectedIndex < FormSequentialImage.MaximumNumber) - FormSequentialImage.SelectedIndex++; + if (dlg.ShowDialog() != DialogResult.OK) + throw new Exception(); - } + tempFilename = dlg.FileName; + tempFilename = tempFilename.Remove(tempFilename.LastIndexOf(".")); + SaveProfile(diffractionProfile,tempFilename + "-whole" + extension); + } + else + SaveProfile(diffractionProfile,fileName); + } - private void FormMain_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyValue == 17 && IsManualSpotMode) - { - IsManualSpotMode = false; - FormProperty.checkBoxManualMaskMode.Checked = false; - Draw(); - } - } + graphControlProfile.Profile = diffractionProfile.Profile; - #region Maskファイルの読み書き - public string initialMaskDirectory; - private void toolStripMenuItemReadMask_Click(object sender, EventArgs e) - { - var dlg = new OpenFileDialog() { Filter = "Mask file; *.mas|*.mas" }; - if (initialMaskDirectory != "") - dlg.InitialDirectory = initialMaskDirectory; - if (dlg.ShowDialog() == DialogResult.OK) - { - ReadMask(dlg.FileName); - initialMaskDirectory = Path.GetDirectoryName(dlg.FileName); - } - } - public void ReadMask(string filename) - { - if (filename == "") - { - var dlg = new SaveFileDialog { Filter = "*.mas|*.mas" }; - if (dlg.ShowDialog() == DialogResult.OK) - filename = dlg.FileName; - else - return; - } + FormProperty.radioButtonSector.Checked = true; + for (int i = 0; i < 360 / anglestep; i++) + { + Skip = true; + FormProperty.numericUpDownSectorStartAngle.Value = (decimal)(anglestep * i - anglestep / 2); + Skip = false; + FormProperty.numericUpDownSectorEndAngle.Value = (decimal)(anglestep * i + anglestep / 2); + Application.DoEvents(); + //SetMask(); + diffractionProfile.OriginalProfile = Ring.GetProfile(IP); + diffractionProfile.Name = FileName + " - " + (i * anglestep).ToString("000"); + diffractionProfile.SrcAxisMode = FormProperty.radioButtonConcentricAngle.Checked ? HorizontalAxis.Angle : HorizontalAxis.Length; + diffractionProfile.SrcTakeoffAngle = IP.WaveLength; + diffractionProfile.IsLPOmain = false; + diffractionProfile.IsLPOchild = true; + + this.toolStripStatusLabel.Text = "Calculating Time (Get Profile): " + (Environment.TickCount - d).ToString() + "ms"; + //toolStripSplitButtonGetProfile.Enabled = true; - try - { - var br = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.ReadWrite)); - var mask = new bool[br.ReadInt32()]; - int n = 0; - for (int i = 0; i < mask.Length / 8; i++) - { - byte b = br.ReadByte(); - for (int j = 0; j < 8; j++) + dpList.Add((DiffractionProfile)diffractionProfile.Clone()); + if (FormProperty.checkBoxSaveFile.Checked) + { + if (FormProperty.radioButtonSetDirectoryEachTime.Checked) + SaveProfile( diffractionProfile,tempFilename + "-" + (i * anglestep).ToString("000")); + else + SaveProfile(diffractionProfile); + } + + } + if (FormProperty.checkBoxSendProfileToPDIndexer.Checked) { - mask[n++] = (b & 1) == 1; - b >>= 1; + using (Mutex clipboard = new Mutex(false, "ClipboardOperation")) + { + if (clipboard.WaitOne(5000, false)) + { + Clipboard.SetDataObject(dpList.ToArray()); + clipboard.ReleaseMutex(); + } + clipboard.Close(); + } } + FormProperty.radioButtonRectangle.Checked = true; ; + FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; + toolStripSplitButtonGetProfile.Enabled = true; } - br.Close(); - if (Ring.IsSpots != null && mask != null && mask.Length == Ring.IsSpots.Count) + catch { - for (int i = 0; i < mask.Length; i++) - Ring.IsSpots[i] = mask[i]; + toolStripSplitButtonGetProfile.Enabled = true; + FormProperty.radioButtonRectangle.Checked = true; + FormProperty.comboBoxRectangleDirection.SelectedIndex = 0; - SetMask(); - Draw(); + MessageBox.Show("正常にデータを送信できませんでした。"); + this.Cursor = Cursors.Default; + return; } + #endregion } - catch { } + + this.Cursor = Cursors.Default; } - public void toolStripMenuItemSaveMask_Click(object sender, EventArgs e) + private void toolStripMenuItemSendProfileToPDIndexer_Click(object sender, EventArgs e) { - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "Mask file; *.mas|*.mas"; - if (dlg.ShowDialog() == DialogResult.OK) - SaveMask(dlg.FileName); + FormProperty.checkBoxSendProfileToPDIndexer.Checked = !FormProperty.checkBoxSendProfileToPDIndexer.Checked; } - public void SaveMask(string fileName) + #endregion + + #region SaveProfile + + private void SaveProfile(DiffractionProfile dp, string filename="") { - if (fileName == "") + string extension = FormProperty.radioButtonAsPDIformat.Checked ? ".pdi" : ".csv"; + if (FormProperty.radioButtonSetDirectoryEachTime.Checked) { - var dlg = new OpenFileDialog { Filter = "*.mas|*.mas" }; - if (dlg.ShowDialog() == DialogResult.OK) - fileName = dlg.FileName; - else - return; - if (!fileName.EndsWith("mas")) - fileName += ".mas"; + var dialog = new SaveFileDialog(); + dialog.Filter = extension + "|" + extension; + dialog.FileName = dp.Name.Substring(0, dp.Name.LastIndexOf('.')); + if (dialog.ShowDialog() == DialogResult.OK) + filename = dialog.FileName; + else return; } + else if(filename=="") + filename = FilePath + dp.Name.Substring(0, dp.Name.LastIndexOf('.')) + extension; - var br = new BinaryWriter(new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite)); - br.Write(Ring.IsSpots.Count); - int n = 0; - for (int i = 0; i < Ring.IsSpots.Count / 8; i++) - { - byte b = 0; - byte m = 1; - for (int j = 0; j < 8; j++) - { - if (Ring.IsSpots[n++]) - b += m; - m *= 2; - } - br.Write(b); + if (FormProperty.radioButtonAsPDIformat.Checked) + { + if (!filename.EndsWith(".pdi")) + filename += ".pdi"; + XYFile.SavePdiFile(new DiffractionProfile[] { dp }, filename); + } + else if (FormProperty.radioButtonAsCSVformat.Checked) + { + if (!filename.EndsWith(".csv")) + filename += ".csv"; + StreamWriter sw = new StreamWriter(filename); + for (int i = 0; i < dp.OriginalProfile.Pt.Count; i++) + sw.WriteLine($"{dp.OriginalProfile.Pt[i].X},{dp.OriginalProfile.Pt[i].Y},{dp.OriginalProfile.Err[i].Y}"); + sw.Close(); + } + else if (FormProperty.radioButtonAsTSVformat.Checked) + { + if (!filename.EndsWith(".tsv")) + filename += ".tsv"; + StreamWriter sw = new StreamWriter(filename); + for (int i = 0; i < dp.OriginalProfile.Pt.Count; i++) + sw.WriteLine($"{dp.OriginalProfile.Pt[i].X}\t{dp.OriginalProfile.Pt[i].Y}\t{dp.OriginalProfile.Err[i].Y}"); + sw.Close(); } - br.Close(); - } #endregion - - - private void hintToolStripMenuItem_Click(object sender, EventArgs e) - { - InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.Hint; - InitialDialog.Visible = true; - } - - private void licenseToolStripMenuItem_Click(object sender, EventArgs e) - { - InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.License; - InitialDialog.Visible = true; - } - - private void versionHistoryToolStripMenuItem_Click(object sender, EventArgs e) - { - InitialDialog.DialogMode = Crystallography.Controls.CommonDialog.DialogModeEnum.History; - InitialDialog.Visible = true; - } - - - - double maxIntensity = uint.MinValue; - double sumOfIntensity = 0; - double variance = 0; - public void SetFrequencyProfile() + #region IntegralArea_Changed + public void IntegralArea_Changed(object sender, EventArgs e) { - maxIntensity = uint.MinValue; - sumOfIntensity = 0; - double sumOfSquare = 0; - frequencyProfile = new Profile(); - frequencyProfile.Pt = new List(); - for (int i = 0; i < Ring.Intensity.Count; i++) - { - double intensity = Ring.Intensity[i]; - maxIntensity = Math.Max(maxIntensity, intensity); - sumOfIntensity += intensity; - sumOfSquare += intensity * intensity; - } - - for (int i = 0; i < Ring.Frequency.Count; i++) - frequencyProfile.Pt.Add(new PointD(Ring.Frequency.Keys[i], Ring.Frequency[Ring.Frequency.Keys[i]])); - graphControlFrequency.Profile = frequencyProfile; - variance = Math.Sqrt((Ring.Intensity.Count * sumOfSquare - sumOfIntensity * sumOfIntensity) / Ring.Intensity.Count / (Ring.Intensity.Count - 1)); - } + if (!IsImageReady || Skip) return; + SetIntegralProperty(); + System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); + sw.Start(); - private void graphControlFrequency_LinePositionChanged() - { - if (graphControlFrequency.LineList.Length == 2) - { - var max = Math.Max(graphControlFrequency.LineList[0].X, graphControlFrequency.LineList[1].X); - if (trackBarAdvancedMaxInt.Maximum < max) - trackBarAdvancedMaxInt.Value = trackBarAdvancedMaxInt.Maximum; - else if (trackBarAdvancedMinInt.Minimum > max) - trackBarAdvancedMaxInt.Value = trackBarAdvancedMaxInt.Minimum; - else - trackBarAdvancedMaxInt.Value = max; + if (FormFindParameter.Visible && FormFindParameter.backgroundWorkerRefine.IsBusy) + Ring.SetInsideArea(IP, true, false, false); + else + Ring.SetInsideArea(IP); - var min = Math.Min(graphControlFrequency.LineList[0].X, graphControlFrequency.LineList[1].X); - if (trackBarAdvancedMinInt.Maximum < min) - trackBarAdvancedMinInt.Value = trackBarAdvancedMinInt.Maximum; - else if (trackBarAdvancedMinInt.Minimum > min) - trackBarAdvancedMinInt.Value = trackBarAdvancedMinInt.Minimum; - else - trackBarAdvancedMinInt.Value = min; - } - } + this.toolStripStatusLabel.Text = "Calculating Time (SetIntegralArea): " + sw.ElapsedMilliseconds.ToString() + "ms"; - private void resetFrequencyProfileToolStripMenuItem_Click(object sender, EventArgs e) - { - SetFrequencyProfile(); + SetMask(); + Draw(); } + #endregion - private void calibrateRaxisImageToolStripMenuItem_Click(object sender, EventArgs e) + #region UnrolledImage + private void toolStripMenuItemSendUnrolledImage_Click(object sender, EventArgs e) { - FormCalibrateIntensity.Show(); + FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked = !FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked; } - private void fourierToolStripMenuItem_Click(object sender, EventArgs e) + private void toolStripButtonCircumferentialBlur_Click(object sender, EventArgs e) { - double[][] valueGray = new double[Ring.SrcImgSize.Height][]; - int n = 0; - for (int y = 0; y < Ring.SrcImgSize.Height; y++) + var formBlurAngle = new FormBlurAngle(); + if (formBlurAngle.ShowDialog() == DialogResult.OK) { - valueGray[y] = new double[Ring.SrcImgSize.Width]; - for (int x = 0; x < Ring.SrcImgSize.Width; x++) - valueGray[y][x] = Ring.Intensity[n++]; + Ring.CircumferentialBlur(formBlurAngle.BlurAngle); + initializeFilter(); + Draw(); } - Complex[][] reverse = Fourier.FFT(valueGray); - //return new PseudoBitmap(, scale, scale, scale, normarize, false); - byte[] scale = new byte[256]; - for (int i = 0; i < 256; i++) - scale[i] = (byte)i; - - pseudoBitmap = new PseudoBitmap(reverse, scale, scale, scale, false, false); - scalablePictureBox.PseudoBitmap = pseudoBitmap; - scalablePictureBoxThumbnail.PseudoBitmap = pseudoBitmap; - Draw(); } + #endregion - private void toolStripMenuItemAngleSetting_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 3; - } + #region 子フォームの立ち上げ、終了 - private void toolStripMenuItemConcenctricIntegration_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.radioButtonConcentric.Checked = true; - FormProperty.tabControl.SelectedIndex = 3; - FormProperty.Visible = true; + #region Intensity Table + private void toolStripButtonIntensityTable_CheckedChanged(object sender, EventArgs e) + => FormIntTable.Visible = toolStripButtonIntensityTable.Checked; + #endregion - } + #region Auto Procedure + private void toolStripButtonAutoProcedure_CheckedChanged(object sender, EventArgs e) + => FormAutoProc.Visible = toolStripButtonAutoProcedure.Checked; + #endregion - private void toolStripMenuItemRadialIntegration_Click(object sender, EventArgs e) + #region Draw Ring + private void toolStripButtonRing_CheckedChanged(object sender, EventArgs e) { + var loc = FormDrawRing.Location; - FormProperty.radioButtonRadial.Checked = true; - FormProperty.tabControl.SelectedIndex = 3; - FormProperty.Visible = true; + FormDrawRing.Visible = toolStripButtonRing.Checked; + FormDrawRing.Location = loc; } + #endregion - private void exitToolStripMenuItem_Click(object sender, EventArgs e) => Close(); + + private void toolStripButtonFindParameter_CheckedChanged(object sender, EventArgs e) + => FormFindParameter.Visible = toolStripButtonFindParameter.Checked; + + private void toolStripButtonImageSequence_CheckedChanged(object sender, EventArgs e) + { + FormSequentialImage.Visible = toolStripButtonImageSequence.Checked; + FormSequentialImage.Location = new Point(this.Location.X + 50, this.Location.Y + 50); + } + /// /// UnrolledImageの作成 @@ -3610,7 +3572,6 @@ private void toolStripSplitButtonUnroll_CheckChanged(object sender, EventArgs e) scalablePictureBox.PseudoBitmap = new PseudoBitmap(imageArray, imageArray.Length / (int)(2 * Math.PI / sectorStep), scale, scale, scale, false); scalablePictureBoxThumbnail.PseudoBitmap = new PseudoBitmap(imageArray, imageArray.Length / (int)(2 * Math.PI / sectorStep), scale, scale, scale, false); - //setScale(); Draw(); } else @@ -3621,105 +3582,163 @@ private void toolStripSplitButtonUnroll_CheckChanged(object sender, EventArgs e) else { initializeFilter(); - //setScale(); Draw(); } } - private void toolStripButtonFixCenter_Click(object sender, EventArgs e) + #endregion + + #region View関連 + private void toolStripComboBoxScale_SelectedIndexChanged(object sender, EventArgs e) { - FormProperty.checkBoxFixCenter.Checked = !FormProperty.checkBoxFixCenter.Checked; + setScale(); + Draw(); } - private void toolStripButtonFixCenter_CheckedChanged(object sender, EventArgs e) + private void toolStripComboBoxScale2_SelectedIndexChanged(object sender, EventArgs e) { - if (toolStripButtonFixCenter.Checked) - { - toolStripButtonFixCenter.ForeColor = Color.Red; - toolStripSplitButtonFindCenter.Enabled = false; - } - else - { - toolStripButtonFixCenter.ForeColor = Color.Gray; - toolStripSplitButtonFindCenter.Enabled = true; - - } + setScale(); + Draw(); } - //マニュアルモードボタンがクリックされた時の反応 - private void toolStripButtonManualSpotMode_Click(object sender, EventArgs e) + private void comboBoxGradient_SelectedIndexChanged_1(object sender, EventArgs e) { - FormProperty.Visible = !toolStripButtonManualSpotMode.Checked; - toolStripButtonManualSpotMode.Checked = !toolStripButtonManualSpotMode.Checked; + setScale(); + Draw(); } - - //マニュアルモードボタンのチェック状態が変更したとき - private void toolStripButtonManualSpotMode_CheckedChanged(object sender, EventArgs e) + private void setScale() { - toolStripComboBoxManualSpotSize.Visible = toolStripButtonManualSpotMode.Checked && FormProperty.radioButtonManualSpot.Checked; + pseudoBitmap.IsNegative = comboBoxGradient.SelectedIndex == 1; - if (toolStripButtonManualSpotMode.Checked) - { - toolStripButtonManualSpotMode.ForeColor = Color.Red; - toolStripSplitButtonFindSpots.Enabled = false; - FormProperty.tabControl.SelectedIndex = 4; - FormProperty.checkBoxManualMaskMode.Checked = true; - } - else - { - toolStripButtonManualSpotMode.ForeColor = Color.Gray; - toolStripSplitButtonFindSpots.Enabled = true; - FormProperty.checkBoxManualMaskMode.Checked = false; - } + //スケールをセット + if (comboBoxScale1.SelectedIndex == 0)//ログスケール + if (comboBoxScale2.SelectedIndex == 0)//グレー + { + pseudoBitmap.ScaleR = pseudoBitmap.ScaleG = pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLog; + pseudoBitmap.GrayScale = true; + } + else + { + pseudoBitmap.ScaleR = PseudoBitmap.BrightnessScaleLogColorR; + pseudoBitmap.ScaleG = PseudoBitmap.BrightnessScaleLogColorG; + pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLogColorB; + pseudoBitmap.GrayScale = false; + } + else//リニア + if (comboBoxScale2.SelectedIndex == 0)//グレー + { + pseudoBitmap.ScaleR = pseudoBitmap.ScaleG = pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLiner; + pseudoBitmap.GrayScale = true; + } + else//color + { + pseudoBitmap.ScaleR = PseudoBitmap.BrightnessScaleLinerColorR; + pseudoBitmap.ScaleG = PseudoBitmap.BrightnessScaleLinerColorG; + pseudoBitmap.ScaleB = PseudoBitmap.BrightnessScaleLinerColorB; + pseudoBitmap.GrayScale = false; + } + trackBarAdvancedMaxInt_ValueChanged(new object(), 0); + trackBarAdvancedMinInt_ValueChanged(new object(),0); } - private void toolStripComboBoxManualSpotSize_TextChanged(object sender, EventArgs e) + #endregion + + #region Whole image / Near centerの切り替え + public bool thumbnailmode = false; + private void radioButton1_CheckedChanged(object sender, EventArgs e) { - if (FormProperty.textBoxManualSpotSize.Text != toolStripComboBoxManualSpotSize.Text) - FormProperty.textBoxManualSpotSize.Text = toolStripComboBoxManualSpotSize.Text; + thumbnailmode = !thumbnailmode; + Draw(); } + #endregion - private void toolStripMenuItemSendProfileToPDIndexer_Click(object sender, EventArgs e) + #region KeyDown, KeyUpイベント + private void FormMain_KeyDown(object sender, KeyEventArgs e) { - FormProperty.checkBoxSendProfileToPDIndexer.Checked = !FormProperty.checkBoxSendProfileToPDIndexer.Checked; + if (e.Control && e.Shift && e.KeyCode == Keys.C) + toolStripSplitButtonFindCenter_ButtonClick(new object(), new EventArgs()); + else if (e.Control && e.Shift && e.KeyCode == Keys.S) + toolStripSplitButtonFindSpots_ButtonClick(new object(), new EventArgs()); + else if (e.Control && e.Shift && e.KeyCode == Keys.G) + toolStripSplitButtonGetProfile_ButtonClick(new object(), new EventArgs()); + else if (e.Control && e.Shift && e.KeyCode == Keys.B) + toolStripSplitButtonBackground_ButtonClick(new object(), new EventArgs()); + else if (e.Control && e.Shift && e.KeyCode == Keys.M) + FormProperty.checkBoxManualMaskMode.Checked = !FormProperty.checkBoxManualMaskMode.Checked; + else if (e.Control && scalablePictureBox.Focused) + { + IsManualSpotMode = true; + FormProperty.checkBoxManualMaskMode.Checked = true; + Draw(); + } + else if (e.Control && e.KeyCode == Keys.Left && toolStripButtonImageSequence.Enabled && FormSequentialImage.SelectedIndex > 0) + FormSequentialImage.SelectedIndex--; + else if (e.Control && e.KeyCode == Keys.Right && toolStripButtonImageSequence.Enabled && FormSequentialImage.SelectedIndex < FormSequentialImage.MaximumNumber) + FormSequentialImage.SelectedIndex++; + } - private void toolStripMenuItemSendUnrolledImage_Click(object sender, EventArgs e) + private void FormMain_KeyUp(object sender, KeyEventArgs e) { - FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked = !FormProperty.checkBoxSendUnrolledImageToPDIndexer.Checked; + if (e.KeyValue == 17 && IsManualSpotMode) + { + IsManualSpotMode = false; + FormProperty.checkBoxManualMaskMode.Checked = false; + Draw(); + } } - private void toolStripButton2_Click(object sender, EventArgs e) - { + #endregion - FormCalibrateIntensity.Visible = true; - } + #region 強度ヒストグラム関連 - private void toolStripComboBoxManualSpotSize_Paint(object sender, PaintEventArgs e) + + public void SetFrequencyProfile() { + maxIntensity = uint.MinValue; + sumOfIntensity = 0; + double sumOfSquare = 0; + frequencyProfile = new Profile(); + frequencyProfile.Pt = new List(); + for (int i = 0; i < Ring.Intensity.Count; i++) + { + double intensity = Ring.Intensity[i]; + maxIntensity = Math.Max(maxIntensity, intensity); + sumOfIntensity += intensity; + sumOfSquare += intensity * intensity; + } + for (int i = 0; i < Ring.Frequency.Count; i++) + frequencyProfile.Pt.Add(new PointD(Ring.Frequency.Keys[i], Ring.Frequency[Ring.Frequency.Keys[i]])); + graphControlFrequency.Profile = frequencyProfile; + variance = Math.Sqrt((Ring.Intensity.Count * sumOfSquare - sumOfIntensity * sumOfIntensity) / Ring.Intensity.Count / (Ring.Intensity.Count - 1)); } - private void toolStripButtonCircumferentialBlur_Click(object sender, EventArgs e) + private void graphControlFrequency_LinePositionChanged() { - FormBlurAngle formBlurAngle = new FormBlurAngle(); - if (formBlurAngle.ShowDialog() == System.Windows.Forms.DialogResult.OK) + if (graphControlFrequency.LineList.Length == 2) { - Ring.CircumferentialBlur(formBlurAngle.BlurAngle); - initializeFilter(); - Draw(); + var max = Math.Max(graphControlFrequency.LineList[0].X, graphControlFrequency.LineList[1].X); + if (trackBarAdvancedMaxInt.Maximum < max) + trackBarAdvancedMaxInt.Value = trackBarAdvancedMaxInt.Maximum; + else if (trackBarAdvancedMinInt.Minimum > max) + trackBarAdvancedMaxInt.Value = trackBarAdvancedMaxInt.Minimum; + else + trackBarAdvancedMaxInt.Value = max; + + var min = Math.Min(graphControlFrequency.LineList[0].X, graphControlFrequency.LineList[1].X); + if (trackBarAdvancedMinInt.Maximum < min) + trackBarAdvancedMinInt.Value = trackBarAdvancedMinInt.Maximum; + else if (trackBarAdvancedMinInt.Minimum > min) + trackBarAdvancedMinInt.Value = trackBarAdvancedMinInt.Minimum; + else + trackBarAdvancedMinInt.Value = min; } } + #endregion - private void languageToolStripMenuItem_Click(object sender, EventArgs e) - { - englishToolStripMenuItem.Checked = ((ToolStripMenuItem)sender).Name.Contains("english"); - japaneseToolStripMenuItem.Checked = !englishToolStripMenuItem.Checked; - Thread.CurrentThread.CurrentUICulture = englishToolStripMenuItem.Checked ? new System.Globalization.CultureInfo("en") : new System.Globalization.CultureInfo("ja"); - Language.Change(this); - } - + #region Program updates private void programUpdatesToolStripMenuItem_Click(object sender, EventArgs e) { toolStripProgressBar.Visible = true; @@ -3804,14 +3823,15 @@ private void reportProgress(long current, long total, long elapsedMilliseconds, private void reportProgress((long current, long total, long elapsedMilliseconds, string message) o) => reportProgress(o.current, o.total, o.elapsedMilliseconds, o.message); + #endregion + #region Sequential Image関連n private void toolStripMenuItemAllSequentialImages_CheckedChanged(object sender, EventArgs e) { if (toolStripMenuItemAllSequentialImages.Checked) toolStripMenuItemSelectedSequentialImages.Checked = false; FormSequentialImage.setRadio(); - } private void toolStripMenuItemSelectedSequentialImages_CheckedChanged(object sender, EventArgs e) @@ -3820,9 +3840,9 @@ private void toolStripMenuItemSelectedSequentialImages_CheckedChanged(object sen toolStripMenuItemAllSequentialImages.Checked = false; FormSequentialImage.setRadio(); } + #endregion - - + #region Rotate, Pollalization処理 public void FlipRotate_Pollalization_Background(bool zoomReset = true) { if (Skip) return; @@ -3924,22 +3944,7 @@ public void FlipRotate_Pollalization_Background(bool zoomReset = true) scalablePictureBox.Zoom = 0; } - - private void flipHorizontallyToolStripMenuItem_CheckedChanged(object sender, EventArgs e) - { - FlipRotate_Pollalization_Background(); - } - - private void flipVerticallyToolStripMenuItem_CheckedChanged(object sender, EventArgs e) - { - FlipRotate_Pollalization_Background(); - } - - private void toolStripComboBoxRotate_SelectedIndexChanged(object sender, EventArgs e) - { - FlipRotate_Pollalization_Background(); - } - + #endregion #region /* @@ -4219,15 +4224,13 @@ public void SetStasticalInformation(bool renewArea = true) } } - #endregion - bool skipSelectedAreaChangedEvent = false; private void numericUpDownSelectedArea_ValueChanged(object sender, EventArgs e) { if (skipSelectedAreaChangedEvent) return; double left = Math.Max((double)Math.Min(numericUpDownSelectedAreaX1.Value, numericUpDownSelectedAreaX2.Value), 0); - double right =Math.Min( (double)Math.Max(numericUpDownSelectedAreaX1.Value, numericUpDownSelectedAreaX2.Value),Ring.SrcImgSize.Width-1); + double right = Math.Min((double)Math.Max(numericUpDownSelectedAreaX1.Value, numericUpDownSelectedAreaX2.Value), Ring.SrcImgSize.Width - 1); double top = Math.Max((double)Math.Min(numericUpDownSelectedAreaY1.Value, numericUpDownSelectedAreaY2.Value), 0); double bottom = Math.Min((double)Math.Max(numericUpDownSelectedAreaY1.Value, numericUpDownSelectedAreaY2.Value), Ring.SrcImgSize.Height - 1); @@ -4235,53 +4238,13 @@ private void numericUpDownSelectedArea_ValueChanged(object sender, EventArgs e) scalablePictureBox.Refresh(); SetStasticalInformation(true); - - - } - - #region マクロ関連 - - - public void SetMacroToMenu(string[] name) - { - if (macroToolStripMenuItem.DropDownItems.Count == 1) - macroToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); - for (int i = macroToolStripMenuItem.DropDownItems.Count-1; i > 1; i--) - macroToolStripMenuItem.DropDownItems.RemoveAt(i); - - - for (int i = 0; i < name.Length; i++) - { - var item = new ToolStripMenuItem(name[i]); - item.Name = name[i]; - item.Click += macroMenuItem_Click; - macroToolStripMenuItem.DropDownItems.Add(item); - } - } - - void macroMenuItem_Click(object sender, EventArgs e) - { - FormMacro.RunMacroName(((ToolStripMenuItem)sender).Name, false); - } - - private void ngenCompileToolStripMenuItem_Click(object sender, EventArgs e) - { - Ngen.Compile(); - } - - private void ToolStripMenuItemReferenceBackground_Click(object sender, EventArgs e) - { - FormProperty.Visible = true; - FormProperty.tabControl.SelectedIndex = 9; } - - - #endregion + #region IPAのマクロ操作を提供するサブクラス /// - /// IPAのマクロ操作を提供する + /// IPAのマクロ操作を提供するサブクラス /// public class Macro: MacroBase { @@ -4793,6 +4756,8 @@ public void ReadImage(string _fileName = "", bool? flag = null) => Execute(new A public void ReadMask(string fileName = "") => Execute(new Action(() => p.main.ReadMask(fileName))); public void SaveMask(string fileName = "") => Execute(new Action(() => p.main.SaveMask(fileName))); + public void ResetMask(string fileName = "") => Execute(new Action(() => p.main.ClearMask())); + } #endregion @@ -4984,19 +4949,7 @@ public double TiltTau #endregion - private void process1_Exited(object sender, EventArgs e) - { - - } - - private void editorToolStripMenuItem_Click(object sender, EventArgs e) - { - FormMacro.Visible = true; - } - - - - + #endregion } diff --git a/IPAnalyzer/FormMain.resx b/IPAnalyzer/FormMain.resx index e17390b..4d2e6f8 100644 --- a/IPAnalyzer/FormMain.resx +++ b/IPAnalyzer/FormMain.resx @@ -328,7 +328,7 @@ scalablePictureBoxThumbnail - Crystallography.Controls.ScalablePictureBox, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.ScalablePictureBox, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null panel3 @@ -754,7 +754,7 @@ scalablePictureBox - Crystallography.Controls.ScalablePictureBox, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.ScalablePictureBox, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null splitContainer2.Panel2 @@ -1678,7 +1678,7 @@ trackBarAdvancedMinInt - Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 @@ -1726,7 +1726,7 @@ trackBarAdvancedMaxInt - Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 @@ -1873,7 +1873,7 @@ graphControlFrequency - Crystallography.Controls.GraphControl, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.GraphControl, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null tabPage1 @@ -1936,7 +1936,7 @@ graphControlProfile - Crystallography.Controls.GraphControl, Crystallography.Controls, Version=2020.12.10.1533, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.GraphControl, Crystallography.Controls, Version=2020.12.14.1152, Culture=neutral, PublicKeyToken=null tabPage2 @@ -2812,946 +2812,952 @@ blur toolStripContainer1 - - 665, 17 + + 551, 17 - + None - - Arial, 9pt + + Segoe UI Symbol, 11.25pt - - 174, 22 + + Alt+O - - Reset + + 207, 24 - - False + + Read Image - - 218, 22 + + 467, 24 - - Lower (% of image size) + + as TIFF format - - 0 + + 467, 24 - - 5 + + as PNG format (preserve brightness, contrast, masked area) - - 10 + + 467, 24 - - 15 + + as IPA format (original format) - - 20 + + MiddleLeft - - 25 + + 207, 24 - - 121, 23 + + Save Image - - 10 + + 204, 6 - - 218, 22 + + 207, 24 - - Upper (% of image size) + + Read Parameter - - 80 + + 207, 24 - - 85 + + Save Parameter - - 90 + + 204, 6 - - 95 + + 207, 24 - - 100 + + Read Mask - - 121, 23 + + 207, 24 - - 90 + + Save Mask - - False + + 207, 24 - - 174, 22 + + Clear Mask - - Detection Range + + 204, 6 - - False + + 207, 24 - - 174, 22 + + Close - - Fourier + + Alt+F - - False + + 44, 24 - - 174, 22 + + File - - Reference image + + 232, 24 - - False + + Reset Frequency Profile - - Segoe UI Symbol, 9.75pt + + 232, 24 - - None + + Calibrate Raxis Image - - White + + 51, 24 - - 100, 56 + + Tool - - Background + + 239, 24 - - ImageAboveText + + Wave Source - - 6, 56 + + X-ray Condition +X線の波長とカメラ長を設定します。 - - 248, 22 + + 239, 24 - - Option + + Imaging Plate Condition - - Option -中心スポットを検索する際の検索範囲を設定します。 + + Imaging Plate Condition +イメージングプレートの画素形状や傾き、ビームの中心を設定します。 - - False + + 236, 6 - - 248, 22 + + 239, 24 - - Find center based on the ring + + Integral Region - - False + + 239, 24 - - Segoe UI Symbol, 9.75pt + + Integral Property - - None + + 236, 6 - - Magenta + + 239, 24 - - 97, 56 + + Manual Mask Mode - - Find Center + + 236, 6 - - ImageAboveText + + 239, 24 - - Find Center -現在の中心位置から設定範囲(Optionで変更可)内で -2次元PseudoVoigt関数フィッティングを行い、中心スポ -ットを検索します。 + + After "Get Profile" - - Segoe UI Symbol, 9.75pt, style=Italic + + 236, 6 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== - + + 239, 24 - - Magenta + + Unrolled Image Option - - 50, 53 + + 236, 6 - - Fix -Center + + 239, 24 - - 6, 56 + + Associated Extensions - - 159, 22 + + 236, 6 - - Clear All Mask + + 239, 24 - - Clear All Mask -マスクされた部分を全てクリアします。 + + Miscellaneous - - 159, 22 + + 77, 24 - - Mask All Area + + Property - - Mask All Area -全てをマスクします + + 174, 24 - - 159, 22 + + ToolTip - - Inverse Mask + + 159, 24 - - 156, 6 + + Horizontally - - 159, 22 + + 159, 24 - - Manual Mode + + Vertically - - Manual Mode -チェックされているときはスポットを手動で選択できます。 -スポットの大きさは"Option"から変更できます。 + + 174, 24 - - 156, 6 + + Flip - - 159, 22 + + 0 deg - - Option + + 90 deg - - Option -Find Spotsのオプション設定をします + + 180 deg - - Segoe UI Symbol, 9.75pt + + 270 deg - - None + + 121, 23 - - White + + 174, 24 - - 99, 56 + + Rotate - - Mask Spots + + 171, 6 - - ImageAboveText + + 174, 24 - - Find Spots - + + Ngen Compile - - Segoe UI Symbol, 9.75pt, style=Italic + + 67, 24 - + + Option + + - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAA + wQAAAMEB4jA9ugAAAUpJREFUOE9jYAhq+Y8Lg8A1Bk04BgFs6uAYpMCmeiFWSf+OVf+fxlcSZRhYDkxC + AboCYgwDOeT7+WtgeQaYIhjQzp8JV0jIMBCAyf39+u0/w00RKzDn/fx1YEkYwGeYf/uq/z/vPUYRBwGG + ltWH///79w9DAgSSpmzGMAwEYPxfD59CRSAAHpsgcFvBBazoTddcMB8E0A0Dsxm1wGwYUMmaCvE6lI8T + YHMZLgCOAGph6hr2af2e//jwA8cEuGJs8sgYJTshg+vs+v8f2MfhjU0QQMk9IAIkAAN/v/9AUYwrAp5E + lYDFHjjEg/lgw8AsKLjGpA1WAMoeIIAt0Ub1rwfTMIAsBzbs358/KILGpXPANuHLTsjgoWsyWJ7hBr8Z + mPFx1XawBEwxIcNAGJR7kAE8o8NTMRImZBgMwwDYm9gUgDCxhoFw/tyd/wHjpZDiF9mN8AAAAABJRU5E + rkJggg== - - Magenta + + 142, 26 - - 55, 53 + + English - - Manual -Mode + + + iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAA + wQAAAMEB4jA9ugAAAG5JREFUOE/tjLsNwCAMRFNQMAyDMQMjMDSOIxHJsc9YSOmSJ11zv4Ne5D/bZ32W + Eje4IrXAT/WJlANOarUHWgDHVUMkgOOqIRLAcdUQCYDdMexYqvdZfMKJQ2v25FLOs2DhNKCU8OQmPtvg + E2dEJ41V0r+pZPOtAAAAAElFTkSuQmCC + - - False + + 142, 26 - - Segoe UI Symbol, 9.75pt + + Japanese - - 2 + + 86, 24 - - 4 + + Language - - 8 + + 118, 24 - - 16 + + Editor - - 32 + + 115, 6 - - 64 + + 63, 24 - - 128 + + Macro - - 256 + + 194, 24 - - 512 + + Program Updates - - 40, 25 + + 191, 6 - - 64 + + 194, 24 - - False + + Hint - - 6, 56 + + 194, 24 - - 291, 22 + + License - - Integral Property + + 194, 24 - - Integral Property -角度の上下限・ステップ、積算後の動作を変更します。 + + Version history - - Arial, 9pt + + 191, 6 - - 291, 22 + + 194, 24 - - Concentric Integration + + Help (web) - - Arial, 9pt + + 53, 24 - - 291, 22 + + Help - - Radial integration + + 0, 0 - - 288, 6 + + True - - 291, 22 + + 734, 28 - - Integral Region + + 23 - - Integral Region -画像の積算範囲・形状を変更します。 - - - 288, 6 - - - No - - - 291, 22 - - - Find Center before Get Profile + + menuStrip - - プロファイルを取得する前に中心点を検出します + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 291, 22 + + toolStripContainer1.TopToolStripPanel - - Find Spots before Get Profile + + 0 - - プロファイルを取得する前にスポット(回折斑点)を検出します + + 665, 17 + + + None - - 288, 6 + + Arial, 9pt - - + + 180, 22 - - 291, 22 + + Reset - - Send profile to PDIndexer + + False - - 291, 22 + + 218, 22 - - with unrolled image + + Lower (% of image size) - - 288, 6 + + 0 - - False + + 5 - - 191, 22 + + 10 - - angle step (degree) + + 15 - - Tahoma, 9pt + + 20 - - 2 + + 25 - - 3 + + 121, 23 - - 4 + + 10 - - 5 + + 218, 22 - - 6 + + Upper (% of image size) - - 9 + + 80 - - 10 + + 85 - - 12 + + 90 - - 20 + + 95 - - 24 + + 100 - - 36 + + 121, 23 - - 40 + + 90 - - 60 + + False - - 121, 22 + + 180, 22 - - 6 + + Detection Range - - 291, 22 + + False - - Lattice Preferred Orientation Analysis + + 180, 22 - - 288, 6 + + Fourier - - 291, 22 + + False - - Get Profiles for all sequential images + + 180, 22 - - 291, 22 + + Reference image - - Get Profiles for selected images + + False - + Segoe UI Symbol, 9.75pt - + None - + White - - 92, 53 + + 100, 56 - - Get Profile + + Background - + ImageAboveText - - Convert the two-dimensional diffraction pattern to one dimensional 2θ-intensity profile - - - 0, 0 - - - 0, 0, 0, 0 + + 6, 56 - - True + + 248, 22 - - 734, 56 + + Option - - 29 + + Option +中心スポットを検索する際の検索範囲を設定します。 - - toolStrip2 + + False - - toolStrip2 + + 248, 22 - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Find center based on the ring - - toolStripContainer1.TopToolStripPanel + + False - - 0 + + Segoe UI Symbol, 9.75pt - - 551, 17 - - + None - - Segoe UI Symbol, 11.25pt + + Magenta - - Alt+O + + 97, 56 - - 207, 24 + + Find Center - - Read Image + + ImageAboveText - - 467, 24 + + Find Center +現在の中心位置から設定範囲(Optionで変更可)内で +2次元PseudoVoigt関数フィッティングを行い、中心スポ +ットを検索します。 - - as TIFF format + + Segoe UI Symbol, 9.75pt, style=Italic - - 467, 24 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + - - as PNG format (preserve brightness, contrast, masked area) + + Magenta - - 467, 24 + + 50, 53 - - as IPA format (original format) + + Fix +Center - - MiddleLeft + + 6, 56 - - 207, 24 + + 159, 22 - - Save Image + + Clear All Mask - - 204, 6 + + Clear All Mask +マスクされた部分を全てクリアします。 - - 207, 24 + + 159, 22 - - Read Parameter + + Mask All Area - - 207, 24 + + Mask All Area +全てをマスクします - - Save Parameter + + 159, 22 - - 204, 6 + + Inverse Mask - - 207, 24 + + 156, 6 - - Read Mask + + 159, 22 - - 207, 24 + + Manual Mode - - Save Mask + + Manual Mode +チェックされているときはスポットを手動で選択できます。 +スポットの大きさは"Option"から変更できます。 - - 204, 6 + + 156, 6 - - 207, 24 + + 159, 22 - - Close + + Option - - Alt+F + + Option +Find Spotsのオプション設定をします - - 44, 24 + + Segoe UI Symbol, 9.75pt - - File + + None - - 232, 24 + + White - - Reset Frequency Profile + + 99, 56 - - 232, 24 + + Mask Spots - - Calibrate Raxis Image + + ImageAboveText - - 51, 24 + + Find Spots + - - Tool + + Segoe UI Symbol, 9.75pt, style=Italic - - 239, 24 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + - - Wave Source + + Magenta - - X-ray Condition -X線の波長とカメラ長を設定します。 + + 55, 53 - - 239, 24 + + Manual +Mode - - Imaging Plate Condition + + False - - Imaging Plate Condition -イメージングプレートの画素形状や傾き、ビームの中心を設定します。 + + Segoe UI Symbol, 9.75pt - - 236, 6 + + 2 - - 239, 24 + + 4 - - Integral Region + + 8 - - 239, 24 + + 16 - - Integral Property + + 32 - - 236, 6 + + 64 - - 239, 24 + + 128 - - Manual Mask Mode + + 256 - - 236, 6 + + 512 - - 239, 24 + + 40, 25 - - After "Get Profile" + + 64 - - 236, 6 + + False - - 239, 24 + + 6, 56 - - Unrolled Image Option + + 291, 22 - - 236, 6 + + Integral Property - - 239, 24 + + Integral Property +角度の上下限・ステップ、積算後の動作を変更します。 - - Associated Extensions + + Arial, 9pt + + + 291, 22 + + + Concentric Integration + + + Arial, 9pt + + + 291, 22 + + + Radial integration + + + 288, 6 - - 236, 6 + + 291, 22 - - 239, 24 + + Integral Region - - Miscellaneous + + Integral Region +画像の積算範囲・形状を変更します。 - - 77, 24 + + 288, 6 - - Property + + No - - 174, 24 + + 291, 22 - - ToolTip + + Find Center before Get Profile - - 159, 24 + + プロファイルを取得する前に中心点を検出します - - Horizontally + + 291, 22 - - 159, 24 + + Find Spots before Get Profile - - Vertically + + プロファイルを取得する前にスポット(回折斑点)を検出します - - 174, 24 + + 288, 6 - - Flip + + - - 0 deg + + 291, 22 - - 90 deg + + Send profile to PDIndexer - - 180 deg + + 291, 22 - - 270 deg + + with unrolled image - - 121, 23 + + 288, 6 - - 174, 24 + + False - - Rotate + + 191, 22 - - 171, 6 + + angle step (degree) - - 174, 24 + + Tahoma, 9pt - - Ngen Compile + + 2 - - 67, 24 + + 3 - - Option + + 4 - - - iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAA - wQAAAMEB4jA9ugAAAUpJREFUOE9jYAhq+Y8Lg8A1Bk04BgFs6uAYpMCmeiFWSf+OVf+fxlcSZRhYDkxC - AboCYgwDOeT7+WtgeQaYIhjQzp8JV0jIMBCAyf39+u0/w00RKzDn/fx1YEkYwGeYf/uq/z/vPUYRBwGG - ltWH///79w9DAgSSpmzGMAwEYPxfD59CRSAAHpsgcFvBBazoTddcMB8E0A0Dsxm1wGwYUMmaCvE6lI8T - YHMZLgCOAGph6hr2af2e//jwA8cEuGJs8sgYJTshg+vs+v8f2MfhjU0QQMk9IAIkAAN/v/9AUYwrAp5E - lYDFHjjEg/lgw8AsKLjGpA1WAMoeIIAt0Ub1rwfTMIAsBzbs358/KILGpXPANuHLTsjgoWsyWJ7hBr8Z - mPFx1XawBEwxIcNAGJR7kAE8o8NTMRImZBgMwwDYm9gUgDCxhoFw/tyd/wHjpZDiF9mN8AAAAABJRU5E - rkJggg== - + + 5 - - 142, 26 + + 6 - - English + + 9 - - - iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAA - wQAAAMEB4jA9ugAAAG5JREFUOE/tjLsNwCAMRFNQMAyDMQMjMDSOIxHJsc9YSOmSJ11zv4Ne5D/bZ32W - Eje4IrXAT/WJlANOarUHWgDHVUMkgOOqIRLAcdUQCYDdMexYqvdZfMKJQ2v25FLOs2DhNKCU8OQmPtvg - E2dEJ41V0r+pZPOtAAAAAElFTkSuQmCC - + + 10 - - 142, 26 + + 12 - - Japanese + + 20 - - 86, 24 + + 24 - - Language + + 36 - - 118, 24 + + 40 - - Editor + + 60 - - 115, 6 + + 121, 22 - - 63, 24 + + 6 - - Macro + + 291, 22 - - 194, 24 + + Lattice Preferred Orientation Analysis - - Program Updates + + 288, 6 - - 191, 6 + + 291, 22 - - 194, 24 + + Get Profiles for all sequential images - - Hint + + 291, 22 - - 194, 24 + + Get Profiles for selected images - - License + + Segoe UI Symbol, 9.75pt - - 194, 24 + + None - - Version history + + White - - 191, 6 + + 92, 53 - - 194, 24 + + Get Profile - - Help (web) + + ImageAboveText - - 53, 24 + + Convert the two-dimensional diffraction pattern to one dimensional 2θ-intensity profile - - Help + + 0, 28 - - 0, 56 + + 0, 0, 0, 0 - + True - - 734, 28 + + 734, 56 - - 23 + + 29 - - menuStrip + + toolStrip2 - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + toolStrip2 - + + System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + toolStripContainer1.TopToolStripPanel - + 1 @@ -3784,9 +3790,6 @@ X線の波長とカメラ長を設定します。 23, 23 - - 885, 17 - True @@ -4311,6 +4314,12 @@ X線の波長とカメラ長を設定します。 System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + clearMaskToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + toolStripSeparator4 @@ -4593,12 +4602,6 @@ X線の波長とカメラ長を設定します。 System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - process1 - - - System.Diagnostics.Process, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - FormMain diff --git a/IPAnalyzer/FormSaveImage.Designer.cs b/IPAnalyzer/FormSaveImage.Designer.cs index f89ae8f..1e2e891 100644 --- a/IPAnalyzer/FormSaveImage.Designer.cs +++ b/IPAnalyzer/FormSaveImage.Designer.cs @@ -56,7 +56,7 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Segoe UI Symbol", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(209, 37); + this.label2.Location = new System.Drawing.Point(227, 37); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(46, 17); this.label2.TabIndex = 12; @@ -90,7 +90,7 @@ private void InitializeComponent() 0, 0, 0}); - this.numericUpDownHeight.Location = new System.Drawing.Point(261, 35); + this.numericUpDownHeight.Location = new System.Drawing.Point(279, 35); this.numericUpDownHeight.Maximum = new decimal(new int[] { 4096, 0, @@ -102,7 +102,7 @@ private void InitializeComponent() 0, 0}); this.numericUpDownHeight.Name = "numericUpDownHeight"; - this.numericUpDownHeight.Size = new System.Drawing.Size(47, 25); + this.numericUpDownHeight.Size = new System.Drawing.Size(53, 25); this.numericUpDownHeight.TabIndex = 1; this.numericUpDownHeight.Value = new decimal(new int[] { 1000, @@ -131,7 +131,7 @@ private void InitializeComponent() 0, 0}); this.numericUpDownWidth.Name = "numericUpDownWidth"; - this.numericUpDownWidth.Size = new System.Drawing.Size(47, 25); + this.numericUpDownWidth.Size = new System.Drawing.Size(53, 25); this.numericUpDownWidth.TabIndex = 0; this.numericUpDownWidth.Value = new decimal(new int[] { 1000, @@ -184,7 +184,7 @@ private void InitializeComponent() 0, 0}); this.numericUpDownResolution.Name = "numericUpDownResolution"; - this.numericUpDownResolution.Size = new System.Drawing.Size(47, 25); + this.numericUpDownResolution.Size = new System.Drawing.Size(53, 25); this.numericUpDownResolution.TabIndex = 3; this.numericUpDownResolution.Value = new decimal(new int[] { 100, @@ -197,7 +197,7 @@ private void InitializeComponent() // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("Segoe UI Symbol", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(209, 99); + this.label7.Location = new System.Drawing.Point(215, 100); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(67, 17); this.label7.TabIndex = 10; @@ -209,7 +209,7 @@ private void InitializeComponent() this.checkBoxKeepAspect.Checked = true; this.checkBoxKeepAspect.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxKeepAspect.Font = new System.Drawing.Font("Segoe UI Symbol", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.checkBoxKeepAspect.Location = new System.Drawing.Point(325, 39); + this.checkBoxKeepAspect.Location = new System.Drawing.Point(343, 39); this.checkBoxKeepAspect.Name = "checkBoxKeepAspect"; this.checkBoxKeepAspect.Size = new System.Drawing.Size(134, 21); this.checkBoxKeepAspect.TabIndex = 2; @@ -256,7 +256,7 @@ private void InitializeComponent() 0, -2147483648}); this.numericUpDownCenterX.Name = "numericUpDownCenterX"; - this.numericUpDownCenterX.Size = new System.Drawing.Size(47, 25); + this.numericUpDownCenterX.Size = new System.Drawing.Size(53, 25); this.numericUpDownCenterX.TabIndex = 0; this.numericUpDownCenterX.Value = new decimal(new int[] { 500, @@ -273,7 +273,7 @@ private void InitializeComponent() 0, 0, 0}); - this.numericUpDownCenterY.Location = new System.Drawing.Point(261, 66); + this.numericUpDownCenterY.Location = new System.Drawing.Point(279, 66); this.numericUpDownCenterY.Maximum = new decimal(new int[] { 4096, 0, @@ -285,7 +285,7 @@ private void InitializeComponent() 0, -2147483648}); this.numericUpDownCenterY.Name = "numericUpDownCenterY"; - this.numericUpDownCenterY.Size = new System.Drawing.Size(47, 25); + this.numericUpDownCenterY.Size = new System.Drawing.Size(53, 25); this.numericUpDownCenterY.TabIndex = 0; this.numericUpDownCenterY.Value = new decimal(new int[] { 500, @@ -308,7 +308,7 @@ private void InitializeComponent() // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Segoe UI Symbol", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label9.Location = new System.Drawing.Point(239, 68); + this.label9.Location = new System.Drawing.Point(257, 68); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(15, 17); this.label9.TabIndex = 8; @@ -328,7 +328,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(493, 130); + this.ClientSize = new System.Drawing.Size(489, 126); this.ControlBox = false; this.Controls.Add(this.checkBoxKeepAspect); this.Controls.Add(this.label7); diff --git a/IPAnalyzer/IPAnalyzer.csproj b/IPAnalyzer/IPAnalyzer.csproj index 1f720ce..4e7aeb4 100644 --- a/IPAnalyzer/IPAnalyzer.csproj +++ b/IPAnalyzer/IPAnalyzer.csproj @@ -469,62 +469,62 @@ False + Exclude + True - Exclude - True Assembly False + Include + True - Include - True File False + Include + True - Include - True File False + Include + True - Include - True File False + Include + True - Include - True File False + Include + True - Include - True File diff --git a/IPAnalyzer/Properties/AssemblyInfo.cs b/IPAnalyzer/Properties/AssemblyInfo.cs index ae291d9..6dc2e47 100644 --- a/IPAnalyzer/Properties/AssemblyInfo.cs +++ b/IPAnalyzer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2020.12.11.0535")] -[assembly: AssemblyFileVersion("2020.12.11.0535")] +[assembly: AssemblyVersion("2020.12.14.1152")] +[assembly: AssemblyFileVersion("2020.12.14.1152")]