[Insight-users] going to a tetrahedral model

Luis Ibanez luis . ibanez at kitware . com
Mon, 01 Dec 2003 21:30:41 -0500


Hi Yasser,

ITK doesn't have at this point an easy mechanism for
generating tetraheda from a volume. You will find such
methods available in VTK. And easy option is to use
the ITK to VTK image filter available at

     InsightApplications/Auxiliary/vtk

in order to generate a VTK image from an ITK image.


You will find details on this in the tutorial document

"Getting Started with ITK and VTK"
http://www . itk . org/CourseWare/Training/GettingStarted-II . pdf


Note that the VTK filter that generates tetrahedra will
produce four tetrahedra per voxel.  You may want to decimate
such structure.



An alternative option that will require some work
on your side is to use a CellularAggregate like the
one illustrated in the Morphogenesis demo application

    http://www . itk . org/HTML/Morphogenesis . htm

a movie of this method at work can be seen at

    http://www . itk . org/Art/MorphogenesisSegmentation . mpg

You will find the source code of this application in

    InsightApplications/Morphogenesis.


In this application an itk::Mesh is evoled by simulating
the growth of a bacterial colony. You could make such
cellular colony grow inside your labeled region.  By tunning
the adult cell size you can select the degree of decimation
of the Mesh.

The part where you will have to put some coffee is in the
reduction of the Mesh to a simplex. The current mesh structure
is simulating the biological process of growth and therefore
uses an overconnected mesh with only 1D topological cells.

If you are in a hurry, a simple solution is to export all the
mesh point coordinates to a file and use the utility "delaunay"
from the qhull package.

http://packages . debian . org/cgi-bin/search_contents . pl?searchmode=filelist&word=libqhull3&version=stable

It will generate the tetrahedral mesh for you. (offline)



-----------------



About your second question...

Using a hierarchy of SpatialObjects is certainly the way to go
if you want to model a representation of the structure.

This is however an ambitious goal an will require several months
of work.  The structural SpatialObject classes are all already
available in ITK, but the process of building an optimal hierarchy
for representing an arbitrary shape is something that you will
have to develop.

A good thing is that you can probably publish a paper once you
are done   :-)


Please let us know if you have further questions.


Thanks


   Luis



----------------------
Yasser Bashir wrote:

