Skip to content

Commit

Permalink
minor change to avoid duplicate patches in some cases
Browse files Browse the repository at this point in the history
thanks to @wenxuanliang
  • Loading branch information
epnev committed Aug 20, 2019
1 parent 9e524e2 commit a02d0dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utilities/memmap/construct_patches.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@

if any(siz<=overlap); error('Size of patch must be greater than the amount of overlap'); end

x_start = 1:siz(1)-overlap(1):sizY(1);
x_start = 1:siz(1)-overlap(1):sizY(1)-overlap(1);
x_end = min(x_start + siz(1) - 1,sizY(1));
if (x_end(end) - x_start(end) + 1 < min_size(1)) || (length(x_end) > 1 && (x_end(end) - x_end(end-1) < min_size(1)))
x_start(end) = [];
x_end(end-1) = [];
end

y_start = 1:siz(2)-overlap(2):sizY(2);
y_start = 1:siz(2)-overlap(2):sizY(2)-overlap(2);
y_end = min(y_start + siz(2) - 1,sizY(2));
if (y_end(end) - y_start(end) + 1 < min_size(2)) || (length(y_end) > 1 && (y_end(end) - y_end(end-1) < min_size(2)))
y_start(end) = [];
y_end(end-1) = [];
end

if dimY == 3
z_start = 1:siz(3)-overlap(3):sizY(3);
z_start = 1:siz(3)-overlap(3):sizY(3)-overlap(3);
z_end = min(z_start + siz(3) - 1,sizY(3));
if z_end(end) - z_start(end) + 1 < min_size(3)
z_start(end) = [];
Expand Down

0 comments on commit a02d0dd

Please sign in to comment.