DicomPage

Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.DataStreamSupporter, com.aspose.imaging.Image, com.aspose.imaging.RasterImage, com.aspose.imaging.RasterCachedImage

public class DicomPage extends RasterCachedImage

It is class for work with DICOM files of the type multi frame

Constructors

ConstructorDescription
DicomPage(DicomImage image, int index)Initializes a new instance of the DicomPage class.
DicomPage(DicomImage image, int index, LoadOptions loadOptions)Initializes a new instance of the DicomPage class.

Methods

MethodDescription
getIndex()Gets the index of the current page.
getWidth()Gets the image width.
getHeight()Gets the image height.
getBitsPerPixel()Gets the image bits per pixel count.
getFileFormat()Gets a value of file format

Example: Create a multi-page Dicom image.

        
try (DicomOptions dicomOptions = new DicomOptions())
{
    dicomOptions.setSource(new StreamSource());
    try (DicomImage image = (DicomImage) Image.create(
            dicomOptions,
            100,
            100))
    {
        // Draw something using vector graphics
        Graphics graphics = new Graphics(image);
        graphics.fillRectangle(new SolidBrush(Color.getBlueViolet()), image.getBounds());
        graphics.fillRectangle(new SolidBrush(Color.getAqua()), 10, 20, 50, 20);
        graphics.fillEllipse(new SolidBrush(Color.getOrange()), 30, 50, 70, 30);

        // Save the pixels of the drawn image. They are now on the first page of the Dicom image.
        int[] pixels = image.loadArgb32Pixels(image.getBounds());

        // Add a few pages after, making them darker
        for (int i = 1; i < 5; i++)
        {
            DicomPage page = image.addPage();
            page.saveArgb32Pixels(page.getBounds(), pixels);
            page.adjustBrightness(i * 30);
        }

        // Add a few pages in front of the main page, making them brighter
        for (int i = 1; i < 5; i++)
        {
            DicomPage page = image.insertPage(0);
            page.saveArgb32Pixels(page.getBounds(), pixels);
            page.adjustBrightness(-i * 30);
        }

        // Save the created multi-page image to the output file
        image.save("MultiPage.dcm");
    }
}

DicomPage(DicomImage image, int index)

public DicomPage(DicomImage image, int index)

Initializes a new instance of the DicomPage class.

Parameters:

ParameterTypeDescription
imageDicomImageThe image.
indexintThe index.

DicomPage(DicomImage image, int index, LoadOptions loadOptions)

public DicomPage(DicomImage image, int index, LoadOptions loadOptions)

Initializes a new instance of the DicomPage class.

Parameters:

ParameterTypeDescription
imageDicomImageThe image.
indexintThe index.
loadOptionsLoadOptionsThe load options.

getIndex()

public final int getIndex()

Gets the index of the current page.

Value: The index.

Returns: int - the index of the current page.

getWidth()

public int getWidth()

Gets the image width.

Value: The image width.

Returns: int

getHeight()

public int getHeight()

Gets the image height.

Value: The image height.

Returns: int

getBitsPerPixel()

public int getBitsPerPixel()

Gets the image bits per pixel count.

Value: The image bits per pixel count.

Returns: int

getFileFormat()

public long getFileFormat()

Gets a value of file format

Returns: long