// 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 = "\rModel - SDA";
                break;

            case ForwardSolverType.MonteCarlo:
                modelString = "\rModel - scaled MC";
                break;

            case ForwardSolverType.Nurbs:
                modelString = "\rModel - nurbs";
                break;

            case ForwardSolverType.TwoLayerSDA:
                modelString = "\rModel - 2 layer SDA";
                break;
            }

            string opString = null;

            if (IsMultiRegion && MultiRegionTissueVM != null)
            {
                var regions = MultiRegionTissueVM.GetTissueInput().Regions;
                opString = "\rμa1=" + regions[0].RegionOP.Mua.ToString("F4") + "\rμs'1=" + regions[0].RegionOP.Musp.ToString("F4") +
                           "\rμa2=" + regions[1].RegionOP.Mua.ToString("F4") + "\rμs'2=" + regions[1].RegionOP.Musp.ToString("F4");
            }
            else
            {
                var opticalProperties = OpticalPropertyVM.GetOpticalProperties();
                opString = "\rμa=" + opticalProperties.Mua.ToString("F4") + " \rμs'=" + opticalProperties.Musp.ToString("F4");
            }

            if (_allRangeVMs.Length > 1)
            {
                var isWavelengthPlot = _allRangeVMs.Any(vm => vm.AxisType == IndependentVariableAxis.Wavelength);
                var secondaryRangeVM = isWavelengthPlot
                    ? _allRangeVMs.Where(vm => vm.AxisType != IndependentVariableAxis.Wavelength).First()
                    : _allRangeVMs.Where(vm => vm.AxisType != IndependentVariableAxis.Time && vm.AxisType != IndependentVariableAxis.Ft).First();

                string[] secondaryAxesStrings = secondaryRangeVM.Values.Select(value => "\r" + secondaryRangeVM.AxisType.GetInternationalizedString() + " = " + value.ToString()).ToArray();
                return(secondaryAxesStrings.Select(sas => modelString + sas + (isWavelengthPlot ? "\r(spectral μa,μs')" : opString)).ToArray());
            }

            return(new [] { modelString + opString });
        }
예제 #2
0
        private object GetOpticalProperties()
        {
            if (
                SolutionDomainTypeOptionVM.IndependentVariableAxisOptionVM.SelectedValues.Contains(
                    IndependentVariableAxis.Wavelength) &&
                SolutionDomainTypeOptionVM.UseSpectralInputs &&
                WindowViewModel.Current != null &&
                WindowViewModel.Current.SpectralMappingVM != null)
            {
                var tissue      = WindowViewModel.Current.SpectralMappingVM.SelectedTissue;
                var wavelengths = GetParameterValues(IndependentVariableAxis.Wavelength);
                var ops         = tissue.GetOpticalProperties(wavelengths);

                if (IsMultiRegion && MultiRegionTissueVM != null)
                {
                    return(ops.Select(op =>
                    {
                        var regions =
                            MultiRegionTissueVM.GetTissueInput()
                            .Regions.Select(region => (IOpticalPropertyRegion)region)
                            .ToArray();
                        regions.ForEach(region =>
                        {
                            region.RegionOP.Mua = op.Mua;
                            region.RegionOP.Musp = op.Musp;
                            region.RegionOP.G = op.G;
                            region.RegionOP.N = op.N;
                        });
                        return regions.ToArray();
                    }));
                }

                return(ops);
            }

            if (IsMultiRegion && MultiRegionTissueVM != null)
            {
                return(new[]
                {
                    MultiRegionTissueVM.GetTissueInput()
                    .Regions.Select(region => (IOpticalPropertyRegion)region)
                    .ToArray()
                });
            }

            return(new[] { OpticalPropertyVM.GetOpticalProperties() });
        }
예제 #3
0
        private object GetOpticalProperties()
        {
            // todo: add-in spectral panel data
            //if (SolutionDomainTypeOptionVM.IndependentVariableAxisOptionVM.SelectedValues.Contains(IndependentVariableAxis.Wavelength) &&
            //    UseSpectralPanelData &&
            //    SolverDemoViewModel.Current != null &&
            //    SolverDemoViewModel.Current.SpectralMappingVM != null)
            //{
            //    var tissue = SolverDemoViewModel.Current.SpectralMappingVM.SelectedTissue;
            //    var wavelengths = GetParameterValues(IndependentVariableAxis.Wavelength);
            //    var ops = tissue.GetOpticalProperties(wavelengths);

            //    if (IsMultiRegion && MultiRegionTissueVM != null)
            //    {
            //        return ops.Select(op =>
            //        {
            //            var regions = MultiRegionTissueVM.GetTissueInput().Regions.Select(region => (IOpticalPropertyRegion)region).ToArray();
            //            regions.ForEach(region =>
            //            {
            //                region.RegionOP.Mua = op.Mua;
            //                region.RegionOP.Musp = op.Musp;
            //                region.RegionOP.G = op.G;
            //                region.RegionOP.N = op.N;
            //            });
            //            return regions.ToArray();
            //        });
            //    }

            //    return ops;
            //}

            if (IsMultiRegion && MultiRegionTissueVM != null)
            {
                return(new[]
                {
                    MultiRegionTissueVM.GetTissueInput()
                    .Regions.Select(region => (IOpticalPropertyRegion)region)
                    .ToArray()
                });
            }

            return(new[] { OpticalPropertyVM.GetOpticalProperties() });
        }