[Insight-users] ITK 4 dicom series reading
Elhassan Abdou
hassan.abdou at yahoo.com
Sat Jul 21 21:13:23 EDT 2012
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
#ifndefBONESEGMENT_H
#defineBONESEGMENT_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>
classBoneSegment
{
public:
BoneSegment();
voidreadDirectory(QStringdirName);
vtkImageData*getImageData()const;
typedefsignedshortPixelType;
typedefitk::Image<PixelType,3>ImageType;
typedefitk::ImageSeriesReader<ImageType>ReaderType;
ReaderType::Pointerreader;
typedefitk::GDCMImageIOImageIOType;
ImageIOType::PointerdicomIO;
typedefitk::GDCMSeriesFileNamesNamesGeneratorType;
NamesGeneratorType::PointernameGenerator;
typedefstd::vector<std::string>SeriesIdContainer;
typedefstd::vector<std::string>FileNamesContainer;
typedefitk::ImageToVTKImageFilter<ImageType>ConnectorType;
};
BoneSegment::BoneSegment(){
}
voidBoneSegment::readDirectory(QStringdirName){
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());
constSeriesIdContainer&seriesUID=nameGenerator->GetSeriesUIDs();
std::stringseriesIdentifier;
seriesIdentifier=seriesUID.begin()->c_str();
FileNamesContainerfileNames;
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::Pointerconnector=ConnectorType::New();
connector->SetInput(reader->GetOutput());
return(connector->GetOutput());
}
#endif//BONESEGMENT_H
El-Hassan Mohamed
Biomedical engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120721/070a70b7/attachment.htm>
More information about the Insight-users
mailing list