Value Multiplicity problem (Value Representation is OW)

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ogabor
Posts: 9
Joined: Wed, 2005-06-29, 15:33
Location: Debrecen, Hungary

Value Multiplicity problem (Value Representation is OW)

#1 Post by ogabor »

Hi Jörg, Thomas, Marco, Michael and Others,

I've a problem with the value multiplicity, when the value representation is OW. Here is a simple sample code:

Code: Select all

int main(int argc, char *argv[])
{
  DcmFileFormat fileformat;

  OFCondition status = fileformat.loadFile(argv[1]);
  if (status.good())
    {
      DcmItem *ditem = fileformat.getDataset();
      
      DcmObject *object = NULL;

      for( int i = 0; i < ditem -> card(); i++)
      {
 	   object = ditem -> nextInContainer( object );

	   DcmTagKey tagKey = object -> getTag();

	   DcmVR vr( object->getVR() );
	  
	   if( vr.getEVR() == EVR_OW )
	     {
	       unsigned long vm = object -> getVM();

	       cout << hex << "(" << tagKey.getGroup() << "," << tagKey.getElement() << dec << "), " 
		   << vr.getVRName() << ", " << vm << endl;
	     }
      }
    }
}
The output of this code is:
(5000,3000), OW, 1
(7fe0,10), OW, 1
But the dcmdump produces:
(5000,3000) OW 001b\001b\001b\001b\001b\001b\001b\001b\001a\001b\001b\001a\001b... # 660, 1 CurveData
(7fe0,0010) OW 2727\2526\2625\2224\2222\2322\2224\181d\1b1a\1b1c\191a\1b1a\1b1a... # 262144, 1 PixelData
Could anybody explain it?

(dicom file can be found here: pet.dote.hu/~ogabor)

Thanks
Gabor

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 »

From DICOM PS 3.5-2004:
Data Elements with a VR of SQ, OF, OW, OB or UN shall always have a Value Multiplicity of one.
"dcmdump" prints both value length (in bytes) and value multiplicity.

ogabor
Posts: 9
Joined: Wed, 2005-06-29, 15:33
Location: Debrecen, Hungary

#3 Post by ogabor »

OK,
the correct cardinality can be calculated (source from dcvrobow.cc):

Code: Select all

      size_t count = 1;
      if ( element -> ident() == EVR_OW )
	{
	  /* get array of 16 bit values */
	  count = OFstatic_cast(size_t, element->getLength() / sizeof(Uint16));
	}
      else        
	{
	  /* get array of 8 bit values */
	  count = OFstatic_cast(size_t, element->getLength());
	}
thanks again
Gabor

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#4 Post by Marco Eichelberg »

Correct. The DICOM Value Multiplicity (VM) is not the same as the cardinality, since for certain Value Representations such as SQ, OB or OW the VM is 1 by definition.

Post Reply

Who is online

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