Skip to content

Commit

Permalink
[bug] fix volgrow and volshrink, flip mask for convn, fix laplacefill
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Dec 23, 2024
1 parent 9caffba commit 4f19094
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions laplacefill.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@
end

if (nargin > 2)
mysolver = str2fun(solver);
mysolver = str2func(solver);
[newvol, flag] = mysolver(Amat, b, tol, maxiter, varargin{:});
else
[newvol, flag] = bicgstab(Amat, b, tol, maxiter, varargin{:});
end

if (flag)
newvol = gmres(Amat, b, 100, tol, maxiter, varargin{:});
newvol = gmres(Amat, b, 28, tol, maxiter, varargin{:});
end

newvol = reshape(full(newvol), size(vol));

if (isempty(seedidx))
newvol = ~newvol;
newvol = ~(newvol > tol);
end
1 change: 1 addition & 0 deletions volgrow.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
end
end

mask = rot90(mask, 2);
newvol = vol;

for i = 1:layer
Expand Down
21 changes: 14 additions & 7 deletions volshrink.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@
mask = [0 1 0; 1 1 1; 0 1 0];
end
end

mask = rot90(mask, 2);
totalmask = sum(mask(:));
newvol = vol;

for i = 1:layer
newvol = (convn(logical(newvol), logical(mask), 'same') == totalmask);
newvol = ones(size(vol) + 2);
if (ndims(vol) == 3)
newvol(2:end - 1, 2:end - 1, 2:end - 1) = (vol ~= 0);
for i = 1:layer
newvol(2:end - 1, 2:end - 1, 2:end - 1) = (convn(logical(newvol), logical(mask), 'valid') == totalmask);
end
newvol = double(newvol(2:end - 1, 2:end - 1, 2:end - 1));
else
newvol(2:end - 1, 2:end - 1) = (vol ~= 0);
for i = 1:layer
newvol(2:end - 1, 2:end - 1) = (convn(logical(newvol), logical(mask), 'valid') == totalmask);
end
newvol = double(newvol(2:end - 1, 2:end - 1));
end

newvol = double(newvol);

0 comments on commit 4f19094

Please sign in to comment.