[Insight-users] vtk polydata import / export

imho imho at bephp . com
Thu, 17 Jul 2003 16:22:42 +0200


Hi Luis,
I have a linking error

"
Compiling...
itkImageViewer.cxx
C:\itk\itksrc\Code\IO\itkImageViewerWindow.h(23) : fatal error C1083: 
Cannot open include file: 'itkGlutMaster.h': No such file or directory
Error executing cl.exe.

NewProject.exe - 1 error(s), 0 warning(s)
"
and I cant' find this in my itk folders.

So if the image files were corrupted, I have a problem with the 
vtkExport ---> itkImport or I've writed the files badly.
The conversion polyData->ImageData->polyData in VTK is OK witout the 
connection to itk.
the files :
vtk stuff
"
        polyToImage->SetInput(poly[0]); //  implicitModeller to do a 
polyData -> ImageData conversion
        polyLiveToImage->SetInput(polyLive);
       
        polyToImage->SetSampleDimensions(10, 10, 10);
        polyToImage->SetMaximumDistance(0.25);
//        polyToImage->SetModelBounds(poly[0]->GetBounds());
       
        polyLiveToImage->SetSampleDimensions(10, 10, 10);
//        polyLiveToImage->SetSampleDimensions(110, 40, 20);
        polyLiveToImage->SetMaximumDistance(0.25);
    //    polyLiveToImage->SetModelBounds(polyLive->GetBounds());
       
        imageModel = polyToImage->GetOutput(); // getting the ImageData
        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;

"

itk stuff
in registrationITK.h
"
...
    typedef float PixelType;
    typedef itk::Image<PixelType, Dimension> ImageType;

    typedef itk::VTKImageImport<ImageType> ImageImportType;
    typedef itk::VTKImageImport<InternalImageType> ImageImportType2;
    typedef itk::VTKImageExport<ImageType> ImageExportType;
    typedef itk::ImageFileWriter<ImageType> ImageWriter;

private :


    ImageImportType::Pointer itkImporter;
    ImageImportType::Pointer itkImporter2;
    ImageExportType::Pointer itkExporter;
    ImageWriter::Pointer writerITK;

};
"
in itkRegistration.cpp
"
registrationITK::registrationITK(vtkImageImport* vtkImporter, 
vtkImageExport *vtkExporter, vtkImageExport *vtkExporter2)
{   
    itkImporter = ImageImportType::New();
    itkImporter2 = ImageImportType::New();
    itkExporter = ImageExportType::New();
    writerITK = ImageWriter::New();

    itkExporter->SetInput(itkImporter->GetOutput());

    ConnectPipelines(vtkExporter, itkImporter);
    ConnectPipelines(vtkExporter2, itkImporter2);
    ConnectPipelines(itkExporter, vtkImporter);   
       
    itkImporter->Update();
    itkImporter2->Update();
    itkExporter->Update();
    writerITK->SetFileName("test_itk_write.vtk");
    
    itk::VTKImageIO::Pointer vtkWriter = itk::VTKImageIO::New();
    vtkWriter->SetFileName( "LOCAL" );
    vtkWriter->SetFileTypeToBinary();

    writerITK->SetImageIO( vtkWriter );
   
    writerITK->SetInput(itkImporter->GetOutput());
    
    writerITK->Update();
}
"
What could I try?

Thanks



Luis Ibanez wrote:

>
> Hi Imho,
>
> If you want to read the vtk image using VTK reader
> you may try the following reader.
> http://www . vtk . org/doc/nightly/html/classvtkDataSetReader . html
>
> I tried both image that you send, and they appear to be
> corrupted.
>
> What error did you encounter while building the viewer ?
>
> The viewer will help you a lot since with it you can see
> images in multiple formats: MetaImage, GIPL, Analyze, VTK...
>
>
>
>
>   Luis
>
>
>
> --------------------
> imho wrote:
>
>> Hi Luis,
>>
>> I have saved the data into a .mdh metaImage file, and it has a non 
>> null size.
>> I've tried to compile the imageViewer but I have a linking error so 
>> I've tried to save it into a VTK format, but I can't open it with my 
>> polyDataReader of course ( ERROR: In 
>> C:\martink\vtk40\VTK\IO\vtkPolyDataReader.cxx, line 167
>> vtkPolyDataReader (0x057D3900): Cannot read dataset type: 
>> structured_points). But it seems that the importer in itk is ok, it's 
>> the last part of the pipe-line that I've to check out, the 
>> itkExporter->vtkImporter.
>>
>> I send you the output files, maybe it could help.
>>
>> thanks
>>
>>
>
> .
>