public static MapData Create(double[] rawData, double[] x, double[] y, double[] dx, double[] dy) { if (rawData.Length != x.Length * y.Length) { throw new ArgumentException(StringLookup.GetLocalizedString("Exception_MismatchedArrays")); } return(new MapData(rawData.ToArray(), x, y, dx, dy)); }
internal static MapData Create(double[,] rawData, double[] x, double[] y, double[] dx, double[] dy) { if (rawData.GetLength(0) != x.Length || rawData.GetLength(1) != y.Length) { throw new ArgumentException(StringLookup.GetLocalizedString("Exception_MismatchedArrays")); } return(new MapData(rawData.ToEnumerable <double>().ToArray(), x, y, dx, dy)); }
public void verify_default_constructor_sets_properties_correctly() { var viewModel = new VoxelRegionViewModel(); Assert.AreEqual(viewModel.Name, StringLookup.GetLocalizedString("Label_Tissue")); Assert.IsFalse(viewModel.IsLayer); Assert.AreEqual(viewModel.Units, StringLookup.GetLocalizedString("Measurement_mm")); Assert.IsTrue(viewModel.OpticalPropertyVM != null); }
public void Verify_constructor_sets_properties_correctly() { var viewModel = new EllipsoidRegionViewModel(new EllipsoidTissueRegion(), "TestEllipsiodTissue"); Assert.AreEqual("TestEllipsiodTissue" + StringLookup.GetLocalizedString("Label_Tissue"), viewModel.Name); Assert.IsTrue(viewModel.IsEllipsoid); Assert.IsFalse(viewModel.IsLayer); Assert.AreEqual(StringLookup.GetLocalizedString("Measurement_mm"), viewModel.Units); Assert.IsTrue(viewModel.OpticalPropertyVM != null); }
public void verify_method_Convert_returns_correct_value() { var rtsConverter = new ResourceToStringConverter(); Assert.That(rtsConverter.Convert( null, typeof(String), "Button_PlotMeasured", // resource is passed as a parameter System.Globalization.CultureInfo.CurrentCulture).Equals(StringLookup.GetLocalizedString("Button_PlotMeasured"))); }
public void Verify_region_is_air() { var ellisoidTissueRegion = new EllipsoidTissueRegion { RegionOP = { G = 0.8, Mua = 0D, Mus = 1E-10 } }; ellisoidTissueRegion.RegionOP.G = 1.4; var viewModel = new EllipsoidRegionViewModel(ellisoidTissueRegion, "TestEllipsiodTissue"); Assert.IsTrue(ellisoidTissueRegion.IsAir()); Assert.AreEqual("TestEllipsiodTissue" + StringLookup.GetLocalizedString("Label_Air"), viewModel.Name); }
public void verify_default_constructor_sets_properties_correctly() { MonteCarloSolverViewModel viewModel = new MonteCarloSolverViewModel(); Assert.IsTrue(viewModel.CanDownloadInfiles); Assert.IsTrue(viewModel.CanLoadInputFile); Assert.IsTrue(viewModel.CanRunSimulation); Assert.IsTrue(viewModel.CanRunSimulation); Assert.IsFalse(viewModel.CanCancelSimulation); Assert.IsFalse(viewModel.CanSaveResults); Assert.AreEqual(viewModel.CancelButtonText, StringLookup.GetLocalizedString("Button_Cancel")); }
private object GetTissueInputVM(string tissueType) { // ops to use as the basis for instantiating multi-region tissues based on homogeneous values (for differential comparison) if (_currentHomogeneousOpticalProperties == null) { _currentHomogeneousOpticalProperties = new OpticalProperties(0.01, 1, 0.8, 1.4); } switch (tissueType) { case "SemiInfinite": if (_currentSemiInfiniteTissueInput == null) { _currentSemiInfiniteTissueInput = new SemiInfiniteTissueInput( new SemiInfiniteTissueRegion(_currentHomogeneousOpticalProperties)); } return(new OpticalPropertyViewModel( _currentSemiInfiniteTissueInput.Regions.First().RegionOP, IndependentVariableAxisUnits.InverseMM.GetInternationalizedString(), StringLookup.GetLocalizedString("Heading_OpticalProperties"))); case "MultiLayer": if (_currentMultiLayerTissueInput == null) { _currentMultiLayerTissueInput = new MultiLayerTissueInput(new ITissueRegion[] { new LayerTissueRegion(new DoubleRange(0, 2), _currentHomogeneousOpticalProperties.Clone()), new LayerTissueRegion(new DoubleRange(2, double.PositiveInfinity), _currentHomogeneousOpticalProperties.Clone()) }); } return(new MultiRegionTissueViewModel(_currentMultiLayerTissueInput)); case "SingleEllipsoid": if (_currentSingleEllipsoidTissueInput == null) { _currentSingleEllipsoidTissueInput = new SingleEllipsoidTissueInput( new EllipsoidTissueRegion(new Position(0, 0, 10), 5, 5, 5, new OpticalProperties(0.05, 1.0, 0.8, 1.4)), new ITissueRegion[] { new LayerTissueRegion(new DoubleRange(0, double.PositiveInfinity), _currentHomogeneousOpticalProperties.Clone()) }); } return(new MultiRegionTissueViewModel(_currentSingleEllipsoidTissueInput)); default: throw new ArgumentOutOfRangeException(nameof(tissueType)); } }
public void validate_ExecuteMonteCarloSolverCommand_failure_sets_properties_correctly() { var viewModel = new MonteCarloSolverViewModel(); // this execution of ExecuteMonteCarloSolverCommand errors in "try" // because threading not established, so values are as initialized viewModel.ExecuteMonteCarloSolverCommand.Execute(null); Assert.IsFalse(viewModel.CanRunSimulation); Assert.IsFalse(viewModel.CanLoadInputFile); Assert.IsTrue(viewModel.CanCancelSimulation); Assert.IsFalse(viewModel.CanSaveResults); Assert.IsTrue(viewModel.CancelButtonText == StringLookup.GetLocalizedString("Button_CancelSimulation")); }
public SimulationInputViewModel(SimulationInput input) { _simulationInput = input; // use the property to invoke the appropriate change notification _simulationOptionsVM = new SimulationOptionsViewModel(_simulationInput.Options); _outputName = input.OutputName; #if WHITELIST TissueTypeVM = new OptionViewModel <string>("Tissue Type:", true, _simulationInput.TissueInput.TissueType, WhiteList.TissueTypes); #else TissueTypeVM = new OptionViewModel <string>("Tissue Type:", true, _simulationInput.TissueInput.TissueType, new[] { "MultiLayer", "SingleEllipsoid", "SingleVoxel" }); #endif UpdateTissueTypeVM(_simulationInput.TissueInput.TissueType); _simulationOptionsVM.PropertyChanged += (sender, args) => { if (_simulationOptionsVM.TrackStatistics && _simulationOptionsVM.OutputFolder != null) { _simulationInput.OutputName = Path.Combine(_simulationOptionsVM.OutputFolder, _outputName); } }; _tissueTypeVM.PropertyChanged += (sender, args) => { switch (_tissueTypeVM.SelectedValue) { case "MultiLayer": _simulationInput.TissueInput = new MultiLayerTissueInput(); break; case "SingleEllipsoid": _simulationInput.TissueInput = new SingleEllipsoidTissueInput(); break; case "SingleVoxel": _simulationInput.TissueInput = new SingleVoxelTissueInput(); break; default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoTissueTypeExists")); } UpdateTissueTypeVM(_simulationInput.TissueInput.TissueType); }; UpdateTissueInputVM(_simulationInput.TissueInput); }
private void SimulateMeasuredDataCommand_Executed(object sender, ExecutedRoutedEventArgs e) { var measuredDataValues = GetSimulatedMeasuredData(); var measuredDataPoints = GetDataPoints(measuredDataValues); //Report the results var axesLabels = GetPlotLabels(); WindowViewModel.Current.PlotVM.SetAxesLabels.Execute(axesLabels); var plotLabels = GetLegendLabels(PlotDataType.Simulated); var plotData = measuredDataPoints.Zip(plotLabels, (p, el) => new PlotData(p, el)).ToArray(); WindowViewModel.Current.PlotVM.PlotValues.Execute(plotData); WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute(StringLookup.GetLocalizedString("Label_SimulatedMeasuredData") + MeasuredOpticalPropertyVM + " \r"); }
private void CalculateInitialGuessCommand_Executed(object sender, ExecutedRoutedEventArgs e) { var initialGuessDataValues = CalculateInitialGuess(); var initialGuessDataPoints = GetDataPoints(initialGuessDataValues); //Report the results var axesLabels = GetPlotLabels(); WindowViewModel.Current.PlotVM.SetAxesLabels.Execute(axesLabels); var plotLabels = GetLegendLabels(PlotDataType.Guess); var plotData = initialGuessDataPoints.Zip(plotLabels, (p, el) => new PlotData(p, el)).ToArray(); WindowViewModel.Current.PlotVM.PlotValues.Execute(plotData); WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute(StringLookup.GetLocalizedString("Label_InitialGuess") + InitialGuessOpticalPropertyVM + " \r"); }
private FluenceSolutionDomainOptionViewModel GetSelectedSolutionDomain() { switch (MapTypeOptionVM.SelectedValue) { case MapType.Fluence: return(FluenceSolutionDomainTypeOptionVM); case MapType.AbsorbedEnergy: return(AbsorbedEnergySolutionDomainTypeOptionVM); case MapType.PhotonHittingDensity: return(PhotonHittingDensitySolutionDomainTypeOptionVM); default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoMapTypeExists")); } }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is string)) { throw new ArgumentException(StringLookup.GetLocalizedString("Exception_String")); } double d; if (double.TryParse((string)value, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out d)) { return(d); } else { return(0); } }
public MultiRegionTissueViewModel(ITissueInput input) { _currentRegionIndex = 0; _input = input; switch (input.TissueType) { case "MultiLayer": var multiLayerTissueInput = (MultiLayerTissueInput)_input; _regionsVM = new ObservableCollection <object>( multiLayerTissueInput.Regions.Select((r, i) => (object)new LayerRegionViewModel( (LayerTissueRegion)r, StringLookup.GetLocalizedString("Label_Layer") + i))); break; case "SingleEllipsoid": var singleEllipsoidTissueInput = (SingleEllipsoidTissueInput)_input; _regionsVM = new ObservableCollection <object>( singleEllipsoidTissueInput.LayerRegions .Select((r, i) => (object)new LayerRegionViewModel( (LayerTissueRegion)r, StringLookup.GetLocalizedString("Label_Layer") + i)) .Concat( new EllipsoidRegionViewModel( (EllipsoidTissueRegion)singleEllipsoidTissueInput.EllipsoidRegion, StringLookup.GetLocalizedString("Label_EllipsoidRegion")))); break; case "SingleVoxel": var singleVoxelTissueInput = (SingleVoxelTissueInput)_input; _regionsVM = new ObservableCollection <object>( singleVoxelTissueInput.LayerRegions .Select((r, i) => (object)new LayerRegionViewModel( (LayerTissueRegion)r, StringLookup.GetLocalizedString("Label_Layer") + i)) .Concat( new VoxelRegionViewModel( (VoxelTissueRegion)singleVoxelTissueInput.VoxelRegion, StringLookup.GetLocalizedString("Label_VoxelRegion")))); break; default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoTissueTypeExists")); } }
internal async Task <bool> GetMapData() { _currentCancellationTokenSource = new CancellationTokenSource(); mapData = await Task.Run(() => ExecuteForwardSolver(_currentCancellationTokenSource.Token)); if (mapData != null) { WindowViewModel.Current.MapVM.PlotMap.Execute(mapData); var opString = OpticalPropertyVM + "\r"; if (IsMultiRegion && ForwardSolver is TwoLayerSDAForwardSolver) { ITissueRegion[] regions = ((MultiRegionTissueViewModel)TissueInputVM).GetTissueInput().Regions; opString = "\rLayer 0: μa=" + regions[0].RegionOP.Mua + " μs'=" + regions[0].RegionOP.Musp + " n=" + regions[0].RegionOP.N + "\r" + "Layer 1: μa=" + regions[1].RegionOP.Mua + " μs'=" + regions[1].RegionOP.Musp + " n=" + regions[0].RegionOP.N + "\r"; } WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute( StringLookup.GetLocalizedString("Label_FluenceSolver") + opString); } return(true); }
public MonteCarloSolverViewModel() { var simulationInput = SimulationInputProvider.PointSourceTwoLayerTissueROfRhoDetector(); _simulationInputVm = new SimulationInputViewModel(simulationInput); _outputName = simulationInput.OutputName; ExecuteMonteCarloSolverCommand = new RelayCommand(() => MC_ExecuteMonteCarloSolver_Executed(null, null)); CancelMonteCarloSolverCommand = new RelayCommand(() => MC_CancelMonteCarloSolver_Executed(null, null)); LoadSimulationInputCommand = new RelayCommand(() => MC_LoadSimulationInput_Executed(null, null)); DownloadDefaultSimulationInputCommand = new RelayCommand(() => MC_DownloadDefaultSimulationInput_Executed(null, null)); SaveSimulationResultsCommand = new RelayCommand(() => MC_SaveSimulationResults_Executed(null, null)); _canDownloadInfiles = true; _canLoadInputFile = true; _canRunSimulation = true; _canCancelSimulation = false; _canSaveResults = false; _newResultsAvailable = false; _cancelButtonText = StringLookup.GetLocalizedString("Button_Cancel"); }
public void verify_method_Convert_returns_correct_value() { var dtsConverter = new DoubleToStringConverter(); Assert.That(dtsConverter.Convert( 12.3, // double to convert typeof(String), null, // no parameters System.Globalization.CultureInfo.CurrentCulture).Equals(d1.ToString(System.Globalization.CultureInfo.CurrentCulture))); Assert.That(dtsConverter.Convert( 12, // int to convert - OK typeof(String), null, // no parameters System.Globalization.CultureInfo.CurrentCulture).Equals(d2.ToString(System.Globalization.CultureInfo.CurrentCulture))); var exception = Assert.Throws <ArgumentException>(() => dtsConverter.Convert( "string", // string not a double typeof(String), null, // no parameters System.Globalization.CultureInfo.CurrentCulture)); Assert.That(exception.Message, Is.EqualTo(StringLookup.GetLocalizedString("Exception_DoubleOrInt"))); }
private async void ExecuteFluenceSolver_Executed(object sender, ExecutedRoutedEventArgs e) { //clear the map in case there is no new mapview WindowViewModel.Current.MapVM.ClearMap.Execute(null); CanRunSolver = false; CanCancelSolver = true; try { MainWindow.Current.Wait.Visibility = Visibility.Visible; ((Storyboard)MainWindow.Current.FindResource("WaitStoryboard")).Begin(); try { await GetMapData(); } catch (System.ArgumentException ex) { WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute( StringLookup.GetLocalizedString("Label_FluenceSolver\r")); WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute("ERROR IN INPUT:" + ex.Message + "\r"); } } catch (OperationCanceledException) { ((Storyboard)MainWindow.Current.FindResource("WaitStoryboard")).Stop(); MainWindow.Current.Wait.Visibility = Visibility.Hidden; WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute("Operation Cancelled\r"); } finally { ((Storyboard)MainWindow.Current.FindResource("WaitStoryboard")).Stop(); MainWindow.Current.Wait.Visibility = Visibility.Hidden; CanRunSolver = true; } CanRunSolver = true; CanCancelSolver = false; }
public void verify_ExecuteForwardSolverCommand_returns_correct_values() { // WindowViewModel needs to be instantiated for default constructor var windowViewModel = new WindowViewModel(); var viewModel = windowViewModel.ForwardSolverVM; viewModel.ForwardSolverTypeOptionVM.SelectedValue = ForwardSolverType.PointSourceSDA; viewModel.SolutionDomainTypeOptionVM.SelectedValue = SolutionDomainType.ROfRho; viewModel.ExecuteForwardSolverCommand.Execute(null); // ExecuteForwardSolver default settings PlotViewModel plotViewModel = windowViewModel.PlotVM; double d1 = 0.01; int i1 = 1; double g = 0.8; double n = 1.4; double d2 = 0.0100; double d3 = 1.0000; var s1 = StringLookup.GetLocalizedString("Label_ForwardSolver") + StringLookup.GetLocalizedString("Label_MuA") + "=" + d1.ToString(CultureInfo.CurrentCulture) + " " + StringLookup.GetLocalizedString("Label_MuSPrime") + "=" + i1.ToString(CultureInfo.CurrentCulture) + " g=" + g.ToString(CultureInfo.CurrentCulture) + " n=" + n.ToString(CultureInfo.CurrentCulture) + "; " + StringLookup.GetLocalizedString("Label_Units") + " = 1/mm\r"; var s2 = StringLookup.GetLocalizedString("Label_ROfRho") + " [mm-2] " + StringLookup.GetLocalizedString("Label_Versus") + " ρ [mm]"; var s3 = "\r" + StringLookup.GetLocalizedString("Label_ModelSDA") + "\r" + StringLookup.GetLocalizedString("Label_MuA") + "=" + d2.ToString("N4", CultureInfo.CurrentCulture) + " \r" + StringLookup.GetLocalizedString("Label_MuSPrime") + "=" + d3.ToString("N4", CultureInfo.CurrentCulture); Assert.AreEqual(plotViewModel.Labels[0], s3); Assert.AreEqual(plotViewModel.Title, s2); TextOutputViewModel textOutputViewModel = windowViewModel.TextOutputVM; Assert.AreEqual(textOutputViewModel.Text, s1); }
private void ExecuteForwardSolver_Executed(object sender, ExecutedRoutedEventArgs e) { try { var points = ExecuteForwardSolver(); var axesLabels = GetPlotLabels(); WindowViewModel.Current.PlotVM.SetAxesLabels.Execute(axesLabels); var plotLabels = GetLegendLabels(); var plotData = points.Zip(plotLabels, (p, el) => new PlotData(p, el)).ToArray(); WindowViewModel.Current.PlotVM.PlotValues.Execute(plotData); WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute( StringLookup.GetLocalizedString("Label_ForwardSolver") + TissueInputVM + "\r"); } catch (System.ArgumentException ex) { WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute( StringLookup.GetLocalizedString("Label_ForwardSolver\r")); WindowViewModel.Current.TextOutputVM.TextOutput_PostMessage.Execute("ERROR IN INPUT:" + ex.Message + "\r"); } }
public MapViewModel(int MapViewId = 0) { _mapViewId = MapViewId; MinValue = 1E-9; MaxValue = 1.0; AutoScale = false; ScalingTypeOptionVM = new OptionViewModel <ScalingType>(StringLookup.GetLocalizedString("Label_ScalingType") + _mapViewId, false); ScalingTypeOptionVM.PropertyChanged += (sender, args) => UpdateImages(); ColormapTypeOptionVM = new OptionViewModel <ColormapType>(StringLookup.GetLocalizedString("Label_ColormapType")); ColormapTypeOptionVM.PropertyChanged += (sender, args) => { _colormap = new Colormap(ColormapTypeOptionVM.SelectedValue); UpdateImages(); }; _colormap = new Colormap(ColormapTypeOptionVM.SelectedValue); Commands.Maps_PlotMap.Executed += Maps_PlotMap_Executed; ExportDataToTextCommand = new RelayCommand(() => Maps_ExportDataToText_Executed(null, null)); DuplicateWindowCommand = new RelayCommand(() => Map_DuplicateWindow_Executed(null, null)); }
// Summary: // Modifies the source data before passing it to the target for display in the // UI. // // Parameters: // value: // The source data being passed to the target. // // targetType: // The System.Type of data expected by the target dependency property. // // parameter: // An optional parameter to be used in the converter logic. // // culture: // The culture of the conversion. // // Returns: // The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { double d1; if (!(value is double || value is int)) { throw new ArgumentException(StringLookup.GetLocalizedString("Exception_DoubleOrInt")); } if (value is int) { d1 = (int)value; } else { d1 = (double)value; } if (parameter != null) { return(d1.ToString((string)parameter, CultureInfo.CurrentCulture)); } return(d1.ToString(CultureInfo.CurrentCulture)); }
public VoxelRegionViewModel(VoxelTissueRegion region, string name) { _region = region; _name = name ?? ""; _opticalPropertyVM = new OpticalPropertyViewModel(_region.RegionOP, StringLookup.GetLocalizedString("Measurement_Inv_mm"), "", true, true, true, false); }
private MapData ExecuteForwardSolver(CancellationToken cancellationToken) // todo: simplify method calls to ComputationFactory, as with Forward/InverseSolver(s) { cancellationToken.ThrowIfCancellationRequested(); var opticalProperties = GetOpticalProperties(); // could be OpticalProperties[] or IOpticalPropertyRegion[][] //double[] rhos = RhoRangeVM.Values.Reverse().Concat(RhoRangeVM.Values).ToArray(); var rhos = RhoRangeVM.Values.Reverse().Select(rho => - rho).Concat(RhoRangeVM.Values).ToArray(); var zs = ZRangeVM.Values.ToArray(); double[][] independentValues = { rhos, zs }; var sd = GetSelectedSolutionDomain(); // todo: too much thinking at the VM layer? var constantValues = new double[0]; if (ComputationFactory.IsSolverWithConstantValues(sd.SelectedValue)) { switch (sd.SelectedValue) { case FluenceSolutionDomainType.FluenceOfRhoAndZAndFt: constantValues = new[] { TimeModulationFrequency }; break; default: constantValues = new[] { sd.ConstantAxesVMs[0].AxisValue }; break; } } var independentAxes = GetIndependentVariableAxesInOrder( sd.IndependentVariableAxisOptionVM.SelectedValue, IndependentVariableAxis.Z); double[] results = null; if (ComputationFactory.IsComplexSolver(sd.SelectedValue)) { Complex[] fluence; if (IsMultiRegion) { fluence = ComputationFactory.ComputeFluenceComplex( ForwardSolverTypeOptionVM.SelectedValue, sd.SelectedValue, independentAxes, independentValues, ((IOpticalPropertyRegion[][])opticalProperties)[0], constantValues); } else { fluence = ComputationFactory.ComputeFluenceComplex( ForwardSolverTypeOptionVM.SelectedValue, sd.SelectedValue, independentAxes, independentValues, ((OpticalProperties[])opticalProperties)[0], constantValues); } switch (MapTypeOptionVM.SelectedValue) { case MapType.Fluence: results = fluence.Select(f => f.Magnitude).ToArray(); break; case MapType.AbsorbedEnergy: results = ComputationFactory.GetAbsorbedEnergy(fluence, ((OpticalProperties[])opticalProperties)[0].Mua).Select(a => a.Magnitude).ToArray(); break; case MapType.PhotonHittingDensity: switch (PhotonHittingDensitySolutionDomainTypeOptionVM.SelectedValue) { case FluenceSolutionDomainType.FluenceOfRhoAndZAndFt: results = ComputationFactory.GetPHD( ForwardSolverTypeOptionVM.SelectedValue, fluence.ToArray(), SourceDetectorSeparation, TimeModulationFrequency, (OpticalProperties[])opticalProperties, independentValues[0], independentValues[1]).ToArray(); break; case FluenceSolutionDomainType.FluenceOfRhoAndZ: case FluenceSolutionDomainType.FluenceOfFxAndZ: case FluenceSolutionDomainType.FluenceOfRhoAndZAndTime: case FluenceSolutionDomainType.FluenceOfFxAndZAndTime: case FluenceSolutionDomainType.FluenceOfFxAndZAndFt: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_SolutionDomainNotSupported")); default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoSolutionDomainExists")); } break; default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoMapTypeExists")); } } else { double[] fluence; if (IsMultiRegion) { fluence = ComputationFactory.ComputeFluence( ForwardSolverTypeOptionVM.SelectedValue, sd.SelectedValue, independentAxes, independentValues, ((IOpticalPropertyRegion[][])opticalProperties)[0], constantValues).ToArray(); } else { fluence = ComputationFactory.ComputeFluence( ForwardSolverTypeOptionVM.SelectedValue, sd.SelectedValue, independentAxes, independentValues, (OpticalProperties[])opticalProperties, constantValues).ToArray(); } switch (MapTypeOptionVM.SelectedValue) { case MapType.Fluence: results = fluence; break; case MapType.AbsorbedEnergy: if (IsMultiRegion) { if (ForwardSolver is TwoLayerSDAForwardSolver) { var regions = ((MultiRegionTissueViewModel)TissueInputVM).GetTissueInput().Regions .Select(region => (ILayerOpticalPropertyRegion)region).ToArray(); var muas = getRhoZMuaArrayFromLayerRegions(regions, rhos, zs); results = ComputationFactory.GetAbsorbedEnergy(fluence, muas).ToArray(); } else { return(null); } } else { // Note: the line below was originally overwriting the multi-region results. // I think this was a bug (DJC 7/11/14) results = ComputationFactory.GetAbsorbedEnergy(fluence, ((OpticalProperties[])opticalProperties)[0].Mua).ToArray(); } break; case MapType.PhotonHittingDensity: switch (PhotonHittingDensitySolutionDomainTypeOptionVM.SelectedValue) { case FluenceSolutionDomainType.FluenceOfRhoAndZ: if (IsMultiRegion) { var nop = (IOpticalPropertyRegion[][])opticalProperties; results = ComputationFactory.GetPHD( ForwardSolverTypeOptionVM.SelectedValue, fluence, SourceDetectorSeparation, (from LayerTissueRegion tissue in nop[0] select tissue.RegionOP).ToArray(), independentValues[0], independentValues[1]).ToArray(); } else { results = ComputationFactory.GetPHD( ForwardSolverTypeOptionVM.SelectedValue, fluence, SourceDetectorSeparation, (OpticalProperties[])opticalProperties, independentValues[0], independentValues[1]).ToArray(); } break; case FluenceSolutionDomainType.FluenceOfFxAndZ: case FluenceSolutionDomainType.FluenceOfRhoAndZAndTime: case FluenceSolutionDomainType.FluenceOfFxAndZAndTime: case FluenceSolutionDomainType.FluenceOfRhoAndZAndFt: case FluenceSolutionDomainType.FluenceOfFxAndZAndFt: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_SolutionDomainNotSupported")); default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoSolutionDomainExists")); } break; default: throw new InvalidEnumArgumentException(StringLookup.GetLocalizedString("Error_NoMapTypeExists")); } } cancellationToken.ThrowIfCancellationRequested(); // flip the array (since it goes over zs and then rhos, while map wants rhos and then zs var destinationArray = new double[results.Length]; long index = 0; for (var rhoi = 0; rhoi < rhos.Length; rhoi++) { for (var zi = 0; zi < zs.Length; zi++) { destinationArray[rhoi + rhos.Length * zi] = results[index++]; } } var dRho = 1D; var dZ = 1D; var dRhos = rhos.Select(rho => 2 * Math.PI * Math.Abs(rho) * dRho).ToArray(); var dZs = zs.Select(z => dZ).ToArray(); //var twoRhos = Enumerable.Concat(rhos.Reverse(), rhos).ToArray(); //var twoDRhos = Enumerable.Concat(dRhos.Reverse(), dRhos).ToArray(); return(new MapData(destinationArray, rhos, zs, dRhos, dZs)); }
public ForwardSolverViewModel() { _showOpticalProperties = true; _useSpectralPanelData = false; _allRangeVMs = new[] { new RangeViewModel { Title = StringLookup.GetLocalizedString("IndependentVariableAxis_Rho") } }; #if WHITELIST ForwardSolverTypeOptionVM = new OptionViewModel <ForwardSolverType>("Forward Model", false, WhiteList.ForwardSolverTypes); #else ForwardSolverTypeOptionVM = new OptionViewModel <ForwardSolverType>("Forward Model", false); #endif SolutionDomainTypeOptionVM = new SolutionDomainOptionViewModel("Solution Domain", SolutionDomainType.ROfRho); ForwardAnalysisTypeOptionVM = new OptionViewModel <ForwardAnalysisType>(StringLookup.GetLocalizedString("Heading_ModelAnalysisOutput"), true); ForwardSolverTypeOptionVM.PropertyChanged += (sender, args) => { OnPropertyChanged("IsGaussianForwardModel"); OnPropertyChanged("IsMultiRegion"); OnPropertyChanged("IsSemiInfinite"); TissueInputVM = GetTissueInputVM(IsMultiRegion ? "MultiLayer" : "SemiInfinite"); UpdateAvailableOptions(); }; ForwardSolverTypeOptionVM.SelectedValue = ForwardSolverType.PointSourceSDA; // force the model choice here? Action <double> updateSolutionDomainWithWavelength = wv => { var wvAxis = SolutionDomainTypeOptionVM.ConstantAxesVMs.FirstOrDefault( axis => axis.AxisType == IndependentVariableAxis.Wavelength); if (wvAxis != null) { wvAxis.AxisValue = wv; } }; SolutionDomainTypeOptionVM.PropertyChanged += (sender, args) => { if (args.PropertyName == "UseSpectralInputs") { UseSpectralPanelData = SolutionDomainTypeOptionVM.UseSpectralInputs; } if (args.PropertyName == "IndependentAxesVMs") { var useSpectralPanelDataAndNotNull = SolutionDomainTypeOptionVM.UseSpectralInputs && WindowViewModel.Current != null && WindowViewModel.Current.SpectralMappingVM != null; AllRangeVMs = (from i in Enumerable.Range(0, SolutionDomainTypeOptionVM.IndependentVariableAxisOptionVM.SelectedValues.Length) orderby i descending // descending so that wavelength takes highest priority, then time/time frequency, then space/spatial frequency select useSpectralPanelDataAndNotNull&& SolutionDomainTypeOptionVM.IndependentVariableAxisOptionVM.SelectedValues[i] == IndependentVariableAxis.Wavelength ? WindowViewModel.Current.SpectralMappingVM.WavelengthRangeVM // bind to same instance, not a copy : SolutionDomainTypeOptionVM.IndependentAxesVMs[i].AxisRangeVM).ToArray(); // if the independent axis is wavelength, then hide optical properties (because they come from spectral panel) ShowOpticalProperties = _allRangeVMs.All(value => value.AxisType != IndependentVariableAxis.Wavelength); // update solution domain wavelength constant if applicable if (useSpectralPanelDataAndNotNull && SolutionDomainTypeOptionVM.ConstantAxesVMs.Any( axis => axis.AxisType == IndependentVariableAxis.Wavelength)) { updateSolutionDomainWithWavelength(WindowViewModel.Current.SpectralMappingVM.Wavelength); } } }; ExecuteForwardSolverCommand = new RelayCommand(() => ExecuteForwardSolver_Executed(null, null)); OpticalPropertyVM.PropertyChanged += (sender, args) => { //need to get the value from the checkbox in case UseSpectralPanelData has not yet been updated if (SolutionDomainTypeOptionVM != null) { UseSpectralPanelData = SolutionDomainTypeOptionVM.UseSpectralInputs; } if (UseSpectralPanelData && WindowViewModel.Current != null && WindowViewModel.Current.SpectralMappingVM != null) { updateSolutionDomainWithWavelength(WindowViewModel.Current.SpectralMappingVM.Wavelength); } }; if (WindowViewModel.Current.SpectralMappingVM != null) { WindowViewModel.Current.SpectralMappingVM.PropertyChanged += (sender, args) => { if (args.PropertyName == "Wavelength") { //need to get the value from the checkbox in case UseSpectralPanelData has not yet been updated if (SolutionDomainTypeOptionVM != null) { UseSpectralPanelData = SolutionDomainTypeOptionVM.UseSpectralInputs; } if (UseSpectralPanelData && WindowViewModel.Current != null && WindowViewModel.Current.SpectralMappingVM != null) { updateSolutionDomainWithWavelength(WindowViewModel.Current.SpectralMappingVM.Wavelength); } } if (args.PropertyName == "OpticalProperties") { //need to get the value from the checkbox in case UseSpectralPanelData has not yet been updated if (SolutionDomainTypeOptionVM != null) { UseSpectralPanelData = SolutionDomainTypeOptionVM.UseSpectralInputs; } if (UseSpectralPanelData && WindowViewModel.Current != null && WindowViewModel.Current.SpectralMappingVM != null) { if (IsMultiRegion && MultiRegionTissueVM != null) { MultiRegionTissueVM.RegionsVM.ForEach(region => ((dynamic)region).OpticalPropertyVM.SetOpticalProperties( WindowViewModel.Current.SpectralMappingVM.OpticalProperties)); } else if (OpticalPropertyVM != null) { OpticalPropertyVM.SetOpticalProperties( WindowViewModel.Current.SpectralMappingVM.OpticalProperties); } } } }; } }
// todo: rename? this was to get a concise name for the legend private string[] GetLegendLabels() { string modelString = null; switch (ForwardSolverTypeOptionVM.SelectedValue) { case ForwardSolverType.DistributedGaussianSourceSDA: case ForwardSolverType.DistributedPointSourceSDA: case ForwardSolverType.PointSourceSDA: modelString = "\r" + StringLookup.GetLocalizedString("Label_ModelSDA"); break; case ForwardSolverType.MonteCarlo: modelString = "\r" + StringLookup.GetLocalizedString("Label_ModelScaledMC"); break; case ForwardSolverType.Nurbs: modelString = "\r" + StringLookup.GetLocalizedString("Label_ModelNurbs"); break; case ForwardSolverType.TwoLayerSDA: modelString = "\r" + StringLookup.GetLocalizedString("Label_Model2LayerSDA"); break; } string opString = null; if (IsMultiRegion && MultiRegionTissueVM != null) { var regions = MultiRegionTissueVM.GetTissueInput().Regions; opString = "\r" + StringLookup.GetLocalizedString("Label_MuA1") + "=" + regions[0].RegionOP.Mua.ToString("F4") + "\r" + StringLookup.GetLocalizedString("Label_MuSPrime1") + "=" + regions[0].RegionOP.Musp.ToString("F4") + "\r" + StringLookup.GetLocalizedString("Label_MuA2") + "=" + regions[1].RegionOP.Mua.ToString("F4") + "\r" + StringLookup.GetLocalizedString("Label_MuSPrime2") + "=" + regions[1].RegionOP.Musp.ToString("F4"); } else { var opticalProperties = OpticalPropertyVM.GetOpticalProperties(); opString = "\r" + StringLookup.GetLocalizedString("Label_MuA") + "=" + opticalProperties.Mua.ToString("F4") + " \r" + StringLookup.GetLocalizedString("Label_MuSPrime") + "=" + opticalProperties.Musp.ToString("F4"); } if (_allRangeVMs.Length > 1) { var isWavelengthPlot = _allRangeVMs.Any(vm => vm.AxisType == IndependentVariableAxis.Wavelength); var secondaryRangeVM = isWavelengthPlot ? _allRangeVMs.First(vm => vm.AxisType != IndependentVariableAxis.Wavelength) : _allRangeVMs .First(vm => vm.AxisType != IndependentVariableAxis.Time && vm.AxisType != IndependentVariableAxis.Ft); var secondaryAxesStrings = secondaryRangeVM.Values.Select( value => "\r" + secondaryRangeVM.AxisType.GetInternationalizedString() + " = " + value) .ToArray(); return (secondaryAxesStrings.Select( sas => modelString + sas + (isWavelengthPlot ? "\r" + StringLookup.GetLocalizedString("Label_SpectralMuAMuSPrime") : opString)).ToArray()); } return(new[] { modelString + opString }); }
private void ConstuctPlot(DataPointCollection dataPointCollection) { // function to filter the results if we're not auto-scaling Func <DataPoint, bool> isWithinAxes = p => (!ManualScaleX || (p.X <= MaxXValue && p.X >= MinXValue)) && (!ManualScaleY || (p.Y <= MaxYValue && p.Y >= MinYValue)); // function to filter out any invalid data points Func <DataPoint, bool> isValidDataPoint = p => !double.IsInfinity(Math.Abs(p.X)) && !double.IsNaN(p.X) && !double.IsInfinity(Math.Abs(p.Y)) && !double.IsNaN(p.Y); // //check if any normalization is selected var normToCurve = PlotNormalizationTypeOptionVM.SelectedValue == PlotNormalizationType.RelativeToCurve && DataSeriesCollection.Count > 1; var normToMax = PlotNormalizationTypeOptionVM.SelectedValue == PlotNormalizationType.RelativeToMax && DataSeriesCollection.Count > 0; var tempPointArrayA = new List <Point>(); var tempPointArrayB = new List <Point>(); double x; double y; var lineSeriesA = new LineSeries(); var lineSeriesB = new LineSeries(); //we need B for complex if (dataPointCollection.DataPoints[0] is ComplexDataPoint) { // normalization calculations var max = 1.0; var maxRe = 1.0; var maxIm = 1.0; if (normToMax) { var points = dataPointCollection.DataPoints.Cast <ComplexDataPoint>().ToArray(); switch (PlotToggleTypeOptionVM.SelectedValue) { case PlotToggleType.Phase: max = points.Select(p => p.Y.Phase * (-180 / Math.PI)).Max(); break; case PlotToggleType.Amp: max = points.Select(p => p.Y.Magnitude).Max(); break; case PlotToggleType.Complex: maxRe = points.Select(p => p.Y.Real).Max(); maxIm = points.Select(p => p.Y.Imaginary).Max(); break; } } double[] tempAmp = null; double[] tempPh = null; double[] tempRe = null; double[] tempIm = null; if (normToCurve) { tempAmp = (from ComplexDataPoint dp in DataSeriesCollection[0].DataPoints select dp.Y.Magnitude).ToArray(); tempPh = (from ComplexDataPoint dp in DataSeriesCollection[0].DataPoints select dp.Y.Phase * (-180 / Math.PI)).ToArray(); tempRe = (from ComplexDataPoint dp in DataSeriesCollection[0].DataPoints select dp.Y.Real).ToArray(); tempIm = (from ComplexDataPoint dp in DataSeriesCollection[0].DataPoints select dp.Y.Imaginary).ToArray(); } var curveIndex = 0; foreach (var dp in dataPointCollection.DataPoints.Cast <ComplexDataPoint>()) { x = XAxisLog10 ? Math.Log10(dp.X) : dp.X; switch (PlotToggleTypeOptionVM.SelectedValue) { case PlotToggleType.Phase: y = -(dp.Y.Phase * (180 / Math.PI)); // force phase to be between 0 and 360 if (y < 0) { y += 360; } switch (PlotNormalizationTypeOptionVM.SelectedValue) { case PlotNormalizationType.RelativeToCurve: var curveY = normToCurve && tempPh != null ? tempPh[curveIndex] : 1.0; y = y / curveY; break; case PlotNormalizationType.RelativeToMax: y = y / max; break; } break; case PlotToggleType.Amp: y = dp.Y.Magnitude; switch (PlotNormalizationTypeOptionVM.SelectedValue) { case PlotNormalizationType.RelativeToCurve: var curveY = normToCurve && tempAmp != null ? tempAmp[curveIndex] : 1.0; y = y / curveY; break; case PlotNormalizationType.RelativeToMax: y = y / max; break; } break; default: // case PlotToggleType.Complex: y = dp.Y.Real; switch (PlotNormalizationTypeOptionVM.SelectedValue) { case PlotNormalizationType.RelativeToCurve: var curveY = normToCurve && tempRe != null ? tempRe[curveIndex] : 1.0; y = y / curveY; break; case PlotNormalizationType.RelativeToMax: max = maxRe; y = y / max; break; } y = YAxisLog10 ? Math.Log10(y) : y; var p = new DataPoint(x, y); if (isValidDataPoint(p) && isWithinAxes(p)) { lineSeriesB.Points.Add(p); //Add the data to the tempPointArray to add to the PlotSeriesCollection tempPointArrayB.Add(new Point(x, y)); } y = dp.Y.Imaginary; //break; // handle imag within switch switch (PlotNormalizationTypeOptionVM.SelectedValue) { case PlotNormalizationType.RelativeToCurve: var curveY = normToCurve && tempIm != null ? tempIm[curveIndex] : 1.0; y = y / curveY; break; case PlotNormalizationType.RelativeToMax: max = maxIm; y = y / max; break; } break; } // ckh 8/13/18 code does not need to repeat here since inside switch above now for all cases //switch (PlotNormalizationTypeOptionVM.SelectedValue) //{ // case PlotNormalizationType.RelativeToCurve: // var curveY = normToCurve && tempAmp != null ? tempAmp[curveIndex] : 1.0; // y = y/curveY; // break; // case PlotNormalizationType.RelativeToMax: // y = y/max; // break; //} y = YAxisLog10 ? Math.Log10(y) : y; var point = new DataPoint(x, y); if (isValidDataPoint(point) && isWithinAxes(point)) { lineSeriesA.Points.Add(point); //Add the data to the tempPointArray to add to the PlotSeriesCollection tempPointArrayA.Add(new Point(x, y)); } curveIndex += 1; } ShowComplexPlotToggle = true; // right now, it's all or nothing - assume all plots are ComplexDataPoints } else { // normalization calculations var max = 1.0; if (normToMax) { var points = dataPointCollection.DataPoints.Cast <DoubleDataPoint>().ToArray(); max = points.Select(p => p.Y).Max(); } double[] tempY = null; if (normToCurve) { tempY = (from DoubleDataPoint dp in DataSeriesCollection[0].DataPoints select dp.Y).ToArray(); } var curveIndex = 0; foreach (var dp in dataPointCollection.DataPoints.Cast <DoubleDataPoint>()) { x = XAxisLog10 ? Math.Log10(dp.X) : dp.X; switch (PlotNormalizationTypeOptionVM.SelectedValue) { case PlotNormalizationType.RelativeToCurve: var curveY = normToCurve && tempY != null ? tempY[curveIndex] : 1.0; y = dp.Y / curveY; break; case PlotNormalizationType.RelativeToMax: y = dp.Y / max; break; default: y = dp.Y; break; } y = YAxisLog10 ? Math.Log10(y) : y; var point = new DataPoint(x, y); if (isValidDataPoint(point) && isWithinAxes(point)) { lineSeriesA.Points.Add(point); //Add the data to the tempPointArray to add to the PlotSeriesCollection tempPointArrayA.Add(new Point(x, y)); } curveIndex += 1; } } if (ShowComplexPlotToggle) { switch (PlotToggleTypeOptionVM.SelectedValue) { case PlotToggleType.Complex: lineSeriesA.Title = dataPointCollection.Title + StringLookup.GetLocalizedString("Label_Imaginary"); lineSeriesB.Title = dataPointCollection.Title + StringLookup.GetLocalizedString("Label_Real"); lineSeriesB.MarkerType = MarkerType.Circle; PlotModel.Series.Add(lineSeriesB); PlotSeriesCollection.Add(tempPointArrayB.ToArray()); break; case PlotToggleType.Phase: lineSeriesA.Title = dataPointCollection.Title + StringLookup.GetLocalizedString("Label_Phase"); break; case PlotToggleType.Amp: lineSeriesA.Title = dataPointCollection.Title + StringLookup.GetLocalizedString("Label_Amplitude"); break; } lineSeriesA.MarkerType = MarkerType.Circle; PlotModel.Series.Add(lineSeriesA); PlotModel.Title = PlotTitles[PlotTitles.Count - 1]; PlotSeriesCollection.Add(tempPointArrayA.ToArray()); } else { lineSeriesA.Title = dataPointCollection.Title; lineSeriesA.MarkerType = MarkerType.Circle; PlotModel.Series.Add(lineSeriesA); PlotModel.Title = PlotTitles[PlotTitles.Count - 1]; PlotSeriesCollection.Add(tempPointArrayA.ToArray()); } PlotModel.Axes.Clear(); PlotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Title = XAxis, TitleFontWeight = FontWeights.Bold }); PlotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = YAxis, TitleFontWeight = FontWeights.Bold }); }
public FluenceSolverViewModel() { RhoRangeVM = new RangeViewModel(new DoubleRange(0.1, 19.9, 100), StringLookup.GetLocalizedString("Measurement_mm"), IndependentVariableAxis.Rho, ""); ZRangeVM = new RangeViewModel(new DoubleRange(0.1, 19.9, 100), StringLookup.GetLocalizedString("Measurement_mm"), IndependentVariableAxis.Z, ""); SourceDetectorSeparation = 10.0; TimeModulationFrequency = 0.1; _tissueInputVM = new OpticalPropertyViewModel(new OpticalProperties(), IndependentVariableAxisUnits.InverseMM.GetInternationalizedString(), StringLookup.GetLocalizedString("Heading_OpticalProperties")); // right now, we're doing manual databinding to the selected item. need to enable databinding // confused, though - do we need to use strings? or, how to make generics work with dependency properties? ForwardSolverTypeOptionVM = new OptionViewModel <ForwardSolverType>( "Forward Model", false, new[] { ForwardSolverType.DistributedPointSourceSDA, ForwardSolverType.PointSourceSDA, ForwardSolverType.DistributedGaussianSourceSDA, ForwardSolverType.TwoLayerSDA }); // explicitly enabling these for the workshop FluenceSolutionDomainTypeOptionVM = new FluenceSolutionDomainOptionViewModel(StringLookup.GetLocalizedString("Heading_FluenceSolutionDomain"), FluenceSolutionDomainType.FluenceOfRhoAndZ); FluenceSolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndTimeEnabled = false; FluenceSolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndFtEnabled = true; AbsorbedEnergySolutionDomainTypeOptionVM = new FluenceSolutionDomainOptionViewModel(StringLookup.GetLocalizedString("Heading_AbsorbedEnergySolutionDomain"), FluenceSolutionDomainType.FluenceOfRhoAndZ); AbsorbedEnergySolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndTimeEnabled = false; AbsorbedEnergySolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndFtEnabled = true; PhotonHittingDensitySolutionDomainTypeOptionVM = new FluenceSolutionDomainOptionViewModel(StringLookup.GetLocalizedString("Heading_PHDSolutionDomain"), FluenceSolutionDomainType.FluenceOfRhoAndZ); PhotonHittingDensitySolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndTimeEnabled = false; PhotonHittingDensitySolutionDomainTypeOptionVM.IsFluenceOfRhoAndZAndFtEnabled = true; PropertyChangedEventHandler updateSolutionDomain = (sender, args) => { if (args.PropertyName == "IndependentAxisType") { RhoRangeVM = ((FluenceSolutionDomainOptionViewModel)sender).IndependentAxesVMs[0].AxisRangeVM; } // todo: must this fire on ANY property, or is there a specific one we can listen to, as above? OnPropertyChanged("IsTimeFrequencyDomain"); }; FluenceSolutionDomainTypeOptionVM.PropertyChanged += updateSolutionDomain; AbsorbedEnergySolutionDomainTypeOptionVM.PropertyChanged += updateSolutionDomain; PhotonHittingDensitySolutionDomainTypeOptionVM.PropertyChanged += updateSolutionDomain; MapTypeOptionVM = new OptionViewModel <MapType>( "Map Type", new[] { MapType.Fluence, MapType.AbsorbedEnergy, MapType.PhotonHittingDensity }); MapTypeOptionVM.PropertyChanged += (sender, args) => { if (args.PropertyName == "SelectedValues") { OnPropertyChanged("IsFluence"); OnPropertyChanged("IsAbsorbedEnergy"); OnPropertyChanged("IsPhotonHittingDensity"); OnPropertyChanged("IsTimeFrequencyDomain"); UpdateAvailableOptions(); } }; ForwardSolverTypeOptionVM.PropertyChanged += (sender, args) => { OnPropertyChanged("ForwardSolver"); OnPropertyChanged("IsGaussianForwardModel"); OnPropertyChanged("IsMultiRegion"); OnPropertyChanged("IsSemiInfinite"); TissueInputVM = GetTissueInputVM(IsMultiRegion ? "MultiLayer" : "SemiInfinite"); UpdateAvailableOptions(); OnPropertyChanged("IsTimeFrequencyDomain"); }; ExecuteFluenceSolverCommand = new RelayCommand(() => ExecuteFluenceSolver_Executed(null, null)); CancelFluenceSolverCommand = new RelayCommand(() => CancelFluenceSolver_Executed(null, null)); _canRunSolver = true; _canCancelSolver = false; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(StringLookup.GetLocalizedString((string)parameter)); }