openlifu.virtual_fit.run_virtual_fit

openlifu.virtual_fit.run_virtual_fit(units: str, target_RAS: Sequence[float], standoff_transform: ndarray, options: VirtualFitOptions, volume_array: ndarray | None = None, volume_affine_RAS: ndarray | None = None, skin_mesh: vtkPolyData | None = None, include_debug_info: bool = False, progress_callback: Callable[[int, str], None] | None = None) List[ndarray] | Tuple[List[ndarray], VirtualFitDebugInfo][source]

Run patient-specific “virtual fitting” algorithm, suggesting a series of candidate transducer transforms for optimal sonicaiton of a given target.

Provide either a volume_array and volume_affine_RAS, or a skin_mesh.

Parameters:
  • units – The spatial units of the RAS space into which volume_affine_RAS maps

  • target_RAS – A 3D point, in the coordinates and units of volume_affine_RAS (the units argument)

  • standoff_transform – See the documentation of create_standoff_transform or Transducer.standoff_transform for the meaning of this. Here it should be provided in the units units. The method Transducer.get_standoff_transform_in_units is useful for getting this.

  • options – Virtual fitting algorithm configuration. See the VirtualFitOptions documentation.

  • volume_array – A 3D volume MRI

  • volume_affine_RAS – A 4x4 affine transform that maps volume_array into RAS space with certain units

  • skin_mesh – Optional pre-computed closed surface mesh. If provided, volume_array and volume_affine_RAS can be omitted. The provided skin mesh should be in RAS space, with units being the provided units arg. The function compute_skin_mesh_from_volume can be used to pre-compute a skin mesh.

  • include_debug_info – Whether to include debugging info in the return value. Disabled by default because some of the debugging info takes some time to compute.

  • progress_callback – An optional function that will be called to report progress. The function should accept two arguments: an integer progress value from 0 to 100 followed by a string message describing the step currently being worked on.

Returns: A list of transducer transform candidates sorted starting from the best-scoring one. The transforms map transducer space

into LPS space, and they are in the same units as the RAS space of volume_affine_RAS (aka the units argument).