Thursday, May 23, 2013
Google Custom Search

Our Community

Membership Membership:
Latest New User Latest: joshekey
New Today New Today: 12
New Yesterday New Yesterday: 10
User Count Overall: 28679

People Online People Online:
Visitors Visitors: 7
Members Members: 0
Total Total: 7

Online Now Online Now:

ClearCanvas Community Forums

We've moved our Developer Forums!
To better assist our open source community, we have moved our repository and developer forums to GitHub. You can access the new developer forums on our ClearCanvas GitHub issues board.

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

--
2010-11-24 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

stewart
Senior Member
Senior Member
Posts:2336

--
2010-12-06 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
Live and real-time support available for Personal and Team Edition customers
hanif123
New Member
New Member
Posts:4

--
2010-12-06 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.
stewart
Senior Member
Senior Member
Posts:2336

--
2010-12-18 07:39 PM

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

Live and real-time support available for Personal and Team Edition customers
stewart
Senior Member
Senior Member
Posts:2336

--
2010-12-18 07:40 PM
In that example, destPoint would be your PictureBox coordinate.
Live and real-time support available for Personal and Team Edition customers
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2013 ClearCanvas Inc. All Rights Reserved