LAUREL BRIDGE

Program Class

DICOM Connectivity Framework V3.4
This example demonstrates how to load all the pixel data image frames from a single multi-frame dataset, or from a set of single frame datasets into a byte array.
Inheritance Hierarchy

SystemObject
  LaurelBridge.DCF.Examples.LoadImageFramesProgram

Namespace:  LaurelBridge.DCF.Examples.LoadImageFrames
Assembly:  LoadImageFrames (in LoadImageFrames.exe) Version: DCF34 r10560 DCF_3_4_10
Syntax

C#
public class Program

The Program type exposes the following members.

Constructors

  NameDescription
Public methodProgram
Initializes a new instance of the Program class
Top
Methods

  NameDescription
Public methodStatic memberMain
Main entry point for LoadImageFrames.
Top
Remarks

This program takes a single file or folder path as an argument. A file path should reference an existing DICOM file containing at least one image frame. A folder path should reference an existing directory that should contain one or more DICOM files with a '.dcm' extension; each containing exactly one image frame, and each frame having the same size and image type. Both the multi-frame and multi-dataset implementations use Parallel.For to load the image frames in parallel.

For a single file, the program will allocate a byte array of sufficient size to contain all frames of the dataset, and then load the image data for each frame. For a very large encapsulated multi-frame image, a fair amount of time may be spent constructing the basic frame table offset which is required to efficiently seek to the correct location for each frame. See the CreateBasicOffsetTable example program to see how to add a basic frame offset table to a dataset.

For a single folder, the program will scan the directory for a sorted list of '.dcm' file names. The program wil then allocate a byte array of sufficient size to contain the single frame of each dataset, and then load the image data. The image frames of each dataset must be identical size.

This implementation allocates exactly the number of bytes needed for the specified number of image frames. Depending upon your application, it may be more performant to make sure image frames are padded to the SystemPageSize to ensure that every frame begins on a page boundary.

Additional image filtering may be necessary for modality and value-of-interest processing.

For very large multi-frame or multi-dataset images it may be more performant and/or necessary to use a MemoryMappedFile as the backing store for the frame buffer.

In some scenarios it may also be simpler to make use of an UnmanagedMemoryStream to avoid extra memory copies, which is exactly what GetRawPixels(int, ref System.Array) does to handle buffers of arbitrary array types.

Other premature optimizations are possible. Your mileage may vary.

See the IFrameProducer interface and the FrameProducer class for more details on loading image frames.

See Also

Reference