[vtkusers] problem in estimating the curvature
Martine Lefevre
martine_lef at yahoo.fr
Mon Jan 26 10:37:04 EST 2009
Thanks ArnaudCan we get also the curvature mean, min and max with Itk? Martine
--- En date de : Lun 26.1.09, Arnaud Gelas <arnaud_gelas at hms.harvard.edu> a écrit :
De: Arnaud Gelas <arnaud_gelas at hms.harvard.edu>
Objet: Re: [vtkusers] problem in estimating the curvature
À: "martine_lef at yahoo.fr" <martine_lef at yahoo.fr>
Cc: "vtk" <vtkusers at vtk.org>
Date: Lundi 26 Janvier 2009, 15h27
Hi Martine,
vtkCurvatures processes vtkPolyData. Thus, if you want to compute Gaussian
curvature, you have to extract one surface from your image (e.g. by using a
Marching Cubes).
Note that you can now directly compute the Gaussian curvature of a given
surface in itk by using itk::QuadEdgeMeshDiscreteGaussianCurvatureEstimator.. The
way to estimate the Gaussian curvature is less sensitive to the connectivity
than the vtk version.
http://www.itk.org/Doxygen/html/classitk_1_1QuadEdgeMeshDiscreteGaussianCurvatureEstimator.html
Arnaud
Martine Lefevre wrote:
> Hi
> I try to estimate the curvature information of an object but I failed. In
run time I get vtkOutpouWindow saying there is an error in the file
vtkDemandDrivenPipeline.cxx.
> My input volume is an itk image that I convert to vtk image in order to
estimate the curvature.
> I paste my code here. Any help is appreciated.
> Thank you.
> Regards
> Martine
>
>
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> #include "itkVTKImageExport.h"
> #include "itkVTKImageImport.h"
> #include "vtkImageData.h"
> #include "vtkImageImport.h"
> #include "vtkImageExport.h"
> #include "vtkCurvatures.h"
> // This function will connect the given itk::VTKImageExport filter to the
given vtkImageImport filter.
> template <typename ITK_Exporter, typename VTK_Importer>
> void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
> {
>
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
>
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
>
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
> importer->SetSpacingCallback(exporter->GetSpacingCallback());
> importer->SetOriginCallback(exporter->GetOriginCallback());
> importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
>
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
>
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
> importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
> importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
>
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
> importer->SetCallbackUserData(exporter->GetCallbackUserData());
> }
> int main()
> {
> typedef float PixelType;
> const unsigned int Dimension = 3;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
> typedef itk::ImageFileWriter <ImageType> WriterType;
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
> reader->SetFileName("C:/work/MyImages/MyObject.hdr");
> // convert itk to vtk image type
> typedef itk::VTKImageExport< ImageType > ExportFilterType;
> ExportFilterType::Pointer itkExporter = ExportFilterType::New();
> itkExporter->SetInput( reader->GetOutput() );
> // Create the vtkImageImport and connect it to the itk::VTKImageExport
instance.
> vtkImageImport* vtkImporter = vtkImageImport::New();
> ConnectPipelines(itkExporter, vtkImporter);
> // estimate the curvature mean
> vtkCurvatures* myCurvatures= vtkCurvatures::New();
> myCurvatures->SetCurvatureTypeToGaussian();
> myCurvatures->SetInput(vtkImporter->GetOutput());
> myCurvatures->Update();
> std::cout << "end of the code !" << std::endl;
> std::cin.get();
> return 0;
> }
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090126/025ab4ca/attachment.htm>
More information about the vtkusers
mailing list