US Multiframe

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

US Multiframe

#1 Post by paolom »

Hi, i've read that DCMTK-3.5.4 can handle the presentation display of US Multiframe (PALETTE COLOR) but with the DicomImage and the getOutputData I can retrive correctly only the first frame of the US ( the other frame are always black).

This is the dump of the file:

Code: Select all

# Dicom-File-Format

# Dicom-Meta-Information-Header
# Used TransferSyntax: LittleEndianExplicit
(0002,0000) UL 176                                      #   4, 1 MetaElementGroupLength
(0002,0001) OB 00\01                                    #   2, 1 FileMetaInformationVersion
(0002,0002) UI =UltrasoundMultiframeImageStorage        #  28, 1 MediaStorageSOPClassUID
(0002,0003) UI [999.999.133.1996.1.1800.1.6.25]         #  30, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =LittleEndianExplicit                    #  20, 1 TransferSyntaxUID
(0002,0012) UI [1.2.276.0.7230010.3.0.3.5.4]            #  28, 1 ImplementationClassUID
(0002,0013) SH [OFFIS_DCMTK_354]                        #  16, 1 ImplementationVersionName

# Dicom-Data-Set
# Used TransferSyntax: LittleEndianExplicit
(0008,0016) UI =UltrasoundMultiframeImageStorage        #  28, 1 SOPClassUID
(0008,0018) UI [999.999.133.1996.1.1800.1.6.25]         #  30, 1 SOPInstanceUID
(0008,0020) DA [1994.01.30]                             #  10, 1 StudyDate
(0008,0030) TM [11:25:01]                               #   8, 1 StudyTime
(0008,0060) CS [US]                                     #   2, 1 Modality
(0008,0090) PN [Anonymized]                             #  10, 1 ReferringPhysiciansName
(0008,1030) LO [Echocardiogram]                         #  14, 1 StudyDescription
(0008,103e) LO [PS LAX MR & AI]                         #  14, 1 SeriesDescription
(0010,0010) PN [Anonymized]                             #  10, 1 PatientsName
(0018,1063) DS [76.000000]                              #  10, 1 FrameTime
(0020,000d) UI [999.999.3859744]                        #  16, 1 StudyInstanceUID
(0020,000e) UI [999.999.94827453]                       #  16, 1 SeriesInstanceUID
(0020,0011) IS [5829]                                   #   4, 1 SeriesNumber
(0020,0013) IS [24]                                     #   2, 1 InstanceNumber
(0028,0002) US 1                                        #   2, 1 SamplesPerPixel
(0028,0004) CS [PALETTE COLOR]                          #  14, 1 PhotometricInterpretation
(0028,0008) IS [10]                                     #   2, 1 NumberOfFrames
(0028,0009) AT (0018,1063)                              #   4, 1 FrameIncrementPointer
(0028,0010) US 430                                      #   2, 1 Rows
(0028,0011) US 600                                      #   2, 1 Columns
(0028,0100) US 8                                        #   2, 1 BitsAllocated
(0028,0101) US 8                                        #   2, 1 BitsStored
(0028,0102) US 7                                        #   2, 1 HighBit
(0028,0103) US 0                                        #   2, 1 PixelRepresentation
(0028,1101) US 256\0\16                                 #   6, 3 RedPaletteColorLookupTableDescriptor
(0028,1102) US 256\0\16                                 #   6, 3 GreenPaletteColorLookupTableDescriptor
(0028,1103) US 256\0\16                                 #   6, 3 BluePaletteColorLookupTableDescriptor
(0028,1199) UI [999.999.389972238]                      #  18, 1 PaletteColorLookupTableUID
(0028,1201) OW 0000\0200\0400\0700\0a00\0c00\0f00\1100\1300\1700\1900\1c00\1e00... # 512, 1 RedPaletteColorLookupTableData
(0028,1202) OW 0000\0200\0400\0700\0a00\0c00\0f00\1100\1300\1700\1900\1c00\1e00... # 512, 1 GreenPaletteColorLookupTableData
(0028,1203) OW 0000\0200\0400\0700\0a00\0c00\0f00\1100\1300\1700\1900\1c00\1e00... # 512, 1 BluePaletteColorLookupTableData
(7fe0,0010) OW 7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f\7f7f... # 2580000, 1 PixelData

I've misunderstood, or it's possible to retrieve the pixeldata to display the US Multiframe without handle the Red,Green,Blue lookup table??

