Library dicom

DICOM library

This library implements (partially) the DICOM protocol. This protocol is used to capture, store and distribute medical images.

From Wikipedia: The core application of the DICOM standard is to capture, store and distribute medical images. The standard also provides services related to imaging such as managing imaging procedure worklists, printing images on film or digital media like DVDs, reporting procedure status like completion of an imaging acquisition, confirming successful archiving of images, encrypting datasets, removing patient identifying information from datasets, organizing layouts of images for review, saving image manipulations and annotations, calibrating image displays, encoding ECGs, encoding CAD results, encoding structured measurement data, and storing acquisition protocols.

OPTIONS: *called_aet - If set it changes the called Application Entity Title used in the requests. Default: ANY-SCP *calling_aet - If set it changes the calling Application Entity Title used in the requests. Default: ECHOSCU

Author:

  • Paulino Calderon <paulino@calderonpale.com>

Copyright © Same as Nmap--See https://nmap.org/book/man-legal.html

Source: https://svn.nmap.org/nmap/nselib/dicom.lua

Script Arguments

dicom.called_aet

Called Application Entity Title. Default: ANY-SCP

dicom.calling_aet

Calling Application Entity Title. Default: ECHOSCU

Functions

associate (host, port, calling_aet, called_aet)

associate(host, port) Attempts to associate to a DICOM Service Provider by sending an A-ASSOCIATE request.

pdu_header_encode (pdu_type, length)

pdu_header_encode(pdu_type, length) encodes the DICOM PDU header

receive (dcm)

receive(dcm) Reads DICOM packets over an established socket

send (dcm, data)

send(dcm, data) Sends DICOM packet over established socket

start_connection (host, port)

start_connection(host, port) starts socket to DICOM service

Functions

associate (host, port, calling_aet, called_aet)

associate(host, port) Attempts to associate to a DICOM Service Provider by sending an A-ASSOCIATE request.

Parameters

host
Host object
port
Port object
calling_aet
 
called_aet
 

Return value:

(status, dcm) If status is true, the DICOM object is returned. If status is false, dcm is the error message.
pdu_header_encode (pdu_type, length)

pdu_header_encode(pdu_type, length) encodes the DICOM PDU header

Parameters

pdu_type
PDU type as ann unsigned integer
length
Length of the DICOM message

Return value:

(status, dcm) If status is true, the DICOM object with the header set is returned. If status is false, dcm is the error message.
receive (dcm)

receive(dcm) Reads DICOM packets over an established socket

Parameters

dcm
DICOM object

Return value:

(status, data) Returns data if status true, otherwise data is the error message.
send (dcm, data)

send(dcm, data) Sends DICOM packet over established socket

Parameters

dcm
DICOM object
data
Data to send

Return value:

status True if data was sent correctly, otherwise false and error message is returned.
start_connection (host, port)

start_connection(host, port) starts socket to DICOM service

Parameters

host
Host object
port
Port table

Return value:

(status, socket) If status is true, socket of DICOM object is set. If status is false, socket is the error message.