←Select platform

GetEncapsulatedDocument(DicomElement,bool,string,DicomEncapsulatedDocument,DicomCodeSequenceItem) Method

Summary
Retrieves an encapsulated document and corresponding DICOM elements from a DICOM data set and output the results to a disk file.
Syntax
C#
C++
Java
public void getEncapsulatedDocument(DicomElement element, boolean child, String fileDocument, DicomEncapsulatedDocument encapsulatedDocument, DicomCodeSequenceItem conceptNameCodeSequence) 

Parameters

element
A DicomElement in the data set.

child
true to retrieve the encapsulated document as a child of element., false to retrieve the encapsulated document on the same level as element.

fileDocument
The name of the file that will contain the encapsulated document.

encapsulatedDocument
The encapsulated document module attributes

conceptNameCodeSequence
The concept name code sequence attributes

Remarks

This feature is available in version 16 or higher.

The members of the DicomEncapsulatedDocument class and the DicomCodeSequenceItem class together represent the set of attributes contained in the "Encapsulated Document Module Attributes". The Encapsulated Information Object Definition (IOD) describes either a

  • PDF document
  • CDA document

that has been encapsulated within a DICOM information object. For more information, refer to Part 3 of the DICOM standard.

The encapsulatedDocument class corresponds to the Encapsulated Document Module Attributes described in part 3 of the DICOM specification. To retrieve the Concept Name Code Sequence element (0040,A043) pass a conceptNameCodeSequence object.

fileDocument is a file location that will contain the encapsulated document after it is extracted. If this file already exists, it will be over written.

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
///  
void DumpEncapsulatedDocumentTags(string sMsgIn, DicomEncapsulatedDocument encapsulatedDocument, DicomCodeSequenceItem conceptNameCodeSequence) 
{ 
   string sMimeTypes = string.Empty; 
   string[] sListOfMimeTypes = encapsulatedDocument.GetListOfMimeTypes(); 
   foreach (string s in sListOfMimeTypes) 
      sMimeTypes = sMimeTypes + s + ","; 
   string sMsg1 = string.Format("{0}\n\nuType: {1}\n" + 
                                "InstanceNumber: {2}\n" + 
                                "ContentDate: {3}\n" + 
                                "ContentTime: {4}\n" + 
                                "AcquisitionDateTime: {5}\n" + 
                                "BurnedInAnnotation: {6}\n" + 
                                "DocumentTitle: {7}\n" + 
                                "VerificationFlag: {8}\n" + 
                                "HL7InstanceIdentifier: {9}\n" + 
                                "MIMETypeOfEncapsulatedDocument: {10}\n" + 
                                "ListOfMIMETypes: {11}\n\n", 
      sMsgIn, 
      encapsulatedDocument.Type.ToString(), 
      encapsulatedDocument.InstanceNumber, 
      encapsulatedDocument.ContentDate.ToString(), 
      encapsulatedDocument.ContentTime.ToString(), 
      encapsulatedDocument.AcquisitionDateTime.ToString(), 
      encapsulatedDocument.BurnedInAnnotation, 
      encapsulatedDocument.DocumentTitle, 
      encapsulatedDocument.VerificationFlag, 
      encapsulatedDocument.HL7InstanceIdentifier, 
      encapsulatedDocument.MimeTypeOfEncapsulatedDocument, 
      sMimeTypes 
      ); 
 
   // ConceptNameCodeSequence 
   string sMsg2 = string.Format("CodeValue: {0}\n" + 
                                "CodingSchemeDesignator: {1}\n" + 
                                "CodingSchemeVersion: {2}\n" + 
                                "CodeMeaning: {3}\n" + 
                                "ContextIdentifier: {4}\n" + 
                                "MappingResource: {5}\n" + 
                                "ContextGroupVersion: {6}\n" + 
                                "ContextGroupLocalVersion: {7}\n" + 
                                "ContextGroupExtensionCreatorUID: {8}", 
      conceptNameCodeSequence.CodeValue, 
      conceptNameCodeSequence.CodingSchemeDesignator, 
      conceptNameCodeSequence.CodingSchemeVersion, 
      conceptNameCodeSequence.CodeMeaning, 
      conceptNameCodeSequence.ContextIdentifier, 
      conceptNameCodeSequence.MappingResource, 
      conceptNameCodeSequence.ContextGroupVersion.ToString(), 
      conceptNameCodeSequence.ContextGroupLocalVersion.ToString(), 
      conceptNameCodeSequence.ContextGroupExtensionCreatorUID 
      ); 
 
   Console.WriteLine(sMsg1 + sMsg2); 
} 
void DicomDataSet_GetEncapsulatedDocumentExample(DicomElement element, bool child, DicomDataSet ds, string sFileDocumentOut) 
{ 
   DicomEncapsulatedDocument encapsulatedDocument = new DicomEncapsulatedDocument(); 
   DicomCodeSequenceItem conceptNameCodeSequence = new DicomCodeSequenceItem(); 
 
   ds.GetEncapsulatedDocument(element, child, sFileDocumentOut, encapsulatedDocument, conceptNameCodeSequence); 
   string sMsg = string.Format("Encapsulated Document Extracted: {0}", sFileDocumentOut); 
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence); 
 
   // We can also use the overload which takes a file stream 
   using (FileStream stream = new FileStream(sFileDocumentOut, FileMode.Create)) 
   { 
      ds.GetEncapsulatedDocument(element, child, stream, encapsulatedDocument, conceptNameCodeSequence); 
   } 
   sMsg = string.Format("Encapsulated Document Extracted from stream: {0}", sFileDocumentOut); 
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence); 
} 
Requirements

Target Platforms

See Also

Reference

DicomDataSet Class

DicomDataSet Members

Overload List

[GetEncapsulatedDocument(DicomElement,Boolean,String,DicomEncapsulatedDocument,DicomCodeSequenceItem)Method

SetEncapsulatedDocument(DicomElement,Boolean,String,DicomEncapsulatedDocument,DicomCodeSequenceItem) Method

DicomEncapsulatedDocument Class

Help Version 22.0.2022.4.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly