Skip to content

Commit

Permalink
add another dimension case to reassemble_hemispheres
Browse files Browse the repository at this point in the history
  • Loading branch information
henneysq committed May 23, 2024
1 parent 594bbdc commit 539c071
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions util/reassemble_hemispheres.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,41 @@
reassembled_pos(idrd) = sources_right_h.pos(ids,d+3);
end
reassembled_pos(idld) = sources_left_h.pos(ids,d);
% figure;plot(reassembled_pos,'LineWidth',2);hold on; plot(reference.pos(:,d),'r--','LineWidth',2)

assert (all(reassembled_pos == reference.pos(:,d)))
end
catch try
ids = [];
idrd = [];
idld = [];

stride_s = dim(1)*dim(3);
stride_d = dim(1)*dim(2)*2;
consec = dim(1);
for z = 1:dim(3)
for y = 1:dim(2)
ids = [ids (1:consec)+(y-1)*stride_s+(z-1)*consec];
idrd = [idrd (1:consec)+(y-1)*consec+(z-1)*stride_d];
idld = [idld (1:consec)+(y-1)*consec+(z-.5)*stride_d];
end
end

for d = 1:3
reassembled_pos = zeros(prod(dim)*2,1);
if d == 2
flipped_right = flip(sources_right_h.pos);
reassembled_pos(idrd) = flipped_right(ids,d+3);
else
reassembled_pos(idrd) = sources_right_h.pos(ids,d+3);
end
reassembled_pos(idld) = sources_left_h.pos(ids,d);
figure;plot(reassembled_pos,'LineWidth',2);hold on; plot(reference.pos(:,d),'r--','LineWidth',2)

assert (all(reassembled_pos == reference.pos(:,d)))
end


catch % the above assertion - could be more specific
catch % the above assertion - should be more specific
ids = [];
idrd = [];
idld = [];
Expand All @@ -65,7 +95,7 @@
end
end

% figure;plot(reassembled_pos,'LineWidth',2);hold on; plot(ref_vals,'r--','LineWidth',2)
% figure;plot(reassembled_pos,'LineWidth',2);hold on; plot(reference.pos(:,d),'r--','LineWidth',2)

par_fields = strsplit(parameter, '.');
for n = 1:numel(par_fields)
Expand Down

0 comments on commit 539c071

Please sign in to comment.