Package be.uclouvain.orthanc
Class Image
- java.lang.Object
-
- be.uclouvain.orthanc.Image
-
public class Image extends java.lang.Object
2D image managed by the Orthanc core
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Image(long self)
Construct a Java object wrapping a C object that is managed by Orthanc.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Image
convertPixelFormat(PixelFormat targetFormat)
Change the pixel format of an image.static Image
createImage(PixelFormat format, int width, int height)
Create an image.static Image
decodeDicomImage(byte[] buffer, int frameIndex)
Decode one frame from a DICOM instance.void
dispose()
Manually deallocate the C object that is associated with this Java wrapper.void
drawText(int fontIndex, java.lang.String utf8Text, int x, int y, byte r, byte g, byte b)
Draw text on an image.protected void
finalize()
int
getImageHeight()
Return the height of an image.int
getImagePitch()
Return the pitch of an image.PixelFormat
getImagePixelFormat()
Return the pixel format of an image.int
getImageWidth()
Return the width of an image.protected long
getSelf()
Return the C object that is associated with this Java wrapper.static Image
uncompressImage(byte[] data, ImageFormat format)
Decode a compressed image.
-
-
-
Method Detail
-
getSelf
protected long getSelf()
Return the C object that is associated with this Java wrapper.- Returns:
- Pointer to the C object.
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
dispose
public void dispose()
Manually deallocate the C object that is associated with this Java wrapper. This method can be used to immediately deallocate the C object, instead of waiting for the garbage collector to dispose the Java wrapper.
-
uncompressImage
public static Image uncompressImage(byte[] data, ImageFormat format)
Decode a compressed image. This function decodes a compressed image from a memory buffer.- Parameters:
data
- Pointer to a memory buffer containing the compressed image.format
- The file format of the compressed image.- Returns:
- The newly constructed object.
-
createImage
public static Image createImage(PixelFormat format, int width, int height)
Create an image. This function creates an image of given size and format.- Parameters:
format
- The format of the pixels.width
- The width of the image.height
- The height of the image.- Returns:
- The newly constructed object.
-
decodeDicomImage
public static Image decodeDicomImage(byte[] buffer, int frameIndex)
Decode one frame from a DICOM instance. This function decodes one frame of a DICOM image that is stored in a memory buffer. This function will give the same result as OrthancPluginUncompressImage() for single-frame DICOM images.- Parameters:
buffer
- Pointer to a memory buffer containing the DICOM image.frameIndex
- The index of the frame of interest in a multi-frame image.- Returns:
- The newly constructed object.
-
getImagePixelFormat
public PixelFormat getImagePixelFormat()
Return the pixel format of an image. This function returns the type of memory layout for the pixels of the given image.- Returns:
- The pixel format.
-
getImageWidth
public int getImageWidth()
Return the width of an image. This function returns the width of the given image.- Returns:
- The width.
-
getImageHeight
public int getImageHeight()
Return the height of an image. This function returns the height of the given image.- Returns:
- The height.
-
getImagePitch
public int getImagePitch()
Return the pitch of an image. This function returns the pitch of the given image. The pitch is defined as the number of bytes between 2 successive lines of the image in the memory buffer.- Returns:
- The pitch.
-
convertPixelFormat
public Image convertPixelFormat(PixelFormat targetFormat)
Change the pixel format of an image. This function creates a new image, changing the memory layout of the pixels.- Parameters:
targetFormat
- The target pixel format.- Returns:
- The newly constructed object.
-
drawText
public void drawText(int fontIndex, java.lang.String utf8Text, int x, int y, byte r, byte g, byte b)
Draw text on an image. This function draws some text on some image.- Parameters:
fontIndex
- The index of the font. This value must be less than OrthancPluginGetFontsCount().utf8Text
- The text to be drawn, encoded as an UTF-8 zero-terminated string.x
- The X position of the text over the image.y
- The Y position of the text over the image.r
- The value of the red color channel of the text.g
- The value of the green color channel of the text.b
- The value of the blue color channel of the text.
-
-