[vtkusers] problem in estimating the curvature

Martine Lefevre martine_lef at yahoo.fr
Mon Jan 26 10:05:58 EST 2009


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/bc586c03/attachment.htm>


More information about the vtkusers mailing list