[Insight-users] Cannot read DICOM file series
Luca Binotto
binotto at lycos.de
Fri Sep 29 09:52:37 EDT 2006
Hello users,
I need to read the dicom file series hosted at http://nova.nlm.nih.gov/data/
knee sheep and tooth series.
For that purpose I used the code found in Examples/IO
DicomSeriesReadImageWrite2.cxx:
For example to read the knee series I used:
( MRI human knee: each pixel is 16 bits (an unsigned short), data ordering BigEndian)
typedef unsigned short PixelType;
const unsigned int Dimension = 3;
typedef itk::Image<PixelType,Dimension> ImageType;
typedef itk::ImageSeriesReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer dicomIO = ImageIOType::New();
dicomIO->SetByteOrderToBigEndian();
reader->SetImageIO( dicomIO );
typedef itk::GDCMSeriesFileNames NamesGeneratorType;
NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
nameGenerator->SetUseSeriesDetails( true );
//nameGenerator->AddSeriesRestriction("0008|0021" );
nameGenerator->SetDirectory( argv[1] );
try
{
std::cout << std::endl << "The directory: " << std::endl;
std::cout << std::endl << argv[1] << std::endl << std::endl;
std::cout << "Contains the following DICOM Series: ";
std::cout << std::endl << std::endl;
typedef std::vector< std::string > SeriesIdContainer;
const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
while( seriesItr != seriesEnd )
{
std::cout << seriesItr->c_str() << std::endl;
seriesItr++;
}
std::string seriesIdentifier;
if( argc > 3 ) // If no optional series identifier
{
seriesIdentifier = argv[3];
}
else
{
seriesIdentifier = seriesUID.begin()->c_str();
}
std::cout << std::endl << std::endl;
std::cout << "Now reading series: " << std::endl << std::endl;
std::cout << seriesIdentifier << std::endl;
std::cout << std::endl << std::endl;
typedef std::vector< std::string > FileNamesContainer;
FileNamesContainer fileNames;
fileNames = nameGenerator->GetFileNames( seriesIdentifier );
reader->SetFileNames( fileNames );
try
{
reader->Update();
}
catch (itk::ExceptionObject &ex)
{
std::cout << ex << std::endl;
return EXIT_FAILURE;
}
}
catch (itk::ExceptionObject &ex)
{
std::cout << ex << std::endl;
return EXIT_FAILURE;
}
#################################################
shell output : (Linux)
luca at linuxBINOTTO:~/devel/vtkITK> vtkITK /home/luca/devel/vtkITK/knee knee
The directory:
/home/luca/devel/vtkITK/knee
Contains the following DICOM Series:
WARNING: In /usr/local/ITK_src/InsightToolkit-2.8.1/Code/IO/itkGDCMSeriesFileNames.cxx, line 89
GDCMSeriesFileNames (0x812fed0): No Series were found
Segmentation fault
Someone can tell me what's wrong ?
Thanks in advance, Luca
Schnell und einfach ohne Anschlusswechsel zur Lycos DSL Flatrate wechseln und 3 Monate kostenlos ab effektiven 5,21 EUR pro Monat im ersten Jahr surfen.
http://www.lycos.de/startseite/online/dsl/index.html?prod=DSL&trackingID=email_footertxt
More information about the Insight-users
mailing list