Program Class

DICOM Connectivity Framework V3.4
An example program to demonstrate various techniques for getting and using pixel data from a DICOM dataset. If you wish to acquire window-leveled Bitmaps, see the DicomImage class which uses these techniques.
Inheritance Hierarchy


Namespace:  LaurelBridge.DCFExamples.GetPixelData
Assembly:  GetPixelData (in GetPixelData.exe) Version: DCF34 r12431 DCF_3_4_38_20200923 NetFramework

public class Program

The Program type exposes the following members.


Public methodProgram
Initializes a new instance of the Program class

Public methodStatic memberMain
Main entry point for GetPixelData.

The IFrameProducer interface provides methods for loading and acquiring the pixel data in several different formats. One creates a FrameProducer with the CreateFromFile(String, TagPath, DicomSessionSettings, Int64) or the CreateFromDataSet(DicomDataSet, DicomSessionSettings) factory methods. The decoded raw pixels for a frame are acquired using either GetRawPixels(Int32, Array), or GetRawPixels(Int32, Stream). The encapsulated (compressed) data stream for an image frame may be extracted using the GetCompressedDataStream(Int32) method. The entire encapsulated stream which includes the compressed data for all frames and the frame delimiters may be accessed using the GetFrameDataStream(Int32) method. These acquisition methods are safe for use by multiple threads to allow concurrent acquisition of image frame data in performance intensive applications.

The three approaches demonstrated in this example are:

load the decoded raw pixels into an ArrayThis approach uses GetRawPixels(Int32, Array) to decode and read the pixel data for the specified image frame into an array. The decode pixel data is properly byte swapped and sign extended if needed. This approach is useful when you would like to perform custom transformations on the data, such as dynamically applying window level and center or other custom manipulations. The destination array is passed by reference, and you may pass a null array to have the properly typed array created for you.
load the decoded raw pixels into a MemoryStreamThis approach uses GetRawPixels(Int32, Stream). The raw pixels are properly byte swapped and sign extended if needed, but no window level or lut processing is performed. This approach might be useful for saving raw pixel data in another format for analysis or processing.
save the encapsulated data streamThe FrameProducer provides GetCompressedDataStream(Int32) method to allow the acquisition of the encapsulated data for a frame without decoding. This example writes the compressed data to another file which may be able to be read by other image viewers. Note that most image viewers support the Jpeg50 format, so the demo image we use by default in this example is in that format.

See Also