LEADTOOLS Medical (Leadtools.Dicom assembly)

FindFirstPrivateCreatorDataElement Method

Show in webframe
Example 







A DicomElement in the data set. The search for Private Creator Data Elements will be at the same level as as this item.
true to evaluate the Data Set as a tree; false to evaluate the Data Set as a list.
String identifier that is assigned to the private creator data element. If non-null, search includes only those Private Creator Data Elements that have a string value that is the same as idCode. If null, search includes Private Creator Data Elements with any string value.
Group number to search within. If elementGroup is 0, search includes Private Creator Data Elements with any group. If elementGroup is 0x0010 to 0x00FF, the search includes only those Private Creator Data Elements in elementGroup.
Returns the Private Creator Data Element that matches the search constraints.
Syntax
public DicomElement FindFirstPrivateCreatorDataElement( 
   DicomElement element,
   bool tree,
   string idCode,
   int elementGroup
)
'Declaration
 
Public Function FindFirstPrivateCreatorDataElement( _
   ByVal element As DicomElement, _
   ByVal tree As Boolean, _
   ByVal idCode As String, _
   ByVal elementGroup As Integer _
) As DicomElement
'Usage
 
Dim instance As DicomDataSet
Dim element As DicomElement
Dim tree As Boolean
Dim idCode As String
Dim elementGroup As Integer
Dim value As DicomElement
 
value = instance.FindFirstPrivateCreatorDataElement(element, tree, idCode, elementGroup)
public DicomElement FindFirstPrivateCreatorDataElement( 
   DicomElement element,
   bool tree,
   string idCode,
   int elementGroup
)

            
public DicomElement findFirstPrivateCreatorDataElement(DicomElement element, boolean tree, String idCode, int elementGroup)
 function Leadtools.Dicom.DicomDataSet.FindFirstPrivateCreatorDataElement( 
   element ,
   tree ,
   idCode ,
   elementGroup 
)
public:
DicomElement^ FindFirstPrivateCreatorDataElement( 
   DicomElement^ element,
   bool tree,
   String^ idCode,
   int elementGroup
) 

Parameters

element
A DicomElement in the data set. The search for Private Creator Data Elements will be at the same level as as this item.
tree
true to evaluate the Data Set as a tree; false to evaluate the Data Set as a list.
idCode
String identifier that is assigned to the private creator data element. If non-null, search includes only those Private Creator Data Elements that have a string value that is the same as idCode. If null, search includes Private Creator Data Elements with any string value.
elementGroup
Group number to search within. If elementGroup is 0, search includes Private Creator Data Elements with any group. If elementGroup is 0x0010 to 0x00FF, the search includes only those Private Creator Data Elements in elementGroup.

Return Value

The first Private Creator Data Element that matches the search constraints. If null is returned, no item exists with the specified search constraints.
Remarks

This feature is available in version 16 or higher.

Use this method along with FindNextPrivateCreatorDataElement to find any or all the Private Creator Data Elements in a DICOM data set. The search for private creator data elements is on the same level as the parameter element. If element is null, the search is at the top or first level.

If tree is true, the data set is searched as a tree. If tree is false, the data set is searched as a list. For more information on the use of this parameter, see FindFirstElement.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Dicom

Private Function DumpElement(ByVal p As DicomElement) As String
   If p Is Nothing Then
      Return String.Empty
   End If
   Return String.Format("({0:X4},{1:X4})" & Constants.vbLf, p.Tag >> &H10, p.Tag And &HFFFF)
End Function
Private Function DumpPrivateElements(ByVal ds As DicomDataSet, ByVal privateCreatorDataElement As DicomElement) As String
   Dim sMsg As String = String.Empty
   Dim p As DicomElement = ds.FindFirstPrivateElement(privateCreatorDataElement)
   Do While Not p Is Nothing
      sMsg = sMsg & Constants.vbTab + DumpElement(p)
      p = ds.FindNextPrivateElement(p, privateCreatorDataElement)
   Loop
   Return sMsg
End Function

