# doc-cache created by Octave 6.2.0
# name: cache
# type: cell
# rows: 3
# columns: 162
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
advancefront


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 671

 [elist,nextfront]=advancefront(edges,loop,elen)

 advance an edge-front on an oriented surface to the next separated by
 one-element width

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/02/09

 input:
      edges: edge list of an oriented surface mesh, must be in CCW order
      loop: a 2-column array, specifying a closed loop in CCW order
      elen: node number inside each element, if ignored, elen is set to 3

 output:
      elist: list of triangles that is enclosed between the two
             edge-fronts
      nextfront: a new edge loop list representing the next edge-front

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49

 [elist,nextfront]=advancefront(edges,loop,elen)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
affinemap


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 704
  [A,b]=affinemap(pfrom,pto)

  calculate an affine transform (A matrix and b vector) to map n
  vertices from one space to the other using least square solutions

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      pfrom: nx3 matrix, each row is a 3d point in original space
      pto: nx3 matrix, each row is a 3d point in the mapped space

 outputs:
      A: 3x3 matrix, the calculated affine A matrix
      b: 3x1 vector, the calculated affine b vector

 the solution will satisfy the following equation: A*pfrom'+b=pto

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
  [A,b]=affinemap(pfrom,pto)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
barydualmesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 830

 [newnode,newelem]=barydualmesh(node,elem)

 generate barycentric dual-mesh by connecting edge, face and elem centers

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node: list of input mesh nodes
    elem: list of input mesh elements (each row are indices of nodes of each element)
    flag: if is 'cell', output newelem as cell arrays (each has 1x4 nodes)

 output:
    newnode: all new nodes in the barycentric dual-mesh (made of edge/face/elem centers)
    newelem: the indices of the face nodes for each original tet element

 example:
    [node,elem]=meshgrid6([0 60],[0 60],[0 60]);
    [newnode,newelem]=barydualmesh(node,elem,'cell');
    plotmesh(newnode,newelem);
    hold on; plotmesh(node,[],elem,'facecolor','none','edgecolor','b')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43

 [newnode,newelem]=barydualmesh(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
bbxflatsegment


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 564

 seg=bbxflatsegment(node,loop)

 decompose edge loops into flat segments along the x/y/z 
 planes of the bounding box

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/04/08

 input:   
    node:  x,y,z coordinates of each node of the mesh
    loop:  input, a single vector separated by NaN, each segment
             is a close-polygon consisted by node IDs 
 output:
    seg:   output, a single vector separated by NaN, each segment
             is a close-polygon on x/y/z plane 

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31

 seg=bbxflatsegment(node,loop)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
binsurface


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 853

 [node,elem]=binsurface(img,nface)

 fast isosurface extraction from 3D binary images

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   img:  a 3D binary image
   nface: nface=3 or ignored - for triangular faces, 
          nface=4 - square faces
          nface=0 - return a boundary mask image via node

 output:
   elem: integer array with dimensions of NE x nface, each row represents
         a surface mesh face element 
   node: node coordinates, 3 columns for x, y and z respectively

 the outputs of this subroutine can be easily plotted using 
     patch('Vertices',node,'faces',elem,'FaceVertexCData',node(:,3),
           'FaceColor','interp');
 if the surface mesh has triangular faces, one can plot it with
     trisurf(elem,node(:,1),node(:,2),node(:,3))

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35

 [node,elem]=binsurface(img,nface)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
bwislands


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 427

 islands=bwislands(img)

 return the indices of non-zero elements in a 2D or 3D image
 grouped by connected regions in a cell array

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 img: a 2D or 3D array
 output:
	 islands: a cell array, each cell records the indices 
		  of the non-zero elements in img for a connected 
		  region (or an island)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24

 islands=bwislands(img)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
cgals2m


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1225

 [node,elem,face]=cgals2m(v,f,opt,maxvol)

 wrapper for CGAL 3D mesher (CGAL 3.5 and newer)
 convert a triangular surface to tetrahedral mesh

 http://www.cgal.org/Manual/3.5/doc_html/cgal_manual/Mesh_3/Chapter_main.html

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 v: the node coordinate list of a surface mesh (nn x 3)
	 f: the face element list of a surface mesh (be x 3)
	 opt: parameters for CGAL mesher, if opt is a structure, then
	     opt.radbound: defines the maximum surface element size
	     opt.angbound: defines the miminum angle of a surface triangle
	     opt.distbound: defines the maximum distance between the 
		 center of the surface bounding circle and center of the 
		 element bounding sphere
	     opt.reratio:  maximum radius-edge ratio
	     if opt is a scalar, it only specifies radbound.
	 maxvol: target maximum tetrahedral elem volume

 output:
	 node: output, node coordinates of the tetrahedral mesh
	 elem: output, element list of the tetrahedral mesh, the last 
	      column is the region id
	 face: output, mesh surface element list of the tetrahedral mesh
	      the last column denotes the boundary ID

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 [node,elem,face]=cgals2m(v,f,opt,maxvol)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
cgalv2m


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1413

 [node,elem,face]=cgalv2m(vol,opt,maxvol)

 wrapper for CGAL 3D mesher (CGAL 3.5 or up)
 convert a binary (or multi-valued) volume to tetrahedral mesh

 http://www.cgal.org/Manual/3.5/doc_html/cgal_manual/Mesh_3/Chapter_main.html

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 vol: a volumetric binary image
	 ix,iy,iz: subvolume selection indices in x,y,z directions
	 opt: parameters for CGAL mesher, if opt is a structure, then
	     opt.radbound: defines the maximum surface element size
	     opt.angbound: defines the miminum angle of a surface triangle
	     opt.distbound: defines the maximum distance between the 
		 center of the surface bounding circle and center of the 
		 element bounding sphere
	     opt.reratio:  maximum radius-edge ratio
	     if opt is a scalar, it only specifies radbound.
	 maxvol: target maximum tetrahedral elem volume

 output:
	 node: output, node coordinates of the tetrahedral mesh
	 elem: output, element list of the tetrahedral mesh, the last 
	      column is the region id
	 face: output, mesh surface element list of the tetrahedral mesh
	      the last column denotes the boundary ID
	      note: each triangle will appear twice in the face list with each
		    one attaches to each side of the interface. one can remove
		    the redundant triangles by unique(face(:,1:3),'rows')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 [node,elem,face]=cgalv2m(vol,opt,maxvol)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
closestnode


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 95

 [idx, dist]=closestnode(node,p)

 Find the closest point in a node list and return its index



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33

 [idx, dist]=closestnode(node,p)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
deislands2d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 397

 cleanimg=deislands2d(img,sizelim)

 remove isolated islands on a 2D image below speicified size limit

 author: Qianqian Fang (q.fang at neu.edu)

 input:
 	img: a 2D binary image
 	sizelim: a integer as the maximum pixel size of a isolated region

 output:
 	cleanimg: a binary image after removing islands below sizelim

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35

 cleanimg=deislands2d(img,sizelim)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
deislands3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 382

 cleanimg=deislands3d(img,sizelim)

 remove isolated islands for 3D image (for each slice)

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      img: a 3D volumetric image
      sizelim: maximum island size (in pixels) for each x/y/z slice

 output:
      cleanimg: 3D image after removing the islands

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35

 cleanimg=deislands3d(img,sizelim)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
delendelem


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 368

 elem=delendelem(elem,mask)

 delete elements whose nodes are all edge nodes

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/24

 input/output: 
      elem: input/output, surface/volumetric element list
      mask: of length of node number, =0 for internal nodes, =1 for edge nodes

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 elem=delendelem(elem,mask)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
deletemeshfile


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 294

 flag=deletemeshfile(fname)

 delete a given work mesh file under the working directory

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
     fname: specified file name (without path)

 output:
     flag: not used

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 flag=deletemeshfile(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
dist2surf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 844
  [d2surf,cn]=dist2surf(node,nv,p)

  calculate the distances from a point cloud to a surface, and return
  the indices of the closest surface node

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      node: node coordinate of the surface mesh (nn x 3)
      nv: nodal norms (vector) calculated from nodesurfnorm.m
          with dimensions of (size(node,1),3), this can be 
          calcuated from nodesurfnorm.m
      pt: points to be calculated, 3 columns for x,y and z respectively

 outputs:
      d2surf: a vector of length of p, the distances from p(i) to the surface
      cn: a integer vector with the length of p, the indices of the closest surface node

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
  [d2surf,cn]=dist2surf(node,nv,p)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
edgeneighbors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1002

 edgenb=edgeneighbors(t,opt)

 to find neighboring triangular elements in a triangule surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     t: a triangular surface element list, 3 columns of integers
     opt: if opt='general', return the edge neighbors for a general
          triangular surface: each edge can be shared by more than 2
          triangles; if ignored, we assume all triangles are shared by no
          more than 2 triangles.

 output:
     edgenb: if opt is not supplied, edgenb is a size(t,1) by 3 array with
     each element being the triangle ID of the edge neighbor of that
     triangle. For each row, the order of the neighbors is listed as those
     sharing edges [1 2], [2 3] and [3 1] between the triangle nodes.

     when opt='general', edgenb is a cell array with a length of size(t).
     each member of the cell array is a list of edge neighbors (the order 
     is not defined).

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 edgenb=edgeneighbors(t,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
elemfacecenter


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 710

 [newnode,newelem]=elemfacecenter(node,elem)

 generate barycentric dual-mesh face center nodes and indices per element
 very similar to highordertet which finds edge-centers instead of
 face-centers

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node: list of nodes
    elem: list of elements (each row are indices of nodes of each element)

 output:
    newnode: all new face-nodes on the output mesh
    newelem: the indices of the face nodes for each original tet element

    to combine the newnode/newelem with the old mesh, one should use

    elemfull=[elem(:,1:4) newelem+size(node,1)];
    nodefull=[node;newnode];

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45

 [newnode,newelem]=elemfacecenter(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
elemvolume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 467

 vol=elemvolume(node,elem,option)

 calculate the volume for a list of simplexes

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
    node:  node coordinates
    elem:  element table of a mesh
    option: if option='signed', the volume is the raw determinant,
            else, the results will be the absolute values

 output:
    vol:   volume values for all elements

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34

 vol=elemvolume(node,elem,option)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
extractloops


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 605

 loops=extractloops(edges)

 extract individual loop or polyline segment from a collection of edges

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:   
    edges:  two column matrix recording the starting/ending 
             points of all edge segments

 output:
    loops:  output, a single vector separated by NaN, each segment
             is a 3D polyline or loop consisted of node IDs

 example:
    edges=[1 2;2 3;1 4;3 4;7 3;1 9;5 6;6 7;10 9; 8 10;1 8;9 3;11 11;11 12];
    loops=extractloops(edges)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27

 loops=extractloops(edges)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
extrudecurve


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1547

 [node,face,yz0,yz1]=extrudecurve(xy, yz, Nx, Nz, Nextrap, spacing, anchor)
 
 create a triangular surface mesh by swining a 2D spline along another 2D
 spline curve

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      xy: a 2D spline path, along which the surface is extruded, defined
          on the x-y plane
      yz: a 2D spline which will move along the path to form a surface,
          defined on the y-z plane
      Nx: the count of sample points along the extrusion path (xy), if
          ignored, it is 40
      Nz: the count of sample points along the curve to be extruded (yz),
          if ignored, it is 40
      Nextrap: number of points to extrapolate outside of the xy/yz
          curves, 0 if ignored
      spacing: define a spacing scaling factor for spline interpolations,
          1 if ignored
      anchor: the 3D point in the extruded curve plane (yz) that is aligned
          at the nodes long the extrusion path. this point does not have
          to be located on the yz curve; orig = [ox oy oz], if ignored, it
          is set as the point on the interpolated yz with the largested
          y-value
      dotopbottom: a flag, if set to 1, tessellated top and bottom faces
          will be added. default is 0.

 output:
      node: 3D node coordinates for the generated surface mesh
      face: triangular face patches of the generated surface mesh, each
           row represents a triangle denoted by the indices of the 3 nodes

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,face,yz0,yz1]=extrudecurve(xy, yz, Nx, Nz, Nextrap, spacing, anchor)
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
extrudesurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 447

 [node,face]=extrudesurf(no,fc,vec)
 
 create a enclosed surface mesh by extruding an open surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:

 output:
      node: 3D node coordinates for the generated surface mesh
      face: triangular face patches of the generated surface mesh, each
           row represents a triangle denoted by the indices of the 3 nodes

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,face]=extrudesurf(no,fc,vec)
 
 create a enclosed surface mesh by ext...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
faceneighbors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 897

 facenb=faceneighbors(t,opt)

 to find 4 face-neighboring elements of a tetrahedron

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     t: tetrahedron element list, 4 columns of integers
     opt: if opt='surface', return boundary triangle list 
          (should be the same as the face output from v2m)
          if opt='rowmajor', same as 'surface', except the 
          order of the triangles are in the row-major order

          otherwise, return the element list for each element:
          each row contains 4 numbers, representing the element
          indices sharing triangular faces [1 2 3],[1 2 4],[1 3 4]
          and [2 3 4] in order, where 1~4 is the node local index.
          if the index is 0, indicating the face has no neighbor
          (i.e. a boundary face)

 output:
     facenb: see opt

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 facenb=faceneighbors(t,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
fallbackexeext


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 406

 exesuff=fallbackexeext(exesuffix, exename)

 get the fallback external tool extension names for the current platform

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     exesuffix: the output executable suffix from getexeext
     exename: the executable name

 output:
     exesuff: file extension for iso2mesh tool binaries

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44

 exesuff=fallbackexeext(exesuffix, exename)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
fillholes3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 425

 resimg=fillholes3d(img,maxgap)

 close a 3D image with the speicified gap size and then fill the holes

 author: Qianqian Fang, <q.fang at neu.edu>
 
 input:
    img: a 3D binary image
    maxgap: maximum gap size for image closing

 output:
    resimg: the image free of holes

 this function requires the image processing toolbox for matlab/octave

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 resimg=fillholes3d(img,maxgap)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
fillsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 327

 [no,el]=fillsurf(node,face)

 calculate the enclosed volume for a closed surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node:  node coordinates
    face:  surface triangle list

 output:
    vol:   total volume of the enclosed space

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 [no,el]=fillsurf(node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
finddisconnsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 385

 facecell=finddisconnsurf(f)
 
 subroutine to extract disconnected surfaces from a 
 cluster of surfaces
 
 author: Qianqian Fang (q.fang at neu.edu)
 Date: 2008/03/06

 input: 
     f: faces defined by node indices for all surface triangles

 output:
     facecell: separated disconnected surface node indices

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 facecell=finddisconnsurf(f)
 
 subroutine to extract disconnected surfaces ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
flatsegment


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 630

 mask=flatsegment(node,edge)

 decompose edge loops into flat segments alone arbitrary planes of the bounding box

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/04/08

 this code is fragile: it can not handle curves with many co-linear
 nodes near the corner point

 input:   
    node:  x,y,z coordinates of each node of the mesh
    edge:  input, a single vector separated by NaN, each segment
           is a close-polygon consisted by node IDs 

 output:
    mask:  output, a cell, each element is a close-polygon 
           on x/y/z plane 

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 mask=flatsegment(node,edge)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
getexeext


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 275

 exesuff=getexeext()

 get meshing external tool extension names for the current platform

 author: Qianqian Fang, <q.fang at neu.edu>

 output:
     exesuff: file extension for iso2mesh tool binaries

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21

 exesuff=getexeext()



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
getintersecttri


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 489

 eid=getintersecttri(tmppath)

 get the IDs of self-intersecting elements from tetgen
 call this when tetgen complains about self-intersection

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   tmppath: working dir, use mwpath('') in most cases

 output:
   eid: an array of all intersecting surface elements, 
     one can read the corresponding node/elem by
     [no,el]=readoff(mwpath('post_vmesh.off'));

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 eid=getintersecttri(tmppath)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
getoptkey


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 602

 val=getoptkey(key,default,opt)
    or
 val=getoptkey(key,default,'key1',val1,'key2',val2, ...)

 query the value of a key from a structure or a list of key/value pairs

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   key: a string name for the target struct field name
   default: the default value of the key is not found
   opt: a struct object; the field names will be searched to match the 
        key input, opt can be a list of 'keyname'/value pairs

 output:
   val: val=opt.key if found, otherwise val=default

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 val=getoptkey(key,default,opt)
    or
 val=getoptkey(key,default,'key1',val...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
getplanefrom3pt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 363

 [a,b,c,d]=getplanefrom3pt(plane)
 
 define a plane equation ax+by+cz+d=0 from three 3D points

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
    plane: a 3x3 matrix with each row specifying a 3D point (x,y,z)

 output:
    a,b,c,d: the coefficient for plane equation ax+by+cz+d=0

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [a,b,c,d]=getplanefrom3pt(plane)
 
 define a plane equation ax+by+cz+d=0 fr...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
getvarfrom


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 408

 p=getvarfrom(ws,name)

 get variable value by name from specified work-space

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    ws: name of the work-space, for example, 'base'
    name: name string of the variable

 output:
    p: the value of the specified variable, if the variable does not
       exist, return empty array

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23

 p=getvarfrom(ws,name)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
highordertet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 786

 [newnode,newelem]=highordertet(node,elem)

 generate high-order straight-edge tetrahedral mesh from
 the 1st order tetrahedral mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node: list of nodes
    elem: list of elements (each row are indices of nodes of each element)
    order: optional, the order of the generated mesh; if missing, order=2

 output:
    newnode: all new edge-nodes on the output mesh
    newelem: the indices of the edge nodes for each original tet element

    currently, this function only supports order=2
    to combine the newnode/newelem with the old mesh, one should use

    elemfull=[elem(:,1:4) newelem+size(node,1)]; % 10-node element
    nodefull=[node;newnode];

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43

 [newnode,newelem]=highordertet(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
i2m


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 275

 newworkspace=i2m;
  or
 newworkspace=i2m(workspace)

 Shortcut for img2mesh, a GUI for iso2mesh

 author: Qianqian Fang (q.fang at neu.edu)

 input/output: please see details in the help for img2mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53

 newworkspace=i2m;
  or
 newworkspace=i2m(workspace)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
imedge3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 634

 imgdiff=imedge3d(binimg,isdiff)

 Extract the boundary voxels from a binary image
 
 author: Aslak Grinsted <ag at glaciology.net>
 modified by Qianqian Fang <q.fang at neu.edu>

 input: 
   binimg: a 3D binary image
   isdiff: if isdiff=1, output will be all voxels which 
         is different from its neighbors; if isdiff=0 or 
         ignored, output will be the edge voxels of the 
         non-zero regions in binimg

 output:
   imgdiff: a 3D logical array with the same size as binimg
            with 1 for voxels on the boundary and 0 otherwise 
 
 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33

 imgdiff=imedge3d(binimg,isdiff)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
img2mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 747
 
  Format: 
      newworkspace = img2mesh or imgmesh(workspace)

  A GUI for Iso2Mesh for streamlined mesh data processing
  
  Author: Qianqian Fang <q.fang at neu.edu>
  
  Input:
        workspace (optional): a struct containing the below fields
           .graph: a digraph object containing the i2m workspace data
  Output:
        newworkspace (optional): the updated workspace, with the same
        subfields as the input.

   If a user supplys an output variable, the GUI will not return until 
   the user closes the window; if a user does not provide any output,
   the call will return immediately.

   Please find more information at http://iso2mesh.sf.net/
  
 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
 
  Format: 
      newworkspace = img2mesh or imgmesh(workspace)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
innersurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 511

 outface=innersurf(node,face,outface)

 extract the interior triangles (shared by two enclosed compartments) of a complex surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node:  node coordinates
    face:  surface triangle list
    outface: (optional) the exterior triangle list, if not given, will
           be computed using outersurf().

 output:
    inface: the collection of interior triangles of the surface mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38

 outface=innersurf(node,face,outface)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
insurface


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 526

 tf=innersurf(node,face,points)

 test if a set of 3D points is located inside a 3D triangular surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node:  node coordinates
    face:  surface triangle list
    points: a set of 3D points (Nx3 array)

 output:
    tf: a vector with the same length of points, 
        a value of 1 means the point is inside of the surface, and
        a value of 0 means the point is outside of the surface.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 tf=innersurf(node,face,points)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
internalpoint


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 482

 p=internalpoint(v,aloop)

 imperical function to find an internal point
 of a planar polygon

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/04/08

 input:   
    v:     x,y,z coordinates of each node of the mesh
    aloop:  input, a single vector separated by NaN, each segment
             is a close-polygon consisted by node IDs 
 output:
    p:   output, [x y z] of an internal point of aloop

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26

 p=internalpoint(v,aloop)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
iso2meshver


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 629

 [major,minor,patchnum,extra]=iso2meshver
      or
 v=iso2meshver

 get the version number of iso2mesh toolbox

 author: Qianqian Fang, <q.fang at neu.edu>

 output:
    if you ask for a single output:
      v: a string denotes the current version number; the string is 
       typically in the following format: "major.minor.patch-extra"
       where major/minor/patch are typically integers, and extra can
       be an arbitrary string and is optional
    if you ask for 4 outputs:
     [major,minor,patchnum,extra] are each field of the version string

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66

 [major,minor,patchnum,extra]=iso2meshver
      or
 v=iso2meshver



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
latticegrid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1133

 [node,face,centroids]=latticegrid(xrange,yrange,zrange,...)

 generate a 3D lattice

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   xrange, yrange, zrange ...: 1D vectors specifying the range of each
         dimension of the lattice

 output:
   node: the vertices of the 3D lattice
   face: the list of cell faces of the lattice, including both internal
         and external facets. By default, face is in the form of a cell
         array, with each row representing a face. One can use
         cell2mat(face) to convert it to an array
   centroids: the centroids of each lattice cell

 example:
    % generate a 3D lattice
    [node,face,c0]=latticegrid([1 2 4],1:3,1:4);
    plotmesh(node,face)
    
    % mesh the 3D lattice based on the face info
    [no,el]=surf2mesh(node,face,[],[],1,0.01,c0);
    figure; plotmesh(no,el)

    % mesh a 2-layer structure using a simple lattice
    [node,face,c0]=latticegrid([0 10],[0 5],[0 3.5 4]);
    c0(:,4)=[0.01;0.001];
    [no,el]=surf2mesh(node,face,[],[],1,[],c0);
    figure; plotmesh(no,el)

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61

 [node,face,centroids]=latticegrid(xrange,yrange,zrange,...)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
layersurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2127

 face=layersurf(elem, opt)
    or
 [face,labels]=layersurf(elem,'option1',value1,'option2',value2,...)

 process a multi-layered tetrahedral mesh, like a brain mesh, to extract
 the layer surface meshes with one enclosed by another

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    elem: an Nx5 integer array, representing the tetrahedral mesh element
         list. The first 4 columns represent the tetrahedral element node
         indices; the last column represents tissue labels.
    opt: (optional) a struct or pairs of names/values to provide
         additional options; accepted options include
         'order': ['>='] or '=', '<=' . if set to '>=' (default), the 
             outmost layer has the lowest label count; if '<=', innermost 
             is lowest; if '=', surface of each label is extracted
             individually - meaning that inner surfaces will have two
             duplicates
         'innermost': [0] or an array of labels. The labels defined in
             this list will be treated as the innermost regions, and its
             boundary will be extracted using the '==' test (order='=').
             by default; label 0 is assumed to be innermost (i.e. nothing
             is enclosed inside).
         'unique': [0] or 1. if 1, remove duplicated triangles; if 0, keep
             all triangles.
         'occurence': ['first'] or 'last'. if 'first', the unique operator
             keeps a duplicated triangle with the lowest label number; 
             otherwise, a repeated triange keeps the highest label number.

 output:
    vol: a 2-D or 3-D array of the same type/size of the input arrays. The
         label for each voxel is determined by the index to the highest
         value in TPM of the same voxel. If a voxel is a background voxel
         - i.e. zeros for all TPMs, it stays 0
    names: a cell array storing the names of the labels (if input is a
         struct), the first string is the name for label 1, and so on

 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 face=layersurf(elem, opt)
    or
 [face,labels]=layersurf(elem,'option1',va...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
linextriangle


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1061
  [isinside,pt,coord]=linextriangle(p0,p1,plane)

  calculate the intersection of a 3d line (passing two points)
  with a plane (determined by 3 points)

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      p0: a 3d point in form of (x,y,z)
      p1: another 3d point in form of (x,y,z), p0 and p1 determins the line
      plane: a 3x3 matrix, each row is a 3d point in form of (x,y,z)
             this is used to define a plane
 outputs:
      isinside: a boolean variable, 1 for the intersection is within the 
               3d triangle determined by the 3 points in plane; 0 is outside
      pt: the coordinates of the intersection pint
      coord: 1x3 vector, if isinside=1, coord will record the barycentric 
          coordinate for the intersection point within the triangle; 
          otherwise it will be all zeros.

 for degenerated lines or triangles, this will stop

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
  [isinside,pt,coord]=linextriangle(p0,p1,plane)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
m2v


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321

 vol=m2v(node,face,Nxyz)
  or
 vol=m2v(node,face,xi,yi,zi)

 shortcut for mesh2vol, rasterizing a teterahedral mesh to a volume using graphics

 author: Qianqian Fang (q.fang at neu.edu)

 input/output: please see details in the help for mesh2vol

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59

 vol=m2v(node,face,Nxyz)
  or
 vol=m2v(node,face,xi,yi,zi)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
maskdist


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 769

 dist=maskdist(vol)

 return the distance in each voxel towards the nearest label boundaries

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 vol: a 2D or 3D array

 output:
	 dist: an integer array, storing the distance, in voxel unit, towards
	       the nearest boundary between two distinct non-zero voxels, the
	       zero voxels in the domain and space outside of the array 
          are also treated as a unique non-zero label. If the goal is to 
	       get the minimum distance measured from the center of the voxel,
	       one should use (dist-0.5).

 example:

    a=ones(60,60,60);
    a(:,:,1:10)=2;
    a(:,:,11:20)=3;
    im=maskdist(a);
    imagesc(squeeze(im(:,30,:)))

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 dist=maskdist(vol)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
maxsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 680

 [f maxsize]=maxsurf(facecell,node)

 return the surface with the maximum element number or  
 total area from a cell arry of surfaces

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    facecell: a cell array, each element is a face array
    node: optional, node list, if given, the output is the
          surface with the largest surface area.

 output:
    f: the surface data (node indices) for the surface with the 
       most elements (or largest area when node is given)
    maxsize: if node is not given, maxisize is row number of f;
             otherwise, maxsize is the total area of f

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36

 [f maxsize]=maxsurf(facecell,node)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
mcpath


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 613

 binname=mcpath(fname)

 get full executable path by prepending a command directory path
 parameters:

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    fname: input, a file name string

 output:
    binname: output, full file name located in the bin directory

    if global variable ISO2MESH_BIN is set in 'base', it will
    use [ISO2MESH_BIN filesep cmdname] as the command full path,
    otherwise, let matlab pass the cmdname to the shell, which
    will search command in the directories listed in system
    $PATH variable.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23

 binname=mcpath(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
memmapstream


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1600

    outstruct=memmapstream(bytes, format)

    Map a byte-array (in char array or uint8/int8 array) into a structure
    using a dictionary (format is compatible with memmapfile in MATLAB)

    This function is compatible with both MATLAB and GNU Octave. 

    author: Qianqian Fang (q.fang <at> neu.edu)

    input:
        bytes: a char, int8 or uint8 vector or array
        format: a 3-column cell array in the format compatible with the
              'Format' parameter of memmapfile in MATLAB. It has the
              following structure

             column 1: data type string, it can be one of the following
                'int8','int16','int32','int64',
                'uint8','uint16','uint32','uint64',
                'single','double','logical'
             column 2: an integer vector denoting the size of the data
             column 3: a string denoting the fieldname in the output struct

             For example format={'int8',[1,8],'key'; 'float',[1,1],'value'}
             reads the first 8 bytes from 'bytes' as the first subfield
             'key' and the following 4 bytes as the floating point 'value'
             subfield.

    output:
        outstruct: a structure containing the required field

    example:
        bytestream=['Andy' 5 'JT'];
        format={'uint8', [1,4], 'name',
              'uint8', [1,1], 'age',
              'uint8', [1,2], 'school'};
        data=memmapstream(bytestream,format);

    this file is part of JNIfTI specification: https://github.com/fangq/jnifti

    License: Apache 2.0, see https://github.com/fangq/jnifti for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

    outstruct=memmapstream(bytes, format)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
mergemesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1084

 [newnode,newelem]=mergemesh(node,elem,varargin)

 concatenate two or more tetrahedral meshes or triangular surfaces
 
 author: Qianqian Fang <q.fang at neu.edu>

 input: 
      node: node coordinates, dimension (nn,3)
      elem: tetrahedral element or triangle surface (nn,3) to (nn,5)

 output:
      newnode: the node coordinates after merging, dimension (nn,3)
      newelem: tetrahedral element or surfaces after merging (nn,4) or (nhn,5)

 note: you can call meshcheckrepair for the output newnode and
 newelem to remove the duplicated nodes or elements. mergemesh does
 detect self-intersecting elements when merging; to remove self-intersecting
 elements, you need to use mergesurf().

 example:

   [node1,face1,elem1]=meshabox([0 0 0],[10 10 10],1,1);
   [node2,face2,elem2]=meshasphere([5 5 13.1],3,0.3,3);
   [newnode,newelem]=mergemesh(node1,elem1,node2,elem2);
   plotmesh(newnode,newelem);
   figure;
   [newnode,newface]=mergemesh(node1,face1,node2,face2);
   plotmesh(newnode,newface,'x>5');

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49

 [newnode,newelem]=mergemesh(node,elem,varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
mergesurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 851

 [newnode,newelem]=mergesurf(node1,elem1,node2,elem2,...)

 merge two or more triangular meshes and split intersecting elements
 
 author: Qianqian Fang <q.fang at neu.edu>

 input:
      node: node coordinates, dimension (nn,3)
      elem: tetrahedral element or triangle surface (nn,3)

 output:
      newnode: the node coordinates after merging, dimension (nn,3)
      newelem: tetrahedral element or surfaces after merging (nn,4) or (nhn,5)

 note: you can call meshcheckrepair for the output newnode and
 newelem to remove the duplicated nodes or elements

 example:

   [node1,face1,elem1]=meshabox([0 0 0],[10 10 10],1,1);
   [node2,face2,elem2]=meshasphere([5 5 10],3,0.3,3);
   [newnode,newface]=mergesurf(node1,face1,node2,face2);
   plotmesh(newnode,newface,'x>5');

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58

 [newnode,newelem]=mergesurf(node1,elem1,node2,elem2,...)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
mesh2mask


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1254

 [mask weight]=mesh2mask(node,face,Nxy)
   or
 [mask weight]=mesh2mask(node,face,[Nx,Ny])
   or
 [mask weight]=mesh2mask(node,face,xi,yi,hf)

 fast rasterization of a 2D mesh to an image with triangle index labels
 
 author: Qianqian Fang <q.fang at neu.edu>
 date for initial version: July 18,2013

 input:
      node: node coordinates, dimension N by 2 or N by 3 array
      face: a triangle surface, N by 3 or N by 4 array
      Nx,Ny,Nxy: output image in x/y dimensions, or both
      xi,yi: linear vectors for the output pixel center positions in x/y
      hf: (optional) the handle of a pre-created figure window, for faster 
          rendering

 output:
      mask: a 2D image, the value of each pixel is the index of the
            enclosing triangle, if the pixel is outside of the mesh, NaN
      weight: (optional) a 3 by Nx by Ny array, where Nx/Ny are the dimensions for
            the mask

 note: This function only works in MATLAB when the DISPLAY is not 
       disabled. The maximum size of the mask output is limited by the 
       screen size.

 example:

   [no,fc]=meshgrid6(0:5,0:5);
   [mask weight]=mesh2mask(no,fc,-1:0.1:5,0:0.1:5);
   imagesc(mask);

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [mask weight]=mesh2mask(node,face,Nxy)
   or
 [mask weight]=mesh2mask(node,...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
mesh2vol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1521

 [mask weight]=mesh2vol(node,face,Nxyz)
 [mask weight]=mesh2vol(node,face,[Nx,Ny,Nz])
 [mask weight]=mesh2vol(node,face,xi,yi,zi,hf)
   or
 newval=mesh2vol(node_val,face,...)

 fast rasterization of a 3D mesh to a volume with tetrahedron index labels
 
 author: Qianqian Fang <q.fang at neu.edu>
 date for initial version: Feb 10,2014

 input:
      node: node coordinates, dimension N by 2 or N by 3 array
      nodeval: a 4-column array, the first 3 columns are the node coordinates, 
            the last column denotes the values associated with each node
      face: a triangle surface, N by 3 or N by 4 array
      Nx,Ny,Nxy: output image in x/y dimensions, or both
      xi,yi: linear vectors for the output pixel center positions in x/y
      hf: the handle of a pre-created figure window for faster rendering

 output:
      mask: a 3D image, the value of each pixel is the index of the
            enclosing triangle, if the pixel is outside of the mesh, NaN
      weight: (optional) a 3 by Nx by Ny array, where Nx/Ny are the dimensions
            for the mask
      newval: when the node has 4 columns, the last column represents the
            values (color) at each node, the output newval is the rasterized
            mesh value map over the specified grid.

 note: This function only works for matlab

 example:

   [no,el]=meshgrid6(0:5,0:5,0:3);
   mask=mesh2vol(no,el(:,1:4),0:0.1:5,0:0.1:5,0:0.1:4);
   imagesc(mask(:,:,3))

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [mask weight]=mesh2vol(node,face,Nxyz)
 [mask weight]=mesh2vol(node,face,[N...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meshabox


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 855

 [node,face,elem]=meshabox(p0,p1,opt,nodesize)

 create the surface and tetrahedral mesh of a box geometry

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   p0:  coordinates (x,y,z) for one end of the box diagnoal
   p1:  coordinates (x,y,z) for the other end of the box diagnoal
   opt: maximum volume of the tetrahedral elements
   nodesize: 1 or a 8x1 array, size of the element near each vertex

 output:
   node: node coordinates, 3 columns for x, y and z respectively
   face: integer array with dimensions of NB x 3, each row represents
         a surface mesh face element 
   elem: integer array with dimensions of NE x 4, each row represents
         a tetrahedron 

 example:
   [node,face,elem]=meshabox([2 3 2],[6 12 15],0.1,1);
   plotmesh(node,elem,'x>4');

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47

 [node,face,elem]=meshabox(p0,p1,opt,nodesize)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
meshacylinder


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1238

 [node,face]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
    or
 [node,face,elem]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
 [nplc,fplc]=meshacylinder(c0,c1,r,0,0,ndiv);

 create the surface and (optionally) tetrahedral mesh of a 3D cylinder

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   c0, c1:  cylinder axis end points
   r:   radius of the cylinder; if r contains two elements, it outputs
        a cone trunk, with each r value specifying the radius on each end
   tsize: maximum surface triangle size on the sphere
   maxvol: maximu volume of the tetrahedral elements

         if both tsize and maxvol is set to 0, this function sill return 
         the piecewise-linear-complex (PLC) in the form of the nodes (as node)
         and a cell array (as face).

   ndiv: approximate the cylinder surface into ndiv flat pieces, if 
         ignored, ndiv is set to 20

 output:
   node: node coordinates, 3 columns for x, y and z respectively
   face: integer array with dimensions of NB x 3, each row represents
         a surface mesh triangle
   elem: (optional) integer array with dimensions of NE x 4, each row 
         represents a tetrahedron 

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,face]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
    or
 [node,face,ele...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
meshanellip


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1214

 [node,face,elem]=meshanellip(c0,rr,opt)

 create the surface and tetrahedral mesh of an ellipsoid

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   c0:  center coordinates (x0,y0,z0) of the ellipsoid
   rr:  radii of an ellipsoid, 
        if rr is a scalar, this is a sphere with radius rr
        if rr is a 1x3 or 3x1 vector, it specifies the ellipsoid radii [a,b,c]
        if rr is a 1x5 or 5x1 vector, it specifies [a,b,c,theta,phi]
           where theta and phi are the rotation angles along z and x 
           axes, respectively. Rotation is applied before translation.
   tsize: maximum surface triangle size on the sphere
   maxvol: maximu volume of the tetrahedral elements

 output:
   node: node coordinates, 3 columns for x, y and z respectively
   face: integer array with dimensions of NB x 3, each row represents
         a surface mesh face element 
   elem: integer array with dimensions of NE x 4, each row represents
         a tetrahedron; if ignored, only produces the surface

 example:
   [node,face,elem]=meshanellip([10,10,-10],[30,20,10,pi/4,pi/4],0.5,0.4);
   plotmesh(node,elem,'x>10');axis equal;

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41

 [node,face,elem]=meshanellip(c0,rr,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
meshasphere


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 698

 [node,face,elem]=meshasphere(c0,r,tsize,maxvol)

 create the surface and tetrahedral mesh of a sphere

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   c0:  center coordinates (x0,y0,z0) of the sphere
   r:   radius of the sphere
   tsize: maximum surface triangle size on the sphere
   maxvol: maximu volume of the tetrahedral elements

 output:
   node: node coordinates, 3 columns for x, y and z respectively
   face: integer array with dimensions of NB x 3, each row represents
         a surface mesh face element 
   elem: integer array with dimensions of NE x 4, each row represents
         a tetrahedron 

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49

 [node,face,elem]=meshasphere(c0,r,tsize,maxvol)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
meshcentroid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 428

 centroid=meshcentroid(v,f)
 
 compute the centroids of a mesh defined by nodes and elements
 (surface or tetrahedra) in R^n space

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      v: surface node list, dimension (nn,3)
      f: surface face element list, dimension (be,3)

 output:
      centroid: centroid positions, one row for each element

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 centroid=meshcentroid(v,f)
 
 compute the centroids of a mesh defined by no...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
meshcheckrepair


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 937

 [node,elem]=meshcheckrepair(node,elem,opt)
 
 check and repair a surface mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/10/10

 input/output:
      node: input/output, surface node list, dimension (nn,3)
      elem: input/output, surface face element list, dimension (be,3)
      opt: options, including
            'dupnode': remove duplicated nodes
            'dupelem' or 'duplicated': remove duplicated elements
            'dup': both above
            'isolated': remove isolated nodes
            'open': abort when open surface is found
            'deep': call external jmeshlib to remove non-manifold vertices
            'meshfix': repair a closed surface by the meshfix utility (new)
                       it can remove self-intersecting elements and fill holes
            'intersect': test a surface for self-intersecting elements

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79

 [node,elem]=meshcheckrepair(node,elem,opt)
 
 check and repair a surface mesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meshconn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 544

 [conn,connnum,count]=meshconn(elem,nn)

 create node neighbor list from a mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
    elem:  element table of a mesh
    nn  :  total node number of the mesh

 output:
    conn:  output, a cell structure of length nn, conn{n}
           contains a list of all neighboring node ID for node n
    connnum: vector of length nn, denotes the neighbor number of each node
    count: total neighbor numbers

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40

 [conn,connnum,count]=meshconn(elem,nn)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
meshcylinders


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 732

 [node,face]=meshcylinders(c0, v, len, r,tsize,maxvol,ndiv)
    or
 [node,face,elem]=meshacylinder(c0, v, len, r, tsize,maxvol,ndiv)
 [nplc,fplc]=meshacylinder(c0, v, len,r,0,0,ndiv);

 create the surface and (optionally) tetrahedral mesh of a 3D cylinder

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   c0, cylinder list axis's starting point
   v: directional vector of the cylinder
   len: a scalar or a vector denoting the length of each 
        cylinder segment along the direction of v
   tsize, maxvol, ndiv: please see the help for meshacylinder for details

 output:
   node, face, elem: please see the help for meshacylinder for details

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,face]=meshcylinders(c0, v, len, r,tsize,maxvol,ndiv)
    or
 [node,fa...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meshedge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 881

 edges=meshedge(elem,opt)

 return all edges in a surface or volumetric mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/02/26

 input:
    elem:  element table of a mesh (support N-d space element)
    opt: optional input, giving the additional options. If opt
         is a struct, it can have the following field:
       opt.nodeorder: if 1, assuming the elem node indices is in CCW 
                      orientation; 0 use nchoosek() output to order edges
         you can replace opt by a series of ('param', value) pairs.

 output:
    edge:  edge list; each row is an edge, specified by the starting and
           ending node indices, the total edge number is
           size(elem,1) x nchoosek(size(elem,2),2). All edges are ordered
           by looping through each element first. 

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26

 edges=meshedge(elem,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
mesheuler


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 330

 [X,V,E,F]=mesheuler(face)

 Euler's charastistics of a mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   face: a closed surface mesh

 output:
   X: Euler's charastistics
   V: number of vertices 
   E: number of edges
   F: number of faces

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27

 [X,V,E,F]=mesheuler(face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meshface


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 881

 faces=meshface(elem,opt)

 return all faces in a surface or volumetric mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/02/26

 input:
    elem:  element table of a mesh (support N-d space element)
    opt: optional input, giving the additional options. If opt
         is a struct, it can have the following field:
       opt.nodeorder: if 1, assuming the elem node indices is in CCW 
                      orientation; 0 use nchoosek() output to order faces
         you can replace opt by a series of ('param', value) pairs.

 output:
    face:  face list; each row is an face, specified by the starting and
           ending node indices, the total face number is
           size(elem,1) x nchoosek(size(elem,2),2). All faces are ordered
           by looping through each element first. 

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26

 faces=meshface(elem,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
meshgrid5


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 817

 [node,elem]=meshgrid5(v1,v2,v3,...)

 mesh an ND rectangular lattice by splitting 
 each hypercube into 5 tetrahedra

 author: Qianqian Fang, <q.fang at neu.edu>
 inspired by John D'Errico
 URL: http://www.mathworks.com/matlabcentral/newsreader/view_thread/107191

 input:
    v1,v2,v3,... - numeric vectors defining the lattice in
                   each dimension.
                   Each vector must be of length >= 1

 output:
    node - factorial lattice created from (v1,v2,v3,...)
           Each row of this array is one node in the lattice
    elem - integer array defining simplexes as references to
           rows of "node".

 example:
     [node,elem]=meshgrid5(0:5,0:6,0:4);
     plotmesh(node,elem);

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,elem]=meshgrid5(v1,v2,v3,...)

 mesh an ND rectangular lattice by ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
meshgrid6


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 816

 [node,elem]=meshgrid6(v1,v2,v3,...)

 mesh an ND rectangular lattice by splitting 
 each hypercube into 6 tetrahedra

 author: John D'Errico
 URL: http://www.mathworks.com/matlabcentral/newsreader/view_thread/107191
 modified by Qianqian Fang (q.fang at neu.edu)

 input:
    v1,v2,v3,... - numeric vectors defining the lattice in
                   each dimension.
                   Each vector must be of length >= 1

 output:
    node - factorial lattice created from (v1,v2,v3,...)
           Each row of this array is one node in the lattice
    elem - integer array defining simplexes as references to
           rows of "node".

 example:
     [node,elem]=meshgrid6(0:5,0:6,0:4);
     plotmesh(node,elem);

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,elem]=meshgrid6(v1,v2,v3,...)

 mesh an ND rectangular lattice by ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
meshinterp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1561

 newval=meshinterp(fromval,elemid,elembary,fromelem)

 Interpolate nodal values from the source mesh to the target mesh based on
 a linear interpolation

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 fromval: values defined at the source mesh nodes, the row or column
	          number must be the same as the source mesh node number, which
	          is the same as the elemid length
	 elemid: the IDs of the source mesh element that encloses the nodes of
            the target mesh nodes; a vector of length of target mesh node
            count; elemid and elembary can be generated by calling

           [elemid,elembary]=tsearchn(node_src, elem_src, node_target);

           note that the mapping here is inverse to that in meshremap()

	 elembary: the bary-centric coordinates of each target mesh nodes
	         within the source mesh elements, sum of each row is 1, expect
	         3 or 4 columns (or can be N-D)
    fromelem: the element list of the source mesh


 output:
	 newval: a 2D array with rows equal to the target mesh nodes (nodeto), 
            and columns equals to the value numbers defined at each source
            mesh node
 example:

    [n1,f1,e1]=meshabox([0 0 0],[10 20 5],1); % target mesh
    [n2,f2,e2]=meshabox([0 0 0],[10 20 5],2); % src mesh
    [id, ww]=tsearchn(n2,e2,n1);              % project target to src mesh
    value_src=n2(:,[2 1 3]);             % create dummy values at src mesh
    newval=meshinterp(value_src,id, ww, e2);

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53

 newval=meshinterp(fromval,elemid,elembary,fromelem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
meshquality


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 820

 quality=meshquality(node,elem)

 compute the Joe-Liu mesh quality measure of an N-D mesh (N<=3)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/02/26

 input:
    node:  node coordinates of the mesh (nn x 3)
    elem:  element table of an N-D mesh (ne x (N+1))

 output:
    quality: a vector of the same length as size(elem,1), with 
           each element being the Joe-Liu mesh quality metric (0-1) of 
           the corresponding element. A value close to 1 represents
           higher mesh quality (1 means equilateral tetrahedron); 
           a value close to 0 means nearly degenerated element.

 reference:
    A. Liu, B. Joe, Relationship between tetrahedron shape measures, 
                    BIT 34 (2) (1994) 268-287.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 quality=meshquality(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
meshrefine


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3540

 [newnode,newelem,newface]=meshrefine(node,elem,face,opt)

 refine a tetrahedral mesh by adding new nodes or constraints

 author: Qianqian Fang, <q.fang at neu.edu>

 input parameters:
      node: existing tetrahedral mesh node list
      elem: existing tetrahedral element list
      face: (optional) existing tetrahedral mesh surface triangle list
      opt:  options for mesh refinement:
        if opt is a Nx3 array, opt is treated as a list of new nodes to
          be inserted into the mesh. the new nodes must be located on the 
          surface or inside the original mesh. external nodes are
          discarded, unless the opt.extcmdopt is specified.
        if opt is a vector with a length that equals to that of node,
          it will be used to specify the desired edge-length at each node;
          setting a node value to 0 will by-pass the refinement at this node
        if opt is a vector with a length that equals to that of elem,
          it will be used as the desired maximum element volume of each
          tetrahedron; setting to 0 will by-pass the refinement of that element.
        if opt is a struct, it can have the following fields:
          opt.newnode: same as setting opt to an Nx3 array
          opt.reratio: radius-edge ratio, by default, iso2mesh uses 1.414
          opt.maxvol: maximum element volume
          opt.sizefield: a vector specifying either the desired edge-length
              at each node, or the maximum volume constraint within each 
              tetrahedron, see above for details.
          opt.extcmdopt: by default, meshrefine can only insert nodes
              that are inside the original mesh. if one prefers to insert
              nodes that are outside of the original mesh, one can define
              this parameter to specify the meshing option (for tetgen)
              for the extended domain, i.e. the convex hull including 
              both the original and the external nodes. If not defined, 
              '-Y' option is used by default (prevent tetgen from
              inserting new nodes on the surface).
          opt.extlabel: when external nodes are inserted, the new elements
              will be assigned with an element label to group them
              together, by default, this label is 0, unless opt.extlabel
              is given
          opt.extcorelabel: when external nodes are inserted, par of the 
              new elements share the polyhedra between the inserted nodes,
              these special elements will be marked by opt.extcorelabel, 
              otherwise the label will be set to -1 

 outputs:
      newnode: node coordinates of the tetrahedral mesh
      newelem: element list of the tetrahedral mesh
      newface: mesh surface element list of the tetrahedral mesh 
             the last column denotes the boundary ID

 examples:

     [node,face,elem]=meshasphere([0 0 0],24,1,2);
     elem(:,5)=1;

     % inserting nodes that are inside the original mesh
     innernodes=double([1 1 1; 2 2 2; 3 3 3]);
     [newno,newel]=meshrefine(node,elem,innernodes);
     all(ismember(round(innernodes*1e10)*1e-10,round(newno*1e10)*1e-10,'rows'))
     plotmesh(newno,[],newel,'x>-3')

     % inserting nodes that are external to the original mesh
     extnodes=double([-5 -5 25;-5 5 25;5 5 25;5 -5 25]);
     [newno,newel]=meshrefine(node,elem,struct('newnode',extnodes,'extcmdopt','-Y'));
     figure;
     plotmesh(newno,[],newel,'x>-3')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58

 [newnode,newelem,newface]=meshrefine(node,elem,face,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
meshremap


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1666

 newval=meshremap(fromval,elemid,elembary,toelem,nodeto)

 Redistribute nodal values from the source mesh to the target mesh so that 
 the sum of each property on each mesh is the same

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 fromval: values defined at the source mesh nodes, the row or column
	          number must be the same as the source mesh node number, which
	          is the same as the elemid length
	 elemid: the IDs of the target mesh element that encloses the nodes of
            the source mesh nodes; a vector of length of src mesh node
            count; elemid and elembary can be generated by calling

           [elemid,elembary]=tsearchn(node_target, elem_target, node_src);

           note that the mapping here is inverse to that in meshinterp()

	 elembary: the bary-centric coordinates of each source mesh nodes
	         within the target mesh elements, sum of each row is 1, expect
	         3 or 4 columns (or can be N-D)
    toelem: the element list of the target mesh
    nodeto: the total number of target mesh nodes


 output:
	 newval: a 2D array with rows equal to the target mesh nodes (nodeto), 
            and columns equals to the value numbers defined at each source
            mesh node
 example:

    [n1,f1,e1]=meshabox([0 0 0],[10 20 5],1); % src mesh
    [n2,f2,e2]=meshabox([0 0 0],[10 20 5],2); % target mesh
    [id, ww]=tsearchn(n2,e2,n1);              % project src to target mesh
    value_src=n1(:,[2 3 1]);             % create dummy values at src mesh
    newval=meshremap(value_src,id,ww,e2,size(n2,1)); % map to target

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57

 newval=meshremap(fromval,elemid,elembary,toelem,nodeto)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
meshreorient


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 507

 [newelem, evol]=meshreorient(node,elem)

 reorder nodes in a surface or tetrahedral mesh to ensure all
 elements are oriented consistently

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2010/05/05

 input:
    node: list of nodes
    elem: list of elements (each row are indices of nodes of each element)

 output:
    newelem: the element list with consistent ordering
    evol: the signed element volume before reorientation

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41

 [newelem, evol]=meshreorient(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
meshresample


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 570

 [node,elem]=meshresample(v,f,keepratio)

 resample mesh using CGAL mesh simplification utility

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/12

 input:
    v: list of nodes
    f: list of surface elements (each row for each triangle)
    keepratio: decimation rate, a number less than 1, as the percentage
               of the elements after the sampling

 output:
    node: the node coordinates of the sampled surface mesh
    elem: the element list of the sampled surface mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41

 [node,elem]=meshresample(v,f,keepratio)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshunitsphere


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 928

 [node,face,elem]=meshunitsphere(tsize,maxvol)

 create the surface and/or volumetric mesh of a unit sphere 
 centered at [0 0 0] and radius 1

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   tsize: maximum size of the surface triangles (from 0 to 1)
   maxvol: maximum volume of the tetrahedron; if one wants to return
           elem without specifying maxvol, maxvol=tsize^3

 output:
   node: node coordinates, 3 columns for x, y and z respectively
   face: integer array with dimensions of NB x 3, each row represents
         a surface mesh face element 
   elem: integer array with dimensions of NE x 4, each row represents
         a tetrahedron. If ignored, this function only produces the surface

 example:
   [node,face]=meshunitsphere(0.05);
   [node,face,elem]=meshunitsphere(0.05,0.01);
   plotmesh(node,elem,'x>0'); axis equal;

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



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47

 [node,face,elem]=meshunitsphere(tsize,maxvol)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
metchgui


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2771
    alldata = metchgui(node,elem,points,pface) or metchgui(volume,points,pface)

    A GUI to register a point cloud to a mesh or volumetric image
  
    author: Qianqian Fang <q.fang at neu.edu>
    date: 12/16/2008
  
   parameters: 
        node: node coordinate of the surface mesh (nn x 3)
        elem: element list of the surface mesh (3 columns for 
              triangular mesh, 4 columns for cubic surface mesh)
        points: the coordinates (3 columns for x/y/z) of the 
              point cloud which you want to register
        pface:trianglular surface defined on the point cloud.
              pface is optional; if presents, metch will display 
              a surface object instead of a point cloud.

   the input can also be two parameters in form of metchgui(volume,points), 
    where volume is a 3D image (array).

   outputs:
        alldata: a structrure containing all processing outputs
        the fields include: 
         .node: the input node 
         .elem: the input surface mesh elements
         .volume: if the input volumetric image
         .A0: the affine rotation for selected point pairs (after Initialize)
         .b0: the affine translation for selected point pairs (after Initialize)
         .A: the affine rotation for the point cloud (after Optimize)
         .b: the affine translation for the point cloud (after Optimize)
         .points: the input point cloud
         .pointsinit: the point cloud after initialization
         .pointsopt: the point cloud after optimization
         .pointsproj: the point cloud after projecting to the surface
         .initplot: the handle to the point cloud plot after init
         .optplot: the handle to the point cloud plot after optimization
         .projplot: the handle to the point cloud plot after projection

   If user supplys an output variable, the GUI will not return until the
   user hits the "close" button or close the window; if user does not
   supply any output, the call will return immediately; any data user
   intends to save, he has to click on "Save Session" button and provides
   a mat-file file name. A single structure named "metchsession" will be
   stored in this file.

   example: (meshasphere/meshunitsphere are defined in iso2mesh http://iso2mesh.sf.net)

       [noderef,faceref,elemref]=meshunitsphere(0.08,10);
       [no,fc]=removeisolatednode(noderef(:,1:3),faceref(:,1:3));
       [node,face,elem]=meshasphere([10 20 15],3,0.5,10);
       [no2,fc2]=removeisolatednode(node(:,1:3),face(:,1:3));
       alldata = metchgui(no,fc,no2);
       % or alldata = metchgui(no,fc,no2,fc2);

   Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch
  
   this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79
    alldata = metchgui(node,elem,points,pface) or metchgui(volume,points,pface)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
metchgui_one


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2777
    alldata = metchgui_one(node,elem,points) or metchgui_one(volume,points,pface)

    A GUI to register a point cloud to a mesh or volumetric image
  
    author: Qianqian Fang <q.fang at neu.edu>
    date: 12/16/2008
  
   parameters: 
        node: node coordinate of the surface mesh (nn x 3)
        elem: element list of the surface mesh (3 columns for 
              triangular mesh, 4 columns for cubic surface mesh)
        points: the coordinates (3 columns for x/y/z) of the 
              point cloud which you want to register
        pface:trianglular surface defined on the point cloud.
              pface is optional; if presents, metch will display 
              a surface object instead of a point cloud.

   the input can also be two parameters in form of metchgui_one(volume,points), 
    where volume is a 3D image (array).

   outputs:
        alldata: a structrure containing all processing outputs
        the fields include: 
         .node: the input node 
         .elem: the input surface mesh elements
         .volume: if the input volumetric image
         .A0: the affine rotation for selected point pairs (after Initialize)
         .b0: the affine translation for selected point pairs (after Initialize)
         .A: the affine rotation for the point cloud (after Optimize)
         .b: the affine translation for the point cloud (after Optimize)
         .points: the input point cloud
         .pointsinit: the point cloud after initialization
         .pointsopt: the point cloud after optimization
         .pointsproj: the point cloud after projecting to the surface
         .initplot: the handle to the point cloud plot after init
         .optplot: the handle to the point cloud plot after optimization
         .projplot: the handle to the point cloud plot after projection

   If user supplys an output variable, the GUI will not return until the
   user hits the "close" button or close the window; if user does not
   supply any output, the call will return immediately; any data user
   intends to save, he has to click on "Save Session" button and provides
   a mat-file file name. A single structure named "metchsession" will be
   stored in this file.

   example: (meshasphere/meshunitsphere are defined in iso2mesh http://iso2mesh.sf.net)

       [noderef,faceref,elemref]=meshunitsphere(0.08,10);
       [no,fc]=removeisolatednode(noderef(:,1:3),faceref(:,1:3));
       [node,face,elem]=meshasphere([10 20 15],3,0.5,10);
       [no2,fc2]=removeisolatednode(node(:,1:3),face(:,1:3));
       alldata = metchgui(no,fc,no2);
       % or alldata = metchgui(no,fc,no2,fc2);

   Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch
  
   this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
    alldata = metchgui_one(node,elem,points) or metchgui_one(volume,points,pf...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
mwpath


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 673

 tempname=meshtemppath(fname)

 get full temp-file name by prepend working-directory and current session name

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    fname: input, a file name string

 output:
    tempname: output, full file name located in the working directory

    if global variable ISO2MESH_TEMP is set in 'base', it will use it
    as the working directory; otherwise, will use matlab function tempdir
    to return a working directory.

    if global variable ISO2MESH_SESSION is set in 'base', it will be
    prepended for each file name, otherwise, use supplied file name.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 tempname=meshtemppath(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
ndgaussian


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 584

 h=ndgaussian(r, sigma, ndim)

 create an ND Gaussian or box filter kernel matrix

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    r: kernel half-width, the output is 2*r+1 in each dimension; if
       missing, use 1
    sigma: the standard deviation of the Gaussian; if not given, use 1; if
       set to inf, output box filter
    ndim: an integer for the output dimension; if not given, use 3

 output:
    h: an ndim-dimensional matrix

 -- this function is part of the Iso2Mesh Toolbox (http://iso2mesh.sf.net)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 h=ndgaussian(r, sigma, ndim)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
ndimfilter


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 743

 img=ndimfilter(im,kernel,r,sigma)

 filter an ND array using a specified filter using convolution

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    im: input ND array
    kernel: can be an ND array, or a string. if string, the below filters
        are supported:
        'box': box filter (need r)
        'gaussian': Gaussian filter (need r,sigma input)
    r: kernel half-width, the output is 2*r+1 in each dimension; if
       missing, use 1
    sigma: the standard deviation of the Gaussian; if not given, use 1; if
       set to inf, output box filter

 output:
    img: the filtered ND array

 -- this function is part of the Iso2Mesh Toolbox (http://iso2mesh.sf.net)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35

 img=ndimfilter(im,kernel,r,sigma)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
neighborelem


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 548

 [conn,connnum,count]=neighborelem(elem,nn)

 create node neighbor list from a mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
    elem:  element table of a mesh
    nn  :  total node number of the mesh

 output:
    conn:  output, a cell structure of length nn, conn{n}
           contains a list of all neighboring elem ID for node n
    connnum: vector of length nn, denotes the neighbor number of each node
    count: total neighbor numbers

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44

 [conn,connnum,count]=neighborelem(elem,nn)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
nodesurfnorm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 730
  nv=nodesurfnorm(node,elem)

  calculate a nodal norm for each vertix on a surface mesh (surface 
   can only be triangular or cubic)

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      node: node coordinate of the surface mesh (nn x 3)
      elem: element list of the surface mesh (3 columns for 
            triangular mesh, 4 columns for cubic surface mesh)
      pt: points to be projected, 3 columns for x,y and z respectively

 outputs:
      nv: nodal norms (vector) calculated from nodesurfnorm.m
          with dimensions of (size(v,1),3)

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
  nv=nodesurfnorm(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
nodevolume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 449

 nodevol=nodevolume(node,elem)

 calculate the volumes of the cells in the barycentric dual-mesh
 (this is different from the Voronoi cells, which blong to the 
 circumcentric dual mesh)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/12/31

 input:
    node:  node coordinates
    elem:  element table of a mesh

 output:
    nodevol:   volume values for all nodes

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31

 nodevol=nodevolume(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
orderloopedge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 426

 [newedge]=orderloopedge(edge)

 order the node list of a simple loop based on connection sequence

 author: Qianqian Fang (q.fang at neu.edu)
 date:   2008/05

 input: 
        edge: a loop consisted by a sequence of edges, each row 
              is an edge with two integers: start/end node index

 output:
        newedge: reordered edge node list

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31

 [newedge]=orderloopedge(edge)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
orthdisk


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 838

 node=orthdisk(c0,c1,r,ndiv)

 Defining a 3D disk that is orthogonal to the vector c1-c0 

 author: Qianqian Fang (q.fang at neu.edu)

 input:
     c0: a 1x3 vector for the origin
     c1: a 1x3 vector to define a direction vector c1-c0
     r: the radius of the disk that is orthogonal to c1-c0, passing through c0
     ndiv: division count to approximate a circle by a polygon, if ignored, ndiv=20
     v1: a 1x3 vector specifying the first point on the output 3D disk. if
         v1 is not perpendicular to c1-c0, the disk rotation axis is
         changed to cross(v1,cross(c1-c0,v1)); 
     angle0: angle0 represents the angle (in radian) of the 1st point in 
         the 3D disk if placed on the x-y plane.

 output:
     node: the 3D vertices of the disk

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 node=orthdisk(c0,c1,r,ndiv)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
outersurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 336

 outface=outersurf(node,face)

 extract the out-most shell of a complex surface mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node:  node coordinates
    face:  surface triangle list

 output:
    outface: the out-most shell of the surface mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 outface=outersurf(node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
plotedges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 920

 hm=plotedges(node,edges,opt)
   or
 hm=plotedges(node,loops,opt)

 plot a 3D polyline or close loop (1d manifold)
 
 author: Qianqian Fang <q.fang at neu.edu>

 input: 
      node: node coordinates, dimension (nn,3); if node has a 
            4th column, it will be used to set the color at each node.
      edges:edge list: a 2-column index array, with each row being
            an edge connecting the two indexed node
      loops:loops is an NaN separated integer array, with each segment
            denoting a 3D polyline or loop represented by a list of node
            indices
      opt:  additional options for the plotting, see plotmesh

 output:
      hm: handle or handles (vector) to the plotted surfaces

 example:

   h=plotedges(node,[1 2 3 4 5 nan 6 7 8 9]);
   h=plotedges(node,edges,'marker','o','linewidth',2,'color','r');
 
 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66

 hm=plotedges(node,edges,opt)
   or
 hm=plotedges(node,loops,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
plotmesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2211

 hm=plotmesh(node,face,elem,opt)

 plot surface and volumetric meshes
 
 author: Qianqian Fang <q.fang at neu.edu>

 input: 
      node: a node coordinate list, 3 columns for x/y/z; if node has a 
            4th column, it will be used to set the color at each node.
      face: a triangular surface face list; if face has a 4th column,
            it will be used to separate the surface into 
            sub-surfaces and display them in different colors;
            face can be a cell array, each element of the array represents
            a polyhedral facet of the mesh, if an element is an array with
            two array subelements, the first one is the node index, the
            second one is a scalar as the group id of the facet.
      elem: a tetrahedral element list; if elem has a 5th column,
            it will be used to separate the mesh into 
            sub-domains and display them in different colors.
      opt:  additional options for the plotting

            for simple point plotting, opt can be markers
            or color options, such as 'r.', or opt can be 
            a logic statement to select a subset of the mesh,
            such as 'x>0 & y+z<1', or an equation defining
            a plane at which a mesh cross-section is plotted, for
            example 'y=2*x'; opt can have more than one
            items to combine these options, for example: 
            plotmesh(...,'x>0','r.'); the range selector must
            appear before the color/marker specifier

 in the event where all of the above inputs have extra settings related to 
 the color of the plot, the priorities are given in the following order:

          opt > node(:,4) > elem(:,5) > face(:,4)

 output:
   hm: handle or handles (vector) to the plotted surfaces

 example:

   h=plotmesh(node,'r.');
   h=plotmesh(node,'x<20','r.');
   h=plotmesh(node,face);
   h=plotmesh(node,face,'y>10');
   h=plotmesh(node,face,'facecolor','r');
   h=plotmesh(node,elem,'x<20');
   h=plotmesh(node,elem,'x<20 & y>0');
   h=plotmesh(node,face,elem);
   h=plotmesh(node,face,elem,'linestyle','--');
   h=plotmesh(node,elem,'z=20');
 
 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33

 hm=plotmesh(node,face,elem,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
plotsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1112

 hm=plotsurf(node,face,opt)

 plot 3D surface meshes (2d manifold) or polylines (1d manifold)
 
 author: Qianqian Fang <q.fang at neu.edu>

 input: 
      node: node coordinates, dimension (nn,3); if node has a 
            4th column, it will be used to set the color at each node.
      face: triangular surface face list; if face has a 4th column,
            it will be used to separate the surface into 
            sub-surfaces and display them in different colors;
            face can be a cell array, each element of the array represents
            a polyhedral facet of the mesh, if an element is an array with
            two array subelements, the first one is the node index, the
            second one is a scalar as the group id of the facet.
      opt:  additional options for the plotting, see plotmesh

 output:
   hm: handle or handles (vector) to the plotted surfaces

 example:

   h=plotsurf(node,face);
   h=plotsurf(node,face,'facecolor','r');
   h=plotsurf(node,edges,'linestyle','-','linewidth',2,'color','r');

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 hm=plotsurf(node,face,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
plottetra


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 871

 hm=plottetra(node,elem,opt)

 plot 3D surface meshes
 
 author: Qianqian Fang <q.fang at neu.edu>

 input: 
      node: a node coordinate list, 3 columns for x/y/z; if node has a 
            4th column, it will be used to set the color at each node.
      elem: a tetrahedral element list; if elem has a 5th column,
            and the 5th column are all integers, it will be treated
            as labels of sub-domains and display them in different colors.
            if the 5th column contains non-integer values, it will be
            used to map to the color of triangles.
      opt:  additional options for a patch object, see plotmesh

 output:
   hm: handle or handles (vector) to the plotted surfaces

 example:

   h=plottetra(node,elem);
   h=plottetra(node,elem,'facealpha',0.5);
 
 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 hm=plottetra(node,elem,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
polylineinterp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1360

 [idx, weight]=polylineinterp(polylen, len)
 [idx, weight, newnodes]=polylineinterp(polylen, len, nodes)

 Find the polyline segment indices and interpolation weights for a 
 specified total length or a set of lengths

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    polylen: a 1D vector sequentially recording the length of each segment
         of a polyline, the first number is the length of the 1st segment,
         and so on
    len: a single scalar, or a vector of scalars, specifying the total
         length
    nodes: if nodes is an array with a row-number equal to length(polylen)+1,
         we assume each row defines a coordinate for the nodes along the
         polyline

 output:
    idx: the indices of the polyline segments, starting from 1, where each
         length defined in len ends; if len> sum(polylen), nan is
         returned; if len<0, the weight will be a negative value.
    weight: the interpolation weight between 0-1 towards the end node 
         of the containing segment; the weight for the start-node is 1-weight
    newnodes: the interpolated node positions at the end of the len

 example:
    lineseg=[2,2,1,7,10];
    [idx, weight]=polylineinterp(lineseg, [3, 12, 7])

 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [idx, weight]=polylineinterp(polylen, len)
 [idx, weight, newnodes]=polylin...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
polylinelen


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 942

 [len, node]=polylinelen(node, p0, p1)

 Calculate the polyline line segment length vector in sequential order

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    node: an N x 3 array defining each vertex of the polyline in
          sequential order
    p0:(optional) a given node to define the start of the polyline, if not
         defined, start position is assumed to be 1st node
    p1:(optional) a given node to define the end of the polyline, if not
         defined, end position is assumed to be last node
    pmid:(optional) a given node sits between p0 and p1, if not
         defined, index of the middle (floored) node is used

 output:
    len: the length of each segment between the start and the end points
    node: the node list between the start and end points of the polyline


 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39

 [len, node]=polylinelen(node, p0, p1)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
polylinesimplify


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 701

 [newnodes, len]=polylinesimplify(nodes, minangle)

 Calculate a simplified polyline by removing nodes where two adjacent
 segment have an angle less than a specified limit

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    node: an N x 3 array defining each vertex of the polyline in
          sequential order
    minangle:(optional) minimum segment angle in radian, if not given, use
          0.75*pi

 output:
    newnodes: the updated node list; start/end will not be removed
    len: the length of each segment between the start and the end points


 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51

 [newnodes, len]=polylinesimplify(nodes, minangle)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
proj2mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1533
  [newpt elemid weight]=proj2mesh(v,f,pt,nv,cn)

  project a point cloud on to the surface mesh (surface can only be triangular)

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      v: node coordinate of the surface mesh (nn x 3)
      f: element list of the surface mesh (3 columns for 
            triangular mesh, 4 columns for cubic surface mesh)
      pt: points to be projected, 3 columns for x,y and z respectively
      nv: nodal norms (vector) calculated from nodesurfnorm.m
          with dimensions of (size(v,1),3)
      cn: a integer vector with the length of p, denoting the closest
          surface nodes (indices of v) for each point in p. this 
          value can be calculated from dist2surf.m
      radmax: if speicified, the search for elements to project will be
          limited to those within a bounding box with half-edge-length 
          of radmax centered at the point to be projected

      if nv and cn are not supplied, proj2mesh will project the point
      cloud onto the surface by the direction pointing to the centroid
      of the mesh

 outputs:
      newpt: the projected points from p
      elemid: a vector of length of p, denotes which surface trangle (in elem)
             contains the projected point
      weight: the barycentric coordinate for each projected points, these are
             the weights 

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
  [newpt elemid weight]=proj2mesh(v,f,pt,nv,cn)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
qmeshcut


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2313

 [cutpos,cutvalue,facedata,elemid]=qmeshcut(elem,node,value,cutat)

 fast tetrahedral mesh slicer

 author:Qianqian Fang, <q.fang at neu.edu>

 input: 
   elem: integer array with dimensions of NE x 4, each row contains
         the indices of all the nodes for each tetrahedron
   node: node coordinates, 3 columns for x, y and z respectively
   value: a scalar array with the length of node numbers, can have 
          multiple columns 
   cutat: cutat can have different forms:
          if cutat is a 3x3 matrix, it defines a plane by 3 points: 
                 cutat=[x1 y1 z1;x2 y2 z2;x3 y3 z3]
          if cutat is a vector of 4 element, it defines a plane by
                 a*x+b*y+c*z+d=0  and cutat=[a b c d]
          if cutat is a single scalar, it defines an isosurface 
                 inside the mesh at value=cutat
          if cutat is a string, it defines an implicit surface
                 at which the cut is made. it must has form expr1=expr2
                 where expr1 expr2 are expressions made of x,y,z,v and
                 constants
          if cutat is a cell in the form of {'expression',scalar}, 
                 the expression will be evaluated at each node to 
                 produce a new value, then an isosurface is produced 
                 at the levelset where new value=scalar; the 
                 expression can contain constants and x,y,z,v

 output:
   cutpos: all the intersections of mesh edges by the cutat
           cutpos is similar to node, containing 3 columns for x/y/z
   cutvalue: interpolated values at the intersections, with row number
           being the num. of the intersections, column number being the 
           same as "value".
   facedata: define the intersection polygons in the form of patch "Faces"
   elemid: the index of the elem in which each intersection polygon locates

   without any output, qmeshcut generates a cross-section plot

 the outputs of this subroutine can be easily plotted using 

  % if value has a length of node:
     patch('Vertices',cutpos,'Faces',facedata,'FaceVertexCData',cutvalue,'FaceColor','interp');

  % if value has a length of elem:
     patch('Vertices',cutpos,'Faces',facedata,'CData',cutvalue,'FaceColor','flat');

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67

 [cutpos,cutvalue,facedata,elemid]=qmeshcut(elem,node,value,cutat)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
raysurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1293

 [t,u,v,idx,xnode]=raysurf(p,v,node,face)

 perform a Havel-styled ray tracing for a triangular surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   p0: list of starting points of the rays
   v0: directional vector of the rays, 
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)

 output:
   t: distance from p0 to the intersection point for each surface
      triangle, if t(i)=NaN, no intersection was found for that ray
   u: bary-centric coordinate 1 of all intersection points
   v: bary-centric coordinate 2 of all intersection points
      the final bary-centric triplet is [u,v,1-u-v]
   idx: idx lists the IDs of the face elements that intersects 
      each ray
   xnode: optional output, if requested, xnode gives the intersection
      point coordinates; to compute manually, xnode=p0+repmat(t,1,3).*v0

 Reference: 
  [1] J. Havel and A. Herout, "Yet faster ray-triangle intersection (using 
          SSE4)," IEEE Trans. on Visualization and Computer Graphics,
          16(3):434-438 (2010)
  [2] Q. Fang, "Comment on 'A study on tetrahedron-based inhomogeneous 
          Monte-Carlo optical simulation'," Biomed. Opt. Express, (in
          press)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 [t,u,v,idx,xnode]=raysurf(p,v,node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
raytrace


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1265

 [t,u,v,idx]=raytrace(p0,v0,node,face)

 perform a Havel-styled ray tracing for a triangular surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   p0: starting point coordinate of the ray
   v0: directional vector of the ray
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)

 output:
   t: signed distance from p to the intersection point for each surface
      triangle, if ray is parallel to the triangle, t is set to Inf
   u: bary-centric coordinate 1 of all intersection points
   v: bary-centric coordinate 2 of all intersection points
      the final bary-centric triplet is [u,v,1-u-v]
   idx: optional output, if requested, idx lists the IDs of the face
      elements that intersects the ray; users can manually calc idx by

      idx=find(u>=0 & v>=0 & u+v<=1.0 & ~isinf(t));

 Reference: 
  [1] J. Havel and A. Herout, "Yet faster ray-triangle intersection (using 
          SSE4)," IEEE Trans. on Visualization and Computer Graphics,
          16(3):434-438 (2010)
  [2] Q. Fang, "Comment on 'A study on tetrahedron-based inhomogeneous 
          Monte-Carlo optical simulation'," Biomed. Opt. Express, (in
          press)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39

 [t,u,v,idx]=raytrace(p0,v0,node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
readasc


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 328

 [node,elem]=readasc(fname)

 read FreeSurfer ASC mesh format

 author: Qianqian Fang <q.fang at neu.edu>
 date: 2009/04/02
 
 input:
      fname: name of the asc file

 output:
      node: node positions of the mesh
      elem: element list of the mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 [node,elem]=readasc(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
readgts


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 522

 [node,elem,edges,edgemap]=readgts(fname)

 read GNU Triangulated Surface files (GTS)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/03/28

 input:
    fname: name of the OFF data file

 output:
    node: node coordinates of the mesh
    elem: list of elements of the surface mesh
    edges: the edge list section in the GTS file (optional)
    edgemap: the face section (in terms of edge indices) in the GTS file
             (optional)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 [node,elem,edges,edgemap]=readgts(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
readinr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 285

 vol=readinr(fname)

 load a volume from an INR file

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/05/03

 input:
      fname: input file name

 output:
      dat: output, data read from the inr file

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 vol=readinr(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
readmedit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 376

 [node,elem,face]=readmedit(filename)

 read Medit mesh format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    fname: name of the medit data file

 output:
    node: node coordinates of the mesh
    elem: list of elements of the mesh	    
    face: list of surface triangles of the mesh	    

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38

 [node,elem,face]=readmedit(filename)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
readmptiff


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 282

 vol=readmptiff(fname)

 load a volume from a multi-page TIFF file

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      fname: input file name

 output:
      dat: output, data read from the TIFF file

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23

 vol=readmptiff(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
readnirfast


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1406

 nirfastmesh=readnirfast(v,f,filestub)

 load a group of mesh files saved in the NIRFAST format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      filestub: output file stub, output will include multiple files
          filestub.node: node file
          filestub.elem: element file to store the surface or tet mesh
          filestub.param: parameter file
          filestub.region: node label file
          filestub.excoef: extinction coeff list

 output:
      nirfastmesh.nodes: node list, 3 columns
      nirfastmesh.elements: element list, 3 or 4 columns integers
      nirfastmesh.bndvtx: boundary flag for each node, 1: on the boundary
      nirfastmesh.region: node segmentation labels
      nirfastmesh.dimension: dimension of the mesh
      nirfastmesh.excoef: extinction coeff list
      nirfastmesh.excoefheader: extinction coeff list field names
      nirfastmesh.type: the header of the .param file
      nirfastmesh.prop: optical property list (non-standard, need further processing)

   format definition see http://www.dartmouth.edu/~nir/nirfast/tutorials/NIRFAST-Intro.pdf

 example:
    [node,face,elem]=meshabox([0 0 0],[10 10 10],0.3,1);
    savenirfast(node,elem,'test', [], ones(size(node)), 'user');
    mymesh=readnirfast('test')
    plotmesh([mymesh.nodes mymesh.bndvtx], mymesh.elements,'x>5')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39

 nirfastmesh=readnirfast(v,f,filestub)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
readoff


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 345

 [node,elem]=readoff(fname)

 read Geomview Object File Format (OFF)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/03/28

 input:
    fname: name of the OFF data file

 output:
    node: node coordinates of the mesh
    elem: list of elements of the mesh	    

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 [node,elem]=readoff(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
readsmf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 333

 [node,elem]=readsmf(fname)

 read simple model format (SMF)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input: 
    fname: name of the	SMF data file

 output:
    node: node coordinates of the mesh
    elem: list of elements of the mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 [node,elem]=readsmf(fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
readtetgen


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 391

 [node,elem,face]=readtetgen(fstub)

 read tetgen output files

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
    fstub: file name stub

 output:
    node: node coordinates of the tetgen mesh
    elem: tetrahedra element list of the tetgen mesh
    face: surface triangles of the tetgen mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36

 [node,elem,face]=readtetgen(fstub)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
regpt2surf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1629
  [A,b,newpos]=regpt2surf(node,elem,p,pmask,A0,b0,cmask,maxiter)
  Perform point cloud registration to a triangular surface
  (surface can be either triangular or cubic), Gauss-Newton method
  is used for the calculation

  author: Qianqian Fang <q.fang at neu.edu>
  date: 12/12/2008

 parameters: 
      node: node coordinate of the surface mesh (nn x 3)
      elem: element list of the surface mesh (3 columns for 
            triangular mesh, 4 columns for cubic surface mesh)
      p: points to be registered, 3 columns for x,y and z respectively
      pmask: a mask vector with the same length as p, determines the 
         method to handle the point, if pmask(i)=-1, the point is a free
         node and can be move by the optimization, if pmask(i)=0, the
         point is fixed; if pmask(i)=n>0, the distance between p(i,:)
         and node(n,:) will be part of the object function and be optimized
      A0: a 3x3 matrix, as the initial guess for the affine A matrix (rotation&scaling)
      b0: a 3x1 vector, as the initial guess for the affine b vector (translation)
      cmask: a binary 12x1 vector, determines which element of [A(:);b] will be optimized
          if cmask(i)=0, the corresponding coefficient will not be updated
      maxiter: a integer, specifying the optimization iterations

 outputs:
      A: 3x3 matrix, the updated affine A matrix
      b: 3x1 vector, the updated affine b vector
      newpos: the registered positions for p, newpos=A*p'+b

 Please find more information at http://iso2mesh.sf.net/cgi-bin/index.cgi?metch

 this function is part of "metch" toobox, see COPYING for license



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  [A,b,newpos]=regpt2surf(node,elem,p,pmask,A0,b0,cmask,maxiter)
  Perform po...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
remeshsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 950

 [newno,newfc]=remeshsurf(node,face,opt)

 remesh a triangular surface and the output is guaranteed to be
 free of self-intersecting element. This function is similar to 
 meshresample, but it can both downsample or upsample a mesh

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 node: list of nodes on the input suface mesh, 3 columns for x,y,z
	 face: list of trianglular elements on the surface, [n1,n2,n3,region_id]
	 opt: function parameters
	   opt.gridsize:  resolution for the voxelization of the mesh
	   opt.closesize: if there are openings, set the closing diameter
	   opt.elemsize:  the size of the element of the output surface
	   if opt is a scalar, it defines the elemsize and gridsize=opt/4

 output:
	 newno:  list of nodes on the resulting suface mesh, 3 columns for x,y,z
	 newfc:  list of trianglular elements on the surface, [n1,n2,n3,region_id]

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41

 [newno,newfc]=remeshsurf(node,face,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
removedupelem


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 313

 elem=removedupelem(elem)

 remove doubly duplicated (folded) elements

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    elem: list of elements (node indices)

 output:
    elem: element list after removing the duplicated elements

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26

 elem=removedupelem(elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
removedupnodes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 504

 [newnode,newelem]=removedupnodes(node,elem)

 removing the duplicated nodes from a mesh

 author: Qianqian Fang <q.fang at neu.edu>

 input:
   elem: integer array with dimensions of NE x 4, each row contains
         the indices of all the nodes for each tetrahedron
   node: node coordinates, 3 columns for x, y and z respectively

 output:
   newnode: nodes without duplicates
   newelem: elements with only the unique nodes


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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45

 [newnode,newelem]=removedupnodes(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
removeisolatednode


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 474

 [no,el]=removeisolatednode(node,elem)

 remove isolated nodes: nodes that are not included in any element

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     node: list of node coordinates
     elem: list of elements of the mesh, can be a regular array or a cell array for PLCs

 output:
     no: node coordinates after removing the isolated nodes
     el: element list of the resulting mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39

 [no,el]=removeisolatednode(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
removeisolatedsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 489

 fnew=removeisolatedsurf(v,f,maxdiameter)

 remove disjointed surface fragment filtered by using mesh diameter

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    v: list of nodes of the input surface
    f: list of triangles of the input surface
    maxdiameter: maximum bounding box size for surface removal

 ouput:
    fnew: new face list after removing the components smaller than 
          maxdiameter

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 fnew=removeisolatedsurf(v,f,maxdiameter)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
rotatevec3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 621

 newpt=rotatevec3d(pt,v1,u1,p0)

 rotate 3D points from one Cartesian coordinate system to another

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   pt: 3D points defined in a standard Cartesian system where a unitary
       z-vector is (0,0,1), 3 columns for x, y and z 
   v1: the unitary z-vector for the target coordinate system
   u1: the unitary z-vector for the source coordinate system, if ignored,
       u1=(0,0,1) 
   p0: offset of the new coordinate system, if ignored, p0=(0,0,0)

 output:
   newpt: the transformed 3D points

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 newpt=rotatevec3d(pt,v1,u1,p0)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
rotmat2vec


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 490

 [R,s]=rotmat2vec(u,v)

 the rotation matrix from vector u to v, satisfying R*u*s=v

 author: Bruno Luong
 URL:http://www.mathworks.com/matlabcentral/newsreader/view_original/827969

 input: 
   u: a 3D vector in the source coordinate system;
   v: a 3D vector in the target coordinate system;

 output:
   R: a rotation matrix to transform normalized u to normalized v
   s: a scaling factor, so that R*u(:)*s=v(:)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23

 [R,s]=rotmat2vec(u,v)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
s2m


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 695

 [node,elem,face]=s2m(v,f,keepratio,maxvol,method)
 [node,elem,face]=s2m(v,f,keepratio,maxvol,'tetgen',regions,holes)

 volumetric mesh generation from a closed surface, shortcut for surf2mesh

 author: Qianqian Fang (q.fang at neu.edu)

 inputs and outputs are similar to those defined in surf2mesh

 if method='cgalpoly', s2m will call cgals2m and keepratio should be a 
 structure (as the 'opt' input in cgals2m)

 input default values:
       method: if ignored, iso2mesh uses surf2mesh ('tetgen') to do the
               tetrahedral mesh generation
       regions,holes: if ignored, iso2mesh assumes both are empty

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,elem,face]=s2m(v,f,keepratio,maxvol,method)
 [node,elem,face]=s2m(v,f...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
s2v


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1061

 [img,v2smap]=s2v(node,face,div)

 shortcut for surf2vol, coverting a surface to a volumetric image

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 node: node list of the triangular surface, 3 columns for x/y/z
	 face: triangle node indices, each row is a triangle
	 div:  division number along the shortest edge of the mesh (resolution)
              if not given, div=50

 output:
	 img: a volumetric binary image at position of ndgrid(xi,yi,zi)
        v2smap (optional): a 4x4 matrix denoting the Affine transformation to map
             the voxel coordinates back to the mesh space. One can use the 
             v2smap to convert a mesh generated from the rasterized volume
             into the original input mesh space (work coordinate system). For example:

             [img,map]=s2v(node,face);
             [no,el]=v2s(img,0.5,5);
             newno=map*[no ones(length(no),1)]';
             newno=newno(1:3,:)'; % newno and el now go back to the world coordinates

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33

 [img,v2smap]=s2v(node,face,div)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
saveabaqus


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 567

 saveabaqus(node,fname)
 saveabaqus(node,face,fname)
 saveabaqus(node,face,elem,fname)

 save a tetrahedral and/or surface mesh as an ABAQUS input file

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/07/05

 input:
      node: input, surface node list, dimension (nn,3)
      face: input, surface face element list, dimension (be,3)
      elem: input, tetrahedral element list, dimension (ne,4)
      fname: output file name
      heading: optional, a descriptive string for the mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 saveabaqus(node,fname)
 saveabaqus(node,face,fname)
 saveabaqus(node,face,e...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
saveasc


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 360

 saveasc(v,f,fname)

 save a surface mesh to FreeSurfer ASC mesh format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/04/02

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 saveasc(v,f,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
savebinstl


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 491

 savebinstl(node,elem,fname,solidname)

 save a tetrahedral mesh to a binary STL (Standard Tessellation Language) file

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/02/14

 input:
      node: input, surface node list, dimension Nx3
      elem: input, tetrahedral element list; if size(elem,2)==3, it is a surface
      fname: output file name
      solidname: an optional string for the name of the object

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39

 savebinstl(node,elem,fname,solidname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
savedxf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 423

 savedxf(node,face,elem,fname)

 save a surface mesh to DXF format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2010/04/25

 input:
      node: input, surface node list, dimension (nn,3)
      face: input, surface face element list, dimension (be,3)
      elem: input, tetrahedral element list, dimension (ne,4)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31

 savedxf(node,face,elem,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
savegts


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 502

 nedge=savegts(v,f,fname,edges)

 save a surface mesh to GNU Triangulated Surface Format (GTS)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/02/23

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name
      edges: edge list, if ignored, savegts will compute

 output:
      nedge: the number of unique edges in the mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 nedge=savegts(v,f,fname,edges)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
saveinr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 266

 saveinr(vol,fname)

 save a surface mesh to INR Format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/01/04

 input:
      vol: input, a binary volume
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 saveinr(vol,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
savejmesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1581

 savejmesh(node,face,elem,fname,opt)

 export a mesh to the JMesh format defined in http://github.com/fangq/jmesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/10/06

 input:
      node: input, node list, dimension (nn,3)
      face: input, optional, surface face element list, dimension (be,3)
      elem: input, tetrahedral element list, dimension (ne,4)
      fname: output file name; if file name has a suffix .bmsh or .bmesh, 
           the mesh data will be saved in the binary jmesh format; otherwise,
           the file will be saved as a text-based jmesh (which is a plain 
           JSON file)
      opt: additional parameters in the form of 'parameter',value pairs
           valid parameters include:
           'Dimension': 0 - a user defined mesh, 2- a 2D mesh, 3- a 3D mesh
           'Author': a string to set the author of the mesh
           'MeshTitle': a string to set the title of the mesh
           'MeshTag': a value as the tag of the mesh data
           'Comment': a string as the additional note for the mesh data

           please type 'help savejson' and 'help saveubjson' to see additional 
           supported options    

 examples:

    [no,fc,el]=meshabox([0 0 0],[60,30,40],3,10);
    savejmesh(no,fc,[],'box_surf.jmsh','dimension',3);
    savejmesh(no,fc,el,'box_zlib.jmsh','compression','zlib');
    savejmesh(no,fc,el,'box.bmsh','dimension',3);
    savejmesh(no,fc,el,'box_zlib.bmsh','dimension',3,'compression','zlib');
    mesh=loadubjson('box.bmsh')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37

 savejmesh(node,face,elem,fname,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
savemedit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 457

 savemedit(node,face,elem,fname)

 save a surface or tetrahedral mesh to Medit format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2010/10/30

 input:
      node: input, surface node list, dimension (nn,3 or 4)
      face: input, surface face element list, dimension (be,3 or 4)
      elem: input, tetrahedral element list, dimension (ne,4 or 5)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33

 savemedit(node,face,elem,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
savemphtxt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 491

 savemphtxt(node, face, elem, filename)

 save tetrahedron mesh to comsol file (.mphtxt)

 author: Donghyeon Kim (danielkim<at> gist.ac.kr)
 date: 2011/09/29

 input:
      node: input, node list, dimension (nn,3)
      face: input, surface face element list with label, dimension (be,4)
      elem: input, tetrahedron element list with label, dimension (ne,5)
      filename: input, output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 savemphtxt(node, face, elem, filename)

 save tetrahedron mesh to comsol...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
savemsh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 492

 savemsh(node,elem,fname,rname)

 save a tetrahedral mesh to GMSH mesh format

 author: Riccardo Scorretti (riccardo.scorretti<at> univ-lyon1.fr)
 date: 2013/07/22

 input:
      node: input, node list, dimension (nn,3)
      elem: input, tetrahedral mesh element list, dimension (ne,4) or (ne,5) for multi-region meshes
      fname: output file name
      rname: name of the regions, cell-array of strings (optional)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 savemsh(node,elem,fname,rname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
savenirfast


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1715

 savenirfast(nirfaststruct,filestub)
    or
 savenirfast(v,f,filestub, nodeseg, proptype, proptype)

 save a tetrahedral or surface mesh and associated properties to NIRFAST format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      nirfaststruct: a structure storing the NIRFAST mesh data, type 
         'help readnirfast' to read more; alternatively one can use:
      v: input, node list, the first 3 columns are the x/y/z positions,
         the remaining columns are combined with nodeprop as node-based
         (optical) parameters
      f: input, tetrahedral or surface element list, dimension (ne,3)
      filestub: output file stub, output will include multiple files
          filestub.node: node file
          filestub.elem: element file to store the surface or tet mesh
          filestub.param: parameter file
          filestub.region: node label file
      nodeseg: optional, an integer label field to group nodes into
         segmentations, same length as v, number starting from 0; or empty
      nodeprop: optional, additional nodal parameters, typically defined
         as mua (1/mm), musp (1/mm) and refractive index (n)l; row number
         equals to that of v, column number is user-defined
      proptype: optional, the type of the node-property. by default it is 
         'stnd' - for standard properties; one can also define multi-row
         header using a cell-array.

 example:
    [node,face,elem]=meshabox([0 0 0],[10 10 10],0.3,1);
    savenirfast(node,elem,'test', [], ones(size(node)), 'user');
    mymesh=readnirfast('test')
    plotmesh([mymesh.nodes mymesh.bndvtx], mymesh.elements,'x>5')

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 savenirfast(nirfaststruct,filestub)
    or
 savenirfast(v,f,filestub, nodes...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
saveoff


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 367

 saveoff(v,f,fname)

 save a surface mesh to Geomview Object File Format (OFF)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/03/28

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 saveoff(v,f,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
savesmf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 344

 savesmf(v,f,fname)

 save a surface mesh to smf format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 savesmf(v,f,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
savestl


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 482

 savestl(node,elem,fname,solidname)

 save a tetrahedral mesh to an STL (Standard Tessellation Language) file

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/02/14

 input:
      node: input, surface node list, dimension Nx3
      elem: input, tetrahedral element list; if size(elem,2)==3, it is a surface
      fname: output file name
      solidname: an optional string for the name of the object

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36

 savestl(node,elem,fname,solidname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
savesurfpoly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 919

 savesurfpoly(v,f,holelist,regionlist,p0,p1,fname)

 save a set of surfaces into poly format (for tetgen)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
      v: input, surface node list, dimension (nn,3)
         if v has 4 columns, the last column specifies mesh density near each node
      f: input, surface face element list, dimension (be,3)
      holelist: list of holes, each hole is represented by an internal point
      regionlist: list of regions, similar to holelist
      p0: coordinate of one of the end of the bounding box
      p1: coordinate for the other end of the bounding box
      fname: output file name
      forcebox: non-empty: add bounding box, []: automatic
                if forcebox is a 8x1 vector, it will be used to 
                specify max-edge size near the bounding box corners

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51

 savesurfpoly(v,f,holelist,regionlist,p0,p1,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
savetetgenele


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 423

 savetetgenele(elem,fname)

 save a mesh tetrahedral element list to tetgen .ele format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      elem: tetrahedral element list, dimension (ne,4)
            columns beyound the 4rd column are treated as 
            markers and attributes associated with the element
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27

 savetetgenele(elem,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
savetetgennode


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 399

 savetetgennode(node,fname)

 save a mesh node list to tetgen .node format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
      node: node coordinates, dimension (nn,3)
            columns beyound the 3rd column are treated as 
            markers and attributes associated with the node
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 savetetgennode(node,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
savevrml


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 429

 savevrml(node,face,elem,fname)

 save a surface mesh to VRML 1.0 format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2010/04/25

 input:
      node: input, surface node list, dimension (nn,3)
      face: input, surface face element list, dimension (be,3)
      elem: input, tetrahedral element list, dimension (ne,4)
      fname: output file name

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 savevrml(node,face,elem,fname)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
slicesurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 862

 [bcutpos, bcutloop]=slicesurf(node, face, varargin)

 Slice a closed surface by a plane and extract the intersection curve as a
 polyline loop

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    node: an N x 3 array defining the 3-D positions of the mesh
    face: an N x 3 interger array specifying the surface triangle indices;

 output:
    bcutpos: the nodes on the intersection curve
    bcutloop: the sequential order of the nodes to form a polyline loop;
          the last node is assumed to be connected to the first node; an
          nan indicates the end of a loop; the intersection may contain
          multiple loops; if only bcutpos is returned, the nodes will be
          made in sequential order.


 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53

 [bcutpos, bcutloop]=slicesurf(node, face, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
slicesurf3


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1764

 [leftpt,leftcurve,rightpt,rightcurve]=slicesurf3(node,elem,p1,p2,p3,step,minangle)

 Slice a closed surface by a plane and extract the landmark nodes along
 the intersection between p1 and p3, then output into 2 segments: between
 p2 to p1 (left half), and p2 to p3 (right half)

 author: Qianqian Fang (q.fang at neu.edu)

 input:
    node: an N x 3 array defining the 3-D positions of the mesh
    elem: an N x 3 interger array specifying the surface triangle indices;
    p1: 3D position of the start on the curve-of-interest
    p2: 3D position of the middle on the curve-of-interest
    p3: 3D position of the end on the curve-of-interest
    step: (optional) a percentage (0-100) specifying the spacing of the
        output landmark nodes; step=20 means the landmarks on the left
        curve are spaced as 20% of the total lengths of the left-half, and
        those on the right-curve are spaced at 20% of the right-half,
        starting from p2.
    minangle: (optional) a positive minangle will ask this function to
        call polylinesimplify to remove sharp turns on the curve.

 output:
    leftpt: the equal-spaced landmark nodes on the left-half (p2-p1)
            intersection curve; spacing between these nodes are
            (step% * length of the curve between p2-p1)
    leftcurve: all nodes on the left-half (p2-p1) intersection curve
    rightpt: the equal-spaced landmark nodes on the right-half (p2-p3)
            intersection curve; spacing between these nodes are
            (step% * length of the curve between p2-p3)
    rightcurve: all nodes on the left-half (p2-p1) intersection curve

 -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
    License: GPL v3 or later, see LICENSE.txt for details




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [leftpt,leftcurve,rightpt,rightcurve]=slicesurf3(node,elem,p1,p2,p3,step,mi...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
smoothbinvol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 357

 vol=smoothbinvol(vol,layer)

 perform a memory-limited 3D image smoothing

 author: Qianqian Fang <q.fang at neu.edu>

 input:
     vol: a 3D volumetric image to be smoothed
     layer: number of iterations for the smoothing

 output:
     vol: the volumetric image after smoothing

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29

 vol=smoothbinvol(vol,layer)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
smoothsurf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1313

 p=smoothsurf(node,mask,conn,iter,useralpha,usermethod,userbeta)

 smoothing a surface mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
    node:  node coordinates of a surface mesh
    mask:  flag whether a node is movable: 0 movable, 1 non-movable
           if mask=[], it assumes all nodes are movable
    conn:  input, a cell structure of length size(node), conn{n}
           contains a list of all neighboring node ID for node n,
           this can be computed from meshconn function
    iter:  smoothing iteration number
    useralpha: scaler, smoothing parameter, v(k+1)=(1-alpha)*v(k)+alpha*mean(neighbors)
    usermethod: smoothing method, including 'laplacian','laplacianhc' and 'lowpass'
    userbeta: scaler, smoothing parameter, for 'laplacianhc'

 output:
    p: output, the smoothed node coordinates

 recommendations
    Based on [Bade2006], 'Lowpass' method outperforms 'Laplacian-HC' in volume
    preserving and both are significantly better than the standard Laplacian method

    [Bade2006]  R. Bade, H. Haase, B. Preim, "Comparison of Fundamental Mesh 
                Smoothing Algorithms for Medical Surface Models," 
                Simulation and Visualization, pp. 289-304, 2006. 

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65

 p=smoothsurf(node,mask,conn,iter,useralpha,usermethod,userbeta)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
sms


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 577

 newnode=sms(node,face,iter,useralpha,method)

 simplified version of surface mesh smoothing

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/10/21

 input:
    node:  node coordinates of a surface mesh
    face:  face element list of the surface mesh
    iter:  smoothing iteration number
    alpha: scaler, smoothing parameter, v(k+1)=alpha*v(k)+(1-alpha)*mean(neighbors)
    method: same as in smoothsurf, default is 'laplacianhc'

 output:
    newnode: output, the smoothed node coordinates

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46

 newnode=sms(node,face,iter,useralpha,method)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
sortmesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 991

 [no,el,fc]=sortmesh(origin,node,elem,face)

 sort nodes and elements in a mesh so that the indexed
 nodes and elements are closer to each order
 (this may reduce cache-miss in a calculation)

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2010/05/06

 input:
    origin: sorting all nodes and elements with the distance and
            angles wrt this location, if origin=[], it will be 
            node(1,:)
    node: list of nodes
    elem: list of elements (each row are indices of nodes of each element)
    ecol: list of columns in elem to participate sorting
    face: list of surface triangles (this can be omitted)
    fcol: list of columns in face to participate sorting

 output:
    no: node coordinates in the sorted order
    el: the element list in the sorted order
    fc: the surface triangle list in the sorted order (can be ignored)
    nodemap: the new node mapping order, no=node(nodemap,:)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44

 [no,el,fc]=sortmesh(origin,node,elem,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
surf2mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1224

 [node,elem,face]=surf2mesh(v,f,p0,p1,keepratio,maxvol,regions,holes,forcebox)

 create quality volumetric mesh from isosurface patches

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/24

 input parameters:
      v: input, isosurface node list, dimension (nn,3)
         if v has 4 columns, the last column specifies mesh density near each node
      f: input, isosurface face element list, dimension (be,3)
      p0: input, coordinates of one corner of the bounding box, p0=[x0 y0 z0]
      p1: input, coordinates of the other corner of the bounding box, p1=[x1 y1 z1]
      keepratio: input, percentage of elements being kept after the simplification
      maxvol: input, maximum tetrahedra element volume
      regions: list of regions, specifying by an internal point for each region
      holes: list of holes, similar to regions
      forcebox: 1: add bounding box, 0: automatic

 outputs:
      node: output, node coordinates of the tetrahedral mesh
      elem: output, element list of the tetrahedral mesh
      face: output, mesh surface element list of the tetrahedral mesh 
             the last column denotes the boundary ID

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79

 [node,elem,face]=surf2mesh(v,f,p0,p1,keepratio,maxvol,regions,holes,forcebox)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
surf2vol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1279

 [img, v2smap]=surf2vol(node,face,xi,yi,zi,'options',values,...)

 convert a triangular surface to a shell of voxels in a 3D image

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 node: node list of the triangular surface, 3 columns for x/y/z
	 face: triangle node indices, each row is a triangle
              if face contains the 4th column, it indicates the label of
              the face triangles (each face componment must be closed); if
              face contains 5 columns, it stores a tetrahedral mesh with
              labels, where the first 4 columns are the element list and 
              the last column is the element label;
	 xi,yi,zi: x/y/z grid for the resulting volume
        options: 'fill', if set to 1, the enclosed voxels are labeled by 1
                 'label', if set to 1, the enclosed voxels are labeled by
                          the corresponding label of the face or element;
                          setting 'label' to 1 also implies 'fill'.

 output:
	 img: a volumetric binary image at position of ndgrid(xi,yi,zi)
        v2smap (optional): a 4x4 matrix denoting the Affine transformation to map
             the voxel coordinates back to the mesh space.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65

 [img, v2smap]=surf2vol(node,face,xi,yi,zi,'options',values,...)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
surf2volz


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 488

 img=surf2volz(node,face,xi,yi,zi)

 convert a triangular surface to a shell of voxels in a 3D image
 along the z-axis

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 node: node list of the triangular surface, 3 columns for x/y/z
	 face: triangle node indices, each row is a triangle
	 xi,yi,zi: x/y/z grid for the resulting volume

 output:
	 img: a volumetric binary image at position of ndgrid(xi,yi,zi)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35

 img=surf2volz(node,face,xi,yi,zi)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
surfaceclean


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 415

 f=surfaceclean(f,v)

 remove surface patches that are located inside 
               the bounding box faces

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2008/04/08

 input: 
      v: surface node list, dimension (nn,3)
      f: surface face element list, dimension (be,3)  

 output:
      f: faces free of those on the bounding box

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21

 f=surfaceclean(f,v)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
surfacenorm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 601

 snorm=surfacenorm(node,face)
    or
 snorm=surfacenorm(node,face,'Normalize',0)

 compute the normal vectors for a triangular surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)
   opt: a list of optional parameters, currently surfacenorm supports:
        'Normalize': [1|0] if set to 1, the normal vectors will be 
                           unitary (default)

 output:
   snorm: output surface normal vector at each face

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 snorm=surfacenorm(node,face)
    or
 snorm=surfacenorm(node,face,'Normalize...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
surfboolean


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2742

 [newnode,newelem,newelem0]=surfboolean(node1,elem1,op2,node2,elem2,op3,node3,elem3,...)

 merge two or more triangular meshes and resolve intersecting elements
 
 author: Qianqian Fang <q.fang at neu.edu>

 input:
      node: node coordinates, dimension (nn,3)
      elem: triangle surfaces (ne,3)
      op:  a string of a boolean operator, possible op values include
           'union' or 'or': the outter surface of the union of the enclosed space
           'inter' or 'and': the surface of the domain contained by both meshes
           'diff' or '-': the surface of the domain in mesh 1 excluding that of
                   mesh 2
           'all', 'resolve', or 'xor' or '+': the output contains 4 subsurfaces, identified by the 4th
                  column of newelem:
                    1: mesh 1 outside of mesh 2
                    2: mesh 2 outside of mesh 1
                    3: mesh 1 inside of mesh 2
                    4: mesh 2 inside of mesh 1
                  you can use newelem(find(mod(newelem(:,4),2)==1),:) to
                  get mesh 1 cut by mesh 2, or newelem(find(mod(newelem(:,4),2)==0),:) 
                  to get mesh 2 cut by mesh 1;
           'first': combine 1 and 3 from the output of 'all'
           'second': combine 2 and 4 from the output of 'all'
           'self': test for self-intersections; only the first mesh is
                   tested; other inputs are ignored.
           'remesh': remesh the first input mesh (2nd input mesh is ignored)
           'decouple': separate two shells and make sure there is no intersection;
                   the input surfaces must be closed and ordered from outer to inner

           if a dash '-' is preceding a command, including
              -diff, -union, -isct, -resolve, -first, -second, -xor
           a 'remesh' operation is applied to the output mesh to remove poorly shaped 
           triangles

 output:
      newnode: the node coordinates after boolean operations, dimension (nn,3)
      newelem: tetrahedral element or surfaces after boolean operations (nn,4) or (nhn,5)
      newelem0: when the operator is 'self', return the intersecting
               element list in terms of the input node list (experimental)

 example:

   [node1,face1,elem1]=meshabox([0 0 0],[10 10 10],1,1);
   [node2,face2,elem2]=meshabox([0 0 0]+5,[10 10 10]+5,1,1);
   [newnode,newface]=surfboolean(node1,face1,'union',node2,face2);
   plotmesh(newnode,newface);
   [newnode,newface]=surfboolean(node1,face1,'-union',node2,face2);
   figure; plotmesh(newnode,newface);
   [newnode,newface]=surfboolean(node1,face1,'diff',node2,face2);
   figure;plotmesh(newnode,newface,'x>5');

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [newnode,newelem,newelem0]=surfboolean(node1,elem1,op2,node2,elem2,op3,node...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
surfdiffuse


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 672

 valnew=surfdiffuse(node,tri,val,ddt,iter,type1,opt)

 apply a smoothing/diffusion process on a surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     node: list of nodes of the surface mesh
     tri: triangular element list of the surface
     val: vector, scalar value for each node
     ddt: diffusion coefficient multiplied by delta t
     iter: iterations for applying the smoothing
     type1: indices of the nodes which will not be updated
     opt: method, 'grad' for gradient based, and 'simple' for simple average

 output:
     valnew: nodal value vector after the smoothing

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53

 valnew=surfdiffuse(node,tri,val,ddt,iter,type1,opt)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
surfedge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 531

 [openedge,elemid]=surfedge(f)

 find the edge of an open surface or surface of a volume

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2007/11/21

 input:
      f: input, surface face element list, dimension (be,3)

 output:
      openedge: list of edges of the specified surface
      elemid (optional): the corresponding index of the 
                tetrahedron of an open-edge or triangle, 
                elemid has the same length as openedge.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31

 [openedge,elemid]=surfedge(f)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
surfinterior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 712

 [pt,p0,v0,t,idx]=surfinterior(node,face)

 identify a point that is enclosed by the (closed) surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)

 output:
   pt: the interior point coordinates [x y z]
   p0: ray origin used to determine the interior point
   v0: the vector used to determine the interior point
   t : ray-tracing intersection distances (with signs) from p0. the
       intersection coordinates can be expressed as p0+t(i)*v0
   idx: index to the face elements that intersect with the ray, order
       match that of t

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42

 [pt,p0,v0,t,idx]=surfinterior(node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
surfpart


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 455

 elist=surfpart(f,loopedge)

 partition a triangular surface using a closed loop defined by existing edges

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/02/09

 input:
      f: input, surface face element list, dimension (be,3)
      loopedge: a 2-column array, specifying a closed loop in CCW order

 output:
      elist: list of triangles that is enclosed by the loop

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 elist=surfpart(f,loopedge)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
surfplane


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 431

 plane=surfplane(node,face)

 plane equation coefficients for each face in a surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)

 output:
   plane: a (ne x 4) array, in each row, it has [a b c d]
        to denote the plane equation as "a*x+b*y+c*z+d=0"

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 plane=surfplane(node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
surfreorient


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 526

 [newnode,newface]=surfreorient(node,elem)

 reorder nodes in a single closed surface to ensure the norms of all
 triangles are pointing outward

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/07/06

 input:
    node: list of nodes
    face: list of surface triangles (each row are indices of nodes of each triangle)

 output:
    newnode: the output node list, in most cases it equals node
    newface: the face list with consistent ordering

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43

 [newnode,newface]=surfreorient(node,elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
surfseeds


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 436

 seeds=surfseeds(node,face)

 calculate a set of interior points with each enclosed by a closed
 component of a surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
   node: a list of node coordinates (nn x 3)
   face: a surface mesh triangle list (ne x 3)

 output:
   seeds: the interior points coordinates for each closed-surface
          component

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28

 seeds=surfseeds(node,face)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
surfvolume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 332

 vol=surfvolume(node,face,option)

 calculate the enclosed volume for a closed surface

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    node:  node coordinates
    face:  surface triangle list

 output:
    vol:   total volume of the enclosed space

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34

 vol=surfvolume(node,face,option)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
thickenbinvol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 503

 vol=thickenbinvol(vol,layer)

 thickening a binary volume by a given pixel width
 this is similar to bwmorph(vol,'thicken',3) except 
 this does it in 3d and only does thickening for 
 non-zero elements (and hopefully faster)

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     vol: a volumetric binary image
     layer: number of iterations for the thickenining

 output:
     vol: the volume image after the thickening

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 vol=thickenbinvol(vol,layer)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
thinbinvol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 603

 vol=thinbinvol(vol,layer,nobd)

 thinning a binary volume by a given pixel width
 this is similar to bwmorph(vol,'thin',n) except 
 this does it in 3d and only run thinning for 
 non-zero elements (and hopefully faster)

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     vol: a volumetric binary image
     layer: number of iterations for the thickenining
     nobd: (optional) if set to 1, boundaries will not 
            erode. if not given, nobd=0.

 output:
     vol: the volume image after the thinning operations

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32

 vol=thinbinvol(vol,layer,nobd)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
uniqedges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 582

 [edges,idx,edgemap]=uniqedges(elem)

 return the unique edge list from a surface or tetrahedral mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     elem: a list of elements, each row is a list of nodes for an element.
           elem can have 2, 3 or 4 columns

 output:
     edge: unique edges in the mesh, denoted by a pair of node indices
     idx:  index of the output in the raw edge list (returned by meshedge)
     edgemap: index of the raw edges in the output list (for triangular mesh)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37

 [edges,idx,edgemap]=uniqedges(elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
uniqfaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 577

 [faces,idx,facemap]=uniqfaces(elem)

 return the unique face list from a or tetrahedral mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
     elem: a list of elements, each row is a list of nodes for an element.
           elem can have 2, 3 or 4 columns

 output:
     face: unique faces in the mesh, denoted by a triplet of node indices
     idx:  index of the output in the raw face list (returned by meshface)
     facemap: index of the raw faces in the output list (for triangular mesh)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37

 [faces,idx,facemap]=uniqfaces(elem)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
v2m


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 331

 [node,elem,face]=v2m(img,isovalues,opt,maxvol,method)

 volumetric mesh generation from binary or gray-scale volumetric images
 shortcut for vol2mesh

 author: Qianqian Fang (q.fang at neu.edu)

 inputs and outputs are similar to those defined in vol2mesh

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55

 [node,elem,face]=v2m(img,isovalues,opt,maxvol,method)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
v2s


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 411

 [no,el,regions,holes]=v2s(img,isovalues,opt,method)

 surface mesh generation from binary or gray-scale volumetric images
 shortcut for vol2surf

 author: Qianqian Fang (q.fang at neu.edu)

 inputs and outputs are similar to those defined in vol2surf; In v2s, 
 method can be set to 'cgalmesh' in addition to those allowed by vol2surf.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53

 [no,el,regions,holes]=v2s(img,isovalues,opt,method)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
varargin2struct


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 670

 opt=varargin2struct('param1',value1,'param2',value2,...)
   or
 opt=varargin2struct(...,optstruct,...)

 convert a series of input parameters into a structure

 authors:Qianqian Fang (q.fang <at> neu.edu)
 date: 2012/12/22

 input:
      'param', value: the input parameters should be pairs of a string and a value
       optstruct: if a parameter is a struct, the fields will be merged to the output struct

 output:
      opt: a struct where opt.param1=value1, opt.param2=value2 ...

 license:
     BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details 

 -- this function is part of JSONLab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 opt=varargin2struct('param1',value1,'param2',value2,...)
   or
 opt=varargi...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
vol2mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1782

 [node,elem,face,regions]=vol2mesh(img,ix,iy,iz,opt,maxvol,dofix,method,isovalues)

 convert a binary (or multi-valued) volume to tetrahedral mesh

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 img: a volumetric binary image
	 ix,iy,iz: subvolume selection indices in x,y,z directions
	 opt: as defined in vol2surf.m
	 maxvol: target maximum tetrahedral elem volume
                when method='cgalmesh', maxvol can specify the target
                for each label (subregion index) by the following syntax
                'label1=size1:label2=size2:...'
	 dofix: 1: perform mesh validation&repair, 0: skip repairing
	 method: 'cgalsurf' or omit: use CGAL surface mesher
		 'simplify': use binsurface and then simplify
		 'cgalmesh': use CGAL 3.5 3D mesher for direct mesh generation [new]

		 generally speaking, 'cgalmesh' is the most robust path
		 if you want to product meshes from binary or multi-region
		 volumes, however, its limitations include 1) only accept 
		 uint8 volume, and 2) can not extract meshes from gray-scale
		 volumes. If ones goal is to process a gray-scale volume,
		 he/she should use the 'cgalsurf' option. 'simplify' approach
		 is not recommended unless other options has failed.
	 isovalues: a list of isovalues where the levelset is defined

 output:
	 node: output, node coordinates of the tetrahedral mesh
	 elem: output, element list of the tetrahedral mesh, the last 
	       column is the region ID
	 face: output, mesh surface element list of the tetrahedral mesh
	       the last column denotes the boundary ID
        region: optional output. if opt.autoregion is set to 1, region
              saves the interior points for each closed surface component

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,elem,face,regions]=vol2mesh(img,ix,iy,iz,opt,maxvol,dofix,method,isov...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
vol2restrictedtri


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1008

 [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode)

 surface mesh extraction using CGAL mesher

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/01/06

 input:
       vol: a 3D volumetric image
       thres: a scalar as the threshold of of the extraction
       cent: a 3d position (x,y,z) which locates inside the resulting
             mesh, this is automatically computed from vol2surf
       brad: maximum bounding sphere squared of the resulting mesh
       ang: minimum angular constrains of the resulting tranglar elements
            (in degrees)
       radbound: maximum triangle delaunay circle radius
       distbound: maximum delaunay sphere distances
       maxnode: maximum number of surface nodes (even radbound is not reached)
 output:
       node: the list of 3d nodes in the resulting surface (x,y,z)
       elem: the element list of the resulting mesh (3 columns of integers)

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

 [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,ma...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
vol2surf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2507

 [no,el,regions,holes]=vol2surf(img,ix,iy,iz,opt,dofix,method,isovalues)

 converting a 3D volumetric image to surfaces

 author: Qianqian Fang (q.fang at neu.edu)

 input:
	 img: a volumetric binary image; if img is empty, vol2surf will
	      return user defined surfaces via opt.surf if it exists
	 ix,iy,iz: subvolume selection indices in x,y,z directions
	 opt: function parameters
	   if method is 'cgalsurf' or 'cgalpoly':
	     opt=a float number>1: max radius of the Delaunay sphere(element size) 
	     opt.radbound: same as above, max radius of the Delaunay sphere
	     opt.distbound: maximum deviation from the specified isosurfaces
	     opt(1,2,...).radbound: same as above, for each levelset
	   if method is 'simplify':
	     opt=a float number<1: compression rate for surf. simplification
	     opt.keepratio=a float less than 1: same as above, same for all surf.
	     opt(1,2,..).keepratio: setting compression rate for each levelset
	   opt(1,2,..).maxsurf: 1 - only use the largest disjointed surface
				0 - use all surfaces for that levelset
          opt(1,2,..).side: - 'upper': threshold at upper interface
                              'lower': threshold at lower interface
	   opt(1,2,..).maxnode: - the maximum number of surface node per levelset
	   opt(1,2,..).holes: user specified holes interior pt list
	   opt(1,2,..).regions: user specified regions interior pt list
	   opt(1,2,..).surf.{node,elem}: add additional surfaces
	   opt(1,2,..).{A,B}: linear transformation for each surface
	   opt.autoregion: if set to 1, vol2surf will try to determine 
              the interior points for each closed surface automatically
	 dofix: 1: perform mesh validation&repair, 0: skip repairing
	 method: - if method is 'simplify', iso2mesh will first call
		   binsurface to generate a voxel-based surface mesh and then
		   use meshresample/meshcheckrepair to create a coarser mesh;
		 - if method is 'cgalsurf', iso2mesh will call the surface
		   extraction program from CGAL to make surface mesh
		 - if method is not specified, 'cgalsurf' is assumed by default
	 isovalues: a list of isovalues where the levelset is defined

 output: 
	 no:  list of nodes on the resulting suface mesh, 3 columns for x,y,z
	 el:  list of trianglular elements on the surface, [n1,n2,n3,region_id]
	 regions: list of interior points for all sub-region, [x,y,z]
	 holes:   list of interior points for all holes, [x,y,z]

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73

 [no,el,regions,holes]=vol2surf(img,ix,iy,iz,opt,dofix,method,isovalues)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
volface


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 508

 [openface,elemid]=volface(t)

 find the surface patches of a volume

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/10/13

 input:
      t: input, volumetric element list, dimension (ne,4)

 output:
      openface: list of faces of the specified volume
      elemid (optional): the corresponding index of the 
                tetrahedron of an open-edge or triangle, 
                elemid has the same length as openedge.

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




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30

 [openface,elemid]=volface(t)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
volmap2mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 693

 [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 (q.fang at neu.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)




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73

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





