Home > vbmeg > external > iso2mesh > volmap2mesh.m

volmap2mesh

PURPOSE ^

SYNOPSIS ^

function [node,elem,face]=volmap2mesh(img,ix,iy,iz,elemnum,maxvol,thickness,Amat,Bvec)

DESCRIPTION ^

 [node,elem,face]=volmap2mesh(img,ix,iy,iz,thickness,elemnum,maxvol,A,B)

 convert a binary volume to tetrahedral mesh followed by an Affine transform

 author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
 date:   2008/01/12

 input: 
        img, ix,iy,iz, elemnum and  maxvol: see vol2mesh.m
        thickness: scale z-dimension of the mesh to specified thickness, 
                   if thickness==0, scaling is bypassed
        Amat: a 3x3 transformation matrix
        Bvec: a 3x1 vector
        Amat and Bvec maps the image index space to real world coordnate system by
                   [x,y,z]_new=Amat*[x,y,z]_old+Bvec

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [node,elem,face]=volmap2mesh(img,ix,iy,iz,elemnum,maxvol,thickness,Amat,Bvec)
0002 %
0003 % [node,elem,face]=volmap2mesh(img,ix,iy,iz,thickness,elemnum,maxvol,A,B)
0004 %
0005 % convert a binary volume to tetrahedral mesh followed by an Affine transform
0006 %
0007 % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
0008 % date:   2008/01/12
0009 %
0010 % input:
0011 %        img, ix,iy,iz, elemnum and  maxvol: see vol2mesh.m
0012 %        thickness: scale z-dimension of the mesh to specified thickness,
0013 %                   if thickness==0, scaling is bypassed
0014 %        Amat: a 3x3 transformation matrix
0015 %        Bvec: a 3x1 vector
0016 %        Amat and Bvec maps the image index space to real world coordnate system by
0017 %                   [x,y,z]_new=Amat*[x,y,z]_old+Bvec
0018 %
0019 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0020 %
0021 
0022 [node,elem,face]=vol2mesh(img,ix,iy,iz,elemnum,maxvol);
0023 
0024 node(:,1:3)=(Amat*node(:,1:3)'+repmat(Bvec(:),1,size(node,1)))';
0025 
0026 if(thickness)
0027     zmin=min(node(:,3));
0028     zmax=max(node(:,3));
0029     node(:,3)=(node(:,3)-zmin)/(zmax-zmin)*thickness;
0030 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005