Some media objects and procedures provided in Oracle are defined in Oracle mode to create a table containing the ORDDicom column. If you have any questions about Oracle-related operations, you can read the following articles to understand them.
This tutorial uses a simple table that contains four columns: an integer identifier (id) and an ORDSYS. ORDDicom object (dicom), an ORDSYS. ORDImage object (imageThumb) and another ORDSYS. ORDDicom object (anonDicom ). Note that all multimedia objects and processes provided by Oracle are defined in Oracle mode. Perform the following steps:
1. In the SQL * Plus session, run the following command:
- @create_dicom_table
The create_dicom_table. SQL code is as follows:
Java code
- set echo on;
- drop table medical_image_table;
- create table medical_image_table
- (id integer primary key,
- dicom ordsys.orddicom,
- imageThumb ordsys.ordimage,
- anonDicom ordsys.orddicom);
- set echo on;
- drop table medical_image_table;
- create table medical_image_table
- (id integer primary key,
- dicom ordsys.orddicom,
- imageThumb ordsys.ordimage,
- anonDicom ordsys.orddicom);
Import Medical Images
This topic describes how to load medical images in the database file system to a newly created table named "medical_image_table. Note: In most cases, you want to use SQL * Loader instead of the Oracle mode defined in this example to load data.
Create a PL/SQL process image_import (), which inserts a new row into the medical_image_table, and imports the DICOM data in the file name into the newly created ORDDICOM object, the DICOM attributes are extracted to the metadata attributes based on the default ing document) and the UID attributes of the ORDDICOM object. Note that the default ing document ordcmmp. xml is loaded during installation.
You can create a custom ing document and extract attributes to a separate XML document, but this topic is not covered in this tutorial.
Perform the following steps:
1. In the SQL * Plus session, enter the following command:
- @create_import_procedure
The create_import_procedure. SQL code is as follows:
Java code
- -- Set Data Model Repository
- execute ordsys.ord_dicom.setDataModel();
- create or replace procedure image_import
(dest_id number, filename varchar2) is
- dcm ordsys.orddicom;
- begin
- delete from medical_image_table where id
= dest_id;
- insert into medical_image_table
(id, dicom, imageThumb, anonDicom)
- values (dest_id, ordsys.orddicom
(‘file’, ‘IMAGEDIR’, filename, 0),
- ordsys.ordimage.init(), ordsys.orddicom())
- returning dicom into dcm;
- dcm.import(1);
- update medical_image_table set dicom=
dcm where id=dest_id;
- commit;
- end;
- /
- show errors;
- -- Set Data Model Repository
- execute ordsys.ord_dicom.setDataModel();
- create or replace procedure image_import
(dest_id number, filename varchar2) is
- dcm ordsys.orddicom;
- begin
- delete from medical_image_table where id
= dest_id;
- insert into medical_image_table
(id, dicom, imageThumb, anonDicom)
- values (dest_id, ordsys.orddicom
(‘file’, ‘IMAGEDIR’, filename, 0),
- ordsys.ordimage.init(), ordsys.orddicom())
- returning dicom into dcm;
- dcm.import(1);
- update medical_image_table set dicom=
dcm where id=dest_id;
- commit;
- end;
- /
- show errors;
2. Now, you can execute the new creation process to import the sample DICOM file. In the SQL * Plus session, enter the following command:
Java code
- execute image_import(1,'179.dcm');
- execute image_import(1,'179.dcm');
The above is an introduction to all the multimedia objects and processes provided by Oracle that are defined in the Oracle mode. We hope you will gain some benefits.