LEADTOOLS Medical (Leadtools.Dicom assembly)
LEAD Technologies, Inc

CreatePrivateCreatorDataElement Method

Example 







A DicomElement in the data set. The Private Creator Data Element will be inserted at the same level as this item.
Group number of the private creator data element.
Element number of the private creator data element.
String identifier that is assigned to the private creator data element.
Creates a Private Creator Data Element to reserve private data elements. .NET support WinRT support Silverlight support
Syntax
public DicomElement CreatePrivateCreatorDataElement( 
   DicomElement element,
   int elementGroup,
   int elementNumber,
   string idCode
)
'Declaration
 
Public Function CreatePrivateCreatorDataElement( _
   ByVal element As DicomElement, _
   ByVal elementGroup As Integer, _
   ByVal elementNumber As Integer, _
   ByVal idCode As String _
) As DicomElement
'Usage
 
Dim instance As DicomDataSet
Dim element As DicomElement
Dim elementGroup As Integer
Dim elementNumber As Integer
Dim idCode As String
Dim value As DicomElement
 
value = instance.CreatePrivateCreatorDataElement(element, elementGroup, elementNumber, idCode)
public DicomElement CreatePrivateCreatorDataElement( 
   DicomElement element,
   int elementGroup,
   int elementNumber,
   string idCode
)
ObjectiveC Syntax
 function Leadtools.Dicom.DicomDataSet.CreatePrivateCreatorDataElement( 
   element ,
   elementGroup ,
   elementNumber ,
   idCode 
)
public:
DicomElement^ CreatePrivateCreatorDataElement( 
   DicomElement^ element,
   int elementGroup,
   int elementNumber,
   String^ idCode
) 

Parameters

element
A DicomElement in the data set. The Private Creator Data Element will be inserted at the same level as this item.
elementGroup
Group number of the private creator data element.
elementNumber
Element number of the private creator data element.
idCode
String identifier that is assigned to the private creator data element.

Return Value

The newly inserted Private Creator Data Element.
Remarks

This feature is available in version 16 or higher.

A DICOM Data Set can have private data which is stored in private tags. Private tags are reserved by adding a Private Creator Data Element to the data set. Elements of the form (gggg,0010-00FF) represent private creator data elements. More specifically:

Private Creator Data Elements are elements of the form (gggg,eeee) where:

  1. gggg is a four-digit hexadecimal group number
  2. eeee is a four-digit hexadecimal element number
  3. gggg is odd
  4. gggg is NOT 0001, 0003, 0005, 0007 or FFFF
  5. eeee is in the range 0010 to 00FF
  6. Value Representation is LO (Long String).
  7. Value Multiplicity is 1

A private creator data element of the form (gggg,00ee) reserves the following 256 elements, which can be of any value representation:

For example, suppose you want to add the following three private elements to a DICOM data set:

You would first reserve the elements by adding the corresponding private creator data element (0017, 0012).

When using CreatePrivateCreatorDataElement, the created private creator data element is on the same level as element. If element is null, the private creator data element is created at the top or first level.

If parameter uElementNumber is 0xFFFF, the private creator data element is created with the first available element number in group elementGroup.

Example
Copy CodeCopy Code  
Public Sub DicomDataSet_CreatePrivateCreatorDataElement(ByVal ds As DicomDataSet, ByVal root As DicomElement, ByVal elementGroup As Integer)
   Dim tag As Integer = 0
   Dim sUniqueID As String = "MyPrivateCreatorDataElement"
   ' We will add some private tags
   ' First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   Dim privateCreatorElement As DicomElement = ds.FindFirstPrivateCreatorDataElement(root, True, sUniqueID, 0)

   ' If the Private Creator Data Element does not exist, try to create it
   If privateCreatorElement Is Nothing Then
      privateCreatorElement = ds.CreatePrivateCreatorDataElement(root, elementGroup, &HFF, sUniqueID)
      If privateCreatorElement Is Nothing Then
         Return
      End If

      ' Private Creator Data Element tag was created successfully
      ' Add it to the DICOM Tag table 
      DicomTagTable.Instance.Insert(privateCreatorElement.Tag, &HFFFFFFFFL, sUniqueID, privateCreatorElement.VR, 1, 1, 1)
   End If

   ' Insert some private elements
   dim p as DicomElement
   For i As Integer = 0 To 4
      tag = ds.GetNextUnusedPrivateTag(privateCreatorElement)
      p = ds.InsertElement(root, False, tag, DicomVRType.IS, False, 0)
      If Not p Is Nothing Then
         ds.SetIntValue(p, New Integer() {i}, 1)
      End If
   Next i