> Ken and Luis,
> 
> Thank you very much for your help.  Really appreciate it.  I can now open
> and manipulate all my segmented images using ITK.
> 
> I have two further goals that i want to accomplish using the ITK.  If you
> have any pointers or suggestions, they will be greatly appreciated.
> 
> 1.  MarchingCubes gives me a surface representation of the objects hence i
> lose the information on geometry inside the objects.  Is there a way to go
> from volume image data to a tetrahedral representation in ITK?  (Using itk's
> tetrahedral cells) thus preserving the topology and geometry inside objects.
> 
> 2.  For my medical image (say the virtual human) I want to create a spatial
> object hierarchy of Spatial Objects that contain geometry as calculated in
> step 1 and topology of labelled organs as well as the physical and
> physiological properties of each organ.  How ambitious do you think this
> goal is given the current ITK infrastructure?
> 
> Thank you again for your help
> 
> Yasser.
> 
> 
> ----- Original Message ----- 
> From: "KenLists" <kenlists at nycap . rr . com>
> To: "'Luis Ibanez'" <luis . ibanez at kitware . com>; "'Yasser Bashir'"
> <itk_at_stanford at yahoo . com>
> Cc: <insight-users at itk . org>
> Sent: Friday, November 28, 2003 10:39 AM
> Subject: RE: [Insight-users] Volview Adds more contours than needed : Labels
> are not Intensities
> 
> 
> The modification of label 180 to be larger, 230 or 231 etc, can be done
> with
> the threshold plugin. Also I believe the threshold plugin can be used
> to
> modify values > 180 to be zero which would also let you generate your
> contour.
> 
> Ken
> 
> 
>>-----Original Message-----
>>From: insight-users-admin at itk . org
> 
> [mailto:insight-users-admin at itk . org] On
> 
>>Behalf Of Luis Ibanez
>>Sent: Friday, November 28, 2003 11:42 AM
>>To: Yasser Bashir
>>Cc: insight-users at itk . org
>>Subject: Re: [Insight-users] Volview Adds more contours than needed :
>>Labels are not Intensities
>>
>>
>>Hi Yasser,
>>
>>Thaks for posting your labeled image,
>>that make things much clearer.
>>
>>You cannot use marching cubes (nor any other
>>iso-surface extraction algorithm for that matter)
>>in order to extract surfaces from a labeled image.
>>
>>Iso-surface extraction relies on the fact that
>>all the pixels inside a region have intensity
>>values lower than the iso-value and that all the
>>external pixels surrounding the region have
>>intensity values higher than the iso-value.
>>
>>In your image, you have the case in which a structure
>>is labeled as "180" and it is in contact with regions
>>with labels: 0 and 196.
>>
>>There is no way in which an iso-contour algorithm
>>could extract the boundary of the region with label 180.
>>If you try to recover the boundary between the label 180
>>and 196 you have to chose an isovalue between 180 and 196,
>>let's say 185. While if you want to extract the boundary
>>between the region labeled 180 and the region labeled 0
>>you have to select an iso-value between 0 and 180, let's say
>>70.
>>
>>It is impossible in this case to find a single iso-value that
>>will extract the entire boundary of the region labeled at 180.
>>
>>There is a simple solution however: just make sure that the
>>label assigned to the region you want to iso-surface, is the
>>largest or the lowest of all the labels.  That is, simply
>>replace 180 with 230.  In that case it will be surrounded by
>>regions at 0 and 196 that are all lower than 230.  You can
>>then use an iso-value like 225 in order to extract the surface
>>of your region of interest.
>>
>>What you have to keep in mind is that labels are interpreted
>>as intensity values by the marching cubes algorithm. However
>>labels do not represent any scalar value. They are just like
>>letters. You can assign any value to a labe as long as it is
>>different from any other label.
>>
>>--
>>
>>One nice option in VolView is to create mult-component datasets.
>>In your case, you have 4 objects plust a background. You could
>>create binary masks for each one of the 4 objects and load them
>>in VolView using the Volume Merge option.
>>
>>You will find this option under :
>>
>>
>>    "View" --> "Filters" --> "Utility" --> "Merge Volumes"
>>
>>one by one, you selecte one of the binary masks as a "second
>>input" and it will get merged with the current components of
>>the data set.  Then you can extract iso-contours per individual
>>component.  If you go to the "Contours" menu, you will see that
>>there is a "Component" option under the "Isovalue" slicer.
>>
>>I will strongly recomend you to apply the ITK AntiAlias image
>>filter to the binary masks  before you merge them and attempt
>>to extract iso-surfaces from them. Binary masks look really
>>bad when you extract iso-surfaces because you get all the
>>staircase effects.
>>
>>In any case, the very nature of segmentation makes unlikely that
>>your binary masks are accurate on the borders, therefore you are
>>more clear by using a fuzzy representation for the boundaries
>>of the regions.
>>
>>
>>Please let us know if you have further questions.
>>
>>
>>Thanks
>>
>>
>>   Luis
>>
>>
>>
>>------------------------
>>Yasser Bashir wrote:
>>
>>
>>>Hi Luis,
>>>
>>>Thank you for your response.
>>>
>>>Does it mean that the marchingCubes alone is insufficient for
> 
> generating
> 
>>>surface representation of objects in a labelled image.  Can you
> 
> also
> 
>>explain
>>
>>>the difference between a labelled and a segmented image in ITKs
> 
> context?
> 
>>>Attached are a few slices from my labelled image.
>>>
>>>Yasser
>>>----- Original Message -----
>>>From: "Luis Ibanez" <luis . ibanez at kitware . com>
>>>To: "ITK Stanford" <itk_at_stanford at yahoo . com>
>>>Cc: <insight-users at itk . org>
>>>Sent: Thursday, November 27, 2003 8:42 PM
>>>Subject: Re: [Insight-users] Volview Adds more contours than needed
>>>
>>>
>>>
>>>
>>>>Hi ITK-Stanford
>>>>
>>>>There is something strange in your description of the
>>>>problem.  Adding contours in VolView should only generate
>>>>iso-level at a particular value. It will not select a
>>>>region that has an assigned value.
>>>>
>>>>If what you did was to *label* the segmented images and
>>>>you assigned a label value of 182 to the aorta, and a
>>>>label value of 0 to the trachea then spurious contours may
>>>>appear around the trachea if the trachea has bordering
>>>>labels that are at values > 182.
>>>>
>>>>Keep in mind that when you ask for an iso-contours at level
>>>>182 what you are computing is a surface with values < 182
>>>>in one side and values > 182 on the other side. You are not
>>>>asking for the surface surrounding a region whose value is 182.
>>>>
>>>>
>>>>
>>>>Here is a simple solution for your problem:
>>>>
>>>>                    Use the ITK plugins in VolView.
>>>>
>>>>Simply load your stack of images, then go to the menu
>>>>
>>>>                   "View" -> "Filter"
>>>>
>>>>and select the group
>>>>
>>>>                "Segmentation - Region Growing"
>>>>
>>>>Then the filter
>>>>
>>>>                "Confidence Connected (ITK)"
>>>>
>>>>Set
>>>>
>>>>the number of iterations to 2
>>>>the multiplier to 1.0
>>>>the output value to 255
>>>>
>>>>Then go to the menu
>>>>
>>>>                 "View" -> "Markers"
>>>>
>>>>enable "Display 3D cursor" and "Display 3D markers"
>>>>
>>>>Add a 3D marker inside the structure that you want to
>>>>contour.
>>>>
>>>>Then go back to the filters menu (there should be a
>>>>tab for it now) and click in "Apply Filter" the
>>>>segmentation result will be a binary image of your
>>>>label (eg. the region at label value 182 if that's
>>>>where you put the 3D marker).  Once there, you can
>>>>enable a contour at value level 128.
>>>>
>>>>You will also find useful to run the AntiAlias image
>>>>filter available in the group " Surface Generation"
>>>>it will smooth the iso-surface of your binary segmenation
>>>>by reducing the staircase effects of the typical binary
>>>>images.
>>>>
>>>>
>>>>Please let us know if you find any problems,
>>>>
>>>>
>>>>Thanks
>>>>
>>>>
>>>>   Luis
>>>>
>>>>
>>>>--------------------------------------------------------
>>>>ITK Stanford wrote:
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>I have a stack of .pgm files containing a segmented volume of the
>>>>>heart.  I can open and view the intensity values of pixels in
>>>>
>>>>volview.
>>>>
>>>>
>>>>>However, adding a contour at a certain intensity value, adds
> 
> contours
> 
>>>>>for that value and all values lower than it.  For example the
>>>>
>>>>intensity
>>>>
>>>>
>>>>>value of the descending aorta is 182 and the intensity value of
>>>>
>>>>trachea
>>>>
>>>>
>>>>>is 0.  However adding a contour at value 182 also adds a contour
> 
> at
> 
>>>>value 0.
>>>>
>>>>
>>>>>Any idea why this is happening and how can it be fixed??
>>>>>
>>>>>All help will be appreciated
>>>>>--
>>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>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
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>