From a56bef4e0a0a9d1023de5d8164cc4629dda1ae77 Mon Sep 17 00:00:00 2001 From: Lisa Malenfant Date: Fri, 29 Sep 2023 11:36:51 -0700 Subject: [PATCH 1/9] Reorganized ROfRho and ROfRhoAndTime --- src/Vts/Interfaces/IForwardSolver.cs | 381 ++++++++++++--------------- 1 file changed, 168 insertions(+), 213 deletions(-) diff --git a/src/Vts/Interfaces/IForwardSolver.cs b/src/Vts/Interfaces/IForwardSolver.cs index 5aadea530..e2e20666d 100644 --- a/src/Vts/Interfaces/IForwardSolver.cs +++ b/src/Vts/Interfaces/IForwardSolver.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Numerics; -using Vts.MonteCarlo; namespace Vts { @@ -10,10 +9,47 @@ namespace Vts /// public interface IForwardSolver : INotifyPropertyChanged { - #region IMultiRegionForwardSolver // ? + #region ROfRho + /// + /// Determines reflectance at source-detector separation rho + /// + /// optical properties of the medium + /// source-detector separation (mm) + /// Reflectance at source-detector separation rho + double ROfRho(OpticalProperties op, double rho); + + /// + /// Overload of scalar ROfRho function. Determines reflectance at optical properties 'op' and source-detector separations 'rhos' + /// + /// medium optical properties + /// source-detector separations (mm) + /// Reflectance as a function of rhos + double[] ROfRho(OpticalProperties op, double[] rhos); + + /// + /// Overload of ROfRho. Determines reflectance at optical properties 'ops', and source-detector separation 'rho' + /// + /// sets of medium optical properties + /// source-detector separation (mm) + /// Reflectance as a function of rho + double[] ROfRho(OpticalProperties[] ops, double rho); + + /// + /// Overload of scalar ROfRho function. Determines reflectance at optical properties 'ops' and source-detector separations 'rhos' + /// + /// sets of medium optical properties + /// source-detector separations (mm) + /// Reflectance as a function of rhos + double[] ROfRho(OpticalProperties[] ops, double[] rhos); + + /// + /// Overload of scalar ROfRho function. Determines reflectance at optical properties 'ops' and source-detector separations 'rhos' + /// + /// sets of medium optical properties + /// source-detector separations (mm) + /// Reflectance as a function of rhos + IEnumerable ROfRho(IEnumerable ops, IEnumerable rhos); - // prototype of new interface methods for multi-region capabilities - #region double ROfRho(IOpticalPropertyRegion[] regions, double rho); /// /// Determines reflectance at source-detector separation rho /// @@ -23,20 +59,20 @@ public interface IForwardSolver : INotifyPropertyChanged double ROfRho(IOpticalPropertyRegion[] regions, double rho); /// - /// Overload of scalar ROfRho function. Determines reflectance at tissue regions and source-detector separations 'rhos' + /// Overload of scalar ROfRho function. Determines reflectance given tissue regions and source-detector separations 'rhos' /// /// sets of medium optical and geometrical properties for each sub-region /// source-detector separations (mm) /// Reflectance as a function of rhos - IEnumerable ROfRho(IEnumerable regions, IEnumerable rhos); + double[] ROfRho(IOpticalPropertyRegion[] regions, double[] rhos); /// - /// Overload of scalar ROfRho function. Determines reflectance given tissue regions and source-detector separations 'rhos' + /// Overload of scalar ROfRho function. Determines reflectance at tissue regions and source-detector separations 'rhos' /// /// sets of medium optical and geometrical properties for each sub-region /// source-detector separations (mm) /// Reflectance as a function of rhos - double[] ROfRho(IOpticalPropertyRegion[] regions, double[] rhos); + IEnumerable ROfRho(IEnumerable regions, IEnumerable rhos); /// /// Overload of scalar ROfRho function. Determines reflectance given tissue regions and source-detector separations 'rhos' @@ -47,26 +83,99 @@ public interface IForwardSolver : INotifyPropertyChanged double[] ROfRho(IOpticalPropertyRegion[][] regions, double[] rhos); #endregion - #region double ROfRhoAndTime(IOpticalPropertyRegion[] regions, double rho, double time); + #region ROfRhoAndTime /// /// Determines reflectance at source-detector separation rho and time /// - /// optical and geometrical properties of the medium for each sub-region + /// optical properties of the medium /// source-detector separation (mm) /// time (ns) - /// Reflectance at source-detector separation rho - double ROfRhoAndTime(IOpticalPropertyRegion[] regions, double rho, double time); + /// Reflectance at source-detector separation rho and time + double ROfRhoAndTime(OpticalProperties op, double rho, double time); /// - /// Overload of scalar ROfRho function. Determines reflectance at tissue regions, source-detector - /// separations 'rhos', and times 'times' + /// Overload of scalar ROfRhoAndTime function. Determines reflectance at optical properties 'op', source-detector separations 'rhos' and times /// - /// sets of medium optical and geometrical properties for each sub-region + /// medium optical properties /// source-detector separations (mm) /// times (ns) /// Reflectance as a function of rhos and times - IEnumerable ROfRhoAndTime(IEnumerable regions, IEnumerable rhos, - IEnumerable times); + /// IEnumerable can be one or more values - use the .AsEnumerable() extension method (in Vts.Extensions) on single items + double[] ROfRhoAndTime(OpticalProperties op, double[] rhos, double[] times); + + /// + /// Overload of ROfRhoAndTime. Determines reflectance at optical properties 'op', source-detector separation 'rho' and times + /// + /// medium optical properties + /// source-detector separation (mm) + /// times (ns) + /// Reflectance as a function of rho and times + double[] ROfRhoAndTime(OpticalProperties op, double rho, double[] times); + + /// + /// Overload of ROfRhoAndTime. Determines reflectance at optical properties 'op', source-detector separations 'rhos' and time 't' + /// + /// medium optical properties + /// source-detector separation (mm) + /// time (ns) + /// Reflectance as a function of rhos and time + double[] ROfRhoAndTime(OpticalProperties op, double[] rhos, double time); + + /// + /// Overload of ROfRhoAndTime. Determines reflectance at optical properties 'ops', source-detector separation 'rho' and times 't' + /// + /// sets of medium optical properties + /// source-detector separation (mm) + /// time (ns) + /// Reflectance as a function of rho and time + double[] ROfRhoAndTime(OpticalProperties[] ops, double rho, double time); + + /// + /// Overload of ROfRhoAndTime. Determines reflectance at optical properties 'ops', source-detector separations 'rhos' and time + /// + /// sets of medium optical properties + /// source-detector separations (mm) + /// time (ns) + /// Reflectance as function of rhos and times + double[] ROfRhoAndTime(OpticalProperties[] ops, double[] rhos, double time); + + /// + /// Overload of ROfRhoAndTime. Determines reflectance at optical properties 'ops', source-detector separation 'rho' and times + /// + /// sets of medium optical properties + /// source-detector separation (mm) + /// times (ns) + /// Reflectance as a function of rho and time + double[] ROfRhoAndTime(OpticalProperties[] ops, double rho, double[] times); + + /// + /// Overload of scalar ROfRhoAndTime function. Determines reflectance at optical properties 'ops', source-detector separations 'rhos' and times + /// + /// sets of medium optical properties + /// source-detector separations (mm) + /// times (ns) + /// Reflectance as a function of rho and time + /// IEnumerable can be one or more values - use the .AsEnumerable() extension method (in Vts.Extensions) on single items + double[] ROfRhoAndTime(OpticalProperties[] ops, double[] rhos, double[] times); + + /// + /// Overload of scalar ROfRhoAndTime function. Determines reflectance at optical properties 'ops', source-detector separations 'rhos' and times + /// + /// sets of medium optical properties + /// source-detector separations (mm) + /// times (ns) + /// Reflectance as a function of rhos and times + /// IEnumerable can be one or more values - use the .AsEnumerable() extension method (in Vts.Extensions) on single items + IEnumerable ROfRhoAndTime(IEnumerable ops, IEnumerable rhos, IEnumerable times); + + /// + /// Determines reflectance at source-detector separation rho and time + /// + /// optical and geometrical properties of the medium for each sub-region + /// source-detector separation (mm) + /// time (ns) + /// Reflectance at source-detector separation rho + double ROfRhoAndTime(IOpticalPropertyRegion[] regions, double rho, double time); /// /// Overload of scalar ROfRho function. Determines reflectance given tissue regions, source-detector @@ -107,9 +216,19 @@ IEnumerable ROfRhoAndTime(IEnumerable regions, /// times (ns) /// Reflectance as a function of rhos and times double[] ROfRhoAndTime(IOpticalPropertyRegion[][] regions, double[] rhos, double[] times); + + /// + /// Overload of scalar ROfRho function. Determines reflectance at tissue regions, source-detector + /// separations 'rhos', and times 'times' + /// + /// sets of medium optical and geometrical properties for each sub-region + /// source-detector separations (mm) + /// times (ns) + /// Reflectance as a function of rhos and times + IEnumerable ROfRhoAndTime(IEnumerable regions, IEnumerable rhos, + IEnumerable times); #endregion - #region Complex ROfRhoAndFt(IOpticalPropertyRegion[] regions, double rho, double ft); /// /// Determines reflectance at source-detector separation rho and temporal frequency ft /// @@ -168,9 +287,8 @@ IEnumerable ROfRhoAndTime(IEnumerable regions, /// temporal frequencies /// Reflectance as a function of rhos and fts Complex[] ROfRhoAndFt(IOpticalPropertyRegion[][] regions, double[] rhos, double[] fts); - #endregion - #region double ROFx(IOpticalPropertyRegion[] regions, double fx); + /// /// Determines reflectance at spatial frequency /// @@ -202,9 +320,8 @@ IEnumerable ROfRhoAndTime(IEnumerable regions, /// spatial frequencies /// Reflectance at spatial frequency double[] ROfFx(IOpticalPropertyRegion[][] regions, double[] fxs); - #endregion - #region double ROfFxAndTime(IOpticalPropertyRegion[] regions, double fx, double time); + /// /// Determines reflectance at spatial frequency and time /// @@ -264,9 +381,8 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// times (ns) /// Reflectance at spatial freq. and time double[] ROfFxAndTime(IOpticalPropertyRegion[][] regions, double[] fxs, double[] times); - #endregion - #region Complex ROfFxAndFt(IOpticalPropertyRegion[] regions, double fx, double ft); + /// /// Determines reflectance at spatial frequency fx and temporal frequency ft /// @@ -325,9 +441,8 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// temporal frequencies /// Reflectance at spatial freq. and temporal freq. Complex[] ROfFxAndFt(IOpticalPropertyRegion[][] regions, double[] fxs, double[] fts); - #endregion - #region double[] FluenceOfRhoAndZ(IOpticalPropertyRegion[][] regions, double[] rhos, double[] zs); + /// /// Overload of scalar FluenceOfRhoAndZ function. Determines fluence of tissue 'regions' and source-detector separations 'rhos' and 'zs' /// @@ -345,8 +460,7 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// depth bins /// Fluence as a function of rhos and zs IEnumerable FluenceOfRhoAndZ(IEnumerable regions, IEnumerable rhos, IEnumerable zs); - #endregion - #region Complex[] FluenceOfRhoAndZAndFt(IOpticalPropertyRegion[][] regions, double[] rhos, double[] zs, double[] fts); + /// /// Overload of scalar FluenceOfRhoAndZ function. Determines fluence of tissue 'regions' and source-detector separations 'rhos' and 'zs' /// at temporal frequencies fts @@ -368,32 +482,6 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// temporal frequencies /// Fluence as a function of rhos, zs and fts IEnumerable FluenceOfRhoAndZAndFt(IEnumerable regions, IEnumerable rhos, IEnumerable zs, IEnumerable fts); - #endregion - - #endregion // IMultiRegionForwardSolver - - #region double ROfRho(OpticalProperties op, double rho); - /// - /// Determines reflectance at source-detector separation rho - /// - /// optical properties of the medium - /// source-detector separation (mm) - /// Reflectance at source-detector separation rho - double ROfRho(OpticalProperties op, double rho); - #endregion - - #region double ROfRhoAndTime(OpticalProperties op, double rho, double ttime); - /// - /// Determines reflectance at source-detector separation rho and time - /// - /// optical properties of the medium - /// source-detector separation (mm) - /// time (ns) - /// Reflectance at source-detector separation rho and time - double ROfRhoAndTime(OpticalProperties op, double rho, double time); - #endregion - - #region Complex ROfRhoAndFt(OpticalProperties op, double rho, double ft); /// /// Determines reflectance at source-detector separation rho and modulation frequency ft @@ -403,9 +491,8 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// modulation frequency (GHz) /// Reflectance at source-detector separation rho and modulation frequency ft Complex ROfRhoAndFt(OpticalProperties op, double rho, double ft); - #endregion - #region double ROfFx(OpticalProperties op, double fx); + /// /// Determines reflectance at spatial frequency fx /// @@ -413,9 +500,8 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// spatial frequency (1/mm) /// Reflectance at spatial frequency fx double ROfFx(OpticalProperties op, double fx); - #endregion - #region double ROfFxAndTime(OpticalProperties op, double fx, double time); + /// /// Determines reflectance at spatial frequency fx and time /// @@ -424,9 +510,8 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// time (ns) /// Reflectance at spatial frequency fx and time double ROfFxAndTime(OpticalProperties op, double fx, double time); - #endregion - #region double ROfFxAndFt(OpticalProperties op, double fx, double ft); + /// /// Determines reflectance at spatial frequency fx and modulation frequency ft @@ -436,63 +521,61 @@ IEnumerable ROfFxAndTime(IEnumerable regions, /// modulation frequency (GHz) /// Reflectance at spatial frequency fx and modulation frequency ft Complex ROfFxAndFt(OpticalProperties op, double fx, double ft); - #endregion - // The following methods are designed to return values based on iteration - // with the leftmost IEnumerable