[ITK] [ITK-users] Fwd: problem with convert itk to vtk

Dženan Zukić dzenanz at gmail.com
Tue Apr 29 07:14:29 EDT 2014


Then you most likely have some problems with how libraries are
compiled/built. Can you successfully run examples that come with ITK and
VTK libraries? If not, you first need to take care of those issues.


On Tue, Apr 29, 2014 at 1:01 PM, Роман Глуховский <roman_glu at mail.ru> wrote:

> I try this example, but i get also a segmentation fault
>
>
> Tue, 29 Apr 2014 12:04:45 +0200 от Dženan Zukić <dzenanz at gmail.com>:
>
>   Have you seen this example?
>
> http://vtk.org/Wiki/VTK/ExamplesBoneYard/Cxx/VolumeRendering/itkVtkImageConvert
>
>
> On Tue, Apr 29, 2014 at 10:45 AM, Роман Глуховский <roman_glu at mail.ru<https://e.mail.ru/compose/?mailto=mailto%3aroman_glu@mail.ru>
> > wrote:
>
>
>   I change the part of my programm to load the ImageSeries,
>
>     typedef itk::Image<unsigned char, 3> ImageType;
>     typedef itk::ImageSeriesReader< ImageType >  ReaderType;
>     ReaderType::Pointer reader = ReaderType::New();
>     typedef itk::GDCMImageIO ImageIOType;
>     ImageIOType::Pointer dicomIO = ImageIOType::New();
>     reader->SetImageIO(dicomIO);
>
>     typedef itk::GDCMSeriesFileNames NamesGeneratorType;
>     NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
>     nameGenerator->SetDirectory("Folder");
>
>
>     // get series IDs
>     typedef std::vector<std::string> SeriesIdContainer;
>     const SeriesIdContainer &seriesUID = nameGenerator->GetSeriesUIDs();
>
>     // get dicom series
>     typedef std::vector<std::string> FileNamesContainer;
>     FileNamesContainer fileName;
>     fileName=nameGenerator->GetFileNames(seriesUID.begin()->c_str());
>     reader->SetFileNames(fileName);
>
>     // pull reader
>     reader->Update();
>
> But my programm crash again at the same position, when i try to convert to
> vtk.
>
>
> Sat, 26 Apr 2014 07:12:55 +0800 (CST) от 关红彦 <ghy at tellyes.com<https://e.mail.ru/compose/?mailto=mailto%3aghy@tellyes.com>
> >:
>
>
>
> I just wonder if your 3D medical images save as a file or a series of
> images.
> If you save  them to a series of files,  you shouldn't  do this:
>  #include <itkImageFileReader.h<http://www.itk.org/Doxygen45/html/itkImageFileReader_8h_source.html>
> >
> reader->SetFileName( "DICOM-File" ); 
>
> but this:
> #include <itkImageSeriesReader.h<http://www.itk.org/Doxygen45/html/itkImageSeriesReader_8h_source.html>
> >
>  void SetFileNames<http://www.itk.org/Doxygen45/html/classitk_1_1ImageSeriesReader.html#aedb3ea58c4bb4975f46ef9c85a855aa6>
>  (const FileNamesContainer<http://www.itk.org/Doxygen45/html/classitk_1_1ImageSeriesReader.html#a2efd0b86373c161229f7984b9ea4af56>
>  &name) This class can read a series of *.DCM files that are using a lot
> in the hospital.
>
>
> At 2014-04-25 20:52:20,"Роман Глуховский" <roman_glu at mail.ru<https://e.mail.ru/compose/?mailto=mailto%3aroman_glu@mail.ru>>
> wrote:
>
> Hi vtkusers,
>
> i load a DICOM-file with itk and after that i would like to display the
> file with vtk.
>
> If I compile the programm I have no error. When i start the programm, its
> crashed and
> i get a return value "0".
>
> In the debug-mode i get a "segmentation fault" and the programm stops at
> this position
>
> ---------->
> m_Importer->SetPropagateUpdateExtentCallback(m_Exporter->GetPropagateUpdateExtentCallback());
>
> in the "itkImageToVTKImageFilter_hxx".
>
> Here is my code:
>
>         typedef itk::Image<unsigned char, 3> VisualizingImageType;
>         typedef itk::ImageFileReader< VisualizingImageType >  ReaderType;
>         ReaderType::Pointer reader = ReaderType::New();
>         reader->SetFileName( "DICOM-File" );
>         typedef itk::GDCMImageIO ImageIOType;
>
>         ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
>
>         reader->SetImageIO( gdcmImageIO );
>         reader->Update();
>         reader->GetOutput()->Print(std::cout);
>
>         vtkSmartPointer<vtkRenderWindow> renWin =
> vtkSmartPointer<vtkRenderWindow>::New();
>         vtkSmartPointer<vtkRenderer> ren1 =
> vtkSmartPointer<vtkRenderer>::New();
>         ren1->SetBackground(0.5f,0.5f,1.0f);
>
>         renWin->AddRenderer(ren1);
>         renWin->SetSize(1280,1024);
>         vtkSmartPointer<vtkRenderWindowInteractor> iren =
>             vtkSmartPointer<vtkRenderWindowInteractor>::New();
>         iren->SetRenderWindow(renWin);
>         renWin->Render(); // make sure we have an OpenGL context.
>
>         typedef itk::ImageToVTKImageFilter<VisualizingImageType>
> itkVtkConverter;
>         itkVtkConverter::Pointer conv=itkVtkConverter::New();
>         conv->GetExporter()->SetInput(reader->GetOutput());
>         conv->GetImporter()->Update();
>         conv->GetImporter()->GetOutput()->Print(std::cout);
>
>         vtkImageViewer * viewer =vtkImageViewer::New();
>         vtkRenderWindowInteractor * renderWindowInteractor =
>         vtkRenderWindowInteractor::New();
>         viewer->SetupInteractor( renderWindowInteractor );
>         viewer->SetInputData( conv->GetImporter()->GetOutput() );
>         viewer->SetZSlice( 0 ); // <-- Slice selection
>         viewer->Render();
>         renderWindowInteractor->Start();
>
>         viewer->Delete();
>         renderWindowInteractor->Delete();
>         conv->GetImporter()->Delete();
>
>
> Thank you for your help
>
> Roman
>
>
>  _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> ------------------------------
>
> ------------------------------
>
> --
> Роман Глуховский
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140429/391998eb/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users


More information about the Community mailing list