GdPicture image identifier. The DICOM image.
The window width. Should be a value in the range 1 ; DicomGetMaxWindowWidth().
The window level. Should be a value in the range DicomGetMinWindowLevel() ; DicomGetMaxWindowLevel().
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / DicomSetWindowLevel Method

DicomSetWindowLevel Method (GdPictureImaging)

In This Topic
Changes the current window level of a DICOM image by applying VOI LUT transformation.
Syntax
'Declaration
 
Public Function DicomSetWindowLevel( _
   ByVal ImageID As Integer, _
   ByVal WindowWidth As Single, _
   ByVal WindowLevel As Single _
) As GdPictureStatus
public GdPictureStatus DicomSetWindowLevel( 
   int ImageID,
   float WindowWidth,
   float WindowLevel
)
public function DicomSetWindowLevel( 
    ImageID: Integer;
    WindowWidth: Single;
    WindowLevel: Single
): GdPictureStatus; 
public function DicomSetWindowLevel( 
   ImageID : int,
   WindowWidth : float,
   WindowLevel : float
) : GdPictureStatus;
public: GdPictureStatus DicomSetWindowLevel( 
   int ImageID,
   float WindowWidth,
   float WindowLevel
) 
public:
GdPictureStatus DicomSetWindowLevel( 
   int ImageID,
   float WindowWidth,
   float WindowLevel
) 

Parameters

ImageID
GdPicture image identifier. The DICOM image.
WindowWidth
The window width. Should be a value in the range 1 ; DicomGetMaxWindowWidth().
WindowLevel
The window level. Should be a value in the range DicomGetMinWindowLevel() ; DicomGetMaxWindowLevel().

Return Value

A member of the GdPictureStatus enumeration.
Remarks
An example of this method can be seen on the DICOM Viewer demo application.
Example
Saving the first page of a dicom document to jpeg using different window levels.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
 
    // Read the dicom properties.
    float windowWidth = gdpictureImaging.DicomGetDefaultWindowWidth(imageID);
    float windowLevel = gdpictureImaging.DicomGetMinWindowLevel(imageID);
    float maxWindowLevel = gdpictureImaging.DicomGetMaxWindowLevel(imageID);
 
    // Save different views as jpeg.
    float step = (maxWindowLevel - windowLevel) / 10;
    while (windowLevel <= maxWindowLevel)
    {
        gdpictureImaging.DicomSetWindowLevel(imageID, windowWidth, windowLevel);
        gdpictureImaging.SaveAsJPEG(imageID, "image" + windowLevel.ToString() + ".jpg", 75);
        windowLevel += step;
    }
 
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also