Skip to content

Commit a02d0dd

Browse files
committed
minor change to avoid duplicate patches in some cases
thanks to @wenxuanliang
1 parent 9e524e2 commit a02d0dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utilities/memmap/construct_patches.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@
2828

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

31-
x_start = 1:siz(1)-overlap(1):sizY(1);
31+
x_start = 1:siz(1)-overlap(1):sizY(1)-overlap(1);
3232
x_end = min(x_start + siz(1) - 1,sizY(1));
3333
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)))
3434
x_start(end) = [];
3535
x_end(end-1) = [];
3636
end
3737

38-
y_start = 1:siz(2)-overlap(2):sizY(2);
38+
y_start = 1:siz(2)-overlap(2):sizY(2)-overlap(2);
3939
y_end = min(y_start + siz(2) - 1,sizY(2));
4040
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)))
4141
y_start(end) = [];
4242
y_end(end-1) = [];
4343
end
4444

4545
if dimY == 3
46-
z_start = 1:siz(3)-overlap(3):sizY(3);
46+
z_start = 1:siz(3)-overlap(3):sizY(3)-overlap(3);
4747
z_end = min(z_start + siz(3) - 1,sizY(3));
4848
if z_end(end) - z_start(end) + 1 < min_size(3)
4949
z_start(end) = [];

0 commit comments

Comments
 (0)