LEADTOOLS Medical (Leadtools.Dicom assembly)

GetEncapsulatedDocument(DicomElement,Boolean,ILeadStream,DicomEncapsulatedDocument,DicomCodeSequenceItem) Method

Show in webframe
Example 







A DicomElement in the data set.
true to retrieve the encapsulated document as a child of element., false to retrieve the encapsulated document on the same level as element.
The stream that will contain the encapsulated document.
The encapsulated document module attributes
The concept name code sequence attributes
Retrieves an encapsulated document and corresponding DICOM elements from a DICOM data set and outputs the results to a stream.
Syntax
public void GetEncapsulatedDocument( 
   DicomElement element,
   bool child,
   ILeadStream stream,
   DicomEncapsulatedDocument encapsulatedDocument,
   DicomCodeSequenceItem conceptNameCodeSequence
)
'Declaration
 
Public Overloads Sub GetEncapsulatedDocument( _
   ByVal element As DicomElement, _
   ByVal child As Boolean, _
   ByVal stream As ILeadStream, _
   ByVal encapsulatedDocument As DicomEncapsulatedDocument, _
   ByVal conceptNameCodeSequence As DicomCodeSequenceItem _
) 
'Usage
 
Dim instance As DicomDataSet
Dim element As DicomElement
Dim child As Boolean
Dim stream As ILeadStream
Dim encapsulatedDocument As DicomEncapsulatedDocument
Dim conceptNameCodeSequence As DicomCodeSequenceItem
 
instance.GetEncapsulatedDocument(element, child, stream, encapsulatedDocument, conceptNameCodeSequence)
public void GetEncapsulatedDocument( 
   DicomElement element,
   bool child,
   ILeadStream stream,
   DicomEncapsulatedDocument encapsulatedDocument,
   DicomCodeSequenceItem conceptNameCodeSequence
)

            

            
 function Leadtools.Dicom.DicomDataSet.GetEncapsulatedDocument(DicomElement,Boolean,ILeadStream,DicomEncapsulatedDocument,DicomCodeSequenceItem)( 
   element ,
   child ,
   stream ,
   encapsulatedDocument ,
   conceptNameCodeSequence 
)
public:
void GetEncapsulatedDocument( 
   DicomElement^ element,
   bool child,
   ILeadStream^ stream,
   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.
stream
The stream that will contain the encapsulated document.
encapsulatedDocument
The encapsulated document module attributes
conceptNameCodeSequence
The concept name code sequence attributes
Remarks

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 one of the following file types 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.

stream is a stream that will contain the encapsulated document after it is extracted.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Dicom

''' 
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
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
      );

   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);
}
using Leadtools.Dicom.Constants;
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
      );

   Debug.WriteLine(sMsg1 + sMsg2);
}

async Task DicomDataSet_GetEncapsulatedDocumentExample(DicomElement element, bool child, DicomDataSet ds, string sFileDocumentOut)
{
   DicomEncapsulatedDocument encapsulatedDocument = new DicomEncapsulatedDocument();
   DicomCodeSequenceItem conceptNameCodeSequence = new DicomCodeSequenceItem();

   //create the file before calling GetEncapsulatedDocument. 
   StorageFile file = await Tools.AppLocalFolder.CreateFileAsync(Path.GetFileName(sFileDocumentOut));
   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

   ILeadStream stream = LeadStreamFactory.Create(file);
   using (IDisposable disposable = stream as IDisposable)
   {
      ds.GetEncapsulatedDocument(element, child, stream, encapsulatedDocument, conceptNameCodeSequence);
   }
   sMsg = string.Format("Encapsulated Document Extracted from stream: {0}", sFileDocumentOut);
   DumpEncapsulatedDocumentTags(sMsg, encapsulatedDocument, conceptNameCodeSequence);
}
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Examples;

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}\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
      );

   Debug.WriteLine(sMsg1 + sMsg2);
}
Imports Leadtools
Imports Leadtools.Dicom

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
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

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

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