Packages

 

com.aspose.imaging.fileformats.dicom

Class DicomImage

    • Constructor Detail

      • DicomImage

        public DicomImage(InputStream stream,
                          LoadOptions loadOptions)

        Initializes a new instance of the DicomImage class.

        Parameters:
        stream - The stream.
        loadOptions - The load options.
      • DicomImage

        public DicomImage(InputStream stream)

        Initializes a new instance of the DicomImage class.

        Parameters:
        stream - The stream.
    • Method Detail

      • isCached

        public final boolean isCached()

        Gets a value indicating whether object's data is cached currently and no data reading is required.

        Value: true if object's data is cached; otherwise, false.
        Specified by:
        isCached in class DataStreamSupporter
        Returns:
        true if object's data is cached; otherwise, false.
      • getFileInfo

        public ReaderDicomFileInfo getFileInfo()

        Gets a value, which contains info header the DICOM file

      • getDicomPages

        public DicomPage[] getDicomPages()

        Gets the pages.

        Value: The pages.
      • getActivePage

        public DicomPage getActivePage()

        Gets or sets the active page.

        Throws:
        DicomImageException - The active page cannot be set as it belongs to another image. Value: The active page.
      • setActivePage

        public void setActivePage(DicomPage value)

        Gets or sets the active page.

        Throws:
        DicomImageException - The active page cannot be set as it belongs to another image. Value: The active page.
      • getActivePageIndex

        public int getActivePageIndex()

        Gets the index active page.

        Value: The index active page.
      • getWidth

        public int getWidth()

        Gets the image width of the current page.

        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 of the current page.

        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.
      • getImageOpacity

        public float getImageOpacity()

        Gets opacity of this image. 0 = fully transparent, 1 = fully opaque.

        Overrides:
        getImageOpacity in class RasterImage
        Returns:
        The opacity value between 0.0 (fully transparent) and 1.0 (fully opaque).
      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image
        Returns:
        The file format.
      • saveAll

        public void saveAll(String filePath,
                            ImageOptionsBase options)

        Saves the object's data to the specified file (indexer + filename) location in the specified file format according to save options..

        Parameters:
        filePath - The file path.
        options - The options.
      • dither

        public void dither(int ditheringMethod,
                           int bitsCount,
                           IColorPalette customPalette)

        Performs dithering on the current image.

        Specified by:
        dither in class RasterImage
        Parameters:
        ditheringMethod - The dithering method.
        bitsCount - The final bits count for dithering.
        customPalette - The custom palette for dithering.
      • setResolution

        public void setResolution(double dpiX,
                                  double dpiY)

        Sets the resolution for this RasterImage.

        Overrides:
        setResolution in class RasterImage
        Parameters:
        dpiX - The horizontal resolution, in dots per inch, of the RasterImage.
        dpiY - The vertical resolution, in dots per inch, of the RasterImage.
      • cacheData

        public final void cacheData()

        Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer.

        Specified by:
        cacheData in class DataStreamSupporter
      • rotateFlip

        public void rotateFlip(int rotateFlipType)

        Rotates, flips, or rotates and flips the Active frame only.

        Specified by:
        rotateFlip in class Image
        Parameters:
        rotateFlipType - The rotate flip type.
      • rotateFlipAll

        public void rotateFlipAll(int rotateFlip)

        Rotates the flip all frames in image.

        Parameters:
        rotateFlip - The rotate flip type.
      • rotate

        public void rotate(float angle,
                           boolean resizeProportionally,
                           Color backgroundColor)

        Rotate image around the center.

        Overrides:
        rotate in class RasterImage
        Parameters:
        angle - The rotate angle in degrees. Positive values will rotate clockwise.
        resizeProportionally - if set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.
        backgroundColor - Color of the background.
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           int resizeType)

        Resizes the image.

        Overrides:
        resize in class RasterImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           ImageResizeSettings settings)

        Resizes the image.

        Overrides:
        resize in class RasterImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
      • resizeWidthProportionally

        public void resizeWidthProportionally(int newWidth,
                                              int resizeType)

        Resizes the width proportionally.

        Overrides:
        resizeWidthProportionally in class Image
        Parameters:
        newWidth - The new width.
        resizeType - Type of the resize.
      • resizeHeightProportionally

        public void resizeHeightProportionally(int newHeight,
                                               int resizeType)

        Resizes the height proportionally.

        Overrides:
        resizeHeightProportionally in class Image
        Parameters:
        newHeight - The new height.
        resizeType - Type of the resize.
      • resizeProportional

        public void resizeProportional(int newWidth,
                                       int newHeight,
                                       int resizeType)

        Performs proportional resize on the image. The proportional resize will resize each frame according to the ratio of newWidth/width and newHeight/height.

        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • crop

        public void crop(Rectangle rectangle)

        Cropping the image.

        Overrides:
        crop in class RasterImage
        Parameters:
        rectangle - The rectangle.
      • grayscale

        public void grayscale()

        Transformation of an image to its grayscale representation

        Overrides:
        grayscale in class RasterImage
      • binarizeFixed

        public void binarizeFixed(byte threshold)

        Binarization of an image with predefined threshold

        Overrides:
        binarizeFixed in class RasterImage
        Parameters:
        threshold - Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.
        Throws:
        ImageException - Can't make image black and white. Frame index: + i
      • binarizeOtsu

        public void binarizeOtsu()

        Binarization of an image with Otsu thresholding

        Overrides:
        binarizeOtsu in class RasterImage
        Throws:
        ImageException - Can't make image black and white. Frame index: + i
      • binarizeBradley

        public void binarizeBradley(double brightnessDifference)

        Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding

        Overrides:
        binarizeBradley in class RasterImage
        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
      • binarizeBradley

        public void binarizeBradley(double brightnessDifference,
                                    int windowSize)

        Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding

        Overrides:
        binarizeBradley in class RasterImage
        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
        windowSize - The size of s x s window of pixels centered around this pixel
        Throws:
        ImageException - Can't make image black and white. Frame index: + i
      • crop

        public void crop(int leftShift,
                         int rightShift,
                         int topShift,
                         int bottomShift)

        Crop image with shifts.

        Overrides:
        crop in class RasterImage
        Parameters:
        leftShift - The left shift.
        rightShift - The right shift.
        topShift - The top shift.
        bottomShift - The bottom shift.
      • adjustBrightness

        public void adjustBrightness(int brightness)

        Adjust of a brightness for image.

        Overrides:
        adjustBrightness in class RasterImage
        Parameters:
        brightness - Brightness value.
      • adjustContrast

        public void adjustContrast(float contrast)

        Image contrasting

        Overrides:
        adjustContrast in class RasterImage
        Parameters:
        contrast - Contrast value (in range [-100; 100])
      • adjustGamma

        public void adjustGamma(float gammaRed,
                                float gammaGreen,
                                float gammaBlue)

        Gamma-correction of an image.

        Overrides:
        adjustGamma in class RasterImage
        Parameters:
        gammaRed - Gamma for red channel coefficient
        gammaGreen - Gamma for green channel coefficient
        gammaBlue - Gamma for blue channel coefficient
      • replaceColor

        public void replaceColor(int oldColorArgb,
                                 byte oldColorDiff,
                                 int newColorArgb)

        Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.

        Overrides:
        replaceColor in class RasterImage
        Parameters:
        oldColorArgb - Old color ARGB value to be replaced.
        oldColorDiff - Allowed difference in old color to be able to widen replaced color tone.
        newColorArgb - New color ARGB value to replace old color with.
      • replaceNonTransparentColors

        public void replaceNonTransparentColors(int newColorArgb)

        Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.

        Overrides:
        replaceNonTransparentColors in class RasterImage
        Parameters:
        newColorArgb - New color ARGB value to replace non transparent colors with.
      • filter

        public void filter(Rectangle rectangle,
                           FilterOptionsBase options)

        Filters the specified rectangle.

        Overrides:
        filter in class RasterImage
        Parameters:
        rectangle - The rectangle.
        options - The options.
      • adjustGamma

        public void adjustGamma(float gamma)

        Gamma-correction of an image.

        Overrides:
        adjustGamma in class RasterImage
        Parameters:
        gamma - Gamma for red, green and blue channels coefficient