End Sub
public void DicomDataSet_CreatePrivateCreatorDataElement(DicomDataSet ds, DicomElement root, int elementGroup)
{
   int tag = 0;
   string sUniqueID = "MyPrivateCreatorDataElement";
   // We will add some private tags
   // First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   DicomElement privateCreatorElement = ds.FindFirstPrivateCreatorDataElement(root, true, sUniqueID, 0);

   // If the Private Creator Data Element does not exist, try to create it
   if (privateCreatorElement == null)
   {
      privateCreatorElement = ds.CreatePrivateCreatorDataElement(root, elementGroup, 0xFF, sUniqueID);
      if (privateCreatorElement == null)
         return;

      // Private Creator Data Element tag was created successfully
      // Add it to the DICOM Tag table 
      DicomTagTable.Instance.Insert(
         privateCreatorElement.Tag,
         0xFFFFFFFF,
         sUniqueID,
         privateCreatorElement.VR,
         1, 1, 1
         );
   }

   // Insert some private elements
   for (int i = 0; i < 5; i++)
   {
      tag = ds.GetNextUnusedPrivateTag(privateCreatorElement);
      DicomElement p = ds.InsertElement(root, false, tag, DicomVRType.IS, false, 0);
      if (p != null)
      {
         ds.SetIntValue(p, new int[] { i }, 1);
      }
   }
}
public void DicomDataSet_CreatePrivateCreatorDataElement(DicomDataSet ds, DicomElement root, int elementGroup)
{
   uint tag = 0;
   string sUniqueID = "MyPrivateCreatorDataElement";
   // We will add some private tags
   // First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   DicomElement privateCreatorElement = ds.FindFirstPrivateCreatorDataElement(root, true, sUniqueID, 0);

   // If the Private Creator Data Element does not exist, try to create it
   if (privateCreatorElement == null)
   {
      privateCreatorElement = ds.CreatePrivateCreatorDataElement(root, elementGroup, 0xFF, sUniqueID);
      if (privateCreatorElement == null)
         return;

      // Private Creator Data Element tag was created successfully
      // Add it to the DICOM Tag table 
      DicomTagTable.Instance.Insert(
         privateCreatorElement.Tag,
         0xFFFFFFFF,
         sUniqueID,
         privateCreatorElement.VR,
         1, 1, 1
         );
   }

   // Insert some private elements
   for (int i = 0; i < 5; i++)
   {
      tag = ds.GetNextUnusedPrivateTag(privateCreatorElement);
      DicomElement p = ds.InsertElement(root, false, tag, DicomVRType.IS, false, 0);
      if (p != null)
      {
         ds.SetIntValue(p, new int[] { i }, 1);
      }
   }
}
public void DicomDataSet_CreatePrivateCreatorDataElement(DicomDataSet ds, DicomElement root, int elementGroup)
{
   int tag = 0;
   string sUniqueID = "MyPrivateCreatorDataElement";
   // We will add some private tags
   // First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   DicomElement privateCreatorElement = ds.FindFirstPrivateCreatorDataElement(root, true, sUniqueID, 0);

   // If the Private Creator Data Element does not exist, try to create it
   if (privateCreatorElement == null)
   {
      privateCreatorElement = ds.CreatePrivateCreatorDataElement(root, elementGroup, 0xFF, sUniqueID);
      if (privateCreatorElement == null)
         return;

      // Private Creator Data Element tag was created successfully
      // Add it to the DICOM Tag table 
      DicomTagTable.Instance.Insert(
         privateCreatorElement.Tag,
         0xFFFFFFFF,
         sUniqueID,
         privateCreatorElement.VR,
         1, 1, 1
         );
   }

   // Insert some private elements
   for (int i = 0; i < 5; i++)
   {
      tag = ds.GetNextUnusedPrivateTag(privateCreatorElement);
      DicomElement p = ds.InsertElement(root, false, tag, DicomVRType.IS, false, 0);
      if (p != null)
      {
         ds.SetIntValue(p, new int[] { i }, 1);
      }
   }
}
Public Sub DicomDataSet_CreatePrivateCreatorDataElement(ByVal ds As DicomDataSet, ByVal root As DicomElement, ByVal elementGroup As Integer)
   Dim tag As Integer = 0
   Dim sUniqueID As String = "MyPrivateCreatorDataElement"
   ' We will add some private tags
   ' First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   Dim privateCreatorElement As DicomElement = ds.FindFirstPrivateCreatorDataElement(root, True, sUniqueID, 0)

   ' If the Private Creator Data Element does not exist, try to create it
   If privateCreatorElement Is Nothing Then
      privateCreatorElement = ds.CreatePrivateCreatorDataElement(root, elementGroup, &HFF, sUniqueID)
      If privateCreatorElement Is Nothing Then
         Return
      End If

      ' Private Creator Data Element tag was created successfully
      ' Add it to the DICOM Tag table 
      DicomTagTable.Instance.Insert(privateCreatorElement.Tag, &HFFFFFFFFL, sUniqueID, privateCreatorElement.VR, 1, 1, 1)
   End If

   ' Insert some private elements
   For i As Integer = 0 To 4
      tag = ds.GetNextUnusedPrivateTag(privateCreatorElement)
      Dim p As DicomElement = ds.InsertElement(root, False, tag, DicomVRType.IS, False, 0)
      If Not p Is Nothing Then
         ds.SetIntValue(p, New Integer() { i }, 1)
      End If
   Next i
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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