[Insight-users] How to open this DICOM series
Luca Binotto
binotto at lycos.de
Thu Sep 28 12:24:12 EDT 2006
Hi there,
I need to read the DICOM series hosted at http://nova.nlm.nih.gov/data/
( knee , sheep and tooth ). I used the code found in: DicomSeriesReadImageWrite2.cxx
but I still cannot read them.
/**
CT human tooth: each pixel is 16 bits (an unsigned short), data ordering BigEndian
MRI human knee: each pixel is 16 bits (an unsigned short), data ordering BigEndian
MRI sheep heart: each pixel is 8 bits (an unsigned char)
*/
##################################################################
My shell output. for example, trying to read the knee dataset:
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
##########################################################################################
/* CODE */
typedef unsigned short PixelType; // unsigned short
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();
//dicomIO->SetByteOrderToLittleEndian();
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;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I can read other DICOM series but those hosted there no one.
Someone can tell me what 's the correct method ?
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