未使用 ITK 正确读取 DICOM 图像系列
我想读取一系列 DICOM 图像,并使用 ITK 将它们转换为 3D 图像。我遵循文档中的示例:“Examples/IO/DicomSeriesReadImageWrite2.cxx”。但我仍然遇到问题,我解决了一些,但我想听听任何提示,请!
问题出在下划线的代码行中,代码就在下面,而且不是那么长。它编译,变量 'seriesItr' 的值为 = "1.2.392.200036.9116.2.6.1.48.1214834239.1284941923.42443543.0512512" 。但变量“seriesEnd”是一个空指针!我做错了什么?感谢您的提前帮助!
// Reading a 2D DICOM Series and Writing a Volume
ReaderType::Pointer reader = ReaderType::New();
ImageIOType::Pointer dicomIO = ImageIOType::New();
reader->SetImageIO( dicomIO );
NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
nameGenerator->SetUseSeriesDetails( true );
std::string folder;
folder = "C:\\Documents and Settings\\GTTS\\Mis documentos\\Visual Studio 2008\\Projects\\Reg_mono3D\\Reg_mono3D\\DICOM_SERIES\\T\\";
nameGenerator->SetDirectory(folder);
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;
seriesIdentifier = seriesUID.begin()->c_str();
FileNamesContainer fileNames;
fileNames = nameGenerator->GetFileNames( seriesIdentifier );
reader->SetFileNames( fileNames );
try
{
reader->Update();
}
catch (itk::ExceptionObject &ex)
{
cout << ex << std::endl;
}
I want to read a Series of DICOM image to convert them into a 3D image using ITK. I follow the example in the documentation: " Examples/IO/DicomSeriesReadImageWrite2.cxx" . But I am still having problems, I solved some, but I would like to hear any tip, please!
The problem is in the code line underlined, the code is just below here and it’s not so long. It compiles, and the variable ‘seriesItr’ has the value = "1.2.392.200036.9116.2.6.1.48.1214834239.1284941923.42443543.0512512" . But the variable ‘seriesEnd’ is a null pointer! What am I doing wrong? Thanks for your help in advanced!
// Reading a 2D DICOM Series and Writing a Volume
ReaderType::Pointer reader = ReaderType::New();
ImageIOType::Pointer dicomIO = ImageIOType::New();
reader->SetImageIO( dicomIO );
NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
nameGenerator->SetUseSeriesDetails( true );
std::string folder;
folder = "C:\\Documents and Settings\\GTTS\\Mis documentos\\Visual Studio 2008\\Projects\\Reg_mono3D\\Reg_mono3D\\DICOM_SERIES\\T\\";
nameGenerator->SetDirectory(folder);
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;
seriesIdentifier = seriesUID.begin()->c_str();
FileNamesContainer fileNames;
fileNames = nameGenerator->GetFileNames( seriesIdentifier );
reader->SetFileNames( fileNames );
try
{
reader->Update();
}
catch (itk::ExceptionObject &ex)
{
cout << ex << std::endl;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
图像可能不是 100% 合规吗?许多工具包的容错能力都不是很好,而且似乎 90% 的供应商都没有 100% 合规。我会尝试通过 DCMtk 工具 dcmconv 运行图像来“转换”文件。我在引号中使用 Convert 是因为我经常使用与当前完全相同的设置来运行文件,因为 dcmconv 将以 100% 兼容的方式导出副本。
有关 dcmconv 的信息可在此处找到:http://support.dcmtk.org/docs/dcmconv.html
威尔
Is it possible the images aren't 100% compliant? Many toolkits out there are not very fault tolerate, and it seems like 90% of vendors are not 100% compliant. I would try running the images through the DCMtk tool dcmconv to "convert" the files. I use convert in quotes because I'll often run files through it with the exact same settings they currently have because dcmconv will export the copies in a 100% compliant way.
Info on dcmconv can be found here: http://support.dcmtk.org/docs/dcmconv.html
Will