[Insight-users] Converting from 3DS model to DICOM image

Víctor Rodrigo Córdoba vrcordoba at gmail.com
Wed Oct 29 08:04:00 EDT 2008


Hi all.

I'm doing an application to convert 3ds liver models to DICOM images. I
think the main code must look like this (First import to vtk and then import
to itk):

    // Import to VTK
    vtk3DSImporter *importer = vtk3DSImporter::New();
    importer->SetFileName(dirIn);
    importer->ComputeNormalsOn();
    importer->Read();
    vtkImplicitModeller* polyToImage = vtkImplicitModeller::New();
    polyToImage->SetInput((vtkDataSet*)importer->MeshList->aPolyData);
    polyToImage->SetSampleDimensions(10, 10, 10);
    polyToImage->SetMaximumDistance(0.25);
    vtkImageData* vtkData = polyToImage->GetOutput();
    vtkData->Update();

    // Import to ITK
    typedef itk::Image<signed short,3> imageDICOM;
    typedef itk::VTKImageToImageFilter<imageDICOM> VTK2ITKFilter;
    VTK2ITKFilter::Pointer vtk2itk = VTK2ITKFilter::New();
    vtk2itk->SetInput(vtkData);
    vtk2itk->Update();

    // Saving like DICOM
    typedef itk::ImageFileWriter < imageDICOM > WriterType;
    typedef itk::GDCMImageIO ImageIOType;
    ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
    WriterType::Pointer writer = WriterType::New();
    strncpy(dirOut,dirIn,tamanyoDir);
    strcat(dirOut,".dcm");
    writer->SetFileName(dirOut);
    writer->SetInput(vtk2itk->GetOutput());
    writer->SetImageIO(gdcmImageIO);
    try {
            writer->Update();
        }
    catch ( itk::ExceptionObject & anException ) {
        std::cerr << "\n\n** Exception in File Writer:  " << anException
        << " **\n\n" << std::endl;
        return EXIT_FAILURE;
        };

This code crash at vtk2itk->Update(); and I don't know what to do.
All suggestions will be welcomed.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081029/7c7491fe/attachment.htm>


More information about the Insight-users mailing list