LEADTOOLS Medical (Leadtools.Dicom assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
GetEncapsulatedDocument(DicomElement,Boolean,String,DicomEncapsulatedDocument,DicomCodeSequenceItem) Method
See Also 
Leadtools.Dicom Namespace > DicomDataSet Class > GetEncapsulatedDocument Method : GetEncapsulatedDocument(DicomElement,Boolean,String,DicomEncapsulatedDocument,DicomCodeSequenceItem) Method



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
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
Retrieves an encapsulated document and corresponding DICOM elements from a DICOM data set and output the results to a disk file. Supported in Silverlight, Windows Phone 7.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub GetEncapsulatedDocument( _
   ByVal element As DicomElement, _
   ByVal child As Boolean, _
   ByVal fileDocument As String, _
   ByVal encapsulatedDocument As DicomEncapsulatedDocument, _
   ByVal conceptNameCodeSequence As DicomCodeSequenceItem _
) 
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim element As DicomElement
Dim child As Boolean
Dim fileDocument As String
Dim encapsulatedDocument As DicomEncapsulatedDocument
Dim conceptNameCodeSequence As DicomCodeSequenceItem
 
instance.GetEncapsulatedDocument(element, child, fileDocument, encapsulatedDocument, conceptNameCodeSequence)
C++/CLI 
public:
void GetEncapsulatedDocument( 
   DicomElement^ element,
   bool 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

Example

Visual BasicCopy Code
''' 
Private Sub DumpEncapsulatedDocumentTags(ByVal sMsgIn As String, ByVal encapsulatedDocument As DicomEncapsulatedDocument, ByVal conceptNameCodeSequence As DicomCodeSequenceItem)
   Dim sMimeTypes As String = String.Empty
   Dim sListOfMimeTypes As String() = encapsulatedDocument.GetListOfMimeTypes()
   For Each s As String In sListOfMimeTypes
      sMimeTypes = sMimeTypes & s & ","
   Next s
   Dim sMsg1 As String = String.Format("{0}" & Constants.vbLf + Constants.vbLf & "uType: {1}" & Constants.vbLf & "InstanceNumber: {2}" & Constants.vbLf & "ContentDate: {3}" & Constants.vbLf & "ContentTime: {4}" & Constants.vbLf & "AcquisitionDateTime: {5}" & Constants.vbLf & "BurnedInAnnotation: {6}" & Constants.vbLf & "DocumentTitle: {7}" & Constants.vbLf & "VerificationFlag: {8}" & Constants.vbLf & "HL7InstanceIdentifier: {9}" & Constants.vbLf & "MIMETypeOfEncapsulatedDocument: {10}" & Constants.vbLf & "ListOfMIMETypes: {11}" & Constants.vbLf + Constants.vbLf, 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
   Dim sMsg2 As String = String.Format("CodeValue: {0}" & Constants.vbLf & "CodingSchemeDesignator: {1}" & Constants.vbLf & "CodingSchemeVersion: {2}" & Constants.vbLf & "CodeMeaning: {3}" & Constants.vbLf & "ContextIdentifier: {4}" & Constants.vbLf & "MappingResource: {5}" & Constants.vbLf & "ContextGroupVersion: {6}" & Constants.vbLf & "ContextGroupLocalVersion: {7}" & Constants.vbLf & "ContextGroupExtensionCreatorUID: {8}", conceptNameCodeSequence.CodeValue, conceptNameCodeSequence.CodingSchemeDesignator, conceptNameCodeSequence.CodingSchemeVersion, conceptNameCodeSequence.CodeMeaning, conceptNameCodeSequence.ContextIdentifier, conceptNameCodeSequence.MappingResource, conceptNameCodeSequence.ContextGroupVersion.ToString(), conceptNameCodeSequence.ContextGroupLocalVersion.ToString(), conceptNameCodeSequence.ContextGroupExtensionCreatorUID)

   MessageBox.Show(sMsg1 & sMsg2)
End Sub
Private Sub DicomDataSet_GetEncapsulatedDocumentExample(ByVal element As DicomElement, ByVal child As Boolean, ByVal ds As DicomDataSet, ByVal sFileDocumentOut As String)
   Dim encapsulatedDocument As DicomEncapsulatedDocument = New DicomEncapsulatedDocument()
   Dim conceptNameCodeSequence As DicomCodeSequenceItem = New DicomCodeSequenceItem()

   ds.GetEncapsulatedDocument(element, child, sFileDocumentOut, encapsulatedDocument, conceptNameCodeSequence)
   Dim sMsg As 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 stream As New FileStream(sFileDocumentOut, FileMode.Create)
       ds.GetEncapsulatedDocument(element, child, stream, encapsulatedDocument, conceptNameCodeSequence)
   End Using
   sMsg = String.Format("Encapsulated Document Extracted from stream: {0}", sFileDocumentOut)
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence)
End Sub
C#Copy Code
/// 
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}\nInstanceNumber: {2}\nContentDate: {3}\nContentTime: {4}\nAcquisitionDateTime: {5}\nBurnedInAnnotation: {6}\nDocumentTitle: {7}\nVerificationFlag: {8}\nHL7InstanceIdentifier: {9}\nMIMETypeOfEncapsulatedDocument: {10}\nListOfMIMETypes: {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}\nCodingSchemeDesignator: {1}\nCodingSchemeVersion: {2}\nCodeMeaning: {3}\nContextIdentifier: {4}\nMappingResource: {5}\nContextGroupVersion: {6}\nContextGroupLocalVersion: {7}\nContextGroupExtensionCreatorUID: {8}",
      conceptNameCodeSequence.CodeValue,
      conceptNameCodeSequence.CodingSchemeDesignator,
      conceptNameCodeSequence.CodingSchemeVersion,
      conceptNameCodeSequence.CodeMeaning,
      conceptNameCodeSequence.ContextIdentifier,
      conceptNameCodeSequence.MappingResource,
      conceptNameCodeSequence.ContextGroupVersion.ToString(),
      conceptNameCodeSequence.ContextGroupLocalVersion.ToString(),
      conceptNameCodeSequence.ContextGroupExtensionCreatorUID
      );

   MessageBox.Show(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);
}
SilverlightCSharpCopy Code
void DicomDataSet_GetEncapsulatedDocumentExample(DicomElement element, bool child, DicomDataSet ds, Stream outputStream)
{
   DicomEncapsulatedDocument encapsulatedDocument = new DicomEncapsulatedDocument();
   DicomCodeSequenceItem conceptNameCodeSequence = new DicomCodeSequenceItem();
   ds.GetEncapsulatedDocument(element, child, outputStream, encapsulatedDocument, conceptNameCodeSequence);
   string sMsg;
   sMsg = string.Format("Encapsulated Document Extracted.");
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence);
}
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}\nInstanceNumber: {2}\nContentDate: {3}\nContentTime: {4}\nAcquisitionDateTime: {5}\nBurnedInAnnotation: {6}\nDocumentTitle: {7}\nVerificationFlag: {8}\nHL7InstanceIdentifier: {9}\nMIMETypeOfEncapsulatedDocument: {10}\nListOfMIMETypes: {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}\nCodingSchemeDesignator: {1}\nCodingSchemeVersion: {2}\nCodeMeaning: {3}\nContextIdentifier: {4}\nMappingResource: {5}\nContextGroupVersion: {6}\nContextGroupLocalVersion: {7}\nContextGroupExtensionCreatorUID: {8}",
      conceptNameCodeSequence.CodeValue,
      conceptNameCodeSequence.CodingSchemeDesignator,
      conceptNameCodeSequence.CodingSchemeVersion,
      conceptNameCodeSequence.CodeMeaning,
      conceptNameCodeSequence.ContextIdentifier,
      conceptNameCodeSequence.MappingResource,
      conceptNameCodeSequence.ContextGroupVersion.ToString(),
      conceptNameCodeSequence.ContextGroupLocalVersion.ToString(),
      conceptNameCodeSequence.ContextGroupExtensionCreatorUID
      );

   Debug.WriteLine(sMsg1 + sMsg2);
}
SilverlightVBCopy Code
Private Sub DicomDataSet_GetEncapsulatedDocumentExample(ByVal element As DicomElement, ByVal child As Boolean, ByVal ds As DicomDataSet, ByVal outputStream As Stream)
   Dim encapsulatedDocument As DicomEncapsulatedDocument = New DicomEncapsulatedDocument()
   Dim conceptNameCodeSequence As DicomCodeSequenceItem = New DicomCodeSequenceItem()
   ds.GetEncapsulatedDocument(element, child, outputStream, encapsulatedDocument, conceptNameCodeSequence)
   Dim sMsg As String
   sMsg = String.Format("Encapsulated Document Extracted.")
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence)
End Sub
Private Sub DumpEncapsulatedDocumentTags(ByVal sMsgIn As String, ByVal encapsulatedDocument As DicomEncapsulatedDocument, ByVal conceptNameCodeSequence As DicomCodeSequenceItem)
   Dim sMimeTypes As String = String.Empty
   Dim sListOfMimeTypes As String() = encapsulatedDocument.GetListOfMimeTypes()
   For Each s As String In sListOfMimeTypes
      sMimeTypes = sMimeTypes & s & ","
   Next s
   Dim sMsg1 As String = String.Format("{0}" & Constants.vbLf + Constants.vbLf & "uType: {1}" & Constants.vbLf & "InstanceNumber: {2}" & Constants.vbLf & "ContentDate: {3}" & Constants.vbLf & "ContentTime: {4}" & Constants.vbLf & "AcquisitionDateTime: {5}" & Constants.vbLf & "BurnedInAnnotation: {6}" & Constants.vbLf & "DocumentTitle: {7}" & Constants.vbLf & "VerificationFlag: {8}" & Constants.vbLf & "HL7InstanceIdentifier: {9}" & Constants.vbLf & "MIMETypeOfEncapsulatedDocument: {10}" & Constants.vbLf & "ListOfMIMETypes: {11}" & Constants.vbLf + Constants.vbLf, 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
   Dim sMsg2 As String = String.Format("CodeValue: {0}" & Constants.vbLf & "CodingSchemeDesignator: {1}" & Constants.vbLf & "CodingSchemeVersion: {2}" & Constants.vbLf & "CodeMeaning: {3}" & Constants.vbLf & "ContextIdentifier: {4}" & Constants.vbLf & "MappingResource: {5}" & Constants.vbLf & "ContextGroupVersion: {6}" & Constants.vbLf & "ContextGroupLocalVersion: {7}" & Constants.vbLf & "ContextGroupExtensionCreatorUID: {8}", conceptNameCodeSequence.CodeValue, conceptNameCodeSequence.CodingSchemeDesignator, conceptNameCodeSequence.CodingSchemeVersion, conceptNameCodeSequence.CodeMeaning, conceptNameCodeSequence.ContextIdentifier, conceptNameCodeSequence.MappingResource, conceptNameCodeSequence.ContextGroupVersion.ToString(), conceptNameCodeSequence.ContextGroupLocalVersion.ToString(), conceptNameCodeSequence.ContextGroupExtensionCreatorUID)

   Debug.WriteLine(sMsg1 & sMsg2)
End Sub

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.

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

Leadtools.Dicom requires a Medical toolkit server license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features