@@ -109,17 +109,9 @@ def virtual_fit( # pylint: disable=E1121
109109 standoff_transform : np .ndarray ,
110110 volume_array : np .ndarray ,
111111 volume_affine_RAS : np .ndarray ,
112+ units : str ,
112113 target_RAS : Sequence [float ],
113- pitch_range : float ,
114- pitch_step : float ,
115- yaw_range : float ,
116- yaw_step : float ,
117- transducer_steering_center_distance :float ,
118- steering_limits :Tuple [Tuple [float ,float ],Tuple [float ,float ],Tuple [float ,float ]],
119- planefit_dyaw_extent = 15 ,
120- planefit_dyaw_step = 3 ,
121- planefit_dpitch_extent = 15 ,
122- planefit_dpitch_step = 3 ,
114+ options : VirtualFitOptions ,
123115) -> List [np .ndarray ]:
124116 """Run patient-specific "virtual fitting" algorithm, suggesting a series of candidate transducer
125117 transforms for optimal sonicaiton of a given target.
@@ -128,29 +120,27 @@ def virtual_fit( # pylint: disable=E1121
128120 standoff_transform: See `create_standoff_transform` documentation for the meaning of this
129121 volume_array: A 3D volume MRI
130122 volume_affine_RAS: A 4x4 affine transform that maps `volume_array` into RAS space with certain units
131- target_RAS: A 3D point, in the coordinates and units of `volume_affine_RAS`
132- pitch_range:
133- pitch_step: Pitch step size when forming the transducer fitting search grid, in degrees
134- yaw_range: Range of yaws to include in the transducer fitting search grid, in degrees
135- yaw_step: Yaw step size when forming the transducer fitting search grid, in degrees
136- transducer_steering_center_distance: Distance from the transducer origin axially to the center of the steering zone,
137- in the units of `volume_affine_RAS`.
138- steering_limits: Left and right extents of the steering zone in the lateral, elevational, and then axial directions,
139- measured from the transducer steering center.
140- planefit_dyaw_extent: Left and right extents of the point grid to be used for plane fitting along the local yaw axes,
141- in spatial units of `volume_affine_RAS`. The plane fitting point grid will be twice this size, since this is left
142- and right extents. (Note that this has units of length, not angle!)
143- planefit_dyaw_step: Local yaw axis step size to use when constructing plane fitting grids. In spatial units of `volume_affine_RAS`.
144- planefit_dpitch_extent: Left and right extents of the point grid to be used for plane fitting along the local pitch axes,
145- in spatial units of `volume_affine_RAS`. The plane fitting point grid will be twice this size, since this is left
146- and right extents.
147- planefit_dpitch_step: Local pitch axis step size to use when constructing plane fitting grids.
148- In spatial units of `volume_affine_RAS`.
123+ units: The spatial units of the RAS space into which volume_affine_RAS maps
124+ target_RAS: A 3D point, in the coordinates and units of `volume_affine_RAS` (the `units` argument)
125+ options : Virtual fitting algorithm configuration. See the `VirtualFitOptions` documentation.
149126
150127 Returns: A list of transducer transform candidates sorted starting from the best-scoring one. The transforms map transducer space
151- into LPS space, and they are in the same units as the RAS space of `volume_affine_RAS`.
128+ into LPS space, and they are in the same units as the RAS space of `volume_affine_RAS` (aka the `units` argument) .
152129 """
153130
131+ # Express all virtual fit options in the units of volume_affine_RAS, i.e. the physical space of the volume
132+ options = options .to_units (units )
133+ pitch_range = options .pitch_range
134+ pitch_step = options .pitch_step
135+ yaw_range = options .yaw_range
136+ yaw_step = options .yaw_step
137+ transducer_steering_center_distance = options .transducer_steering_center_distance
138+ steering_limits = options .steering_limits
139+ planefit_dyaw_extent = options .planefit_dyaw_extent
140+ planefit_dyaw_step = options .planefit_dyaw_step
141+ planefit_dpitch_extent = options .planefit_dpitch_extent
142+ planefit_dpitch_step = options .planefit_dpitch_step
143+
154144 log .info ("Computing foreground mask..." )
155145 foreground_mask_array = compute_foreground_mask (volume_array )
156146 foreground_mask_vtk_image = vtk_img_from_array_and_affine (foreground_mask_array , volume_affine_RAS )
0 commit comments