Special Labels in DicomObjects

DicomLabels of type LabelSpecial are used where the text content is determined by DicomObjects rather than by the programmer. The first use is for anatomic side markers, but the more general name has been used, as other types may be used in the future.

Anatomic side markers are created by setting the Text (COM version) or Text (.NET version) property of the DicomLabel to one of the following 4 values:

If an unrecognised value is used, or if the image lacks the necessary DICOM attributes then the label will simply not be displayed.

If the label can be displayed, then DicomObjects calculates, using the orientation information within the image which anatomic direction(s) correspond with the selected edge of the image as displayed and (unless changed as below) will display one or more of the following characters R,L,A,P,I or S, corresponding to right, left, anterior, posterior, inferior and superior respectively. Where the image orientation is oblique, 2 or more characters will be displayed, in decreasing order of importance,

If writing an application for users who’s language is not English, you may wish to localise the characters used, and this can be done by setting the DirectionStrings (COM version) or DirectionStrings (.NET version) property of a DicomGlobal object.

When interpreting this property, DicomObjects uses only the value of the text property to calculate the string displayed, not the position of the label, so it is the programmer’s responsibility to ensure that the position and content correspond by placing the label close to the appropriate edge. It is particularly important to ensure that width and height have non-zero but relatively small values, so that the label stays in the correct place when the image is flipped or rotated.

If the ScaleMode (COM version) or ScaleMode (.NET version) property is set to Image, then rotation or flipping of the image cause the label to move, but the text remains constant. If ImageTied is false, then label remains fixed in position, but the text alters to reflect the position of the image. In either case, the information should remain anatomically correct.

If you use this feature, you are strongly advised to use at least two markers, to prevent confusion between orientation and side markers. To make this distinction clear, consider an image of the right leg. If only a single side label is used, at the side of the image corresponding with the midline of the patient, this will be labelled “L” for left, which is correct as far as orientation is concerned, but could confuse users, who might think that they were being shown the left leg. However, if both R and L markers are present, then they could only be orientation markers, and the potential confusion is removed.

Following sample code shows how to use the Special Labels in DicomObjects:

DicomObjects.NET

 // left center
 DicomLabel l = MarkerLabel(Image);
 l.Left = 0.05F;
 l.Top = 0.25F;
 l.Text = "LEFT";
 l.StringFormat = new StringFormat() { 
	Alignment = StringAlignment.Near, 
 	LineAlignment = StringAlignment.Center };
 
 // top center
 l = MarkerLabel(Image);
 l.Left = 0.25F;
 l.Top = 0.05F;
 l.Text = "TOP";
 l.StringFormat = new StringFormat() {
	Alignment = StringAlignment.Center, 
	LineAlignment = StringAlignment.Near };

 // right center
 l = MarkerLabel(Image);
 l.Left = 0.5F;
 l.Top = 0.25F;
 l.Text = "RIGHT";
 l.StringFormat = new StringFormat() {
	Alignment = StringAlignment.Far, 
	LineAlignment = StringAlignment.Center }; 

 // bottom center
 l = MarkerLabel(Image);
 l.Left = 0.25F;
 l.Top = 0.5F;
 l.Text = "BOTTOM";
 l.StringFormat = new StringFormat() {
	Alignment = StringAlignment.Center, 
	LineAlignment = StringAlignment.Far };

 private DicomLabel MarkerLabel(DicomImage Image)
 {
	DicomLabel label = new DicomLabel()
	{
	   LabelType = LabelType.Special,
	   ScaleMode = ScaleMode.Cell,
	   ScaleFontSize = true,
	   Font = new Font(FontFamily.GenericSansSerif, 20),
	   Area = new RectangleF(0, 0, 0.45F, 0.45F),
	   TextBrush = Brushes.Red,
	   Tag = "MARKER"
	};
	Image.Labels.Add(label);
	return label;
}

DicomObjects.COM

 Dim l As DicomImage

 Set l = MarkerLabel(Image)
 l.Left = 0
 l.Top = 500
 l.Text = "LEFT"

 Set l = MarkerLabel(Image)
 l.Left = 500 - l.width / 2
 l.Top = 0
 l.Alignment = doAlignCentre
 l.Text = "TOP"

 Set l = MarkerLabel(Image)
 l.Left = 1000 - l.width
 l.Top = 500
 l.Alignment = doAlignRight
 l.Text = "RIGHT"

 Set l = MarkerLabel(Image)
 l.Left = 500 - l.width / 2
 l.Top = 1000 - l.Height
 l.Alignment = doAlignBottomCentre
 l.Text = "BOTTOM"
 Image.Refresh True


 Private Function MarkerLabel(Image As DicomImage) As DicomLabel
	Set MarkerLabel = Image.Labels.AddNew
	MarkerLabel.LabelType = doLabelSpecial
	MarkerLabel.ScaleWithCell = True
	MarkerLabel.ScaleFontSize = False
	MarkerLabel.width = 200
	MarkerLabel.Height = 200
	MarkerLabel.ForeColour = vbRed
	MarkerLabel.Margin = 2
 End Function


We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE