Oracle DICOM
Version 11.2.0.3

General Information
Dependencies conn / as sysdba

SELECT object_name
FROM dba_objects_ae
WHERE lower(object_name) LIKE '%dicom%';

SELECT object_type, COUNT(*)
FROM dba_objects_ae
WHERE lower(object_name) LIKE '%dicom%'
GROUP BY object_type;

OBJECT_TYPE     COUNT(*)
------------    --------
PACKAGE                5
PACKAGE BODY           5
TYPE BODY              1
SYNONYM              459
JAVA CLASS           456
TYPE                   7

SELECT owner, object_name
FROM dba_objects_ae
WHERE lower(object_name) LIKE '%dicom%'
AND object_type = 'PACKAGE'
ORDER BY 2;

OWNER   OBJECT_NAME
-----   -------------------
ORDSYS  ORD_DICOM
ORDSYS  ORD_DICOM_ADMIN
ORDSYS  ORD_DICOM_ADMIN_PRV
ORDSYS  ORD_DICOM_CT
ORDSYS  ORD_DICOM_PKG
First Available 11.1.0.6
Source {$ORACLE_HOME}/ord/im/admin/ordcpksp.sql
{$ORACLE_HOME}/ord/im/admin/ordcrpsp.sql
Storage Structure DICOM_IMAGE
  ORD_DICOM_HEADER
    VERSION
    DICOM_STANDARD_VERSION
    DICOM_STANDARD_RELEASE
  FILE_META_HEADER
    MEDIA_STORAGE_SOP_CLASS_UID
    MEDIA_STORAGE_SOP_INSTANCE_UID
    TRANSFER_SYNTAX_UID
    IMPLEMENTATION_CLASS_UID
    IMPLEMENTATION_VERSION_NAME
    SOURCE_APPLICATION_ENTITY_TITLE
  PATIENT
    NAME
    ID
    BIRTH_DATE
    SEX
  GENERAL_STUDY
    INSTANCE_UID
    DATE
    TIME
    REFERING_PHYSICIANS_NAME
    ID
    ACCESSION_NUMBER
    DESCRIPTION?
  PATIENT_STUDY?
    ADMITTING_DIAGNOSES_DESCRIPTION
    ADMITTING_DIAGNOSES_CODE_SEQUENCE
  GENERAL_SERIES
    MODALITY
    INSTANCE_UID
    DATE
    TIME
    PERFORMING_PHYSICIANS_NAME
    BODY_PART_EXAMINED
    PATIENT_POSITION
    PERFORMED_PROCEDURE_STEP_ID
    PERFORMED_PROCEDURE_STEP_START_DATE
    PERFORMED_PROCEDURE_STEP_START_TIME
    PERFORMED_PROCEDURE_STEP_DESCRIPTION
    PERFORMED_PROTOCOL_CODE_SEQUENCE
  GENERAL_EQUIPMENT?
    MANUFACTURER
  GENERAL_IMAGE?
    INSTANCE_NUMBER
    ACQUISITION_NUMBER
    ACQUISITION_DATE
    ACQUISITION_TIME
    ACQUISITION_DATETIME
    PATIENT_ORIENTATION
    FRAME_LATERALITY
    ANATOMIC_REGION
  IMAGE_PIXEL?
    SAMPLES_PER_PIXEL
    PHOTOMETRIC_INTERPRETATION
    ROWS
    COLUMNS
    BIT_ALLOCATED
    BIT_STORED
    HIGH_BIT
    PIXEL_REPRESENTATION
    PLANAR_CONFIGURATION
    PIXEL_ASPECT_RATIO
  SOP_COMMON
    CLASS_UID
    INSTANCE_UID
    SPECIFIC_CHARACTER_SET
 
DICOM Demo
Sample DICOM Image Files Download free DICOM images [Click Here]

Download a free DICOM image viewer [Click Here]

-- if these links are broken use google to find DICOM + "DCM" and you'll find lots of other sources
Create Directory Object conn / as sysdba

CREATE OR REPLACE DIRECTORY ctemp AS 'c:\temp';

GRANT read ON DIRECTORY ctemp TO uwclass;

