[Insight-users] vtk polydata import / export
Luis Ibanez
luis . ibanez at kitware . com
Mon, 14 Jul 2003 18:38:41 -0400
Hi Imho,
Your description is a bit confusing.
You may want to verify your processing stage by stage.
A pipeline:
vtkExporter-->itkImporter-->itkExporter-->vtkImporter
Should work without problem.
You may want to verify that you are using compatible
pixel types. What is the pixel type that you are using
for instantiating the ITK images ?
>
> back in vtk I still have a vtkImageData error.
>
What is the error message that you get for vtkImageData ?
is this a compilation error ? a link error ? or a runtime error ?
Posting the error message can always help :-)
Luis
---------------
imho wrote:
> Hi Luis,
>
> I've succeed converting vtkPolyData to vtkImageData, it deforms my
> vtkPolyData and is very slow but I'll try other parameters...
> the principal is that I have a vtkImageData to put in the exporter /
> importer pipe-line.
> And there I have a problem. itk returns a null imageData, so I've tried
> a simple pipe-line to itk where I do nothing, just this :
>
> ------------------------------------------
> in itk class :
> registrationITK::registrationITK(vtkImageImport* vtkImporter,
> vtkImageExport *vtkExporter, vtkImageExport *vtkExporter2)
> { itkImporter = ImageImportType::New();
> itkImporter2 = ImageImportType::New();
> itkExporter = ImageExportType::New();
>
> itkExporter->SetInput(itkImporter->GetOutput());
> ConnectPipelines(vtkExporter, itkImporter);
> ConnectPipelines(vtkExporter2, itkImporter2);
> ConnectPipelines(itkExporter, vtkImporter);
> itkImporter->Update();
> itkImporter2->Update();
> }
> -------------------------------
> in vtk class :
> ...
>
> vtkImporter4 = vtkImageImport::New();
> ...
> vtkExporter4 = vtkImageExport::New();
> vtkExporter5 = vtkImageExport::New();
>
> poly[0] = vtkPolyData::New();
> poly[1] = vtkPolyData::New();
> polyLive = vtkPolyData::New();
>
> imageModel = vtkImageData::New();
> imageModelLive= vtkImageData::New();
>
> polyToImage = vtkImplicitModeller::New();
> polyLiveToImage = vtkImplicitModeller::New();
> ...
> polyToImage->SetInput(poly[0]);
> polyLiveToImage->SetInput(polyLive);
> polyToImage->SetSampleDimensions(10, 10, 10);
> polyToImage->SetMaximumDistance(0.25);
> polyLiveToImage->SetSampleDimensions(10, 10, 10);
> polyLiveToImage->SetMaximumDistance(0.25);
>
> imageModel = polyToImage->GetOutput();
> imageModelLive = polyLiveToImage->GetOutput();
> vtkExporter4->SetInput(imageModel);
> vtkExporter5->SetInput(imageModelLive);
>
> regITK = new registrationITK(vtkImporter4, vtkExporter4,
> vtkExporter5);
>
> cast->SetInput(vtkImporter4->GetOutput());
> castTo3D->SetInput(vtkImporter4->GetOutput());
>
> isRegITK = true;
>
> ...
> poly[0]->CopyStructure(ApplyDemonRegistration());
> ------------------------------------------------
> vtkPolyData* sourceControlVTK::ApplyDemonRegistration()
> {
> vtkPolyData* pol = vtkPolyData::New();
>
> // regITK->InitDemonRegistration(progress); // dans controlQt
> imageModel = vtkImporter4->GetOutput();
> pol = imageToPolyMaker->makePoly(imageModel);
> return pol;
>
> }
>
> back in vtk I still have a vtkImageData error.
> So I resume, when I do :
> vtkPolyData->vtkImageData->vtkPolyData
> my poly is'nt allright but I have something to show
>
> but if I do :
> vtkPolyData->vtkImageData->vtkExporter->itkImporter->itkExporter->vtkImporter->vtkImagedata->vtkPolyData
> with or without the demonFilter
> I have nothing back :/
> I surely do something wrong, but I can't find what.
> Maybe you can help me (again).
>
> thanks a lot.
>
> Imho.
>