[Insight-developers] Fwd: Adding a new cell type to ITK

alex gouaillard alexandre_gouaillard at hms.harvard.edu
Thu Feb 26 01:25:53 EST 2009


hi jim.

indeed for QE we did not have to create another cell type as it is the  
same cells. The underlying QE layers has been added in such a way that  
original CellInterface methods works. We just added a few "optimized"  
versions to be used by itkQuadEdgeMesh class and filters for improved  
performance.

In your case, it would make sense to create a new enum, and to list it  
just before LAST_ITK_CELL. Usr should have used the names in their  
code, but might have used the ID number instead, so if you put the new  
name anywhere else in the list (let's say, after LINE_CELL to mimic  
VTK enum) you would shift IDs and might break someone's code.

I would not recommend picking LINE_CELL, because, even though the  
topological dimension is the same, lots of code will expect a line  
cell to have only two vertices.

You will have a few test cases to improve to cover your new cell type,  
namely:
/Testing/COmmon/itkCellInterfaceTest.cxx
/Testing/Review/itkQuadEdgeMeshCellInterfaceTest.cxx

best,

alex.


Begin forwarded message:

> From: millerjv <millerjv at gmail.com>
> Date: February 21, 2009 2:55:22 AM SST
> To: Insight-developers <insight-developers at itk.org>
> Subject: [Insight-developers] Adding a new cell type to ITK
>
> I need to add a new cell type to ITK.  ITK does not currently have a  
> PolylineCell. I want to use the Mesh class as a container for a set  
> of polylines.
>
> Writing a PolylineCell is fairly straightforward.  Only two methods  
> from PolygonCell need to be modified.
>
> The problem I have is with the itkCellVisitMacro() and the GetType()  
> method.  From the looks of these, I need to define or register a new  
> enum, perhaps named POLYLINE_CELL.
>
> I could modify itkCellInterface to define this new enum. Though I am  
> not sure where in the list of the enums it is safe to put.  The last  
> two enums defined are LAST_ITK_CELL and MAX_ITK_CELLS.  I am  
> guessing I would want to put it before LAST_ITK_CELL.
>
> The other option is to just pick an enum value that could be "safe"  
> and use it appropriatel in my invocation of itkCellVisitMacro() and  
> in the definition of GetType().
>
> A third option is to have PolylineCell use LINE_CELL as its type,  
> since it has a similar topology as a line cell (namely the  
> topological dimension is 1).
>
> A forth option is to create a whole new itkCellInterface class that  
> I template my mesh over.
>
> Have other people added new cell types to itk::Mesh?  It looks like  
> the QuadEdgeMesh re-uses the enums from the standard mesh. So the  
> quad edge polygon class declares that it is a POLYGON_CELL.  I think  
> that makes sense in their context.
>
> Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090226/6168ee6f/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001.txt
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090226/6168ee6f/attachment.txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090226/6168ee6f/attachment-0001.htm>


More information about the Insight-developers mailing list