This method takes optional DICOM group and/or element arguments and returns an array of POINTERs to the values of the elements matching those parameters.
Syntax
Result = Obj->[IDLffDICOM::]GetValue([Group [, Element]] [, REFERENCE=list of element references] [, /NO_COPY])
Return Value
Returns an array of pointers to the values of the elements matching the Group and Element parameters. If no arguments or keywords are specified, the returned array contains pointers to all elements in the object. The effect of multiple keywords and parameters is to AND their results. If no matching elements can be found, the function returns -1.
Arguments
Group
Set this optional argument to the value for the DICOM group for which to search, such as ‘0018’x. If this argument is omitted, then all of the DICOM array elements are returned.
Element
This optional argument can be specified only if the Group argument has also been specified. Set this to the value for the DICOM element for which to search, such as ‘0010’x. If this argument is omitted and the Group argument was specified, then all elements of the specified Group are returned.
Keywords
REFERENCE
Set this keyword to a list of element references from which to return pointer values.
NO_COPY
If this keyword is set, the pointers returned point to the actual data in the object for the specified DICOM fields. If not set (the default), the pointers point to copies of the data instead, and need to be freed by using PTR_FREE.
Examples
Example 1
obj = OBJ_NEW('IDLffDICOM')
read = obj->Read(DIALOG_PICKFILE(FILTER='*'))
array = obj->GetValue('7fe0'x, '0010'x)
OBJ_DESTROY, obj
TVScl, *array[0]
PTR_FREE, array
Example 2
This example is broken into sections; click on each section to run the complete example:
PRO ex_idlffdicom_getvalue
obj = OBJ_NEW('IDLffDICOM')
read = obj->Read(DIALOG_PICKFILE(FILTER='*'))
array = obj->GetValue('7fe0'x,'0010'x,/NO_COPY)
rows = obj->GetValue('0028'x,'0010'x,/NO_COPY)
cols = obj->GetValue('0028'x,'0011'x,/NO_COPY)
isColor = 0
samples = obj->GetValue('0028'x,'0002'x,/NO_COPY)
IF (SIZE(samples,/N_DIMENSIONS) NE 0) THEN BEGIN
IF (*samples[0] GT 1) THEN isColor = 1
ENDIF
IF (isColor EQ 1) THEN BEGIN
isPlanar = 0
planar = obj->GetValue('0028'x,'0006'x, /NO_COPY)
IF (SIZE(planar, /N_DIMENSIONS) NE 0) THEN BEGIN
IF (*planar[0] EQ 1) THEN isPlanar = 1
ENDIF
ENDIF
IF N_ELEMENTS(array) GT 10 THEN NumWin = 10 $
ELSE NumWin = N_ELEMENTS(array)
offset = 0
FOR index = 0, NumWin-1 DO BEGIN
WINDOW,index,XSize=*cols[0],YSize=*rows[0],XPos=offset,YPos=0
WSET,index
IF (isColor EQ 1) THEN $
IF (isPlanar EQ 1) THEN $
TVScl,TRANSPOSE(*array[index],[2,0,1]),/TRUE $
ELSE $
TVScl,*array[index],/TRUE $
ELSE $
TVScl,*array[index]
offset = offset+10
ENDFOR
OBJ_DESTROY,obj
END
Version History