DBA Data[Home] [Help]

PACKAGE: ORDSYS.ORD_DICOM

Source


1 PACKAGE ORD_DICOM
2 authid current_user
3 AS
4 
5   --
6   -- public constants
7   --
8   DEFAULT_ANONYMITY_DOC CONSTANT VARCHAR2(64):='ordcman.xml';
9   DEFAULT_MAPPING_DOC CONSTANT VARCHAR2(64):='ordcmmp.xml';
10   DEFAULT_METADATA_NS CONSTANT VARCHAR2(64):=
11                         'http://xmlns.oracle.com/ord/dicom/metadata_1_0';
12   DATATYPE_NS CONSTANT VARCHAR2(64):=
13                         'http://xmlns.oracle.com/ord/dicom/datatype_1_0';
14   DEFAULT_EXTRACT_OPTION VARCHAR2(32):= 'ALL';
15 
16   --
17   -- public functions/procedures
18   --
19 
20 
21   --
22   -- Description:    Import DICOM binary data from a given source into BLOB.
23   -- Input:
24   --   dest: Destination storage of the imported DICOM file.
25   --   source_type: The type of the source(FILE)
26   --   source_location: The source location. (File directory object)
27   --   source_name: The name of the source file.
28   -- Exception: None.
29   --
30   PROCEDURE importFrom(
31       dest            IN OUT NOCOPY BLOB,
32       source_type     IN     VARCHAR2,
33       source_location IN     VARCHAR2,
34       source_name     IN     VARCHAR2);
35 
36   --
37   -- Description:   Export DICOM binary data in a BLOB to the specified
38   --                destination.
39   --   src: The source location of the DICOM binary data.
40   --   dest_type: The type of the destination. (FILE)
41   --   dest_location: The destination location . (File directory object)
42   --   dest_name: The name of the destination file.
43   -- Exception:  None.
44   --
45   PROCEDURE export(
46       src             IN     BLOB,
47       dest_type       IN     VARCHAR2,
48       dest_location   IN     VARCHAR2,
49       dest_name       IN     VARCHAR2);
50 
51   --
52   -- Description:  Get DICOM metadata in XML for a given XML metadata schema.
53   -- Input:
54   --   data: The input DICOM binary data stored in BLOB.
55   --   extractOption:
56   --    'ALL': Default. Extract all attributes from the DICOM binary data.
57   --    'MAPPED': Extract only mapped attributes.
58   --    'STANDARD': Extract only DICOM Standard attributes and mapped
59   --                attributes.
60   --   docName: The name  of the mapping document. The default mapping document
61   --     ordcmmp.xml is loaded during installation and refers to the default
62   --     metadata namespace of "http://xmlns.oracle.com/ord/dicom/metadata_1_0"
63   -- Return: Metadata encoded in XML (not schema-validated)
64   -- Exception: None.
65   --
66   FUNCTION extractMetadata (
67       data          IN BLOB,
68       extractOption IN VARCHAR2 DEFAULT DEFAULT_EXTRACT_OPTION,
69       docName       IN VARCHAR2 DEFAULT DEFAULT_MAPPING_DOC)
70       RETURN SYS.XMLTYPE;
71 
72   --
73   -- Description:  Get DICOM metadata in XML for a given XML metadata schema.
74   -- Input:
75   --   data: The input DICOM binary data stored in BFILE.
76   --   extractOption:
77   --    'ALL': Default. Extract all attributes from the DICOM binary data.
78   --    'MAPPED': Extract only mapped attributes.
79   --    'STANDARD': Extract only DICOM Standard attributes and mapped
80   --                attributes.
81   --   docName: The name  of the mapping document. The default mapping document
82   --     ordcmmp.xml is loaded during installation and refers to the default
83   --     metadata namespace of "http://xmlns.oracle.com/ord/dicom/metadata_1_0"
84   -- Return: Metadata encoded in XML (not schema-validated)
85   -- Exception:  None.
86   --
87   FUNCTION extractMetadata (
88       data          IN BFILE,
89       extractOption IN VARCHAR2 DEFAULT DEFAULT_EXTRACT_OPTION,
90       docName       IN VARCHAR2 DEFAULT DEFAULT_MAPPING_DOC)
91       RETURN SYS.XMLTYPE;
92 
93   --
94   -- Description:  Get DICOM metadata in XML for a given XML metadata schema.
95   -- Input:
96   --   data: The input DICOM binary data stored in ORDSYS.ORDImage object.
97   --   extractOption:
98   --    'ALL': Default. Extract all attributes from the DICOM binary data.
99   --    'MAPPED': Extract only mapped attributes.
100   --    'STANDARD': Extract only DICOM Standard attributes and mapped
101   --                attributes.
102   --   docName: The name  of the mapping document. The default mapping document
103   --     ordcmmp.xml is loaded during installation and refers to the default
104   --     metadata namespace of "http://xmlns.oracle.com/ord/dicom/metadata_1_0"
105   -- Return: Metadata encoded in XML (not schema-validated)
106   -- Exception:  None.
107   --
108   FUNCTION extractMetadata (
109       data          IN ORDSYS.ORDImage,
110       extractOption IN VARCHAR2 DEFAULT DEFAULT_EXTRACT_OPTION,
111       docName       IN VARCHAR2 DEFAULT DEFAULT_MAPPING_DOC)
112       RETURN SYS.XMLTYPE;
113 
114   --
115   -- Description: Write/modify the current DICOM binary data with the provided
116   -- metadata by making a copy of the existing DICOM binary data and creating a
117   -- new DICOM binary data. The original DICOM binary data is not changed.
118   -- The destination DICOM binary data's attributes will be from the input XML
119   -- metadata.
120   -- Input:
121   --   src: The input DICOM binary data stored in BLOB.
122   --   metadata: The DICOM metadata in XMLTYPE. It should have all the
123   --             standard attributes and private attributes. The SOP instance
124   --             UID in the metadata must ensure the global uniqueness for the
125   --             destination DICOM binary data.
126   --   dest: BLOB to store the new DICOM binary data with the new metadata.
127   -- Exception: None.
128   --
129   PROCEDURE writeMetadata (
130       src       IN BLOB,
131       metadata  IN SYS.XMLTYPE,
132       dest      IN OUT NOCOPY BLOB);
133 
134   --
135   -- Description: Write/modify the current DICOM binary data with the provided
136   -- metadata by making a copy of the existing DICOM binary data and creating a
137   -- new DICOM binary data. The original DICOM binary data is not changed.
138   -- The destination DICOM binary data's attributes will be from the input XML
139   -- metadata.
140   -- Input:
141   --   src: The input DICOM binary data stored in BFILE.
142   --   metadata: The DICOM metadata in XMLTYPE. It should have all the
143   --             standard attributes and private attributes. The SOP instance
144   --             UID in the metadata must ensure the global uniqueness for the
145   --             destination DICOM binary data.
146   --   dest: BLOB to store the new DICOM binary data with the new metadata.
147   -- Exception: None.
148   --
149   PROCEDURE writeMetadata (
150       src       IN BFILE,
151       metadata  IN SYS.XMLTYPE,
152       dest      IN OUT NOCOPY BLOB);
153 
154   --
155   -- Description: Write/modify the current DICOM binary data with the provided
156   -- metadata by making a copy of the existing DICOM binary data and creating a
157   -- new DICOM binary data. The original DICOM binary data is not changed.
158   -- The destination DICOM binary data's attributes will be from the input XML
159   -- metadata.
160   -- Input:
161   --   src: The input DICOM binary data stored in ORDSYS.ORDImage object.
162   --   metadata: The DICOM metadata in XMLTYPE. It should have all the
163   --             standard attributes and private attributes. The SOP instance
164   --             UID in the metadata must ensure the global uniqueness for the
165   --             destination DICOM binary data.
166   --   dest: BLOB to store the new DICOM binary data with the new metadata.
167   -- Exception:  None.
168   --
169   PROCEDURE writeMetadata (
170       src       IN ORDSYS.ORDImage,
171       metadata  IN SYS.XMLTYPE,
172       dest      IN OUT NOCOPY BLOB);
173 
174   --
175   -- Description: Process and copy the input DICOM image data into a raster
176   -- image. The input DICOM image is not changed.
177   -- Input:
178   --   src: The input DICOM image data stored in the source BLOB.
179   --   command: The command could have following verbs:
180   --            fileformat, frameNumber (default 0), contentformat,
181   --            compressionformat, cut, scale, rotate, etc.
182   --            Refer to "Oracle Multimedia Reference Guide" process command
183   --            for details on each verb.
184   --   dest: The destination image stored in the destination BLOB.
185   -- Exception: None.
186   --
187   PROCEDURE processCopy (
188       src       IN BLOB,
189       command   IN VARCHAR2,
190       dest IN OUT NOCOPY BLOB);
191 
192   --
193   -- Description: Process and copy the input DICOM image data into a raster
194   -- image. The input DICOM image is not changed.
195   -- Input:
196   --   src: The input DICOM image data stored in the source BFILE.
197   --   command: The command could have following verbs:
198   --            fileformat, frameNumber (default 0), contentformat,
199   --            compressionformat, cut, scale, rotate, etc.
200   --            Refer to "Oracle Multimedia Reference Guide" process command
201   --            for details on each verb.
202   --   dest: The destination image stored in the destination BLOB.
203   -- Exception: None.
204   --
205   PROCEDURE processCopy (
206       src       IN BFILE,
207       command   IN VARCHAR2,
208       dest      IN OUT NOCOPY BLOB);
209 
210   --
211   -- Description: Process and copy the input DICOM image data into a raster
212   -- image. The input DICOM image is not changed.
213   -- Input:
214   --   src: The input DICOM image data stored in the source ORDImage object.
215   --   command: The command could have following verbs:
216   --            fileformat, frameNumber (default 0), contentformat,
217   --            compressionformat, cut, scale, rotate, etc.
218   --            Refer to "Oracle Multimedia Reference Guide" process command
219   --            for details on each verb.
220   --   dest: The destination image stored in the destination BLOB.
221   -- Exception: None.
222   --
223   PROCEDURE processCopy (
224       src       IN ORDSYS.ORDImage,
225       command   IN VARCHAR2,
226       dest IN OUT NOCOPY BLOB);
227 
228   --
229   -- Description: Process and copy the input DICOM image into a
230   -- new DICOM image/raster image. The input DICOM image is not changed.
231   -- Input:
232   --   src: The input DICOM image stored in the source BLOB.
233   --   command: The command could have following verbs:
234   --            frameNumber (default 0),
235   --            contentformat, compressionformat, cut, scale, rotate.
236   --            Refer to "Oracle Multimedia Reference Guide" process command
237   --            for details on each verb.
238   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
239   --                          DICOM image.
240   --   dest: The destination image stored in the destination BLOB.
241   --   metadata: The new metadata to be written into the new DICOM
242   --             image.
243   -- Exception: None.
244   --
245   PROCEDURE processCopy (
246       src                   IN BLOB,
247       command               IN VARCHAR2,
248       dest_SOP_INSTANCE_UID IN VARCHAR2,
249       dest                  IN OUT NOCOPY BLOB,
250       metadata              IN SYS.XMLTYPE DEFAULT NULL);
251 
252   --
253   -- Description: Process and copy the input DICOM image into a
254   -- new DICOM image/raster image. The input DICOM image is not changed.
255   -- Input:
256   --   src: The input DICOM image stored in the source BFILE.
257   --   command: The command could have following verbs:
258   --            frameNumber (default 0),
259   --            contentformat, compressionformat, cut, scale, rotate.
260   --            Refer to "Oracle Multimedia Reference Guide" process command
261   --            for details on each verb.
262   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
263   --                          DICOM image.
264   --   dest: The destination image stored in the destination BLOB.
265   --   metadata: The new metadata to be written into the new DICOM
266   --             image.
267   -- Exception: None.
268   --
269   PROCEDURE processCopy (
270       src                   IN BFILE,
271       command               IN VARCHAR2,
272       dest_SOP_INSTANCE_UID IN VARCHAR2,
273       dest                  IN OUT NOCOPY BLOB,
274       metadata              IN SYS.XMLTYPE DEFAULT NULL);
275 
276   --
277   -- Description: Process and copy the input DICOM image into a
278   -- new DICOM image/raster image. The input DICOM image is not changed.
279   -- Input:
280   --   src: The input DICOM image stored in the source ORDImage object.
281   --   command: The command could have following verbs:
282   --            frameNumber (default 0),
283   --            contentformat, compressionformat, cut, scale, rotate.
284   --            Refer to "Oracle Multimedia Reference Guide" process command
285   --            for details on each verb.
286   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
287   --                          DICOM image.
288   --   dest: The destination image stored in the destination BLOB.
289   --   metadata: The new metadata to be written into the new DICOM
290   --             image.
291   -- Exception: None.
292   --
293   PROCEDURE processCopy (
294       src                   IN ORDSYS.ORDImage,
295       command               IN VARCHAR2,
296       dest_SOP_INSTANCE_UID IN VARCHAR2,
297       dest                  IN OUT NOCOPY BLOB,
298       metadata              IN SYS.XMLTYPE DEFAULT NULL);
299 
300   --
301   -- Description: Create a DICOM image from a source raster image and
302   -- DICOM metadata.
303   -- Input:
304   --   src: The source raster image stored in BLOB.
305   --   metadata: DICOM metadata in XMLTYPE. It should have all the standard
306   --             and private attributes. It should have a new SOP instance
307   --             UID for the destination DICOM image.
308   --   dest: A DICOM image created from the source image and metadata.
309   -- Exception: None.
310   --
311   PROCEDURE createDICOMImage (
312       src       IN BLOB,
313       metadata  IN SYS.XMLTYPE,
314       dest      IN OUT NOCOPY BLOB);
315 
316   --
317   -- Description: Create a DICOM image from a source raster image and
318   -- DICOM metadata.
319   -- Input:
320   --   src: The source raster image stored in BFILE.
321   --   metadata: DICOM metadata in XMLTYPE. It should have all the standard
322   --             and private attributes. It should have a new SOP instance
323   --             UID for the destination DICOM image.
324   --   dest: A DICOM image created from the source image and metadata.
325   -- Exception:  None.
326   --
327   PROCEDURE createDICOMImage (
328       src       IN BFILE,
329       metadata  IN SYS.XMLTYPE,
330       dest      IN OUT NOCOPY BLOB);
331 
332   --
333   -- Description: Create a DICOM image from a source raster image and
334   -- DICOM metadata.
335   -- Input:
336   --   src: The source raster image stored in ORDImage object.
337   --   metadata: DICOM metadata in XMLTYPE. It should have all the standard
338   --             and private attributes. It should have a new SOP instance
339   --             UID for the destination DICOM image.
340   --   dest: A DICOM image created from the source image and metadata.
341   -- Exception:  None.
342   --
343   PROCEDURE createDICOMImage (
344       src       IN ORDSYS.ORDImage,
345       metadata  IN SYS.XMLTYPE,
346       dest      IN OUT NOCOPY BLOB);
347 
348   --
349   -- Description:    Make the source DICOM binary data anonymous after copying
350   -- into another DICOM binary data. How to make the DICOM binary data
351   -- anonymous is determined by the parameter anonymityDocName.
352   -- Input:
353   --   src: The input DICOM binary data in the source BLOB.
354   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
355   --                          DICOM binary data.
356   --   dest: The anonymous DICOM binary data in the destination BLOB.
357   --   anonymityDocName: The name of the anonymity definition document.
358   -- Exception:  None.
359   --
360   PROCEDURE makeAnonymous (
361       src                   IN BLOB,
362       dest_SOP_INSTANCE_UID IN VARCHAR2,
366   --
363       dest                  IN OUT NOCOPY BLOB,
364       anonymityDocName  IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC);
365 
367   -- Description:    Make the source DICOM binary data anonymous after copying
368   -- into another DICOM binary data. How to make the DICOM binary data
369   -- anonymous is determined by the parameter anonymityDocName.
370   -- Input:
371   --   src: The input DICOM binary data in the source BFILE.
372   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
373   --                          DICOM binary data.
374   --   dest: The anonymous DICOM binary data in the destination BLOB.
375   --   anonymityDocName: The name of the anonymity definition document.
376   -- Exception:  None.
377   --
378   PROCEDURE makeAnonymous (
379       src                   IN BFILE,
380       dest_SOP_INSTANCE_UID IN VARCHAR2,
381       dest                  IN OUT NOCOPY BLOB,
382       anonymityDocName  IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC);
383 
384   --
385   -- Description:    Make the source DICOM binary data anonymous after copying
386   -- into another DICOM binary data. How to make the DICOM binary data
387   -- anonymous is determined by the parameter anonymityDocName.
388   -- Input:
389   --   src: The input DICOM binary data in the source ORDImage object.
390   --   dest_SOP_INSTANCE_UID: The SOP instance UID of the destination
391   --                          DICOM binary data.
392   --   dest: The anonymous DICOM binary data in the destination BLOB.
393   --   anonymityDocName: The name of the anonymity definition document.
394   -- Exception:  None.
395   --
396   PROCEDURE makeAnonymous (
397       src                   IN ORDSYS.ORDImage,
398       dest_SOP_INSTANCE_UID IN VARCHAR2,
399       dest                  IN OUT NOCOPY BLOB,
400       anonymityDocName  IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC);
401 
402   --
403   -- Description:    Check if a DICOM binary data is anonymous according to the
404   -- anonymity definition document.
405   -- Input:
406   --   src: The input DICOM binary data in the source BLOB.
407   --   anonymityDocName: The name of the anonymity definition document.
408   -- Return: 0: not anonymous,
409   --         1: anonymous.
410   -- Exception:  None.
411   --
412   FUNCTION isAnonymous(
413      src                    IN BLOB,
414      anonymityDocName   IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC)
415   RETURN INTEGER;
416 
417   --
418   -- Description:    Check if a DICOM binary data is anonymous according to the
419   -- anonymity definition document.
420   -- Input:
421   --   src: The input DICOM binary data in the source BFILE.
422   --   anonymityDocName: The name of the anonymity definition document.
423   -- Return: 0: not anonymous,
424   --         1: anonymous.
425   -- Exception:  None.
426   --
427   FUNCTION isAnonymous(
428      src                    IN BFILE,
429      anonymityDocName   IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC)
430   RETURN INTEGER;
431 
432   --
433   -- Description:    Check if a DICOM binary data is anonymous according to the
434   -- anonymity definition document.
435   -- Input:
436   --   src: The input DICOM binary data in the source ORDImage object.
437   --   anonymityDocName: The name of the anonymity definition document.
438   -- Return: 0: not anonymous,
439   --         1: anonymous.
440   -- Exception:  None.
441   --
442   FUNCTION isAnonymous(
443      src                    IN ORDSYS.ORDImage,
444      anonymityDocName   IN VARCHAR2 DEFAULT DEFAULT_ANONYMITY_DOC)
445   RETURN INTEGER;
446 
447   --
448   -- Description:    Check if a DICOM binary data conforms to a certain set of
449   -- constraint rules identified by the parameter constraintDocName.
450   -- Input:
451   --   src: The input DICOM binary data in the source BLOB.
452   --   constraintDocName: The name of the constraint.
453   -- Return: 0: invalid,
454   --         1: valid.
455   -- Exception:  None.
456   --
457   FUNCTION isConformanceValid (
458      src                IN BLOB,
459      constraintName     IN VARCHAR2
460   ) RETURN INTEGER;
461 
462   --
463   -- Description:    Check if a DICOM binary data conforms to a certain set of
464   -- constraint rules identified by the parameter constraintName.
465   -- Input:
466   --   src: The input DICOM binary data in the source BFILE.
467   --   constraintName: The name of the constraint.
468   -- Return: 0: invalid,
469   --         1: valid.
470   -- Exception:  None.
471   --
472   FUNCTION isConformanceValid (
473      src                IN BFILE,
474      constraintName     IN VARCHAR2
475   ) RETURN INTEGER;
476 
477   --
478   -- Description:    Check if a DICOM binary data conforms to a certain set of
479   -- constraint rules identified by the parameter constraintDocName.
480   -- Input:
481   --   src: The input DICOM binary data in the source ORDImage object.
482   --   constraintDocName: The name of the constraint.
483   -- Return: 0: invalid,
484   --         1: valid.
485   -- Exception:  None.
486   --
487   FUNCTION isConformanceValid (
488      src                IN ORDSYS.ORDImage,
489      constraintName     IN VARCHAR2
490   ) RETURN INTEGER;
491 
492    --Name: getMappingXPath
493    --Desc:  Returns the absolute xpath from the specified mapping document
494    --Input:
495    --      tag     :  specifies a tag of the mapping document .
496    --                 This tag is a hexadecimal string  eg: '00110001'.
497    --                 The tag must be a simple tag  and not a wild card tag like 6011xx01
498    --      docName :  specifies the name of a mapping document.
499    --                The default value is 'ordcmmp.xml'
500    --      definerName: specifies the definer name of the tag in the mapping document.
501    --                  The default value is 'DICOM' which refers to the DICOM standard.
502    -- Returns: The absolute xpath associated with the tag and definer in the
503    --          specified mapping document.
504    --          Null  - if the tag  is not associated with a path.
505   FUNCTION getMappingXpath(
506            tag IN VARCHAR2,
507            docName IN VARCHAR2  DEFAULT 'ordcmmp.xml',
508            definerName IN VARCHAR2 DEFAULT 'DICOM')
509   RETURN VARCHAR2 DETERMINISTIC;
510 
511    --Name: getDictionaryTag
512    --Desc: :  Lookup the standard and/or private dictionaries for the given tag name
513    --         and definer name and return a hexadecimal tag string.
514    --Input:
515    -- attributeName:  specifies the name of tag in the standard or private dictionary .
516    --            eg: 'Patient's Name'
517    -- definerName: specifies the definer name of the tag  in the standard
518    --              or private dictionary. The default value is 'DICOM'
519    --Returns: The hexadecimal tag string for the given tag name and definer name
520    --           The returned string will always be a  simple tag like 60116011.
521   FUNCTION  getDictionaryTag(
522                attributeName IN VARCHAR2,
523                definerName   IN VARCHAR2  DEFAULT 'DICOM' )
524    return varchar2 DETERMINISTIC;
525 
526   --Name: setDataModel
527   --Desc: Loads the default repository data model into sql and java
528   --Input: modelName - Only DEFAULT is supported in this release
529   --Returns: None
530   PROCEDURE  setDataModel(modelName IN VARCHAR2 DEFAULT 'DEFAULT');
531 
532   --Name: setDataModel with force option ( Not recommended)
533  -- Desc: unconditionally refreshes the datamodel if force = 1.
534   --Returns: None
535   PROCEDURE  setDataModel(modelName IN VARCHAR2 DEFAULT 'DEFAULT'
536                          , force in NUMBER);
537 
538 
539 END ORD_DICOM;