Loading and Saving DICOM Images
Load DICOM images in the same way as you load images of other formats. Use DICOM format options to set specific features for image loading.
Save DICOM images in the same way as you save images of other formats. However, there are a few items that need to be discussed about saving DICOM images.
DICOM File Loading Times
Often, a DICOM file contains a set of pages which is a sequence of frames recorded from the scanning device. For example, recording the working of the heart or the dynamics of the spread of a contrasting drug inside the body. Hence, the need for sequential playback of pages to create a realistic live image illustrating the process occurring in the body. ImageGear allows you to playback the pages in a few different ways. Each of these methods has its own advantages and disadvantages.
This first example illustrates how to load a whole DICOM file into memory and play pages using ImGearPageView. This method is the simplest, although the time to load the file is highest and playing frame rate is slow.
This second example performs the loading the same way as the first example, however, the rendering of pages is performed with Windows GUI using System.Drawing.Bitmap class object (https://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.DRAWING.BITMAP);k(TargetFrameworkMoniker-".NETFRAMEWORK,VERSION=V2.0");k(DevLang-CSHARP)&rd=true). As in the first example, the time to load is slow, however, the playing of pages is very fast. This method is suitable for reviewing information in a file because after the initial loading any page may be displayed quickly.
If the DICOM file is very large, loading all the pages to memory may be a time consuming operation. For cases when the count of pages is very large or the summary size of pages is very large, another method should be used. ImageGear provides the method of loading single page by index from a DICOM file. It does not load all pages into the memory, instead limits to loading only one required page. The following example illustrates how it may be performed with ImageGear and drawing of pages is performed by ImGearPageView. The pre-loading time with this method is absent, however, frame rate will be slow in comparison to the previous methods.
An alternative way of playing the pages is by drawing the pages with System.Drawing.Bitmap (https://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.DRAWING.BITMAP);k(TargetFrameworkMoniker-".NETFRAMEWORK,VERSION=V2.0");k(DevLang-CSHARP)&rd=true). It will increase the frame rate of playing. But, it will still be slower than in first two methods.
In our samples we used the method that converts ImGearDIB object to System.Drawing.Bitmap (https://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.DRAWING.BITMAP);k(TargetFrameworkMoniker-".NETFRAMEWORK,VERSION=V2.0");k(DevLang-CSHARP)&rd=true) for majority count of colorspaces used in DICOM format. We give an example of such methods below.
This section provides information about the following:
ImageGear .NET allows saving of non-DICOM images to DICOM format. A default Secondary Capture DataSet is created for such images.