VirtualPhotonics / Vts.Gui.Wpf

WPF Application using the Vts library
Other
3 stars 0 forks source link

Inverse Solver Panel - Crashes #23

Closed ccampb19 closed 1 year ago

ccampb19 commented 5 years ago

Version: Wpf Application 2.4 on Windows 7

To reproduce: -Inverse Solver Panel -Check "Use Spectral Panel Inputs" -Select lambda (wavelength) for independent axis -Run Inverse Solver

hayakawa16 commented 5 years ago

Thanks for catching this bug. I stepped through and found the problem. With the inputs you specified, a single rho and multiple wavelengths, the inverse solution sets up by concatenating 36 (the number of wavelengths) R(rho=1mm) forward predictions together. This is the first time a concatenated inverse solution is executed in the code. In setting up for the inverse solution which is constrained, the parameters have upper and lower bounds that need to be specified for the OP fits across all wavelengths. The code did not accommodate the concatenated data and indexed outside of an array.

I have made a fix to the code and the code will not crash now. However, the solution converges to the initial guess. This is because this inverse solution is solving for optical properties (mua, mus') as a function of a single R(rho) prediction across multiple wavelengths. There needs to be the use of a PowerLaw equation to produce the iterated mus' values as a function of wavelength and some sort of spectral function to produce the iterated mua values as a function of wavelength, e.g. chromophore concentrations. This can be done more robustly using the Matlab interop software instead of the GUI. In the vts_solver_demo.m there is a an example of how to run an inverse solution for a single rho, multiple wavelengths to solve for absorber concentrations and the power law coefficients.

Please let me know your comments.

ccampb19 commented 5 years ago

Hi Carole, This makes sense. I was thinking it would take the scattering curve from the spectral panel, for some reason.