GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / DicomGetPageCount Method
GdPicture image identifier. The multipage DICOM image.
Example





In This Topic
DicomGetPageCount Method (GdPictureImaging)
In This Topic
Returns the number of pages currently available in a multipage DICOM image.
Syntax
'Declaration
 
Public Function DicomGetPageCount( _
   ByVal ImageID As Integer _
) As Integer
public int DicomGetPageCount( 
   int ImageID
)
public function DicomGetPageCount( 
    ImageID: Integer
): Integer; 
public function DicomGetPageCount( 
   ImageID : int
) : int;
public: int DicomGetPageCount( 
   int ImageID
) 
public:
int DicomGetPageCount( 
   int ImageID
) 

Parameters

ImageID
GdPicture image identifier. The multipage DICOM image.

Return Value

Number of pages currently available in the multipage DICOM image. Returns 0 if the image is not a multipage DICOM image.
Example
Finding out the number of pages in a dicom document.
Saving the pages of a dicom document to jpeg.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
 
    // Save each and every image to a jpeg.
    int pageCount = gdpictureImaging.DicomGetPageCount(imageID);
    for (int pageNo = 1; pageNo <= pageCount; pageNo++)
    {
        gdpictureImaging.DicomSelectPage(imageID, pageNo);
        gdpictureImaging.SaveAsJPEG(imageID, "image" + pageNo.ToString() + ".jpg", 75);
    }
 
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Saving the pages of a dicom document to an animated gif.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int dcmImageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
 
    // Create a gif with the first page.
    int gifImageID = gdpictureImaging.GifCreateMultiFrameFromGdPictureImage(dcmImageID);
 
    // Add the remaining pages as additional frames to the gif.
    int pageCount = gdpictureImaging.DicomGetPageCount(dcmImageID);
    for (int pageNo = 2; pageNo <= pageCount; pageNo++)
    {
        gdpictureImaging.DicomSelectPage(dcmImageID, pageNo);
        gdpictureImaging.GifAppendFrameFromGdPictureImage(gifImageID, dcmImageID);
    }
 
    gdpictureImaging.GifSaveMultiFrameToFile(gifImageID, "image.gif");
 
    gdpictureImaging.ReleaseGdPictureImage(gifImageID);
    gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
}
See Also