[Insight-developers] Re: itkMesh

Brad King brad.king at kitware.com
Thu Jun 29 16:58:30 EDT 2000


Luis,

One quick comment:  please email questions like this to the entire
list.  That way everyone can benefit from both the question and the
response.  Thanks.

Your deduction that "Identifier" is an index into the corresponding
container is correct.  The identifiers should not be iterators because
they cannot be stored to files or displayed easily.  Instead, the
"IndexedContainer" interface defines access routines to get at the values
through an identifier, while also providing iteration if it is needed for
an operation.  Please note that the container types specified in the
"MeshType" structure must conform to the "IndexedContainer" interface, and
cannot be STL containers directly.

Your question about how to setup a mesh in which insertions and deletions
occur frequently is the reason we have the generic "MeshType" approach to
defining the Mesh class.  We figured that most of the time people would be
creating static meshes, and working through operations on only data values
associated with entities in the mesh.  We knew, however, that some people
would like to do a lot of insertions and deletions of points, cells, and
boundaries.

What you need to do is define a replacement for the
"MeshTypeDefaults" class that uses "MapContainer" instead of
"VectorContainer".  Make sure each "MapContainer" is setup to be indexed
by the corresponding Identifier type for the container's purpose.  I have
been planning on creating such an alternate default as a standard part of
Insight, but I was going to define a new "HashMapContainer" to speed up
operations, and then use that in a "MeshTypeDefaultsDynamic" (or some
similar name) class.  Once such a class has been defined, then you can
use:

typedef itk::Mesh< (pixel type) , MeshTypeDefaultsDynamic >  MyMesh;
MyMesh::Pointer myMesh = MyMesh::New();

If you need any more explanation, feel free to ask.  I have already added
appropriate comments to the Cell classes for DOXYGEN, and some of them for
Mesh and MeshTypeDefaults as well.  I have run doxygen on the source tree,
and it produces really nice documentation for these classes.  Hopefully we
will get an official web site up with this documentation built from the
latest CVS source soon.

Good luck,
-Brad

On Thu, 29 Jun 2000, Luis Ibanez wrote:

> 
> Hi Brad, Will,
> 
> We are studying the Mesh and its related classes,
> and would like to verify if we are not missing
> something important.
> 
> This family of  classes is templated by "Type"
> (ie. MeshType, CellType) and the type provides
> some traits.
> 
> Among them, we are confused about the
> "Identifiers", like PointIdentifier,  CellIdentifier,...
> 
> We are first trying to create a 2D surface in
> 3D space. ( a classical triangular mesh ).
> 
> Following the code in itkMeshTypeDefault,
> the identifiers are by default   "unsigned long"
> that can be used as indexes in the STL container
> of the Point, Cell,... etc.
> 
> Is that correct ?
> 
> At some point we got the impression that the identifiers
> could be defined directly  as iterators pointing to the
> elements in a STL container.  Our main concern was that
> using numerical indexes, some dynamic operations like
> inserting a point in the nth position or removing the point
> in the nth will invalidate the identifiers of the m>n points.
> (well, the same is true for iterator, except if we use linked
> lists...)
> 
> Could you recomend us a good way to setup a mesh
> in which insertions and removals will occurr frequently.
> 
> 
> Thanks
> 
> 
> Luis
> 
> --
> ______________________________________________________________________
> 
> Luis Ibanez
> Research Assistant Professor - Division of Neurosurgery
> University of North Carolina at Chapel Hill
> Sitterson Hall, CB#3175, Chapel Hill, NC 27599
> email : ibanez at cs.unc.edu       home  : http://www.cs.unc.edu/~ibanez
> phone : (919)-843-9961          fax   : (919)-962-1799
> ______________________________________________________________________
> 
> 





More information about the Insight-developers mailing list