[Insight-users] itk::Mesh - boundary assignments?

Thomas Boettger t . boettger at dkfz-heidelberg . de
Tue, 14 Oct 2003 19:03:29 +0200


Hi Luis,

thanks for this detailed description. I wanted to use the following of 
your example code lines:

BoundaryAssignmentsContainerPointer cntlines =
                     mesh->GetBoundaryAssignments( 1 );
  BoundaryAssignementIdentifier key0( 267, 0 );
  lineCellId0 = cntlines[ key0 ];

The problem is the typedefs for BoundaryAssignmentsContainer and the 
class BoundaryAssignementIdentifier are protected members of the Mesh 
class. Is this accident or design and shall only mesh classes and 
subclasses get access to the boundary members?

Or maybe I din't understand something.


Regards,
Thomas



Luis Ibanez wrote:

 >
 > Hi Thomas,
 >
 >
 > The Boundary assigment is intended to stablish a relationship
 > between neighbor cells.
 >
 > Every cell in the mesh has a unique identifier, regardless of
 > its dimension.
 >
 > The SetBoundaryAssignment() method has parameters
 >
 >    Dimension
 >    cellId
 >    featureId
 >    cellId 2
 >
 >
 > The call to
 >
 >  SetBoundaryAssignment( Dimension, cellId, featureId, cellId2 );
 >
 > is defining that the cell identified with "cellId" has a neighbor
 > of dimension "Dimension", whose cell identifier is cellId2.
 > Because "cellId" may have many neighbors of that dimension, each
 > one has to be identified with a number (that is local to cellId).
 > This number is provided by "featureId".
 >
 >
 > For the case you mention, the numbers 7,9,10 are not of your
 > free choice. They are the cellID's of the cells that you are
 > setting as boundaries of dimension "Dimension" of "cellId".
 >
 >
 >
 >
 > Let's consider the example below
 >
 > (please make sure that you use a fixed spacing
 >  font for reading this email).
 >
 >
 >
 >   [9]-----------------------------[23]
 >     \            [14]              /
 >      \                            /
 >       \                          /
 >        \                        /
 >         \                      /
 >          \        [267]       /
 >      [24] \                  / [59]
 >            \                /
 >             \              /
 >              \            /
 >               \          /
 >                \        /
 >                 \      /
 >                  \    /
 >                   \  /
 >                   [37]
 >
 >
 >
 > This is a triangular cell with cellId = 267,
 > that has three line cells as boundaries of
 > dimension 1, with cellId' = 14, 24 and 59.
 > and three point cells as boundaries of dimension 0
 > with cellId's = 9, 23, 37.
 >
 > Note that the concept of  PointCell is different
 > from the concept of being a "Point" of the mesh.
 > A CellPoint is a cell of dimension zero.
 >
 > If we do full connectivity here, like a K-Simplex,
 >
 > the mesh will have the following calls (among others)
 >
 > A) For the boundaries of the triangular cell
 >
 > the Dimension=1 boundaries are the line cells
 >
 > mesh->SetBoundaryAssignment( 1, 267, 0, 14 );
 > mesh->SetBoundaryAssignment( 1, 267, 1, 24 );
 > mesh->SetBoundaryAssignment( 1, 267, 2, 59 );
 >
 > the Dimension=0 boundaries are the point cells
 >
 > mesh->SetBoundaryAssignment( 0, 267, 0,  9 );
 > mesh->SetBoundaryAssignment( 0, 267, 1, 23 );
 > mesh->SetBoundaryAssignment( 0, 267, 2, 37 );
 >
 >
 > B) For the line cell with cellID= 24, its neighbors
 >    are two Point cells and one triangle cell
 >
 > mesh->SetBoundaryAssignment( 0, 24, 0,  9 );
 > mesh->SetBoundaryAssignment( 0, 24, 1, 37 );
 >
 > mesh->SetBoundaryAssignment( 2, 24, 0, 267 );
 >
 >
 > C) For the point cells with cellID = 37
 >    there are two boundaries of dimension 1,
 >    the line cells wiht cellId's = 24 and 59,
 >    and one boundary of dimension=2, the triangle
 >    cell with cellId = 267
 >
 >
 > mesh->SetBoundaryAssignment( 1, 37, 0, 24 );
 > mesh->SetBoundaryAssignment( 1, 37, 1, 59 );
 >
 > mesh->SetBoundaryAssignment( 2, 37, 0, 267 );
 >
 >
 >
 > -----------------------------------------------
 >
 >
 >
 > In order to traverse the neighbor relationships,
 > take into account that the boundary relationships
 > are organized by its dimension. There is a separate
 > container per dimension.
 >
 > The call
 >
 > BoundaryAssignmentsContainerPointer cnt =
 >                mesh->GetBoundaryAssignments( 0 );
 >
 > will put in "cnt" the container of boundaries
 > of dimension 0;
 >
 > The container is a MapContainer<>, and the boundary
 > information is stored in the class BoundaryAssignementIdentifier
 > that simply holds the pair of cellIds
 >
 >   cellId and boundary cellId.
 >
 > So, in order to get all the lines that are boundaries
 > of the triangle cell with cellId = 267,
 > you call
 >
 > BoundaryAssignmentsContainerPointer cntlines =
 >                     mesh->GetBoundaryAssignments( 1 );
 >
 > BoundaryAssignementIdentifier key0( 267, 0 );
 >
 >   lineCellId0 = cntlines[ key0 ];
 >
 > BoundaryAssignementIdentifier key1( 267, 1 );
 >
 >   lineCellId1 = cntlines[ key1 ];
 >
 > BoundaryAssignementIdentifier key2( 267, 2 );
 >
 >   lineCellId2 = cntlines[ key2 ];
 >
 >
 >
 > that should result in
 >
 >           lineCellId0 ==  14
 >           lineCellId1 ==  24
 >           lineCellId2 ==  59
 >
 >
 > Note that this mesh structure has been designed
 > for facilitating the access from a specific cell
 > rather than massive access to all the relationships.
 >
 > The reason is that the Mesh has been designed for
 > supporting deformable models and cellular aggregates
 > where cells are born, cells die and reconfigure under
 > local circumstances.
 >
 >
 >
 > Please let us know if you have further questions.
 >
 >
 >
 > Regards,
 >
 >
 >   Luis
 >
 >
 >
 >
 > -----------------------
 > Thomas Boettger wrote:
 >
 >> Hello everybody!
 >>
 >> I have some questions about the itk:Mesh class.
 >>
 >> I want to store additional information for my meshes, i.e. an edge 