If not, I can I obtain the pixelData of all the frame?

Thanks

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Of course, the DicomImage class can handle multi-frame images as you can see when using the dcm2pnm command line tool. What exactly did you do in your source code?

paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

#3 Post by paolom »

I use the Qt as development toolkit.

With framenumber = 0 the image is correct, With > 0 the image is black.

Code: Select all


      
                image= new DicomImage(dataSet,
                                      EXS_LittleEndianExplicit);
      
          
                unsigned long iSize = image->getOutputDataSize();

                void * pixelData=(void *)malloc(iSize);

                frameNumber = 0;

                image->getOutputData(pixelData,iSize,16,frameNumber,0);

                /* For frameNumber = 0 the pixelData is correct,
                if I change frameNumber from 1 to 9 the pixelData as all 0 */

                pixelDataRGB=(Uint16 *)pixelData;

                pixel = (Uint8 *)malloc(iSize*sizeof(Uint8));

                for ( int i =0;i <iSize;i++)
                    pixel[i] = pixelDataRGB[i] >> 8;


                // QImage RGB 24-bit dall'originale
                qimage = new QImage((const uchar *)pixel,
                              image->getWidth(),
                              image->getHeight(),
                              image->getWidth() * 3,
                              QImage::Format_RGB888);

                qimage->save("/test.bmp");
I hope now It's more clear.

Thanks

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

What does DicomImage::getNumberOfFrames() return, and what is the return value of DicomImage::getOutputData() when the image is all black?

Did you also try dcm2pnm with option --all-frames or --frame-range?

Btw, why are you creating a 16 bits/sample output image when you only need 8 bits for your QImage? And, when using DicomImage::getOutputDataSize() you should use the same value for "bits" as for the later call to DicomImage::getOutputData(). In your sample code, the buffer should always be too small ...

paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

#5 Post by paolom »

Code: Select all

                image= new DicomImage(dataSet,
                                      EXS_LittleEndianExplicit);
                iSize = image->getOutputDataSize();

                pixelData=(void *)malloc(iSize);

               image->getOutputData(pixelData,iSize,8,1,0);

               qimage = new QImage((const uchar *)pixelData,
                              image->getWidth(),
                              image->getHeight(),
                              image->getWidth() * 3,
                              QImage::Format_RGB888);

                qimage->save("test.bmp");
I've changed but the result is the same.

getOutputData return 0 when is all black.

Ideas?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

As I wrote before, please use the same "bits" value for getOutputDataSize() and getOutputData()! If getOutputData() returns 0, the creation of the output data failed (for some reason).

Have you checked my other questions (above), e.g. what does getNumberOfFrames() return for your image? Does dcm2pnm work for all frames?

Btw, if I were you, I would probably start to debug my own code (and the DCMTK functions called by my code) ... and of course, you should always check the image status before proceeding, see example in the documentation.

paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

#7 Post by paolom »

Hi,

getNumberOfFrames() in DicomImage doesn't exist...

However, I've used this code finally:

Code: Select all


                image= new DicomImage(dataSet,
                                      EXS_LittleEndianExplicit);

                qDebug() << DicomImage::getString(image->getStatus());
                
                iSize = image->getOutputDataSize(8);

                pixelData=(void *)malloc(iSize);

                    qDebug() <<  image->getOutputData(pixelData,iSize,8,frameNumber);


               // Creazione della QImage RGB 24-bit dall'originale
                qimage = new QImage((const uchar *)pixelData,
                              image->getWidth(),
                              image->getHeight(),
                              image->getWidth() * 3,
                              QImage::Format_RGB888);

                qimage->save("test.bmp");
but the result is the same. For frameNumber = 0 the DicomImage:getOutputData() return 1, for other numbers 0.

Ok, it's possible that it doesn't recognize the other frame.

How you should you to get correctly the pixel data?

Is it the right way ?

Thanks

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#8 Post by Jörg Riesmeier »

You are correct: On DicomImage class level, this method is called getFrameCount() :-)

paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

#9 Post by paolom »

You are right : getFrameCount() return 1 !!!!

I think it's impossible to handle this kind of dicom... ???

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#10 Post by Michael Onken »

Hi,

best is just to try dcm2pnm:

Code: Select all

 dcm2pnm --all-frames inputfile.dcm outputfile.dcm -v -d
Best regards,
Michael & Jörg (@Switzerland) :-)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest