Removing Private Attributes

Private Elements (or Tags) are perfectly legal in DICOM, details of the structure of Private DICOM Elements can be found in DICOM_Private_Elements.

Removing all Private Elements from any DICOM objects is quite simple, following is sample VB 6 code to show you how to do it in DicomObjects.

Dim At As DicomAttribute
Dim Index As Integer

For Index = Image_1.Attributes.Count To 1 Step -1
  Set At = Image_1.Attributes.ItemByIndex(Index)        
  If At.Group Mod 2 > 0 Then
      ' if it's got odd group number, then remove it!
      Image_1.Attributes.Remove At.Group, At.Element
  End If