[Insight-users] calculate normal

Alexandre GOUAILLARD hanfei at caltech.edu
Wed Feb 20 16:40:25 EST 2008


Hi rashed,

The meshtraits is a list of type definition to finely tune your structure
depending on your usage. You can read more in the itk software guide:
Chapter 4.3.4 "Customizing the Mesh", page 70.

A meshtrait is provided by default, so you can basically ignore that for
your first experiments and use the itk:SimplexMesh as if it was templated
only over the PixelType and the Dimension. (Note, the Dimension also has a
default value, so theoretically, you only need to define a PixelType)


//----------------- original code

// NOTE see the default values for Vdimension and TMeshTraits
template < typename TPixelType,
           unsigned int VDimension = 3,
           typename TMeshTraits = DefaultStaticMeshTraits< TPixelType,
                                                           VDimension,
                                                           VDimension,
                                                           TPixelType,
                                                           TPixelType,
                                                           TPixelType >
          >
class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>


//-----------------


Possible usages:

// simplest
Typedef itk::SimplexMesh< float >      MyFirstSimplexMeshType;

// same thing with second template parameter explicitly set
Typedef itk::SimplexMesh< float, 3 >   MySecondSimplexMeshType;

// full options - stay away from that unless you **really** know what you do
Typedef float PointAndCellDataType;
typedef float                Coord;
const unsigned int  SDimension = 3; // space dimension
Const unsigned int  TDimension = 2; // max topological dim. Surface => 2

typedef itk:: DefaultStaticMeshTraits<
      PointAndCellDataType,
      SDimension,  
      TDimension, 
      Coord,
      Coord,
      PointAndCellDataType           >    MeshTraitsType;
 
typedef SimplexMesh< PointAndCellDataType, SDimension, MeshTraitsType >
                                          MeshType;


On 2/20/08 10:18 AM, "rashedk" <rashed.vtk at googlemail.com> wrote:

> 
> Thanks! 
> 
> What is TMeshTraits in itk::SimplexMesh< TPixelType, VDimension, TMeshTraits
>> ??
> 
> What should I pass for TMeshTraits?
> 
> 
> 
> 
> Leila Baghdadi-2 wrote:
>> 
>> check InsightApplication/DeformableModel...
>> 
>> I think that code needs work but I am sure I have the part where it
>> converts the mesh to pass to vtk.
>> 
>> HTH
>> 
>> Leila
>> 
>> On Wed, 2008-20-02 at 09:21 -0800, rashedk wrote:
>>> 
>>> Thanks, but now I am stuck trying to display a simplex mesh in VTK. How
>>> do I
>>> visualize this mesh? Is there also a way to iterate through every point
>>> on
>>> the mesh?  
>>> 
>>> Rashed. 
>>> 
>>> 
>>> Leila Baghdadi-2 wrote:
>>>> 
>>>> Yep that's right and another note,
>>>> 
>>>> you "must" create a triangle mesh in order to create a simplex mesh!
>>>> 
>>>> If you are unsure about how it is done, check the paper
>>>> simplex mesh
>>>> by herve delingette of INRIA france
>>>> 
>>>> good luck
>>>> 
>>>> Leila
>>>> 
>>>> On Wed, 2008-20-02 at 12:47 +0100, Iván Macía wrote:
>>>>> Hi Rashed,
>>>>> 
>>>>> You can do what you mention with VTK or directly in ITK use
>>>>> itk::BinaryMask3DMeshSource, which is the equivalent of Marching Cubes
>>> in
>>>>> ITK. As the name implies, you need a binary mask (segmentation) as
>>> input.
>>>>> 
>>>>> HTH
>>>>> 
>>>>> Ivan
>>>>> 
>>>>> -----Mensaje original-----
>>>>> De: insight-users-bounces+imacia=vicomtech.org at itk.org
>>>>> [mailto:insight-users-bounces+imacia=vicomtech.org at itk.org] En nombre
>>> de
>>>>> rashedk
>>>>> Enviado el: miércoles, 20 de febrero de 2008 12:06
>>>>> Para: insight-users at itk.org
>>>>> Asunto: Re: [Insight-users] calculate normal
>>>>> 
>>>>> 
>>>>> Hi, 
>>>>> 
>>>>> How do I convert my 3D image data to a simplex mesh in order to
>>> compute
>>>>> the
>>>>> normals? Checking the class documentation for itk::SimplexMesh reveals
>>>>> that
>>>>> one has to generate a triangle mesh and then use the
>>>>> itkTriangleMeshToSimplexMeshFilter. But then how do I convert my 3D
>>> image
>>>>> data to a triangle mesh?? Do I use vtkContour to produce polyData and
>>>>> then
>>>>> convert it to itkMesh using appropriate filters?
>>>>> 
>>>>> Any help will be appreciated,
>>>>> 
>>>>> Thanks
>>>>> Rashed 
>>>>> 
>>>>> 
>>>>> 
>>>>> Luis Ibanez wrote:
>>>>>> 
>>>>>> Hi Tony,
>>>>>> 
>>>>>> 
>>>>>> Well.... if you only have a point, then there is no normal to
>>> compute.
>>>>>> 
>>>>>> You probably are thinking of a point from a surface, where a point
>>>>>> belongs to several faces and have other points as neighbors.
>>>>>> 
>>>>>> 
>>>>>> In that case you may want to look at the itk::SimplexMesh
>>>>>> http://www.itk.org/Insight/Doxygen/html/classitk_1_1SimplexMesh.html
>>>>>> 
>>>>>> and its "ComputeNormal" method:
>>>>>> 
>>>>> 
>>> http://www.itk.org/Insight/Doxygen/html/classitk_1_1SimplexMesh.html#itk_1_1
>>>>> SimplexMesha5
>>>>>> 
>>>>>> 
>>>>>>     Regards,
>>>>>> 
>>>>>> 
>>>>>>        Luis
>>>>>> 
>>>>>> 
>>>>>> -------------------
>>>>>> tony hakki wrote:
>>>>>>> Is it possible to calculate normal of a point in ITK? If yes, Could
>>>>> you 
>>>>>>> tell which class should be used?
>>>>>>> thank you
>>>>>>>  
>>>>>>> 
>>>>>> _______________________________________________
>>>>>> Insight-users mailing list
>>>>>> Insight-users at itk.org
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> Insight-users mailing list
>>>> Insight-users at itk.org
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>> 
>>>> 
>>> 
>> 
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>> 
>> 




More information about the Insight-users mailing list