list, a face list ( = cell list?), edge neighbour list and a vertex 
neighbour list. Furthermore I'd like the face list (cell list) in 
counter clockwise order with respect to the outward unit face (vertex) 
normal.
 >>
 >> In the software guide I read about the boundary assignements, so I 
understand how to set my edges for one cell. But still don't know how to 
traverse all edges or even save a neighbour list. Which meaning has the 
BoundaryIdentifier? In the guide there was an example for a tri cell:
 >>
 >>
 >> mesh->SetBoundaryAssignment( dimension, cellId, featureId++, 7 );
 >> mesh->SetBoundaryAssignment( dimension, cellId, featureId++, 9 );
 >> mesh->SetBoundaryAssignment( dimension, cellId, featureId++, 10 );
 >>
 >>
 >> Is the user free to choose those numbers? (7,9,10)
 >>
 >> Should I use the boundary assignements method for my necessary 
attributes or would you suggest to create an extended class containing 
those new attributes?
 >>
 >> Is there more example code for the mesh class?
 >>
 >> Thanks,
 >> Thomas
 >>
 >> _______________________________________________
 >> Insight-users mailing list
 >> Insight-users at itk . org
 >> http://www . itk . org/mailman/listinfo/insight-users
 >>
 >
 >
 >
 >
 >


-- 
Dipl.-Inform. Thomas Boettger
Deutsches Krebsforschungszentrum         (German Cancer Research Center)
Div. Medical and Biological Informatics H0100    Tel: (+49) 6221-42 2328
Im Neuenheimer Feld 280                          Fax: (+49) 6221-42 2345
D-69120 Heidelberg                            e-mail: t . boettger at dkfz . de
Germany                      http://www . dkfz . de/mbi/people/thomasb . shtml