Package mgui.interfaces.shapes.volume
Class Volume3DTexture
java.lang.Object
mgui.interfaces.shapes.volume.Volume3DTexture
- All Implemented Interfaces:
org.jogamp.java3d.ImageComponent3D.Updater
public class Volume3DTexture
extends java.lang.Object
implements org.jogamp.java3d.ImageComponent3D.Updater
Class to create and return Texture3D and TexCoordGeneration objects from a given
set of grid data.
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVolume3DTexture.UpdateTextureType -
Field Summary
Fields Modifier and Type Field Description protected booleanbyRefprotected intcolorSpaceprotected ColourMapcolourMapprotected java.awt.image.BufferedImage[]imagesprotected intrDimprotected intsDimprotected inttDimprotected org.jogamp.java3d.Texture3Dtexturestatic intTYPE_INTENSITY_CMAPstatic intTYPE_INTENSITY_CMAP_ALPHAstatic intTYPE_INTENSITY_GREYstatic intTYPE_INTENSITY_GREY_ALPHAstatic intTYPE_RGBstatic intTYPE_RGB_ALPHA -
Constructor Summary
Constructors Constructor Description Volume3DTexture(int s, int t, int r)Volume3DTexture(Volume3DInt volume)Volume3DTexture(Volume3DInt volume, ColourMap cmap) -
Method Summary
Modifier and Type Method Description java.awt.image.BufferedImage[]getByRefImages()protected java.awt.color.ColorSpacegetColourSpace()protected intgetFormat()voidloadImage(int r0, int r1, java.net.URL image)voidloadImage(int r0, int r1, java.net.URL image, boolean setAlpha, double cutoff, double exp)Loads an image file at the given url into the texture for planes r0 through r1.protected voidresetImageComponent()protected voidresetTexture()voidsetCurrentColumn(GridVertexDataColumn column)Sets the current data column for this texture.voidsetCurrentComposite(Volume3DInt volume)voidsetCurrentMask(boolean[][][] mask)Sets the current mask for this texture; usenullfor no mask.voidsetCurrentUpdateType(Volume3DTexture.UpdateTextureType type)Specifies what type of update will be performed by updateData(org.jogamp.java3d.ImageComponent3D,int,int,int,int,int).booleansetFromVolume(Volume3DInt volume)Set this volume from the specified grid.booleansetFromVolume(Volume3DInt volume, boolean update)Set this volume from the specified grid.protected voidsetTexture()Produces a stack of R-planar images fromvolume, based upon the current data column and its associated colour map.voidupdateData(org.jogamp.java3d.ImageComponent3D imageComponent, int r_index, int x, int y, int s_size, int t_size)booleanupdateFromVolume(Volume3DInt volume)Set this volume from the specified grid.booleanupdateFromVolume(Volume3DInt volume, boolean update)Updates this volume from the specified grid.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
TYPE_INTENSITY_GREY
public static final int TYPE_INTENSITY_GREY- See Also:
- Constant Field Values
-
TYPE_INTENSITY_GREY_ALPHA
public static final int TYPE_INTENSITY_GREY_ALPHA- See Also:
- Constant Field Values
-
TYPE_INTENSITY_CMAP
public static final int TYPE_INTENSITY_CMAP- See Also:
- Constant Field Values
-
TYPE_INTENSITY_CMAP_ALPHA
public static final int TYPE_INTENSITY_CMAP_ALPHA- See Also:
- Constant Field Values
-
TYPE_RGB
public static final int TYPE_RGB- See Also:
- Constant Field Values
-
TYPE_RGB_ALPHA
public static final int TYPE_RGB_ALPHA- See Also:
- Constant Field Values
-
texture
protected org.jogamp.java3d.Texture3D texture -
sDim
protected int sDim -
tDim
protected int tDim -
rDim
protected int rDim -
colorSpace
protected int colorSpace -
colourMap
-
byRef
protected boolean byRef -
images
protected java.awt.image.BufferedImage[] images
-
-
Constructor Details
-
Volume3DTexture
-
Volume3DTexture
-
Volume3DTexture
public Volume3DTexture(int s, int t, int r)
-
-
Method Details
-
getByRefImages
public java.awt.image.BufferedImage[] getByRefImages() -
setFromVolume
Set this volume from the specified grid.- Parameters:
grid-
-
setFromVolume
Set this volume from the specified grid.- Parameters:
grid-update- - Indicates that this is a by-reference update call
-
updateFromVolume
Set this volume from the specified grid.- Parameters:
grid-
-
updateFromVolume
Updates this volume from the specified grid.- Parameters:
grid-update- - Indicates that this is a by-reference update call
-
setTexture
protected void setTexture()Produces a stack of R-planar images fromvolume, based upon the current data column and its associated colour map.- Parameters:
volume-
-
resetTexture
protected void resetTexture() -
getFormat
protected int getFormat() -
resetImageComponent
protected void resetImageComponent() -
getColourSpace
protected java.awt.color.ColorSpace getColourSpace() -
loadImage
public void loadImage(int r0, int r1, java.net.URL image) -
loadImage
public void loadImage(int r0, int r1, java.net.URL image, boolean setAlpha, double cutoff, double exp)Loads an image file at the given url into the texture for planes r0 through r1. If image does not match the dimensions s and t, it will be scaled to fit. If, for example: image.width < sDim, pixels will be inserted to fill the difference. If image.width > sDim, pixels will be removed to fit the image to this texture's dimensions.- Parameters:
r0- Start r-plane into which to load the imager1- End r-plane into which to load the imageimage- URL of the image file to loadhasAlpha- Determines whether to add/set an alpha channel to an RGB image.cutoff- The value at which to cut alpha to zero, from 0 to 1 where 0 is completely transparent, and 1 is completely opaque.exp- Determines the degree of the equation with which alpha proceeds from the cutoff to zero. i.e., determines smoothness of cutoff. A zero or negative value of exp specifies no smoothing.
-
setCurrentMask
public void setCurrentMask(boolean[][][] mask)Sets the current mask for this texture; usenullfor no mask.- Parameters:
mask-
-
setCurrentColumn
Sets the current data column for this texture.- Parameters:
mask-
-
setCurrentUpdateType
Specifies what type of update will be performed by updateData(org.jogamp.java3d.ImageComponent3D,int,int,int,int,int).- Parameters:
type-
-
setCurrentComposite
-
updateData
public void updateData(org.jogamp.java3d.ImageComponent3D imageComponent, int r_index, int x, int y, int s_size, int t_size)- Specified by:
updateDatain interfaceorg.jogamp.java3d.ImageComponent3D.Updater
-