GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / DicomGetTagsCount Method
GdPicture image identifier. The DICOM image.
Example





In This Topic
DicomGetTagsCount Method (GdPictureImaging)
In This Topic
Returns the number of available tags in a DICOM image.
Syntax
'Declaration
 
Public Function DicomGetTagsCount( _
   ByVal ImageID As Integer _
) As Integer
public int DicomGetTagsCount( 
   int ImageID
)
public function DicomGetTagsCount( 
    ImageID: Integer
): Integer; 
public function DicomGetTagsCount( 
   ImageID : int
) : int;
public: int DicomGetTagsCount( 
   int ImageID
) 
public:
int DicomGetTagsCount( 
   int ImageID
) 

Parameters

ImageID
GdPicture image identifier. The DICOM image.

Return Value

0: No tag or error. Use the GetStat() method to determine the reason this method failed. Non-zero: The number of available tags.
Example
Reading the tags from a dicom document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
 
    // Write in a report all the tags available within the file.
    StringBuilder report = new StringBuilder();
    int tagCount = gdpictureImaging.DicomGetTagsCount(imageID);
    for (int tagNo = 1; tagNo <= tagCount; tagNo++)
    {
        string tagDescription = gdpictureImaging.DicomGetTagDescription(imageID, tagNo);
        string tagValue = gdpictureImaging.DicomGetTagValue(imageID, tagNo);
 
        report.AppendLine(tagDescription.ToString() + " " + tagValue.ToString());
    }
    gdpictureImaging.ReleaseGdPictureImage(imageID);
 
    MessageBox.Show(report.ToString(), "Tags", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
See Also