[Insight-users] Converting from 3DS model to DICOM image
Mathieu Malaterre
mathieu.malaterre at gmail.com
Wed Oct 29 17:02:50 EDT 2008
I do not know if this yet available in IJ but there is some work in
progress being done for 2D flat data (RTSTRUCT):
http://www.itk.org/pipermail/insight-users/2008-September/027298.html
2cts
On Wed, Oct 29, 2008 at 8:58 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> 3D Studio models are made of of triangles. The DICOM implementation
> only supports images.
>
> On Wed, Oct 29, 2008 at 8:04 AM, Víctor Rodrigo Córdoba
> <vrcordoba at gmail.com> wrote:
>> 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.
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
--
Mathieu
More information about the Insight-users
mailing list