It is possible to “Capture” an image as displayed on screen. This can be easily done in both .NET and COM version of DicomObjects.
In order to use PrinterImage to make a complete copy of the image as displayed in the viewer, it is necessary to:
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);
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)