Hi all.<br><br>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):<br><br> // Import to VTK<br> vtk3DSImporter *importer = vtk3DSImporter::New();<br>
importer->SetFileName(dirIn);<br> importer->ComputeNormalsOn();<br> importer->Read();<br> vtkImplicitModeller* polyToImage = vtkImplicitModeller::New();<br> polyToImage->SetInput((vtkDataSet*)importer->MeshList->aPolyData);<br>
polyToImage->SetSampleDimensions(10, 10, 10);<br> polyToImage->SetMaximumDistance(0.25);<br> vtkImageData* vtkData = polyToImage->GetOutput();<br> vtkData->Update();<br><br> // Import to ITK<br>
typedef itk::Image<signed short,3> imageDICOM;<br> typedef itk::VTKImageToImageFilter<imageDICOM> VTK2ITKFilter;<br> VTK2ITKFilter::Pointer vtk2itk = VTK2ITKFilter::New();<br> vtk2itk->SetInput(vtkData);<br>
vtk2itk->Update();<br><br> // Saving like DICOM<br> typedef itk::ImageFileWriter < imageDICOM > WriterType;<br> typedef itk::GDCMImageIO ImageIOType;<br> ImageIOType::Pointer gdcmImageIO = ImageIOType::New(); <br>
WriterType::Pointer writer = WriterType::New();<br> strncpy(dirOut,dirIn,tamanyoDir);<br> strcat(dirOut,".dcm");<br> writer->SetFileName(dirOut);<br> writer->SetInput(vtk2itk->GetOutput());<br>
writer->SetImageIO(gdcmImageIO); <br> try {<br> writer->Update();<br> }<br> catch ( itk::ExceptionObject & anException ) {<br> std::cerr << "\n\n** Exception in File Writer: " << anException <br>
<< " **\n\n" << std::endl;<br> return EXIT_FAILURE;<br> }; <br><br>This code crash at vtk2itk->Update(); and I don't know what to do.<br>All suggestions will be welcomed.<br>
<br>Thanks.<br>