Package gov.nih.mipav.view.renderer.J3D
Class VolumeTexture
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.VolumeTexture
-
public class VolumeTexture extends java.lang.Object
Defines 3D texture node for a volume of data. There is a large amount of commented out code. We were trying to have the texture image updated dynamically (i.e., without having to remove the texture map from the scene, updating the texture and putting back into the scene. This is slow and causes flicker. However, it turned out there is a bug in Java3D that makes it impossible to update the texture dynamically. Therefore we left in the code until the bug has been fixed.
-
-
Field Summary
Fields Modifier and Type Field Description protected ModelImage
image
Reference to the image as ModelImage instance.private java.awt.image.BufferedImage[]
m_akImage
Image buffer for each image slice.protected int
m_iTextureSizeX
This are the actual dimensions of the texture associated with each dimension of the volume.protected int
m_iTextureSizeY
DOCUMENT ME!protected int
m_iTextureSizeZ
DOCUMENT ME!protected javax.vecmath.Vector4f
m_kCoordMapX
These vectors are used for mapping each coordinate from its real range into the range [0,1] where real coordinate 0 maps to texture coordinate 0, and real coordinate at the maximum sample index along that axis maps to 1.protected javax.vecmath.Vector4f
m_kCoordMapY
DOCUMENT ME!protected javax.vecmath.Vector4f
m_kCoordMapZ
DOCUMENT ME!private javax.media.j3d.ImageComponent3D
m_kImageComponent
Image component 3D reference which contains the 3D texture volume.protected javax.vecmath.Vector4f
m_kTempPlane
These are declared in the class to avoid allocating temporary instances each call into methods of this class.private javax.media.j3d.TexCoordGeneration
m_kTexCoordGeneration
in any direction.private javax.media.j3d.TexCoordGeneration
m_kTexCoordGenerationAxisAligned
Default axis-aligned texture coordinate generation function.private javax.media.j3d.Texture3D
m_kTexture
3D texture of the entire volume.
-
Constructor Summary
Constructors Constructor Description VolumeTexture(ModelImage kVolume)
Create texture(s) and automatic texture coordinate generation parameters for each slicing of the specified volume along each of the three axes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
createTexture()
Create a single 3D texture coordinate generation function.protected int
dimPowerOfTwo(int dim)
Convert the dimensions to Power of 2.void
disposeLocal()
Sets all variables to null, disposes.protected void
finalize()
Call dispose.int[]
getBufferedRaster(int sliceZ)
Access texture data from the BufferedImage with given z slice number.javax.vecmath.Vector4f
getCoordMapX()
Access functions for Mapping from texture coordinates to model coordinates and vice versa: getCoordMapX:javax.vecmath.Vector4f
getCoordMapY()
getCoordMapY:javax.vecmath.Vector4f
getCoordMapZ()
getCoordMapZ:ModelImage
getImage()
Get the current model image.javax.media.j3d.TexCoordGeneration
getTexCoordGeneration()
Access automatic texture coordinate generation parameters associated with volume for a 3D texture.javax.media.j3d.Texture3D
getTexture()
Access 3D texture object.protected void
resampleImage()
Ressample images to Power of 2.void
setImageComponent(int sliceZ)
Sets the image component3D to import changed slice data.void
setTransform(javax.media.j3d.Transform3D kTransform)
Apply the specified transform to the axis aligned texture.
-
-
-
Field Detail
-
image
protected ModelImage image
Reference to the image as ModelImage instance.
-
m_iTextureSizeX
protected int m_iTextureSizeX
This are the actual dimensions of the texture associated with each dimension of the volume.
-
m_iTextureSizeY
protected int m_iTextureSizeY
DOCUMENT ME!
-
m_iTextureSizeZ
protected int m_iTextureSizeZ
DOCUMENT ME!
-
m_kCoordMapX
protected javax.vecmath.Vector4f m_kCoordMapX
These vectors are used for mapping each coordinate from its real range into the range [0,1] where real coordinate 0 maps to texture coordinate 0, and real coordinate at the maximum sample index along that axis maps to 1.
-
m_kCoordMapY
protected javax.vecmath.Vector4f m_kCoordMapY
DOCUMENT ME!
-
m_kCoordMapZ
protected javax.vecmath.Vector4f m_kCoordMapZ
DOCUMENT ME!
-
m_kTempPlane
protected javax.vecmath.Vector4f m_kTempPlane
These are declared in the class to avoid allocating temporary instances each call into methods of this class.
-
m_akImage
private java.awt.image.BufferedImage[] m_akImage
Image buffer for each image slice.
-
m_kImageComponent
private javax.media.j3d.ImageComponent3D m_kImageComponent
Image component 3D reference which contains the 3D texture volume.
-
m_kTexCoordGeneration
private javax.media.j3d.TexCoordGeneration m_kTexCoordGeneration
in any direction. (s,t,r) <--> (X,Y,Z).
-
m_kTexCoordGenerationAxisAligned
private javax.media.j3d.TexCoordGeneration m_kTexCoordGenerationAxisAligned
Default axis-aligned texture coordinate generation function.
-
m_kTexture
private javax.media.j3d.Texture3D m_kTexture
3D texture of the entire volume.
-
-
Constructor Detail
-
VolumeTexture
public VolumeTexture(ModelImage kVolume)
Create texture(s) and automatic texture coordinate generation parameters for each slicing of the specified volume along each of the three axes.- Parameters:
kVolume
- volume for which to create the associated texture information
-
-
Method Detail
-
disposeLocal
public void disposeLocal()
Sets all variables to null, disposes.
-
getBufferedRaster
public int[] getBufferedRaster(int sliceZ)
Access texture data from the BufferedImage with given z slice number.- Parameters:
sliceZ
- indicates the image slice that is to be set.- Returns:
- reference to integer array instance of texture data.
-
getCoordMapX
public javax.vecmath.Vector4f getCoordMapX()
Access functions for Mapping from texture coordinates to model coordinates and vice versa: getCoordMapX:- Returns:
- DOCUMENT ME!
-
getCoordMapY
public javax.vecmath.Vector4f getCoordMapY()
getCoordMapY:- Returns:
- DOCUMENT ME!
-
getCoordMapZ
public javax.vecmath.Vector4f getCoordMapZ()
getCoordMapZ:- Returns:
- DOCUMENT ME!
-
getImage
public ModelImage getImage()
Get the current model image.- Returns:
- image Current model image.
-
getTexCoordGeneration
public javax.media.j3d.TexCoordGeneration getTexCoordGeneration()
Access automatic texture coordinate generation parameters associated with volume for a 3D texture.- Returns:
- requested automatic texture coordinate generation parameters
-
getTexture
public javax.media.j3d.Texture3D getTexture()
Access 3D texture object.- Returns:
- Texture3D instance of the 3D texture of the image
-
setImageComponent
public void setImageComponent(int sliceZ)
Sets the image component3D to import changed slice data.- Parameters:
sliceZ
- indicates the image slice that is to be set.
-
setTransform
public void setTransform(javax.media.j3d.Transform3D kTransform)
Apply the specified transform to the axis aligned texture.- Parameters:
kTransform
- Transform3D
-
dimPowerOfTwo
protected int dimPowerOfTwo(int dim)
Convert the dimensions to Power of 2.- Parameters:
dim
- Dimension value.- Returns:
- dim Converted dimention value.
-
finalize
protected void finalize() throws java.lang.Throwable
Call dispose.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
- DOCUMENT ME!
-
resampleImage
protected void resampleImage()
Ressample images to Power of 2.
-
createTexture
private void createTexture()
Create a single 3D texture coordinate generation function.
-
-