Skip to content

Commit

Permalink
Minor fixes in the implementation of classical beamforming processsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjarosik committed Nov 14, 2021
1 parent df28f6e commit cd82c6b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions api/python/arrus/utils/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def prepare(self, const_metadata: arrus.metadata.ConstMetadata):
# - multiple different aperture positions
elif len(tx_centers) > 1 and len(tx_angles) == 1:
self.process = self._process_linear_array
return self._prepare_phased_array(const_metadata)
return self._prepare_linear_array(const_metadata)
else:
raise ValueError("The given combination of TX/RX parameters is "
"not supported by ScanConversion")
Expand All @@ -1118,16 +1118,14 @@ def _prepare_linear_array(self, const_metadata: arrus.metadata.ConstMetadata):
raise ValueError("Even number of probe elements is required.")
pitch = probe.pitch
data_desc = const_metadata.data_description
if seq.speed_of_sound is not None:
c = seq.speed_of_sound
else:
c = medium.speed_of_sound
tx_center_diff = set(np.diff(tx_aperture_center_element))
if len(tx_center_diff) != 1:
c = _get_speed_of_sound(const_metadata.context)
tx_center_diff = np.diff(tx_aperture_center_element)
# Check if tx aperture centers are evenly spaced.
if not np.allclose(tx_center_diff, [tx_center_diff[0]]*len(tx_center_diff)):
raise ValueError("Transmits should be done by consecutive "
"center elements (got tx center elements: "
f"{tx_aperture_center_element}")
tx_center_diff = next(iter(tx_center_diff))
tx_center_diff = tx_center_diff[0]
# Determine input grid.
input_x_grid_diff = tx_center_diff*pitch
input_x_grid_origin = tx_aperture_center_element[0]-(n_elements-1)/2*pitch
Expand Down Expand Up @@ -1195,7 +1193,8 @@ def _process_convex(self, data):
self.interpolator = scipy.interpolate.RegularGridInterpolator(
(self.radGridIn, self.azimuthGridIn), data, method="linear",
bounds_error=False, fill_value=0)
return self.interpolator(self.dst_points).reshape(self.dst_shape)
result = self.interpolator(self.dst_points).reshape(self.dst_shape)
return self.num_pkg.asarray(result).astype(np.float32)

def _prepare_phased_array(self, const_metadata: arrus.metadata.ConstMetadata):
probe = const_metadata.context.device.probe.model
Expand Down

0 comments on commit cd82c6b

Please sign in to comment.