Additional Topics > Medical Imaging in IDL > IDL DICOM Reference > IDLffDicomEx::GetValueCount

IDLffDicomEx::GetValueCount

The IDLffDicomEx::GetValueCount function method returns the number of values in a DICOM attribute specified by a standard DICOM attribute tag. This method allows you to return the number of values contained in public attributes. See IDLffDicomEx::GetPrivateValueCount for information on returning the number of values within a private attribute.

Note: GetValueCount will fail if you attempt to return a value for an attribute that does not exist or an attribute that has been removed. If you are not sure if an attribute exists use IDLffDicomEx::QueryValue before calling GetValueCount.

Syntax

Result = Obj->[IDLffDicomEx::]GetValueCount(DicomTag [, SEQID=integer] )

Return Value

Returns an unsigned long value indicating the number of values in the value field of the specified attribute as follows:

Arguments

DicomTag

A string that identifies the group and element of a DICOM attribute in the form 'XXXX,XXXX'. The DicomTag argument must reference a public tag. See DICOM Attributes for a list of tags.

Keywords

SEQID

Set this keyword only if retrieving the value of an attribute that exists within a sequence. Use this keyword to specify sequence identifier as follows:

Example

The following example returns the number of items in a multi-valued Image Type attribute (0008,0008) and uses this value to cycle through the collection of values. For more information on the attribute, see IDLffDicomEx.

PRO read_count_imagetypeattr

 

; Select a DICOM file to examine.

sFile = DIALOG_PICKFILE( $

PATH=FILEPATH('',SUBDIRECTORY=['examples','data']), $

TITLE='Select DICOM Patient File', FILTER='*.dcm')

 

; Open the selected file in read-only mode.

oImg = OBJ_NEW('IDLffDicomEx', sfile)

 

; Return the Image Type attribute count that can have

; 1 to n values. And then return the value of the tag.

vCount = oImg->GetValueCount('0008,0008')

result = oImg->GetValue('0008,0008')

 

FOR i = 1, vCount DO BEGIN

Print, 'Result number', i, + ' is ', result[i-1]

ENDFOR

 

END

For example, when you select us_test.dcm, the following is printed to the Output Log window:

Result number 1 is ORIGINAL

Result number 2 is PRIMARY

Result number 3 is EPICARDIAL

Version History

6.1

Introduced