AW: [Insight-users] Snake?, Yes
Waltraud Henrich
henrich@ira.uka.de
Sun, 10 Nov 2002 14:07:17 +0100
Hi,
I would like to use "deformablemesh3Dfilter" but I am not sure how to
do this.
I am working with VTK (vtkImageData). First I connect my VTK pipeline to an
ITK
pipeline, with vtkImageExport -> itk::VTKImageImport for VTK->ITK and
at the end itk::VTKImageExport -> vtkImageImport for ITK->VTK.
After the first connection I used ImageToMeshFilter for to get a mesh.
The next step was that I used the GradientImageFilter, then the
DeformableMesh3DFilter.
My question now are:
- how can I use the DeformableMesh3DFilter in a corrct way ?
- how exactly is the DeformableMesh3DFilter working ?
- and then I would like to know if the way I used the filters was right
I add my code
//VTK->ITK
vtkImageExport* vtkExporter = vtkImageExport::New();
vtkExporter->SetInput(pImage);
//------------------------------------------------------------------------
// VTK to ITK pipeline connection.
//------------------------------------------------------------------------
typedef itk::Image<short, 3> ImageType;
typedef itk::Image<unsigned long, 3> ImageTypeULONG;
typedef itk::VTKImageImport<ImageType> ImageImportType;
ImageImportType::Pointer itkImporter = ImageImportType::New();
ConnectPipelines(vtkExporter, itkImporter);
typedef itk::Mesh<short, 3> MeshType;
itk::ImageToMeshFilter<ImageType, MeshType>::Pointer
mesh = itk::ImageToMeshFilter<ImageType,MeshType>::New();
mesh->SetInput(0,itkImporter->GetOutput());
mesh->Update();
typedef itk::GradientImageFilter<ImageType, short, short>
FilterType;
typedef FilterType::OutputImageType OutputImageType;
// Set up filter
itk::GradientImageFilter<ImageType, short, short>::Pointer
filter = itk::GradientImageFilter<ImageType, short, short>::New();
double m_stiff[2];
double m_scale[3];
m_stiff[0]=0.00001;
m_stiff[1]=0.04;
m_scale[0] = 2;
m_scale[1] = 2;
m_scale[2] = 2;
itk::DeformableMesh3DFilter<MeshType, MeshType>::Pointer
m_bfilter= itk::DeformableMesh3DFilter<MeshType, MeshType>::New();
m_bfilter->SetStiffness(m_stiff);
m_bfilter->SetTimeStep(0.2);
m_bfilter->SetStepThreshold(1);
m_bfilter->SetScale(m_scale);
m_bfilter->SetGradient(filter->GetOutput());
m_bfilter->SetInput(mesh->GetOutput());
m_bfilter->Update();
//------------------------------------------------------------------------
// ITK to VTK pipeline connection.
//------------------------------------------------------------------------
typedef itk::VTKImageExport<ImageTypeULONG> ImageExportType;
ImageExportType::Pointer itkExporter = ImageExportType::New();
itkExporter->SetInput(m_bfilter->GetOutput());
// Create the vtkImageImport and connect it to the
itk::VTKImageExport instance.
vtkImageImport* vtkImageImport = vtkImageImport::New();
ConnectPipelines(itkExporter, vtkImageImport);
vtkImageImport->Update();
vtkImageData* pResultImage = vtkImageImport->GetOutput();
vtkImageData* pNewResultImage = vtkImageData::New();
pNewResultImage->DeepCopy(pResultImage);
GfxPlaneViewer(pNewResultImage, "snake");
I want to thanks for your help in advance.
Yours sincerely
Waltraut Henrich
-----Originalnachricht-----
Von: Luis Ibanez
An: Waltraud Henrich
Cc: 'insight-users@public.kitware.com'
Gesendet: 04.11.02 15:05
Betreff: Re: [Insight-users] Snake?, Yes
Hi Waltraud,
There are several flavors of active contours in ITK.
1) The first is the traditional expanding Mesh
controled by a force with a constant component
and an image derived component.
This approach is implemented by Dr.Metaxas group
in the classes:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1DeformableMeshFilter
.html
http://www.itk.org/Insight/Doxygen/html/classitk_1_1DeformableMesh3DFilt
er.html
2) The second approach is based on Level Sets.
The surface is represented as the level set
of a function in a higher dimensional space.
The evolution of the function under differential
equations determines the evolution of the embebded
surface. This is implemented in the GeodesicActiveContour
class:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1GeodesicActiveContou
rImageFilter.html
3) Similar effects can be obtained in general with
level sets approached. You may want to consider the
ThresholdSegmentation filter:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ThresholdSegmentatio
nLevelSetImageFilter.html
and the LaplacianSegmentation filter:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1LaplacianSegmentatio
nLevelSetImageFilter.html
Please let us know if you have any question about
the use of these classes.
Thanks
Luis
===========================================
Waltraud Henrich wrote:
>
> Dear users,
>
> I am new to ITK and I have a question . Is there something to program
in
> ITK around Active Contour Models (or snakes) ?
>
> thank for the help.
>
> Waltraut.
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>
>