Private Sub DicomDataSet_FindFirstPrivateCreatorDataElementExample(ByVal ds As DicomDataSet, ByVal root As DicomElement, ByVal tree As Boolean)
   Dim sMsg As String = String.Empty
   Dim pPrivateCreatorDataElement As DicomElement = ds.FindFirstPrivateCreatorDataElement(root, tree, Nothing, 0)
   Do While Not pPrivateCreatorDataElement Is Nothing
      sMsg = sMsg & "*** Private Creator Data Element" & DumpElement(pPrivateCreatorDataElement)
      sMsg = sMsg & DumpPrivateElements(ds, pPrivateCreatorDataElement)
      pPrivateCreatorDataElement = ds.FindNextPrivateCreatorDataElement(pPrivateCreatorDataElement, tree, Nothing, 0)
   Loop

   MessageBox.Show(sMsg.ToString(), "Private Elements", MessageBoxButtons.OK)
End Sub
using Leadtools;
using Leadtools.Dicom;

string DumpElement(DicomElement p)
{
   if (p == null)
      return string.Empty;
   return string.Format("({0:X4},{1:X4})\n", p.Tag >> 0x10, p.Tag & 0xFFFF);
}
string DumpPrivateElements(DicomDataSet ds, DicomElement privateCreatorDataElement)
{
   string sMsg = string.Empty;
   DicomElement p = ds.FindFirstPrivateElement(privateCreatorDataElement);
   while (p != null)
   {
      sMsg = sMsg + "\t" + DumpElement(p);
      p = ds.FindNextPrivateElement(p, privateCreatorDataElement);
   }
   return sMsg;
}

void DicomDataSet_FindFirstPrivateCreatorDataElementExample(DicomDataSet ds, DicomElement root, bool tree)
{
   string sMsg = string.Empty;
   DicomElement pPrivateCreatorDataElement = ds.FindFirstPrivateCreatorDataElement(root, tree, null, 0);
   while (pPrivateCreatorDataElement != null)
   {
      sMsg = sMsg + "*** Private Creator Data Element" + DumpElement(pPrivateCreatorDataElement);
      sMsg = sMsg + DumpPrivateElements(ds, pPrivateCreatorDataElement);
      pPrivateCreatorDataElement = ds.FindNextPrivateCreatorDataElement(pPrivateCreatorDataElement, tree, null, 0);
   }

   MessageBox.Show(sMsg.ToString(), "Private Elements", MessageBoxButtons.OK);
}
using Leadtools.Dicom.Constants;
using Leadtools;
using Leadtools.Dicom;

string DumpElement(DicomElement p)
{
   if (p == null)
      return string.Empty;
   return string.Format("({0:X4},{1:X4})\n", p.Tag >> 0x10, p.Tag & 0xFFFF);
}
string DumpPrivateElements(DicomDataSet ds, DicomElement privateCreatorDataElement)
{
   string sMsg = string.Empty;
   DicomElement p = ds.FindFirstPrivateElement(privateCreatorDataElement);
   while (p != null)
   {
      sMsg = sMsg + "\t" + DumpElement(p);
      p = ds.FindNextPrivateElement(p, privateCreatorDataElement);
   }
   return sMsg;
}

void DicomDataSet_FindFirstPrivateCreatorDataElementExample(DicomDataSet ds, DicomElement root, bool tree)
{
   string sMsg = string.Empty;
   DicomElement pPrivateCreatorDataElement = ds.FindFirstPrivateCreatorDataElement(root, tree, string.Empty, 0);
   while (pPrivateCreatorDataElement != null)
   {
      sMsg = sMsg + "*** Private Creator Data Element" + DumpElement(pPrivateCreatorDataElement);
      sMsg = sMsg + DumpPrivateElements(ds, pPrivateCreatorDataElement);
      pPrivateCreatorDataElement = ds.FindNextPrivateCreatorDataElement(pPrivateCreatorDataElement, tree, null, 0);
   }

  Debug.WriteLine("Private Elements: " + sMsg.ToString());
}

      
public async Task Test_DicomDataSet_FindFirstPrivateCreatorDataElementExample()
{
   DicomEngine.Startup();
   DicomDataSet ds = new DicomDataSet();
   string filePath = @"Assets\PrivateTags.dic";
   StorageFile file = await Tools.AppInstallFolder.GetFileAsync(filePath);
   ILeadStream stream = LeadStreamFactory.Create(file);
   bool success = await ds.LoadAsync(stream, DicomDataSetLoadFlags.None);
   Debug.Assert(success);
   DicomDataSet_FindFirstPrivateCreatorDataElementExample(ds, null, true);
   DicomEngine.Shutdown();
   Debug.WriteLine("Test_DicomDataSet_FindFirstPrivateCreatorDataElementExample Finished");
}
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Examples;