-- place a dicom image named image1.dcm into the directory pointed to by the Oracle Directory object CTEMP
Create table to hold DICOM images conn uwclass/uwclass

CREATE TABLE medicalImages(
image_id    NUMBER,
description VARCHAR2(40),
metadata    XMLType,
image       ORDSYS.ORDIMAGE,
thumb       ORDSYS.ORDIMAGE)
LOB (image.source.localdata) STORE AS (chunk 32K)
-- store images with 32K chunk
LOB (thumb.source.localdata) STORE AS (chunk 16K)
-- but the thumbnails with only 16K
-- bind the XMLType columns to the multiMedia metadata columns

XMLType column metadata
XMLSCHEMA "http://xmlns.oracle.com/ord/meta/dicomImage"
ELEMENT "DICOM_IMAGE";

ALTER TABLE medicalimages
ADD CONSTRAINT pk_medicalimages
PRIMARY KEY(image_id)
USING INDEX;

desc medicalImages

set describe depth all linenum on indent on

desc medicalImages

set describe depth 1

SELECT object_name, object_type
FROM user_objects
WHERE created > SYSDATE-10/1440
ORDER BY 1,2;

desc user_lobs

SELECT table_name, segment_name, index_name, chunk, in_row
FROM user_lobs;

SELECT index_name, index_type, table_type
FROM user_indexes
WHERE table_name = 'MEDICALIMAGES'
ORDER BY 1;

-- explore what ORDDICOM is
conn ordsys/ordsys
-- if you can not log on then do the following:
-- conn / as sysdba
-- alter user ordsys account unlock identified by ordsys
-- grant create session to ordsys;


SELECT object_type
FROM user_objects
WHERE object_name = 'ORDDICOM';

SELECT DISTINCT object_name
FROM user_arguments
WHERE package_name = 'ORDDICOM'
ORDER BY 1;
Load DICOM image file conn uwclass/uwclass

INSERT INTO medicalimages
(image_id, description, metadata, image)
VALUES
(1, 'TEST',  NULL, ordsys.ordimage.init());

-- this does not work
SELECT *
FROM medicalimages;

-- this does
SELECT image_id, description
FROM medicalimages;

set serveroutput on

DECLARE
 obj1 ordsys.ordimage;
BEGIN
  SELECT image
  INTO obj1
  FROM medicalImages
  WHERE image_id = 1
  FOR UPDATE;

  obj1.setSource('FILE', 'CTEMP', 'image1.dcm');

  dbms_output.put_line(obj1.getSource || ' has been loaded');

  UPDATE medicalImages
  SET image=obj1
  WHERE image_id=1;

  COMMIT;
END;
/

-- this does not work
SELECT dbms_lob.getlength(image)
FROM medicalimages;

-- remember this is being stored as ordsys.ordimage not as a BLOB
desc medicalimages
Create metadata extract procedure CREATE OR REPLACE PROCEDURE extractDicomMetadata(inID IN INTEGER) AUTHID DEFINER IS
 local_image    ORDSYS.ORDIMAGE;
 local_id       INTEGER;
 dicom_metadata XMLType := NULL;
BEGIN
  SELECT image
  INTO local_image
  FROM medicalImages
  WHERE image_id = inID;

  -- extract DICOM metadata
  dicom_metadata := local_image.getDicomMetadata('imageGeneral');
  IF (dicom_metadata IS NULL) THEN
    dbms_output.put_line('metadata is NULL');
  ELSE
    UPDATE medicalImages
    SET metadata = dicom_metadata
    WHERE image_id = inID;
  END IF;

  -- print the namespace of the XML document containing the DICOM metadata just extracted
  dbms_output.put_line('namespace: ' || dicom_metadata.getNamespace());
END extractDicomMetadata;
/

-- this may take a ~60 seconds the first time on a Windows machine
exec extractDicomMetadata(1);
View metadata SELECT DISTINCT package_name, object_name
FROM all_arguments
WHERE package_name LIKE '%DICOM%'
ORDER BY 1;

set long 1000000

SELECT metadata FROM medicalimages;

Related Topics
DBMS_LOB
Directories
Multimedia Audio
Multimedia Image
Multimedia Video

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved