[英]Can't get Pixel Data from DICOM using GDCM
I need some help with GDCM . 我需要有关GDCM的帮助。
I've been trying to get the Pixel Data from DICOM file for a few days. 我一直在尝试从DICOM文件中获取像素数据。 There are lot's of ways how to do it... I decided to use GDCM.
有很多方法可以实现...我决定使用GDCM。 I download their libraries and try to get pixel data like this:
我下载了它们的库,并尝试获取像这样的像素数据:
#include "gdcmFileHelper.h"
#include "gdcmFile.h"
int main( int argc, char* argv[] )
{
gdcm::File *f1 = new gdcm::File();
f1->SetFileName( 'test.dcm' );
f1->Load();
gdcm::FileHelper *fh = gdcm::FileHelper::New(f1);
unsigned int *imageData = fh->GetImageDataRaw();
unsigned int imageDatasize = fh->GGetImageDataRawSize();
return 0;
}
But, I have no gdcmFileHelper.h
in their list of headers and lib's ... So I've tried like this: 但是,我在他们的标头列表和lib的列表中都没有
gdcmFileHelper.h
...因此,我尝试过这样的尝试:
#include "gdcmImageReader.h"
#include "gdcmImage.h"
int main(int argc, char *argv[])
{
gdcm::ImageReader reader;
reader.SetFileName( filename );
const gdcm::Image &image = reader.GetImage();
return 0;
}
How can i get pixel data in this way ? 如何以这种方式获取像素数据? Or .. where can i get
gdcmFileHelper.h
... 或者..我在哪里可以得到
gdcmFileHelper.h
...
You have to call image.GetBuffer() , see for example the PIL <-> GDCM binding: 您必须调用image.GetBuffer() ,例如,参见PIL <-> GDCM绑定:
You first example will not work, it uses GDCM 1.x, which has been abandoned AFAIK. 您的第一个示例将不起作用,它使用GDCM 1.x,该版本已被AFAIK放弃。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.