string DumpElement(DicomElement p)
{
   if (p == null)
      return string.Empty;
   return string.Format("({0:X4},{1:X4})\n", p.Tag >> 0x10, p.Tag & 0xFFFF);
}
string DumpPrivateElements(DicomDataSet ds, DicomElement privateCreatorDataElement)
{
   string sMsg = string.Empty;
   DicomElement p = ds.FindFirstPrivateElement(privateCreatorDataElement);
   while (p != null)
   {
      sMsg = sMsg + "\t" + DumpElement(p);
      p = ds.FindNextPrivateElement(p, privateCreatorDataElement);
   }
   return sMsg;
}

void DicomDataSet_FindFirstPrivateCreatorDataElementExample(DicomDataSet ds, DicomElement root, bool tree)
{
   string sMsg = string.Empty;
   DicomElement pPrivateCreatorDataElement = ds.FindFirstPrivateCreatorDataElement(root, tree, null, 0);
   while (pPrivateCreatorDataElement != null)
   {
      sMsg = sMsg + "*** Private Creator Data Element" + DumpElement(pPrivateCreatorDataElement);
      sMsg = sMsg + DumpPrivateElements(ds, pPrivateCreatorDataElement);
      pPrivateCreatorDataElement = ds.FindNextPrivateCreatorDataElement(pPrivateCreatorDataElement, tree, null, 0);
   }

   Debug.WriteLine("Private Elements: " + sMsg.ToString());
}
Imports Leadtools
Imports Leadtools.Dicom

Private Function DumpElement(ByVal p As DicomElement) As String
   If p Is Nothing Then
      Return String.Empty
   End If
   Return String.Format("({0:X4},{1:X4})" & Constants.vbLf, p.Tag >> &H10, p.Tag And &HFFFF)
End Function
Private Function DumpPrivateElements(ByVal ds As DicomDataSet, ByVal privateCreatorDataElement As DicomElement) As String
   Dim sMsg As String = String.Empty
   Dim p As DicomElement = ds.FindFirstPrivateElement(privateCreatorDataElement)
   Do While Not p Is Nothing
      sMsg = sMsg & Constants.vbTab + DumpElement(p)
      p = ds.FindNextPrivateElement(p, privateCreatorDataElement)
   Loop
   Return sMsg
End Function

Private Sub DicomDataSet_FindFirstPrivateCreatorDataElementExample(ByVal ds As DicomDataSet, ByVal root As DicomElement, ByVal tree As Boolean)
   Dim sMsg As String = String.Empty
   Dim pPrivateCreatorDataElement As DicomElement = ds.FindFirstPrivateCreatorDataElement(root, tree, Nothing, 0)
   Do While Not pPrivateCreatorDataElement Is Nothing
      sMsg = sMsg & "*** Private Creator Data Element" & DumpElement(pPrivateCreatorDataElement)
      sMsg = sMsg & DumpPrivateElements(ds, pPrivateCreatorDataElement)
      pPrivateCreatorDataElement = ds.FindNextPrivateCreatorDataElement(pPrivateCreatorDataElement, tree, Nothing, 0)
   Loop

   Debug.WriteLine("Private Elements: " & sMsg.ToString())
End Sub
Requirements

Target Platforms

See Also

Reference

DicomDataSet Class
DicomDataSet Members
Private Data Element Tags
CreatePrivateCreatorDataElement Method
GetNextUnusedPrivateTag Method
FindFirstPrivateCreatorDataElement Method
FindNextPrivateCreatorDataElement Method
FindFirstPrivateElement Method
FindNextPrivateElement Method

 

 


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