-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrid2volSize.m
30 lines (27 loc) · 1.16 KB
/
grid2volSize.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function volSize = grid2volSize(gridSize, patchSize, varargin)
% NPATCHES2VOLSIZE volume size from number of patches
% volSize = grid2volSize(gridSize, patchSize) compute the size of a volume of patches given the
% patch size and number of patches. This assumes sliding patches (i.e. patch overlap of
% patchSize - 1)
%
% volSize = grid2volSize(gridSize, patchSize, patchOverlap) allows for the specification of
% amount of patch overlap.
%
% volSize = grid2volSize(gridSize, patchSize, kind) allows for pre-specified kind of overlaps:
% like 'sliding', 'discrete', or 'half'. see patchlib.overlapkind for details of the supported
% overlap kinds. If not specified (i.e. function has only 2 inputs), default overlap is
% 'sliding'.
%
% See Also: gridsize, grid, overlapkind
%
% Contact: {adalca,klbouman}@csail.mit.edu
narginchk(2, 3)
if nargin == 2
patchOverlap = patchSize - 1;
else
patchOverlap = varargin{1};
if ischar(patchOverlap)
patchOverlap = patchlib.overlapkind(patchOverlap, patchSize);
end
end
volSize = (patchSize - patchOverlap) .* gridSize + patchOverlap;