Чтение многокадровых изображений DICOM с использованием ITK

Я могу нормально читать однокадровые изображения DICOM. Но я не уверен, как читать многокадровый файл DICOM, который, скажем, содержит несколько изображений в одном файле DICOM. Вот код, который я использую для чтения одиночного кадра DICOM. Я думаю, что загруженный буфер изображения (imageBuf) должен быть разделен на столько частей, сколько кадров в DICOM, и использовать каждую часть для построения изображения. Это можно сделать?

int imageWidth = 880;
int imageHeight = 635;
NSString *dicomPath = [[[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/"] stringByAppendingString:@"your dicom file name"];
const char *c_dicomPath = [dicomPath UTF8String];

typedef unsigned char InputPixelType; 
const unsigned int InputDimension = 3;
typedef itk::Image< InputPixelType, InputDimension > InputImageType;

typedef itk::ImageFileReader< InputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(c_dicomPath);

typedef itk::GDCMImageIO ImageIOType; 
ImageIOType::Pointer gdcmImageIO = ImageIOType::New(); 
reader->SetImageIO(gdcmImageIO);

InputPixelType *imageBuf = (InputPixelType*)malloc(sizeof(InputPixelType)*imageHeight*imageWidth*3);
reader->Update();

//get dicom image
memset(imageBuf, 0, sizeof(InputPixelType)*imageHeight*imageWidth*3);

gdcmImageIO->Read(imageBuf);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGDataProviderRef provider = CGDataProviderCreateWithData(nil, imageBuf, imageWidth*imageHeight*3*sizeof(InputPixelType), nil);  

CGImageRef imageRef = CGImageCreate(imageWidth,//width
                                    imageHeight,//height 
                                    8,//size_t bitsPerComponent, 
                                    24,//size_t bitsPerPixel,
                                    imageWidth*sizeof(InputPixelType)*3,//size_t bytesPerRow, 
                                    colorspace,//CGColorSpaceRef space,
                                    kCGBitmapByteOrderDefault,//CGBitmapInfo bitmapInfo,
                                    provider,//CGDataProviderRef provider,
                                    nil,//const CGFloat *decode,
                                    NO,//bool shouldInterpolate, 
                                    kCGRenderingIntentDefault//CGColorRenderingIntent intent
                                    );
//here is the dicom image decode from dicom file
UIImage *dicomImage = [[UIImage alloc] initWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationUp];

person over.drive    schedule 23.03.2012    source источник


Ответы (1)


Вы пробовали itk::ImageSeriesReader?

person QT-ITK-VTK-Help    schedule 10.01.2013