public final class DicomImage extends RasterImage
It is class of the implementation working with image from DICOM file
Constructor and Description |
---|
DicomImage(InputStream stream)
Initializes a new instance of the
DicomImage class. |
DicomImage(InputStream stream,
LoadOptions loadOptions)
Initializes a new instance of the
DicomImage class. |
Modifier and Type | Method and Description |
---|---|
void |
adjustBrightness(int brightness)
Adjust of a brightness for image.
|
void |
adjustContrast(float contrast)
Image contrasting
|
void |
adjustGamma(float gamma)
Gamma-correction of an image.
|
void |
adjustGamma(float gammaRed,
float gammaGreen,
float gammaBlue)
Gamma-correction of an image.
|
void |
binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
|
void |
binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
|
void |
binarizeOtsu()
Binarization of an image with Otsu thresholding
|
void |
cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying
DataStreamSupporter.DataStreamContainer . |
void |
crop(int leftShift,
int rightShift,
int topShift,
int bottomShift)
Crop image with shifts.
|
void |
crop(Rectangle rectangle)
Cropping the image.
|
void |
dither(int ditheringMethod,
int bitsCount,
IColorPalette customPalette)
Performs dithering on the current image.
|
void |
filter(Rectangle rectangle,
FilterOptionsBase options)
Filters the specified rectangle.
|
DicomPage |
getActivePage()
Gets or sets the active page.
|
int |
getActivePageIndex()
Gets the index active page.
|
int |
getBitsPerPixel()
Gets the image bits per pixel count.
|
DicomPage[] |
getDicomPages()
Gets the pages.
|
long |
getFileFormat()
Gets a value of file format
|
ReaderDicomFileInfo |
getFileInfo()
Gets a value, which contains info header the DICOM file
|
int |
getHeight()
Gets the image height of the current page.
|
float |
getImageOpacity()
Gets opacity of this image.
|
int |
getWidth()
Gets the image width of the current page.
|
void |
grayscale()
Transformation of an image to its grayscale representation
|
boolean |
isCached()
Gets a value indicating whether object's data is cached currently and no data reading is required.
|
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.
|
void |
replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image.
|
void |
resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
|
void |
resizeHeightProportionally(int newHeight,
int resizeType)
Resizes the height proportionally.
|
void |
resizeProportional(int newWidth,
int newHeight,
int resizeType)
Performs proportional resize on the image.
|
void |
resizeWidthProportionally(int newWidth,
int resizeType)
Resizes the width proportionally.
|
void |
rotate(float angle,
boolean resizeProportionally,
Color backgroundColor)
Rotate image around the center.
|
void |
rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the Active frame only.
|
void |
rotateFlipAll(int rotateFlip)
Rotates the flip all frames in image.
|
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..
|
void |
setActivePage(DicomPage value)
Gets or sets the active page.
|
void |
setResolution(double dpiX,
double dpiY)
Sets the resolution for this
RasterImage . |
dither, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getTransparentColor, getUpdateXmpData, getUseRawData, getVerticalResolution, getXmpData, hasAlpha, hasTransparentColor, isRawDataAvailable, loadArgb32Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, readArgb32ScanLine, readScanLine, replaceColor, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setTransparentColor, setTransparentColor, setUpdateXmpData, setUseRawData, setVerticalResolution, setXmpData, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBounds, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public DicomImage(InputStream stream, LoadOptions loadOptions)
Initializes a new instance of the DicomImage
class.
stream
- The stream.loadOptions
- The load options.public DicomImage(InputStream stream)
Initializes a new instance of the DicomImage
class.
stream
- The stream.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
.isCached
in class DataStreamSupporter
true
if object's data is cached; otherwise, false
.public ReaderDicomFileInfo getFileInfo()
Gets a value, which contains info header the DICOM file
public DicomPage[] getDicomPages()
Gets the pages.
Value: The pages.public DicomPage getActivePage()
Gets or sets the active page.
DicomImageException
- The active page cannot be set as it belongs to another image.
Value:
The active page.public void setActivePage(DicomPage value)
Gets or sets the active page.
DicomImageException
- The active page cannot be set as it belongs to another image.
Value:
The active page.public int getActivePageIndex()
Gets the index active page.
Value: The index active page.public int getWidth()
Gets the image width of the current page.
Value: The image width.getWidth
in interface IObjectWithBounds
getWidth
in class Image
public int getHeight()
Gets the image height of the current page.
Value: The image height.getHeight
in interface IObjectWithBounds
getHeight
in class Image
public int getBitsPerPixel()
Gets the image bits per pixel count.
Value: The image bits per pixel count.getBitsPerPixel
in class Image
public float getImageOpacity()
Gets opacity of this image. 0 = fully transparent, 1 = fully opaque.
getImageOpacity
in class RasterImage
public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
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..
filePath
- The file path.options
- The options.public void dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
Performs dithering on the current image.
dither
in class RasterImage
ditheringMethod
- The dithering method.bitsCount
- The final bits count for dithering.customPalette
- The custom palette for dithering.public void setResolution(double dpiX, double dpiY)
Sets the resolution for this RasterImage
.
setResolution
in class RasterImage
dpiX
- The horizontal resolution, in dots per inch, of the RasterImage
.dpiY
- The vertical resolution, in dots per inch, of the RasterImage
.public final void cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer
.
cacheData
in class DataStreamSupporter
public void rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the Active frame only.
rotateFlip
in class Image
rotateFlipType
- The rotate flip type.public void rotateFlipAll(int rotateFlip)
Rotates the flip all frames in image.
rotateFlip
- The rotate flip type.public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)
Rotate image around the center.
rotate
in class RasterImage
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.public void resize(int newWidth, int newHeight, int resizeType)
Resizes the image.
resize
in class RasterImage
newWidth
- The new width.newHeight
- The new height.resizeType
- The resize type.public void resize(int newWidth, int newHeight, ImageResizeSettings settings)
Resizes the image.
resize
in class RasterImage
newWidth
- The new width.newHeight
- The new height.settings
- The resize settings.public void resizeWidthProportionally(int newWidth, int resizeType)
Resizes the width proportionally.
resizeWidthProportionally
in class Image
newWidth
- The new width.resizeType
- Type of the resize.public void resizeHeightProportionally(int newHeight, int resizeType)
Resizes the height proportionally.
resizeHeightProportionally
in class Image
newHeight
- The new height.resizeType
- Type of the resize.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.
newWidth
- The new width.newHeight
- The new height.resizeType
- The resize type.public void crop(Rectangle rectangle)
Cropping the image.
crop
in class RasterImage
rectangle
- The rectangle.public void grayscale()
Transformation of an image to its grayscale representation
grayscale
in class RasterImage
public void binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
binarizeFixed
in class RasterImage
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.ImageException
- Can't make image black and white. Frame index: + ipublic void binarizeOtsu()
Binarization of an image with Otsu thresholding
binarizeOtsu
in class RasterImage
ImageException
- Can't make image black and white. Frame index: + ipublic void binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
binarizeBradley
in class RasterImage
brightnessDifference
- The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.ImageException
- Can't make image black and white. Frame index: + ipublic void crop(int leftShift, int rightShift, int topShift, int bottomShift)
Crop image with shifts.
crop
in class RasterImage
leftShift
- The left shift.rightShift
- The right shift.topShift
- The top shift.bottomShift
- The bottom shift.public void adjustBrightness(int brightness)
Adjust of a brightness for image.
adjustBrightness
in class RasterImage
brightness
- Brightness value.public void adjustContrast(float contrast)
Image contrasting
adjustContrast
in class RasterImage
contrast
- Contrast value (in range [-100; 100])public void adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Gamma-correction of an image.
adjustGamma
in class RasterImage
gammaRed
- Gamma for red channel coefficientgammaGreen
- Gamma for green channel coefficientgammaBlue
- Gamma for blue channel coefficientpublic 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.
replaceColor
in class RasterImage
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.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.
replaceNonTransparentColors
in class RasterImage
newColorArgb
- New color ARGB value to replace non transparent colors with.public void filter(Rectangle rectangle, FilterOptionsBase options)
Filters the specified rectangle.
filter
in class RasterImage
rectangle
- The rectangle.options
- The options.public void adjustGamma(float gamma)
Gamma-correction of an image.
adjustGamma
in class RasterImage
gamma
- Gamma for red, green and blue channels coefficientCopyright (c) 2008-2018 Aspose Pty Ltd. All Rights Reserved.