Do you have a question?

First Name:
Surname:
Email:
Phone:
Message:
Get Audio Code

Measurement
Last Post 18 Dec 2010 07:40 PM by stewart. 4 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
Mohamed HUser is Offline
New Member
New Member
Posts:4

--
24 Nov 2010 05:44 AM  

Hi,

  Iam new to handling DICOM images as well as clearcanvas. I created a windows form in vs2008 and show the DICOM images in Picture box. Now i want to measure the image from one pixel to another pixel. I know it is possible in CC. But iam little struggle to find the proper solution. 

Can someone help me to sort out this issues..

Little urgent.

Thanks

stewartUser is Offline
Veteran Member
Veteran Member
Posts:2359

--
06 Dec 2010 10:36 AM  
Hmm, yeah that's a bit tricky without all the underlying CC support. You must be using an IPresentationImage in order to draw your bitmap, right? If so, just do this:

var overlayProvider = presImg as IOverlayGraphicsProvider;
var lineGraphic;
overlayProvider.OverlayGraphics.Add(lineGraphic = new LinePrimitive());
lineGraphic.Point1 = whatever;
lineGraphic.Point2 = whatever;

var roi = lineGraphic.GetRoi();


The roi tells you how long the line is, in cm or pixels. Also, if you get the bitmap now and put it in your picturebox, it'll have the line on it.

Once that works, you can start getting fancier with your graphics and make it interactive, etc.

Hope this helps,
Stewart
Mohamed HUser is Offline
New Member
New Member
Posts:4

--
06 Dec 2010 08:29 PM  
Thanks stewart!

Now i can show the image and measure the area of rectangle in normal mode. Now i want to zoom the picture. While zoom the image, a rectangle draw in somewhere in the image.

See the below code.

LocalSopDataSource _dicomDataSource = new LocalSopDataSource(pdicomFilePath);
ImageSop imageSop = new ImageSop(_dicomDataSource);
int CurrentFrame = imageSop.Frames.Count;

int width = imageSop.Frames[CurrentFrame].Columns;
int height = imageSop.Frames[CurrentFrame].Rows;

Bitmap bmp = null;

IEnumerable images = PresentationImageFactory.Create(imageSop);

foreach (IDicomPresentationImage image in images)
{
ISpatialTransformProvider provider = image as ISpatialTransformProvider;
ImageSpatialTransform transform = (ImageSpatialTransform)provider.SpatialTransform;

transform.ScaleToFit = false;
transform.Scale = pZoomvalue;

CompositeGraphic composite = new CompositeGraphic();


if (pAnnotation == "Rectangle")
{
RectanglePrimitive rect = new RectanglePrimitive();
rect.LineStyle = LineStyle.Dot;
rect.TopLeft = new PointF(currentX1, currentY1);
rect.BottomRight = new PointF(currentX2, currentY2);
rect.Color = Color.Yellow;

RectangularRoi rect1 = new RectangularRoi(rect);
rect1.Units = Units.Pixels ;
label23.Text = "Area : " + Convert.ToString(rect1.Area)+ " px" ;
composite.Graphics.Add(rect);
}
else if (pAnnotation == "Line")
{
LinePrimitive line = new LinePrimitive();
line.LineStyle = LineStyle.Dot;
line.Pt1 = new PointF(currentX1, currentY1);
line.Pt2 = new PointF(currentX2, currentY2);
line.Color = Color.Yellow;
composite.Graphics.Add(line);
}




image.OverlayGraphics.Add(composite);
bmp = image.DrawToBitmap(width, height);
}


pictureBox1.Image = bmp;

}

by the above code, now i want to convert to picture box pixel values to dicom image

Give me better idea to sort out this issues.
stewartUser is Offline
Veteran Member
Veteran Member
Posts:2359

--
18 Dec 2010 07:39 PM  

This post should answer your question about picturebox->DICOM image coordinates.

stewartUser is Offline
Veteran Member
Veteran Member
Posts:2359

--
18 Dec 2010 07:40 PM  
In that example, destPoint would be your PictureBox coordinate.
You are not authorized to post a reply.

Active Forums 4.1