DicomSetWindowLevel Method (GdPictureImaging)
Changes the current window level of a DICOM image by applying VOI LUT transformation.
public function DicomSetWindowLevel(
: Integer;
: Single;
: Single
): GdPictureStatus;
public function DicomSetWindowLevel(
: int,
: float,
: float
) : GdPictureStatus;
'Declaration
Public Function DicomSetWindowLevel( _
ByVal As Integer, _
ByVal As Single, _
ByVal As Single _
) As GdPictureStatus
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.
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);
}