Skip to content

Commit

Permalink
Merge pull request #45 from thorstone25/dev
Browse files Browse the repository at this point in the history
v1.2.2 Changes
  • Loading branch information
thorstone25 authored Oct 25, 2024
2 parents e787031 + d29363b commit b5ffab1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ChannelData.m
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
% get relevant receive info
b = kwargs.buffer(i);
Rx = Receive((b == [Receive.bufnum])); % filter by buffer and frame
if any(kwargs.frames), Rx = Rx(ismember([Receive.framenum], kwargs.frames)); end
if any(kwargs.frames), Rx = Rx(ismember([Rx.framenum], kwargs.frames)); end
if isempty(Rx)
warning("No data found for buffer " + kwargs.buffer(i) + ".");
[smode(i), fmod(i), chd(i)] = deal("N/A", nan, ChannelData('order','TMNF'));
Expand Down Expand Up @@ -1472,7 +1472,7 @@
% implicitly broadcasted: we can use ind2sub to recover it's
% sizing
ix = cell([numel(fdims), 1]); % indices of the frame for the data
[ix{:}] = ind2sub(dsz, gather(m)); % get cell array of indices
[ix{:}] = ind2sub([dsz 1], gather(m)); % get cell array of indices
it = gather(min([ix{:}], tsz)); % restrict to size of chd.time
ix = cellfun(@gather, ix, 'UniformOutput', false); % enforce on CPU

Expand Down
28 changes: 23 additions & 5 deletions src/Sequence.m
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,11 @@
% used by QUPS and Verasonics. If the delays cannot be
% validated, t0 will be NaN.
%
% [...] = Sequence.Verasonics(..., 'tol', tol) sets the numeric
% threshold for verifying the parsed Verasonics delays are
% equivalent to the delays used by QUPS. The default is 1e-16.
% [...] = Sequence.Verasonics(..., 'tol', [ttol atol]) sets the
% numeric thresholds for verifying the parsed Verasonics delays
% and apodization weights are equivalent to the delays and
% apodization weights used by QUPS. The default is atol = 1e-9
% and ttol = 4e-9s = 4ns = 1 / (250MHz).
%
% [...] = Sequence.Verasonics(..., 'c0', c0) sets the sound
% speed c0 in m/s. This should match the value of the Versonics
Expand Down Expand Up @@ -659,7 +661,7 @@
Trans (1,1) struct
TW struct {mustBeScalarOrEmpty} = struct.empty
kwargs.c0 (1,1) {mustBeNumeric, mustBePositive, mustBeFloat} = 1540
kwargs.tol (1,2) {mustBeNumeric, mustBePositive, mustBeFloat} = 1e-16
kwargs.tol (1,2) {mustBeNumeric, mustBePositive, mustBeFloat} = [1/250e6 1e-9]
kwargs.aperture (:,:) {mustBeNumeric, mustBeInteger, mustBePositive}
kwargs.xdc Transducer {mustBeScalarOrEmpty} = TransducerArray.empty
end
Expand Down Expand Up @@ -757,12 +759,28 @@
1 .* sin(ang(:,2)), ...
cos(ang(:,1)) .* cos(ang(:,2)), ...
]; % focal points

if all(rf > 0), styp = "FC"; % focused
elseif all(rf < 0), styp = "DV"; % diverging
else, styp = "VS"; % unclear
warning(wid, wmsg); % VS ambiguity warning
end
seq = Sequence("type",styp, "focus", lambda * pf.');

R = 0; if isa(xdc, "TransducerConvex"), R = Trans.radius; end % radius
apx = [0 0 -R]; % apex / origin
dsta = vecnorm(pog - apx,2,2); % distance to apex

if numel(uniquetol(dsta)) <= numel(uniquetol(rf)) % radial??
tha = atan2(pog(:,1) - apx(1), pog(:,3) - apx(3)); % angle w.r.t. apex
tha = tha .* (rf > 0); % ... weird inconsistency ...
seq = SequenceRadial("type", styp ...
, "apex" , apx * lambda ...
, "angles", rad2deg(tha + ang(:,1)) ...
, "ranges", (R + rf) * lambda ...
);
else
seq = Sequence("type",styp, "focus", lambda * pf.');
end

else
warning( ...
Expand Down
2 changes: 1 addition & 1 deletion utils/isalmostn.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

ntf = isnan(a) & isnan(b);
vtf = (a - b) < tol;
vtf = abs(a - b) < tol;
ttf = ntf | vtf;
tf = all(ttf(:));

0 comments on commit b5ffab1

Please sign in to comment.