コード例 #1
0
ファイル: FourierCommands.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Shows the dialog in which the user can select options for the 2D Fourier transformation, and then executes the Fourier transformation
        /// The result is stored in a newly created data table in the same folder as the source data table.
        /// </summary>
        /// <param name="table">The table containing the data to transform.</param>
        /// <param name="selectedDataRows">The selected data rows of the table. (A value of <c>null</c> can be provided here).</param>
        /// <param name="selectedDataColumns">The selected data columns of the table. (A value of <c>null</c> can be provided here).</param>
        /// <param name="selectedPropertyColumns">The selected property columns of the table. (A value of <c>null</c> can be provided here).</param>
        public static void ShowRealFourierTransformation2DDialog(DataTable table, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns, IAscendingIntegerCollection selectedPropertyColumns)
        {
            DataTableMatrixProxy proxy = null;
            RealFourierTransformation2DOptions options = null;

            try
            {
                proxy = new DataTableMatrixProxy(table, selectedDataRows, selectedDataColumns, selectedPropertyColumns);

                options = null != _lastUsedOptions ? (RealFourierTransformation2DOptions)_lastUsedOptions.Clone() : new RealFourierTransformation2DOptions();
                proxy.TryGetRowHeaderIncrement(out var rowIncrementValue, out var rowIncrementMessage);
                proxy.TryGetColumnHeaderIncrement(out var columnIncrementValue, out var columnIncrementMessage);

                options.IsUserDefinedRowIncrementValue = false;
                options.RowIncrementValue   = rowIncrementValue;
                options.RowIncrementMessage = rowIncrementMessage;

                options.IsUserDefinedColumnIncrementValue = false;
                options.ColumnIncrementValue   = columnIncrementValue;
                options.ColumnIncrementMessage = columnIncrementMessage;
            }
            catch (Exception ex)
            {
                Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in preparation of Fourier transformation");
                return;
            }

            if (!Current.Gui.ShowDialog(ref options, "Choose fourier transform options", false))
            {
                return;
            }

            _lastUsedOptions = options;

            try
            {
                var resultTable = new DataTable {
                    Name = string.Format("{0}Fourier{1} of {2}", table.Folder, options.OutputKind, table.ShortName)
                };
                ExecuteFouriertransformation2D(proxy, options, resultTable);

                // Create a DataSource
                var dataSource = new FourierTransformation2DDataSource(proxy, options, new Altaxo.Data.DataSourceImportOptions());
                resultTable.DataSource = dataSource;

                Current.ProjectService.OpenOrCreateWorksheetForTable(resultTable);
            }
            catch (Exception ex)
            {
                Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in execution of Fourier transformation");
                return;
            }
        }
コード例 #2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="FourierTransformation2DDataSource"/> class.
		/// </summary>
		/// <param name="from">Another instance to copy from.</param>
		public FourierTransformation2DDataSource(FourierTransformation2DDataSource from)
		{
			CopyFrom(from);
		}
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FourierTransformation2DDataSource"/> class.
 /// </summary>
 /// <param name="from">Another instance to copy from.</param>
 public FourierTransformation2DDataSource(FourierTransformation2DDataSource from)
 {
     CopyFrom(from);
 }
コード例 #4
0
ファイル: FourierCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Shows the dialog in which the user can select options for the 2D Fourier transformation, and then executes the Fourier transformation
		/// The result is stored in a newly created data table in the same folder as the source data table.
		/// </summary>
		/// <param name="table">The table containing the data to transform.</param>
		/// <param name="selectedDataRows">The selected data rows of the table. (A value of <c>null</c> can be provided here).</param>
		/// <param name="selectedDataColumns">The selected data columns of the table. (A value of <c>null</c> can be provided here).</param>
		/// <param name="selectedPropertyColumns">The selected property columns of the table. (A value of <c>null</c> can be provided here).</param>
		public static void ShowRealFourierTransformation2DDialog(DataTable table, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns, IAscendingIntegerCollection selectedPropertyColumns)
		{
			DataTableMatrixProxy proxy = null;
			RealFourierTransformation2DOptions options = null;

			try
			{
				proxy = new DataTableMatrixProxy(table, selectedDataRows, selectedDataColumns, selectedPropertyColumns);

				options = null != _lastUsedOptions ? (RealFourierTransformation2DOptions)_lastUsedOptions.Clone() : new RealFourierTransformation2DOptions();

				double rowIncrementValue; string rowIncrementMessage;
				proxy.TryGetRowHeaderIncrement(out rowIncrementValue, out rowIncrementMessage);
				double columnIncrementValue; string columnIncrementMessage;
				proxy.TryGetColumnHeaderIncrement(out columnIncrementValue, out columnIncrementMessage);

				options.IsUserDefinedRowIncrementValue = false;
				options.RowIncrementValue = rowIncrementValue;
				options.RowIncrementMessage = rowIncrementMessage;

				options.IsUserDefinedColumnIncrementValue = false;
				options.ColumnIncrementValue = columnIncrementValue;
				options.ColumnIncrementMessage = columnIncrementMessage;
			}
			catch (Exception ex)
			{
				Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in preparation of Fourier transformation");
				return;
			}

			if (!Current.Gui.ShowDialog(ref options, "Choose fourier transform options", false))
				return;

			_lastUsedOptions = options;

			try
			{
				var resultTable = new DataTable { Name = string.Format("{0}Fourier{1} of {2}", table.Folder, options.OutputKind, table.ShortName) };
				ExecuteFouriertransformation2D(proxy, options, resultTable);

				// Create a DataSource
				Altaxo.Worksheet.Commands.Analysis.FourierTransformation2DDataSource dataSource = new FourierTransformation2DDataSource(proxy, options, new Altaxo.Data.DataSourceImportOptions());
				resultTable.DataSource = dataSource;

				Current.ProjectService.OpenOrCreateWorksheetForTable(resultTable);
			}
			catch (Exception ex)
			{
				Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in execution of Fourier transformation");
				return;
			}
		}