DicomGetMaxWindowWidth Method (GdPictureImaging)
In This Topic
Returns the maximum window width of a DICOM image.
Syntax
'Declaration
Public Function DicomGetMaxWindowWidth( _
ByVal As Integer _
) As Single
public float DicomGetMaxWindowWidth(
int
)
public function DicomGetMaxWindowWidth(
: Integer
): Single;
public function DicomGetMaxWindowWidth(
: int
) : float;
public: float DicomGetMaxWindowWidth(
int
)
public:
float DicomGetMaxWindowWidth(
int
)
Parameters
- ImageID
- GdPicture image identifier. The DICOM image.
Return Value
The maximum window width.
Example
Saving the first page of a dicom document to jpeg using different window widths.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
// Read the dicom properties.
float windowWidth = gdpictureImaging.DicomGetDefaultWindowWidth(imageID);
float maxWindowWidth = gdpictureImaging.DicomGetMaxWindowWidth(imageID);
float windowLevel = gdpictureImaging.DicomGetDefaultWindowLevel(imageID);
// Save different views as jpeg.
float step = (maxWindowWidth - windowWidth) / 10;
while (windowWidth <= maxWindowWidth)
{
gdpictureImaging.DicomSetWindowLevel(imageID, windowWidth, windowLevel);
gdpictureImaging.SaveAsJPEG(imageID, "image" + windowWidth.ToString() + ".jpg", 75);
windowWidth += step;
}
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Saving the first page of a dicom document to jpeg using different window widths.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
// Read the dicom properties.
float windowWidth = gdpictureImaging.DicomGetDefaultWindowWidth(imageID);
float maxWindowWidth = gdpictureImaging.DicomGetMaxWindowWidth(imageID);
float windowLevel = gdpictureImaging.DicomGetDefaultWindowLevel(imageID);
// Save different views as jpeg.
float step = (maxWindowWidth - windowWidth) / 10;
while (windowWidth <= maxWindowWidth)
{
gdpictureImaging.DicomSetWindowLevel(imageID, windowWidth, windowLevel);
gdpictureImaging.SaveAsJPEG(imageID, "image" + windowWidth.ToString() + ".jpg", 75);
windowWidth += step;
}
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also