Home > cellorganizer > utilities > getMeshPoints.m

getMeshPoints

PURPOSE ^

GETMESHPOINTS This function gets mesh points given an image

SYNOPSIS ^

function FV = getMeshPoints(image)

DESCRIPTION ^

GETMESHPOINTS This function gets mesh points given an image

Inputs: 
image = a 2D or 3D image 

Outputs:
FV = a struct containing the vertices etc for the mesh

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function FV = getMeshPoints(image)
0002 %GETMESHPOINTS This function gets mesh points given an image
0003 %
0004 %Inputs:
0005 %image = a 2D or 3D image
0006 %
0007 %Outputs:
0008 %FV = a struct containing the vertices etc for the mesh
0009 %
0010 
0011 %Author: Devin Sullivan September 19,2013
0012 % Copyright (C) 2012 Murphy Lab
0013 % Lane Center for Computational Biology
0014 % School of Computer Science
0015 % Carnegie Mellon University
0016 %
0017 % This program is free software; you can redistribute it and/or modify
0018 % it under the terms of the GNU General Public License as published
0019 % by the Free Software Foundation; either version 2 of the License,
0020 % or (at your option) any later version.
0021 %
0022 % This program is distributed in the hope that it will be useful, but
0023 % WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025 % General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with this program; if not, write to the Free Software
0029 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0030 % 02110-1301, USA.
0031 
0032 %Smooth the image a little, should probably not hard code 11.
0033     D = smooth3(squeeze(image),'gaussian',[11,11,11]);
0034     
0035     [x,y,z] = meshgrid(1:size(image,2),1:size(image,1),1:size(image,3));
0036     x = x-mean(x(:));
0037     y = y-mean(y(:));
0038     z = z-mean(z(:));
0039     v = D;
0040     
0041     %make iso-surface (Mesh) of skin
0042     %should not hard code this.
0043     patchsample = 0.05;
0044     
0045     FV = isosurface(D,0.5);
0046     % FV.vertices = FV.vertices-repmat(shiftvector_flag,size(FV.vertices,1),1);
0047     FV = reducepatch(FV,patchsample);

Generated on Sun 29-Sep-2013 18:44:06 by m2html © 2005