Making a copy of the image as displayed



It is possible to “Capture” an image as displayed on screen. This can be easily done in both .NET and COM version of DicomObjects.

DicomObjects.NET

In order to use PrinterImage to make a complete copy of the image as displayed in the viewer, it is necessary to:

  1. Use the latest version of DicomObjects
  2. Calculate the size of the area being displayed
  3. Find the actual zoom of the image as currently displayed
  4. Scale the current size up to the equivalent in image units (divide by zoom)
  5. Likewise scale the image’s Offset to create correct position for the image in the new rectangle
  6. Call PrinterImage

Note that the zoom used int he final PrinterImage call does not need to be the same as used above, and a higher quality output can be obtained by setting it to 1 (or higher to allow DicomObjects to do any interpolation), but that you may wish to modify the font size of any labels to compensate.

 DicomImage im = Viewer.CurrentImage;           
 SizeF sz;  // display image area in screen pixels
 if (im.Area == RectangleF.Empty)  // not using area
  sz = new SizeF(Viewer.Width / Viewer.MultiColumns, Viewer.Height / Viewer.MultiRows);
 else
  sz = new SizeF(Viewer.Width * im.Area.Width, Viewer.Height * im.Area.Height);

 System.Drawing.Drawing2D.Matrix m = im.Matrix(Viewer);
 float zoom = DicomGlobal.Zoom(m);

 // Convert size to image coordinates
 sz = new SizeF(sz.Width / zoom, sz.Height / zoom);

 // make offset to put image in correct location
 PointF Offset = new PointF(-im.Scroll.X / zoom, -im.Scroll.Y / zoom);
 RectangleF Canvas = new RectangleF(Offset, Size.Truncate(sz));

 DicomImage FinalCopy = Viewer.CurrentImage.PrinterImage(8, 1, true, zoom, Rectangle.Round(Canvas), true);


DicomObjects.COM

A simple way to capture the image as displayed is by the DicomImage.Capture method:

 Dim finalCopy As DicomImage
 Set finalCopy = Viewer.CurrentImage.Capture(False)



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