Routines (alphabetical) > Routines: Q > QUERY_DICOM

# QUERY_DICOM

The QUERY_DICOM function tests a file for compatibility with READ_DICOM and returns an optional structure containing information about images in the DICOM file. This function supports cases in which a blank DICOM tag is supplied.

This routine is written in the IDL language. Its source code can be found in the file `query_dicom.pro` in the `lib` subdirectory of the IDL distribution.

## Examples

DICOM palette vectors are 16 bit quantities and may not cover the entire dynamic range of the image. To view a paletted DICOM image use the following:

IF (QUERY_DICOM('file.dcm',info)) THEN BEGIN

IF (info.has_palette) THEN BEGIN

TV, READ_IMAGE('file.dcm',r, g, b), /ORDER

TVLCT,r/256, g/256, b/256

ENDIF

ENDIF

## Syntax

Result = QUERY_DICOM( Filename [, Info] [, IMAGE_INDEX=index])

## Return Value

This routine returns a long with the value of 1 (one) if the query was successful or 0 (zero) on failure. A result of 1 means it is likely that the file can be read by READ_DICOM.

## Arguments

### Filename

A scalar string containing the full pathname of the file to query.

### Info

Returns an anonymous structure containing information about the image in the file. The Info.TYPE field will return the value ‘DICOM’.

Note: See General Query * Routine Info Structures for detailed structure information.

## Keywords

### IMAGE_INDEX

Set this keyword to the index (zero based) of the image being queried in the file. This keyword has no effect on files containing a single image.

## Version History

5.2 | Introduced
6.2 |

## See Also

READ_DICOM