The LabelType “Formatted” in .NET version of DicomObjects provides a very useful way to access the value of any DicomImage property. For property which has a shortcut name, you can just put the name of the property within a pair of square brackets. You can also specify the “Group” and “Element” of any particular attribute. The code shows how to use the formatted label.

DicomObjects.NET (only)

Use [PropertyName]

	DicomLabel l = new DicomLabel();
	l.LabelType = DicomObjects.Enums.LabelType.Formatted;
	l.Area = new RectangleF(110, 50, 150, 30);
	l.TextBrush = Brushes.Yellow;
	l.ShowTextBox = true;
	l.Text = @"Frame : [Frame]  [FrameCount]"; // [PropertyName] gives you the value of that property
	l.ScaleMode = DicomObjects.Enums.ScaleMode.Image;
	Viewer.CurrentImage.Labels.Add(l);
	

Use [(gggg,eeee)]:

 
  DicomLabel l = new DicomLabel();
	l.LabelType = DicomObjects.Enums.LabelType.Formatted;
	l.Area = new RectangleF(110, 50, 150, 30);
	l.TextBrush = Brushes.Yellow;
	l.ShowTextBox = true;
	l.Text = "PatientName : [(0010,0010)]"; // $ + PropertyName gives you the value of that property
	l.ScaleMode = DicomObjects.Enums.ScaleMode.Image;
	Viewer.CurrentImage.Labels.Add(l);
	

NOTE:

both property name and (gggg,eeee) formats are case sensitive and there is no space between “,” and “eeee”. To get the date time properties displayed right, it’s better to use the [(gggg,eeee)] format as the VR is accessible so the output will be narrowed down to “Date” or “Time”. Using the property name format would not have such distinction as the VR is not accessible and a general DateTime data will be returned.