Alessandro Pierro
Alessandro Pierro

Reputation: 127

OpenDicom Library C#, problems with Real Value of a tag

I need help in visualize a Tag value ( int , string or others ) in unity using OpendDicom library (C#). The problem of the code, is that I don't know how to Get the exact value of a tag i.e. the sex of the patient as a String, his/her age as an int...

public void ReadData(AcrNemaFile file)
{



    Sequence sq = file.GetJointDataSets().GetJointSubsequences();
    string tag = string.Empty;
    string description = string.Empty;
    string value = string.Empty;
    string op = string.Empty;
    string val_rep = string.Empty;
    string war = string.Empty;
    foreach (DataElement el in sq)
    {

            tag = el.Tag.ToString(); //tag group and element
            op = el.VR.Tag.GetDictionaryEntry().Description;//tag description
            val_rep = el.VR.ToString();//value representative
            war = el.Value.ToString();// 
            Debug.Log( tag + " : " + op + " \n   " + val_rep);





    }
}

This is the code to Display the Tags and the related things

Upvotes: 1

Views: 305

Answers (1)

SeLKoT
SeLKoT

Reputation: 49

The library allows you to get the array of values with .ToArray().

With this you will have a array of objects. Then, you only have to cast or convert the object to the type you want. In this case, you can use the VR to know which kind of type has the object; Decimal String (DS), DateTime (DT), etc...

Upvotes: 2

Related Questions