How to calculate 3d patch from 3d data which have 512 clices?

1 次查看(过去 30 天)
Hello I have a problem to calculate 3d patches(blocks) from my 3d dataset. I already know that how to calculate 2d patches like 20 by 20 patch from 2d slice. I want to know, how to make 3d patches from 3d data. like (20 by 20 by 5). If someone have a solution in matlab please share. Thanks

回答(1 个)

Walter Roberson
Walter Roberson 2017-7-26
"patch('Faces',F,'Vertices',V) creates one or more polygons where V specifies vertex values and F defines which vertices to connect. Specifying only unique vertices and their connection matrix can reduce the size of the data when there are many polygons. Specify one vertex per row in V. To create one polygon, specify F as a vector. To create multiple polygons, specify F as a matrix with one row per polygon. Each face does not have to have the same number of vertices. To specify different numbers of vertices, pad F with NaN values."
In my experience, the much harder part is figuring out what to connect between layers. It is not uncommon to have a larger object slice on one layer than on the next, and larger object slices have more points around the perimeter, so you might have more perimeter points on one slice than on the next slice.
  5 个评论
Walter Roberson
Walter Roberson 2017-8-3
Note by the way that
patches{i,j} = Isub(:,xIdxs(j):xIdxs(j+1)-1);
patches {i, j} = reshape(patches{i,j},[1, x_axis_size * y_axes_size]);
patches{i, j} = (patches{i, j})';
can be expressed more compactly as just
patches{i,j} = reshape( Isub(:,xIdxs(j):xIdxs(j+1)-1), [], 1);
Walter Roberson
Walter Roberson 2017-8-3
xsize = 19; ysize = 19; zsize = 4;
[nrows, ncols, npanes] = size(I);
if mod(nrows,ysize) ~= 0 || mod(ncol,xsize) ~= 0 || mod(npanes, zsize) ~= 0
error('Image size [%d, %d, %d] is not evenly divisible into blocks of size [%d, %d, %d]', nrows, ncols, npanes, ysize, xsize, zsize );
end
patches = mat2cell( I, ysize * ones(1, nrows/ysize), xsize * ones(1, ncol/xsize), zsize * ones(1, npanes / zsize) );
patches = reshape( cellfun(@(V) reshape(V,[],1), patches, 'Uniform', 0), 1, [] );

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Polygons 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by