Closed ebrahimebrahim closed 3 weeks ago
When we port over calc_solution
we will want to stack simulation outputs over foci.
In the initial attempt in SlicerOpenLIFU (linked above) you can see that it was done by List[PlanFocus]
where a PlanFocus
contained a simulation output xarray. We will get away from this, because of the fix introduced in #127 .
After the fix in #127 here is a way to stack multiple simulation outputs into the correct sort of xarray dataset.
combined_dataset = xarray.concat(
[
sim.assign_coords(focal_point_index=i)
for i,sim in enumerate(sims)
],
dim='focal_point_index',
)
assuming sims
is a list of individual xarray datasets (one for each focal point and ordered in the same order as the list of focal points) that are output of openlifu.sim.run_similation
.
In #104 the focus was on porting over the solution analysis function.
In this issue we are indicating that we also need
calc_solution
to act as a simulation runner. Note thatPlan
in matlab becomesProtocol
in openlifu-python, and also note that there was an initial attempt to do something similar tocalc_solution
here in SlicerOpenLIFU.scale_solution
aspect which uses part of the solution analysis to rescale the solution andPulse
. This is the criticial part that we need for a minimal workflow to be viable: to determine the amplitude of pulseDepends on #104 Would be nice to have #125 done before starting on this