private static DiffusionParameters[] GetDiffusionParameters(IOpticalPropertyRegion[] regions)
        {
            var diffusionParameters = new DiffusionParameters[regions.Length];

            for (int i = 0; i < regions.Length; i++)
            {
                diffusionParameters[i] = DiffusionParameters.Create(
                    new OpticalProperties(regions[i].RegionOP.Mua, regions[i].RegionOP.Musp, regions[i].RegionOP.G, regions[i].RegionOP.N),
                    ForwardModel.SDA);
            }
            return(diffusionParameters);
        }
 /// <summary>
 /// Vectorized ROfFx. Solves SDA using Cuccia et al JBO, March/April 2009
 /// </summary>
 /// <param name="ops">set of optical properties of the medium</param>
 /// <param name="fxs">spatial frequencies (1/mm)</param>
 /// <returns></returns>
 public override IEnumerable <double> ROfFx(
     IEnumerable <OpticalProperties> ops, IEnumerable <double> fxs)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         foreach (var fx in fxs)
         {
             yield return(SFDDiffusionForwardSolver.StationaryOneDimensionalSpatialFrequencyFluence(
                              dp, fx, 0.0) / 2 / dp.A); // this is not the true mathematical derivation given the source condition! but is the WIDELY used in the lit
         }
     }
 }
 public override IEnumerable <double> ROfRho(
     IEnumerable <OpticalProperties> ops,
     IEnumerable <double> rhos)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         var fr1 = CalculatorToolbox.GetCubicFresnelReflectionMomentOfOrder1(op.N);
         var fr2 = CalculatorToolbox.GetCubicFresnelReflectionMomentOfOrder2(op.N);
         foreach (var rho in rhos)
         {
             yield return(StationaryReflectance(dp, rho, fr1, fr2));
         }
     }
 }
 public override IEnumerable <double> FluenceOfRhoAndZ(
     IEnumerable <OpticalProperties> ops,
     IEnumerable <double> rhos,
     IEnumerable <double> zs)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         foreach (var rho in rhos)
         {
             foreach (var z in zs)
             {
                 yield return(StationaryFluence(rho, z, dp));
             }
         }
     }
 }
 public override IEnumerable <double> FluenceOfFxAndZ(
     IEnumerable <OpticalProperties> ops,
     IEnumerable <double> fxs,
     IEnumerable <double> zs)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         foreach (var fx in fxs)
         {
             foreach (var z in zs)
             {
                 yield return(SFDDiffusionForwardSolver.StationaryOneDimensionalSpatialFrequencyFluence(
                                  dp, fx, z));
             }
         }
     }
 }
 public override IEnumerable <Complex> ROfRhoAndFt(IEnumerable <OpticalProperties> ops,
                                                   IEnumerable <double> rhos, IEnumerable <double> fts)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         var fr1 = CalculatorToolbox.GetCubicFresnelReflectionMomentOfOrder1(op.N);
         var fr2 = CalculatorToolbox.GetCubicFresnelReflectionMomentOfOrder2(op.N);
         foreach (var rho in rhos)
         {
             foreach (var ft in fts)
             {
                 Complex k = ((op.Mua * dp.cn + Complex.ImaginaryOne * ft * 2 * Math.PI) /
                              (dp.cn * dp.D)).SquareRoot();
                 yield return(TemporalFrequencyReflectance(dp, rho, k, fr1, fr2));
             }
         }
     }
 }
 public override IEnumerable <double> FluenceOfRhoAndZAndTime(
     IEnumerable <OpticalProperties> ops,
     IEnumerable <double> rhos,
     IEnumerable <double> zs,
     IEnumerable <double> ts)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         foreach (var rho in rhos)
         {
             foreach (var z in zs)
             {
                 foreach (var t in ts)
                 {
                     yield return(TemporalFluence(dp, rho, z, t));
                 }
             }
         }
     }
 }
        public override IEnumerable <Complex> FluenceOfRhoAndZAndFt(
            IEnumerable <OpticalProperties> ops, IEnumerable <double> rhos,
            IEnumerable <double> zs, IEnumerable <double> fts)
        {
            foreach (var op in ops)
            {
                DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
                foreach (var rho in rhos)
                {
                    foreach (var z in zs)
                    {
                        foreach (var ft in fts)
                        {
                            Complex k = ((op.Mua * dp.cn + Complex.ImaginaryOne * ft * 2 * Math.PI) /
                                         (dp.cn * dp.D)).SquareRoot();

                            yield return(TemporalFrequencyFluence(dp, rho, z, k).Magnitude);
                        }
                    }
                }
            }
        }
 public override IEnumerable <double> FluenceOfFxAndZAndTime(
     IEnumerable <OpticalProperties> ops,
     IEnumerable <double> fxs,
     IEnumerable <double> zs,
     IEnumerable <double> ts)
 {
     foreach (var op in ops)
     {
         DiffusionParameters dp = DiffusionParameters.Create(op, this.ForwardModel);
         foreach (var fx in fxs)
         {
             foreach (var z in zs)
             {
                 foreach (var t in ts)
                 {
                     yield return
                         (HankelTransform.DigitalFilterOfOrderZero(
                              fx, rho => TemporalFluence(dp, rho, z, t)));
                 }
             }
         }
     }
 }