[Insight-developers] Mesh from binary mask options

Luis Ibanez luis.ibanez at kitware.com
Thu Aug 24 11:47:22 EDT 2006


Hi Richard,

Thanks for letting us know about the partial solution that you found.


    Regards,


        Luis


--------------------
Richard Beare wrote:
> Hi,
> 
> Just thought I'd let you know what a partially successful solution
> involved. I haven't gone back to the grayscale yet. Basically I find
> the edge of my mask by subtracting an eroded version from the
> original, blur the edge and combine the blurred version with the
> original using a max operation. I apply the contour extraction to the
> blurred version. No idea how accurate the results are yet, but at
> least they aren't broken into pieces.
> 
> On 8/22/06, Richard Beare <richard.beare at gmail.com> wrote:
> 
>> Hi,
>>
>> Yes I understand that is what the anti aliasing filter does - it still
>> caused breaks in the object when the filaments were a single pixel
>> thick. I experimented with all the parameters and couldn't change
>> that. I guess that in this situation two vertices moving less than a
>> pixel can cause a break. I was hoping to use another level set method
>> applied to the gradient image from which my original segmentation (a
>> marker based watershed) was generated. This might allow a bit more
>> information to be passed through to the contour filter in ITK.
>>
>> On 8/22/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>> >
>> >
>> > Hi Richard,
>> >
>> > Yes, using your binary mask for initializing a LevelSet and then
>> > let it run for several iterations is also an option.
>> >
>> > Actually, this is what the AntiAlias filter does, although it adds
>> > the constrain of not letting the front move more than one pixel
>> > away from its original position.
>> >
>> > You could use any of the LevelSet classes in ITK (except FastMarching)
>> > and then simply pass the output level set to VTK by converting it to
>> > a vtkImageData class. Once inside VTK you use the vtkContourFilter
>> > and as iso-value, the *same* value that defined the zero-set in the
>> > ITK LevelSet filter.
>> >
>> > Note that it is better to transfer the LevelSet image to VTK and then
>> > use the VTK contour filter than trying to extract a contour in ITK as
>> > an ITK Mesh and then convert that mesh to a vtkPolyData.
>> >
>> >
>> > You may want to look at the code of ITKSnap:
>> >
>> >               InsightApplications/SNAP
>> >
>> >
>> >
>> >
>> >    Regards,
>> >
>> >
>> >       Luis
>> >
>> >
>> >
>> > -------------------
>> > Richard Beare wrote:
>> > > Hi,
>> > >
>> > > I've done some experiments using the anti aliasing filter, but
>> > > experience similar problems.
>> > >
>> > > I'm starting to suspect that the way to go may be to initialize a
>> > > level set with my original segmentation image and let it evolve on 
>> a a
>> > > gradient image and transfer the mesh resulting from the level set to
>> > > vtk. Is that sort of thing possible?
>> > >
>> > > On 8/17/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>> > >
>> > >>
>> > >> Hi Richard,
>> > >>
>> > >> Have you tried smoothing the ITK binary image mask
>> > >> before passing it to a vtkImageData ?
>> > >>
>> > >> You may want to try the itkAntiAliasImageFilter.
>> > >> It will smooth the image and still guarantee that
>> > >> the iso-contours are in the same pixels as they
>> > >> were for the Binary Mask.
>> > >>
>> > >> By passing a smoother isocontour you may have
>> > >> better luck when decimating the surface.
>> > >>
>> > >>
>> > >>     Regards,
>> > >>
>> > >>
>> > >>        Luis
>> > >>
>> > >>
>> > >> -----------------------
>> > >> Richard Beare wrote:
>> > >> > Hi,
>> > >> >
>> > >> > I've been playing with FeatureEdgeSmoothing in
>> > >> > vtkWindowedSincPolyDataFilter and setting a feature angle of 
>> around
>> > >> > 140 degrees, but still tend to see the thin filaments I 
>> mentioned get
>> > >> > broken. Now that I'm using the contour filter they are unbroken 
>> prior
>> > >> > to smoothing. Is there any way to smooth while preserving 
>> topology?
>> > >> >
>> > >> > Thanks
>> > >> >
>> > >> > On 8/16/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>> > >> >
>> > >> >>
>> > >> >> Hi Richard,
>> > >> >>
>> > >> >> If you are already combining ITK and VTK, it will be much better
>> > >> >> to convert your ITK binary mask to a vtkImageData and then use
>> > >> >> the vtkContourFilter on it.
>> > >> >>
>> > >> >>
>> > >> >> The vtkContourFilter is much better than the
>> > >> >> itk::BinaryMask3DMeshSource.
>> > >> >>
>> > >> >>
>> > >> >> You will find examples on how to convert itkImage to vtkImageData
>> > >> >> in the InsightApplications/Auxiliary/vtk directory.
>> > >> >>
>> > >> >>
>> > >> >> for example:
>> > >> >>
>> > >> >>       itkReadITKImage3DSegmentShowVTK.cxx
>> > >> >>       itkReadITKImageSegmentShowVTK.cxx
>> > >> >>       itkReadITKImageShowSplineVTK.cxx
>> > >> >>       itkReadITKImageShowVTK.cxx
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>     Regards,
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>        Luis
>> > >> >>
>> > >> >>
>> > >> >> -----------------------
>> > >> >> Richard Beare wrote:
>> > >> >> > Hi everyone,
>> > >> >> >
>> > >> >> > I'm using itk::BinaryMask3DMeshSource to create a mesh from 
>> a mask
>> > >> >> > I've generated. I translate the resulting mesh to an stl 
>> file via
>> > >> >> > itkMeshTovtkPolyData and vtkSTLWriter (and optionally
>> > >> >> > vtkWindowedSincPolyDataFilter). Some of the masks I'm 
>> producing have
>> > >> >> > quite fine structure - for example 1 voxel thick filaments.
>> > >> Naturally
>> > >> >> > the mesh produced by the marching cubes algorithm does not 
>> include
>> > >> >> > this sort of structure - the interpretation of such 
>> structures is
>> > >> >> > application dependent. In my case I would like to have the 
>> filaments
>> > >> >> > represented in the mesh as tubes. One hack that would achieve
>> > >> this is
>> > >> >> > to resample the mask so that the filaments are no longer one 
>> pixel
>> > >> >> > thick and apply the marching cubes as before. However I was
>> > >> wondering
>> > >> >> > if there is any other approach. I'm not tied to stl, I just 
>> need
>> > >> >> > something that can be imported by typical cad packages. In 
>> addition,
>> > >> >> > if anyone can recommend a way of producing a nurbs based
>> > >> >> > representation from (or instead of) the triangulation, I'd 
>> like to
>> > >> >> > hear about it.
>> > >> >> >
>> > >> >> > Thanks.
>> > >> >> > _______________________________________________
>> > >> >> > Insight-developers mailing list
>> > >> >> > Insight-developers at itk.org
>> > >> >> > http://www.itk.org/mailman/listinfo/insight-developers
>> > >> >> >
>> > >> >> >
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >
>> > >> >
>> > >>
>> > >>
>> > >>
>> > >
>> > >
>> >
>> >
>> >
>>
> 
> 




More information about the Insight-developers mailing list