[Insight-users] vtk polydata import / export

Luis Ibanez luis . ibanez at kitware . com
Fri, 18 Jul 2003 11:39:22 -0400


Hi Imho,

The viewer that you may want to use is the one in

    InsightApplications/ImageViewer/

It doesn't reguire GLUT, it does require FLTK.

---

The conversion from vtkPolyData to vtkImage is natually
a slow process, you are generating a volume from a
surface.  You don't want to do this each time.
Simply write a separate program that do the conversion
and save the images in files.  Then use the images
for running the Demons registration process.



Question:  How did you get this vtkPolyData models
            of the liver ?


Presumably you got them from a segmentation of actual
volumetric data....

If this is the case, you better use this original volumetric
data for performing the Demons registration, instead of
going the long way through a geometrical model.

Demons is based on a concept of optical flow, its precision
will be in the order of one-pixel, assuming that the gradients
in the image borders have profiles with linear sections.


Regards,


   Luis



--------------
imho wrote:
> Hi all,
> I have finally compiled it with the glut stuff but I have nothing at the 
> execution on windows...
> (no message, nothing)
> 
> Anyway, I'll try to resolve my pipe-line problem, and if I find out I'll 
> let you know.
> But the conversion vtkPolyData -> vtkImageData with the 
> vtkImplicitModeller is so slow (and I've two models to convert), I don't 
> know if the demons algorithm in ITK will be enough accurate.
> 
> Is there any other way to do a connection vtk-itk-vtk?
> 
> Thanks for your help.
> 
> Mathieu Malaterre wrote:
> 
>> You'll find the file here:
>>
>> http://public . kitware . com/cgi-bin/cvsweb . cgi/Insight/Utilities/GlutMaster/Attic/?cvsroot=Insight 
>>
>>
>> But as you can see this is no longer supported.
>>
>> HTH
>> mathieu
>>
>> imho wrote:
>>
>>> 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
>>>>>
>>>>>
>>>>
>>>> .
>>>>
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk . org
>>> http://www . itk . org/mailman/listinfo/insight-users
>>>
>>
>>
> 
>