Packages

 

com.aspose.imaging.fileformats.dicom

Class DicomPage

  • All Implemented Interfaces:
    IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, com.aspose.internal.IPixelsSaver, com.aspose.internal.progressmanagement.IProgressEventHandler, com.aspose.internal.progressmanagement.IProgressInformer, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class DicomPage
    extends RasterCachedImage

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

    Code 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");
        }
    }
    

    • Constructor Detail

      • DicomPage

        public DicomPage(DicomImage image,
                         int index)

        Initializes a new instance of the DicomPage class.

        Parameters:
        image - The image.
        index - The index.
      • DicomPage

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

        Initializes a new instance of the DicomPage class.

        Parameters:
        image - The image.
        index - The index.
        loadOptions - The load options.
    • Method Detail

      • getIndex

        public final int getIndex()

        Gets the index of the current page.

        Value: The index.
        Returns:
        the index of the current page.
      • getWidth

        public int getWidth()

        Gets the image width.

        Value: The image width.
        Specified by:
        getWidth in interface IObjectWithBounds
        Specified by:
        getWidth in class Image
        Returns:
        The image width.
      • getHeight

        public int getHeight()

        Gets the image height.

        Value: The image height.
        Specified by:
        getHeight in interface IObjectWithBounds
        Specified by:
        getHeight in class Image
        Returns:
        The image height.
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Value: The image bits per pixel count.
        Specified by:
        getBitsPerPixel in class Image
        Returns:
        The image bits per pixel count.
      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image