[Insight-users] How to Decode MultiFrame DICOM Image by Using ITK

Jothybasu Selvaraj jothybasu at gmail.com
Thu Mar 8 05:08:57 EST 2012


I hope , if you have any class such as itkGDCMImageReader it could handle
this.

Jothy

On Thu, Mar 8, 2012 at 1:29 AM, Terran Wu <Terran.Wu at semt.com.cn> wrote:

> Thank you for you kindly help.
> But right now I am using ITK on apple's IOS system and VTK can not been
> used on IOS system.
> Do you know how to decode the multi frame DICOM file by only using ITK?
> Thank you very much.
> --
>
> Best Regards****
>
> Terran Wu****
>
> *Î׎Ì*
>
> * *
>
> [image: Description: cid:image001.png at 01CA4B37.99F9CD50]****
>
> *ÉîÛÚ°ÙʤҽÁƿƼ¼ÓÐÏÞ¹«Ë¾*
>
> Shenzhen Esaote Medical Technology Co., Ltd****
>
> Tel: +86-755-61864500-668
>
> Email: Terran.Wu at semt.com.cn
>
> From: Jothybasu Selvaraj <jothybasu at gmail.com>
> Date: Wed, 7 Mar 2012 09:51:44 +0000
> To: Terran Wu <Terran.Wu at semt.com.cn>
> Cc: "insight-users at itk.org" <insight-users at itk.org>
> Subject: Re: [Insight-users] How to Decode MultiFrame DICOM Image by
> Using ITK
>
> Though it's not a vtk list,
>
> vtkGDCmImageReader can handle it.
>
> Jothy
>
>
>
> On Wed, Mar 7, 2012 at 3:41 AM, Terran Wu <Terran.Wu at semt.com.cn> wrote:
>
>> Hi All,
>>
>> I am currently write a application that reading and display DICOM image
>> on IPAD2. Now I am able to read and decode DICOM files that contain only
>> one frame, here is the code(using ITK LIB and object-c) that decode one
>> frame DICOM file on IPAD:
>>
>> //assume that the size of image is 880*635
>>
>>     int imageWidth = 880;
>>
>>     int imageHeight = 635;
>>
>>
>>
>>     NSString *dicomPath = [[[[NSBundle mainBundle] resourcePath]
>> stringByAppendingString:@"/"] stringByAppendingString:@"dicomfilename"];
>>
>>     const char *c_dicomPath = [dicomPath UTF8String];
>>
>>
>>
>>     typedef unsigned char InputPixelType;
>>
>>     const unsigned int InputDimension = 2;
>>
>>     typedef itk::Image< InputPixelType, InputDimension > InputImageType;
>>
>>
>>
>>     typedef itk::ImageSeriesReader< InputImageType > ReaderType;
>>
>>     ReaderType::Pointer reader = ReaderType::New();
>>
>>     reader->SetFileName(c_dicomPath);
>>
>>
>>
>>     typedef itk::GDCMImageIO ImageIOType;
>>
>>     ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
>>
>>
>>
>>     reader->SetImageIO(gdcmImageIO);
>>
>>
>>
>>     int frame_num = 1;
>>
>>     InputPixelType *imageBuf = new InputPixelType[imageHeight*imageWidth*
>> 3*frame_num];
>>
>>
>>
>>     try
>>
>>     {
>>
>>         reader->Update();
>>
>>         printf("image size in bytes = %d\n", gdcmImageIO->
>> GetImageSizeInBytes());
>>
>>         printf("image size in pixel = %d\n", gdcmImageIO->
>> GetImageSizeInPixels());
>>
>>         printf("image size in Components = %d\n", gdcmImageIO->
>> GetImageSizeInComponents());
>>
>>         printf("pixel stride = %d\n", gdcmImageIO->GetPixelStride());
>>
>>         printf("Dimensions = %d\n", gdcmImageIO->GetNumberOfDimensions
>> ());
>>
>>         printf("file type = %d\n", gdcmImageIO->GetFileType());
>>
>>         std::cout << "file type = " << gdcmImageIO->GetFileTypeAsString
>> (gdcmImageIO->GetFileType()) << std::endl;
>>
>>         std::cout << "Pixel type = " << gdcmImageIO->GetPixelTypeAsString
>> (gdcmImageIO->GetPixelType()) << std::endl;
>>
>>         std::cout << "Byte order = " << gdcmImageIO->GetByteOrderAsString
>> (gdcmImageIO->GetByteOrder()) << std::endl;
>>
>>         gdcmImageIO->GetPixelType();
>>
>>     }
>>
>>     catch (itk::ExceptionObject & e)
>>
>>     {
>>
>>         std::cerr << "exception in file reader " << std::endl; std::cerr<< e <<
>> std::endl;
>>
>>         exit(EXIT_FAILURE);
>>
>>     }
>>
>>
>>
>>     //get dicom image
>>
>>     memset(imageBuf, 0, sizeof(InputPixelType)*imageHeight*imageWidth*3
>> *frame_num);
>>
>>     gdcmImageIO->Read(imageBuf);//get decoded image data
>>
>>
>>
>>     CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
>>
>>     CGDataProviderRef provider = CGDataProviderCreateWithData(nil,
>> imageBuf, imageWidth*imageHeight*3, 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
>>
>>                                         );
>>
>>     UIImage *dicomImage = [[UIImage alloc] initWithCGImage:imageRef scale
>> :1.0 orientation:UIImageOrientationUp];//here is the decoded image
>>
>> But I don't know how to decode and read a DICOM file that has MultiFrame,
>> and how to get the decoded image data to display them on IPAD screen?
>>
>> Can anybody help me on this issue?
>>
>>  Thank you very much!
>>
>> --
>>
>> Best Regards****
>>
>> Terran Wu****
>>
>> *Î׎Ì*
>>
>> *
>> *
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
> --
> Jothy
>
>


-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120308/77e2146b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 6337 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120308/77e2146b/attachment-0001.png>


More information about the Insight-users mailing list