[Insight-users] ITK 4 dicom series reading
Sergio Vera
sergio.vera at alma3d.com
Mon Jul 23 03:24:02 EDT 2012
Is the program catching any itk::exception ? if not, add an additional
catch sentence with ordinary exception and see if any other error message
appears
On Sun, Jul 22, 2012 at 3:13 AM, Elhassan Abdou <hassan.abdou at yahoo.com>wrote:
> Hi
>
> Can anyone help me and tell me why reader->Update in this code is giving
> me SIGABRT signal.
> I can not understand what is wrong PLease help me
>
> #ifndef BONESEGMENT_H
>
> #define BONESEGMENT_H
>
> #include "itkImage.h"
>
> #include "itkGDCMImageIO.h"
>
> #include "itkGDCMSeriesFileNames.h"
>
> #include "itkImageSeriesReader.h"
>
> #include "itkImageToVTKImageFilter.h"
>
> #include <QString>
>
> #include <QMessageBox>
>
> #include <vtkImageData.h>
>
> #include <string>
>
>
> class BoneSegment
>
> {
>
> public:
>
> BoneSegment();
>
> void readDirectory(QString dirName);
>
> vtkImageData* getImageData()const;
>
> typedef signed short PixelType;
>
> typedef itk::Image< PixelType, 3 >ImageType;
>
> typedef itk::ImageSeriesReader< ImageType > ReaderType;
>
> ReaderType::Pointer reader;
>
> typedef itk::GDCMImageIO ImageIOType;
>
> ImageIOType::Pointer dicomIO;
>
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;
>
> NamesGeneratorType::Pointer nameGenerator;
>
> typedef std::vector< std::string > SeriesIdContainer;
>
> typedef std::vector< std::string > FileNamesContainer;
>
> typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
>
> };
>
> BoneSegment::BoneSegment(){
>
> }
>
> void BoneSegment::readDirectory(QString dirName){
>
> reader = ReaderType::New();
>
> dicomIO = ImageIOType::New();
>
> nameGenerator = NamesGeneratorType::New();
>
> nameGenerator->SetUseSeriesDetails( true );
>
> nameGenerator->AddSeriesRestriction("0008|0021" );
>
> nameGenerator->AddSeriesRestriction("0020,0037");
>
> nameGenerator->LoadSequencesOn();
>
> nameGenerator->LoadPrivateTagsOn();
>
> nameGenerator->SetInputDirectory( dirName.toStdString());
>
> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
>
> std::string seriesIdentifier;
>
> seriesIdentifier = seriesUID.begin()->c_str();
>
> FileNamesContainer fileNames;
>
> fileNames = nameGenerator->GetFileNames( seriesIdentifier );
>
> reader->UseStreamingOn();
>
> reader->SetFileNames( fileNames );
>
> reader->SetImageIO( dicomIO );
>
> try
>
> {
>
> reader->Update();
>
> }
>
> catch (itk::ExceptionObject &ex)
>
> {
>
> std::cout << ex << std::endl;
>
> }
>
> }
>
> vtkImageData* BoneSegment::getImageData()const{
>
> ConnectorType::Pointer connector = ConnectorType::New();
>
> connector->SetInput(reader->GetOutput());
>
> return (connector->GetOutput());
>
> }
>
> #endif // BONESEGMENT_H
>
>
> El-Hassan Mohamed
> Biomedical engineering
>
> _____________________________________
> 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
>
>
--
Sergio Vera
Alma IT Systems
C/ Vilana, 4B, 4º 1ª
08022 Barcelona
T. (+34) 932 380 592
www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120723/cd126a69/attachment.htm>
More information about the Insight-users
mailing list