Main Content

dicomget

Retrieve DICOM files from PACS server

Since R2024b

Description

filelist = dicomget(dConn,level,uniqueID) retrieves the DICOM file or files specified by uniqueID from the PACS server indicated by the dicomConnection object dConn at the specified query level level, and returns the paths of the retrieved files filelist.

example

filelist = dicomget(dConn,level,uniqueID,Name=Value) specifies additional options for retrieving the DICOM file or files using one or more optional name-value arguments.

Examples

collapse all

Before running this example, you must get access from the administrator of the PACS server with which you intend to connect. Alternatively, you may consider setting up a local PACS server on your machine, as demonstrated in Working with PACS Server for DICOM Image Retrieval.

Establish a secure TLS connection with the PACS server using the key and certificate of your client system and the trusted certificate of the server. Display the response message of the DICOM connection.

dConn = dicomConnection("localhost",4242,"key.pem","certificate.pem","trusted-certificate.pem");
disp(dConn.ResponseMessage)
I: Requesting Association
I: Association Accepted (Max Send PDV: 16372)
I: Sending Echo Request (MsgID 1)
I: Received Echo Response (Success)
I: Releasing Association

Query the PACS server for the stored DICOM files. Retrieve the DICOM files of the MRI volume.

returnedKey = dicomquery(dConn,"Patient",["PatientID","PatientName"])
returnedKey=1×3 struct array with fields:
    PatientID
    PatientName

Retrieve one of the queried DICOM files.

filelist = dicomget(dConn,"Patient",returnedKey(1).PatientID);

Read the MRI volume from the retrieved DICOM files.

medVol = medicalVolume(filelist{1})
medVol = 
  medicalVolume with properties:

                 Voxels: [512×512×22 int16]
         VolumeGeometry: [1×1 medicalref3d]
           SpatialUnits: "mm"
            Orientation: "transverse"
           VoxelSpacing: [0.2734 0.2734 3.3000]
           NormalVector: [0 0.0968 0.9953]
       NumCoronalSlices: 512
      NumSagittalSlices: 512
    NumTransverseSlices: 22
           PlaneMapping: ["sagittal"    "coronal"    "transverse"]
               Modality: "MR"
          WindowCenters: [22×1 double]
           WindowWidths: [22×1 double]

Input Arguments

collapse all

PACS server connection object, specified as a dicomConnection object.

Retrieve level, specified as "Patient", "Study", "Series", or "Image". For more information regarding retrieve levels, refer to the DICOM Query/Retrieve Information Model in the DICOM Standard.

Data Types: char | string

Unique ID of the DICOM file or files to be retrieved, specified as a string scalar or character vector. The unique ID must be the ID of the DICOM file or files at the specified query level.

Retrieve LevelUnique ID Field
"Patient"PatientID
"Study"StudyInstanceUID
"Series"SeriesInstanceUID
"Image"SOPInstanceUID

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: filelist = dicomget(dConn,level,uniqueID,StorageDirectory="storage") retrieves the DICOM file or files to the directory "storage" within the current directory.

Root level of the query, specified as "Patient" or "Study".

Data Types: char | string

Storage directory for the downloaded DICOM files, specified as a string scalar or character vector. If the specified storage directory does not exist, the function creates the directory before the downloading the files.

Data Types: char | string

Output Arguments

collapse all

Paths of the retrieved files, returned as a cell array in which each cell contains a cell array of filenames.

Data Types: string

Version History

Introduced in R2024b