Package mgui.interfaces.shapes
Class Volume3DInt
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.InterfaceShape
mgui.interfaces.shapes.Shape3DInt
mgui.interfaces.shapes.Volume3DInt
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
,java.lang.Comparable<InterfaceShape>
,AttributeListener
,AttributeObject
,InterfaceObject
,PersistentObject
,ColourMapListener
,VariableObject
,PopupMenuObject
,NamedObject
,InterfaceQueryObject
,InterfaceShapeQueryObject
,ShapeListener
,VertexDataColumnListener
,InterfaceTransferable
,TreeObject
,CleanableObject
,XMLObject
,IconObject
,org.jogamp.java3d.GeometryUpdater
,org.jogamp.java3d.ImageComponent3D.Updater
- Direct Known Subclasses:
TensorVolume3DInt
,Volume4DInt
,VolumeSet3DInt
public class Volume3DInt extends Shape3DInt implements ColourMapListener, org.jogamp.java3d.ImageComponent3D.Updater, ShapeListener
Class acting as interface to a volume shape, as defined by the Grid3D geometry
class. Volume3D provides a Texture3D node and also defines the appearance of the
voxel set in terms of colour or intensity mapping.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from class mgui.interfaces.shapes.Shape3DInt
Shape3DInt.VertexShapeTransformer
Nested classes/interfaces inherited from class mgui.interfaces.shapes.InterfaceShape
InterfaceShape.VertexDataSet
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,java.lang.Boolean>
apply_mask
protected org.jogamp.java3d.BranchGroup
box_node
protected java.util.HashMap<java.lang.String,WindowedColourModel>
colour_models
protected java.util.HashMap<java.lang.String,java.lang.Double>
composite_alphas
protected java.util.ArrayList<java.lang.String>
composite_column_order
protected java.io.File
dataFile
protected org.jogamp.java3d.BranchGroup
group_node
protected ShapeSceneNode
intRect3D
protected VolumeFileLoader
loader
protected java.util.HashMap<java.lang.String,boolean[][][]>
masks
protected org.jogamp.java3d.BranchGroup
render_node
protected Volume3DRenderer
renderer
protected java.util.HashMap<java.lang.String,java.lang.Boolean>
show_in_composite
protected boolean
textureSet
protected org.jogamp.java3d.ImageComponent3D.Updater
updater
protected java.util.HashMap<java.lang.String,java.lang.Double>
xml_composite_alphas
protected java.util.ArrayList<java.lang.String>
xml_composite_column_order
protected boolean
xml_is_reading_composite_order
protected boolean
xml_is_reading_header
Sets the variable's values with thevalues
object, which must be one of the following types:ArrayList<BufferedImage[]>
DataBufferDouble
If not, a value offalse
is returned.protected java.util.HashMap<java.lang.String,java.lang.Boolean>
xml_show_in_composite
Fields inherited from class mgui.interfaces.shapes.Shape3DInt
boundBox, boundBoxNode, bounds_group, bounds_shape, boundSphere, centerPt, children2D, creatable_scene_node, drawEngine2D, has_3d_node, hasCameraListener, idStr, nodeListener, parent2D, scene3DObject, sceneNode, selected_vertices_group, shape_group, shape3d, vertex_shape_transformer, vertices_group
Fields inherited from class mgui.interfaces.shapes.InterfaceShape
attributes, constraints, data_columns, icon, ID, is_auxiliary, is_registered, isDrawable, isImageShape, isLight, isOverridden, last_column_added, last_column_changed, last_column_removed, linked_colour_maps, loader_options, notifyListeners, overrideAttr, parent_set, selected_nodes, shapeListeners, vertex_data, writer_options, xml_current_column, xml_current_loader, xml_current_shape, xml_current_shape_options, xml_current_type, xml_current_url, xml_is_vertex_data, xml_root_dir
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description Volume3DInt()
Volume3DInt(Grid3D g)
Volume3DInt(Grid3D g, ColourMap cmap)
-
Method Summary
Modifier and Type Method Description void
addMask(java.lang.String name, boolean[][][] mask)
Adds a boolean mask to this volume.void
addMask(java.lang.String name, boolean[][][] mask, boolean apply)
Adds a boolean mask to this volume.boolean
addVertexData(java.lang.String column, int data_type)
Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
.boolean
addVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data, NameMap nmap, ColourMap cmap)
Adds vertex-wise data to this shape.boolean
addVertexData(VertexDataColumn column)
Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.void
applyMask()
Applies the mask specified in params to the data in this volume.void
attributeUpdated(AttributeEvent e)
Responds to an update in one of this shape's attributes.void
clearMask(java.lang.String name)
void
colourMapChanged(ColourMap map)
void
deregisterCameraListener(Camera3D c)
boolean
getApplyMasks()
Whether currently set masks are to be applied or not.Box3D
getBox()
Camera3DListener
getCameraListener()
org.jogamp.vecmath.Point3f
getCenterOfVoxel(int i, int j, int k)
int
getClosestVertex(org.jogamp.vecmath.Point3f point)
Returns the index of the vertex of this shape which is closest topoint
.WindowedColourModel
getColourModel()
Returns the colour model for the current column, ornull
if there is no current column.WindowedColourModel
getColourModel(java.lang.String column)
double
getCompositeAlpha(java.lang.String column)
java.util.ArrayList<java.lang.String>
getCompositeOrderedColumns()
int
getDataType()
Returns the data type of the current column.int
getDataType(java.lang.String column)
Returns the data type ofcolumn
.MguiNumber
getDatumAtPoint(java.lang.String column, org.jogamp.vecmath.Point3f point)
Returns the datum from thecolumn
for the voxel enclosingpoint
.MguiNumber
getDatumAtPoint(org.jogamp.vecmath.Point3f point)
Returns the datum from the current column for the voxel enclosingpoint
.MguiNumber
getDatumAtVoxel(int[] voxel)
Returns the datum from the current column atindex
.MguiNumber
getDatumAtVoxel(int i, int j, int k)
Returns the datum from the current column atindex
.MguiNumber
getDatumAtVoxel(java.lang.String column, int[] voxel)
Returns the datum fromcolumn
atindex
.MguiNumber
getDatumAtVoxel(java.lang.String column, int i, int j, int k)
Returns the datum fromcolumn
atindex
.boolean[][][]
getEffectiveMask()
Returns the union of all masks which are currently set.Shape
getGeometryInstance()
Returns an instance of thisInterfaceShape
's geometry class.Grid3D
getGrid()
Returns the Grid3D associated with this volume.double
getInterpolatedValueAtPoint(java.lang.String column, org.jogamp.vecmath.Point3f p)
Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours.double
getInterpolatedValueAtPoint(java.lang.String column, org.jogamp.vecmath.Point3f p, int t)
Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours.double
getInterpolatedValueAtPoint(org.jogamp.vecmath.Point3f p)
Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours.double
getInterpolatedValueAtPoint(org.jogamp.vecmath.Point3f p, int t)
Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours.float
getMapMax()
float
getMapMin()
boolean[][][]
getMask(java.lang.String name)
java.util.ArrayList<java.lang.String>
getMaskNames()
Returns an ordered list of mask names for this volume.java.util.HashMap<java.lang.String,boolean[][][]>
getMasks()
java.lang.String
getRenderMode()
Returns the current render mode of this volumeprotected Shape2DInt
getShape2D(Plane3D plane, float above_dist, float below_dist, org.jogamp.vecmath.Matrix4d transform)
To be overridden by subclasses implementing a 2D representationVolume3DTexture
getTexture()
int
getVertexIndex(int[] voxel)
Obtains an absolute (vertex) index for the specified voxel indicesint
getVertexIndex(int i, int j, int k)
Obtains an absolute (vertex) index for the specified voxel indicesvoid
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.boolean
hasAlpha()
Queries whether this shape has transparency.void
hasAlpha(boolean b)
Specifies whether this shape has transparency.void
hasAlpha(java.lang.String column, boolean b)
protected void
init()
void
invertMask(java.lang.String name)
boolean
isByRef()
boolean
isComposite()
Determines whether this volume is current set to render as a composite of its columnstrue
, or as the current column onlyfalse
.void
isComposite(boolean show)
Set the flag which determines whether this volume should render as a composite of its columnsshow == true
, or as the current column onlyshow == false
.void
isComposite(boolean show, boolean update)
Set the flag which determines whether this volume should render as a composite of its columnsshow == true
, or as the current column onlyshow == false
.boolean
isMaskApplied(java.lang.String name)
boolean
isMaskedAtPoint(org.jogamp.vecmath.Point3f point)
Determines whether the voxel enclosingpoint
is masked.boolean
isMaskedAtVoxel(int[] voxel)
Determines whethervoxel
is masked by any active maskboolean
isMaskedAtVoxel(int i, int j, int k)
Determines whethervoxel
is masked by any active maskvoid
registerCameraListener(Camera3D camera)
void
removeMask(java.lang.String name)
void
removeVertexData(java.lang.String column)
Remove a vertex data column from this shape.boolean
renameVertexDataColumn(java.lang.String old_name, java.lang.String new_name)
Renames the current column.boolean
sampleFromVolume(Volume3DInt sample_volume)
Samplessample_volume
where its geometric bounds cross the bounds of this volume.boolean
sampleFromVolume(Volume3DInt sample_volume, double nan_value)
Samplessample_volume
where its geometric bounds cross the bounds of this volume.boolean
sampleFromVolume(Volume3DInt sample_volume, java.lang.String source_column, java.lang.String target_column)
Samplessample_volume
where its geometric bounds cross the bounds of this volume.boolean
sampleFromVolume(Volume3DInt sample_volume, java.lang.String source_column, java.lang.String target_column, double nan_value)
Samplessample_volume
where its geometric bounds cross the bounds of this volume.void
setAllMasks(boolean show)
void
setApplyMasks(boolean b)
Sets whether currently set masks are to be applied or not.void
setBounds(Box3D box)
void
setCompositeAlpha(java.lang.String column, double value)
Sets the alpha value forcolumn
, which determines its transparency if composite mode is set.void
setCompositeAlpha(java.lang.String column, double value, boolean update)
Sets the alpha value forcolumn
, which determines its transparency if composite mode is set.void
setCompositeIndex(java.lang.String column, int index)
Adjusts the order of columncolumn
in the composite rendering stack.void
setCompositeIndex(java.lang.String column, int index, boolean notify)
Adjusts the order of columncolumn
in the composite rendering stack.boolean
setDatumAtVoxel(int[] voxel, double datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVoxel(int[] voxel, MguiNumber datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVoxel(int i, int j, int k, double datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVoxel(int i, int j, int k, MguiNumber datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVoxel(java.lang.String column, int[] voxel, double datum)
Sets the datum fromcolumn
atindex
.boolean
setDatumAtVoxel(java.lang.String column, int[] voxel, MguiNumber datum)
Sets the datum fromcolumn
atindex
.boolean
setDatumAtVoxel(java.lang.String column, int i, int j, int k, double datum)
Sets the datum fromcolumn
atindex
.boolean
setDatumAtVoxel(java.lang.String column, int i, int j, int k, MguiNumber datum)
Sets the datum fromcolumn
atindex
.void
setGrid(Grid3D grid)
void
setGrid(Grid3D grid, boolean fire)
protected void
setIcon()
void
setMapMax(float m)
void
setMapMin(float m)
void
setMask(java.lang.String name, boolean show)
void
setMask(java.lang.String name, boolean[][][] mask)
void
setMaskApplied(java.lang.String name, boolean b)
void
setParentSet(ShapeSet set)
OverridesInterfaceShape.setParentSet
to add itself as a listener to the parentvoid
setRenderMode(java.lang.String mode)
Sets the current render mode of this volumevoid
setScene3DObject(boolean make_live)
Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes.void
setTexture()
Resets the texture for this volume's renderer.void
setTexture(boolean setModel)
Resets the texture for this volume's renderer.void
setUpdater(Volume3DUpdater u)
Sets an updater class, descended from Volume3DUpdater, with which to update the data in this volume's grid.void
shapeUpdated(ShapeEvent e)
A shape that this object is listening to has been updated.boolean
showInComposite(java.lang.String column)
Returns whethercolumn
's data is to be included in the composite image.void
showInComposite(java.lang.String column, boolean show)
Sets whether to includecolumn
's data in the composite imagevoid
showInComposite(java.lang.String column, boolean show, boolean update)
Sets whether to includecolumn
's data in the composite image.java.lang.String
toString()
boolean
unionMask(java.lang.String name, boolean[][][] to_merge)
boolean
unionMaskWithVolume(java.lang.String name, Volume3DInt volume)
Sets maskname
to a new mask which is a union between its current state and the mask specified byvolume
, where all zero-valued voxels are masked.boolean
unionMaskWithVolume(java.lang.String name, Volume3DInt volume, java.lang.String column)
Sets maskname
to a new mask which is a union between its current state and the mask specified byvolume
, where all zero-valued voxels are masked.void
update(Volume3DTexture.UpdateTextureType type)
Updates this volume's grid data with the current Volume3DUpdater object.void
updateData(org.jogamp.java3d.ImageComponent3D imageComponent, int index, int x, int y, int width, int height)
Updates the underlying images for by-reference texturesprotected void
updateDataColumns()
protected void
updateSceneNode()
void
updateShape()
Updates the geometric bounds of this ShapeInt.void
updateTexture()
Texture has changed, so the texture must be updated.void
updateTextureColourMap()
Texture values have changed, so the texture must be updated.void
updateTextureValues()
Texture values have changed, so the texture must be updated.void
vertexDataColumnChanged(VertexDataColumnEvent event)
void
vertexDataColumnColourMapChanged(VertexDataColumnEvent event)
protected void
writeFullXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.shapes.Shape3DInt
addShape2DChild, clear2DChildren, contains, copyAttributes, crossesPlane, destroy, draw2D, drawShape2D, drawShape2D, drawShape2D, fireChildren2D, fireChildren2DModified, fireShapeListeners, fireShapeModified, geometryChanged, getAlpha, getBoundBox, getBoundBoxNode, getBoundSphere, getCenterOfGravity, getDimensions, getDTD, getFullName, getGeometricCenter, getGeometry, getIcon, getInheritingAttribute, getLabelColour, getLabelFont, getLabelScale, getLineColour, getLineStyle, getLocalName, getModifiedAttribute, getParent2D, getParentAttribute, getPopupMenu, getPopupMenuLength, getProximity, getScene3DObject, getScene3DObject, getShape, getShape2D, getShape2DInt, getShape2DInt, getShapeSceneNode, getShapeSceneNode, getShortXML, getTransferData, getTransferDataFlavors, getTreeLabel, getVertex, getVertexAppearance, getVertexColour, getVertexColour, getVertexCount, getVertexScale, getVertexScale, getVertexSelection, getVertices, handlePopupEvent, hasCameraListener, hasParentShape, isDataFlavorSupported, isHeritableAttribute, isInheritingAttribute, isLive, issueTreeNode, needsRedraw, performTransfer, releaseScene3DChildren, removeShape2DChild, setAlpha, setBoundBoxNode, setCreatableSceneNode, setCurrentColumn, setGeometry, setGraphic3DPopupMenu, setLabelColour, setLabelFont, setLabelScale, setLineStyle, setLive, setParent2D, setScene3DObject, setSelectedVertices, setShape, setShapeSceneNode, setShowSelectedVertices, setVertexSelection, showPopupMenu, showVertices, showVertices, updateChildren2D, updateData, updateSelectedVertices, updateVertices
Methods inherited from class mgui.interfaces.shapes.InterfaceShape
_init, addDataLink, addShapeListener, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, cleanTreeNodes, compareTo, finalizeAfterXML, fromVariable, getAllVertexData, getAttribute, getAttributes, getAttributeValue, getByReferenceUrls, getColourMap, getColourMap, getConstraint, getConstraints, getCurrentColumn, getCurrentDataColumn, getCurrentVertexData, getDataLink, getDataMax, getDataMin, getDatumAtVertex, getDatumAtVertex, getDefaultColourMap, getFileLoader, getFileWriter, getID, getInheritedAttribute, getInheritedAttributes, getInheritedAttributeValue, getLastColumnAdded, getLastColumnChanged, getLastColumnRemoved, getLegalName, getLinkedVertexData, getLinkedVertexDatum, getLoaderOptions, getModel, getName, getNameMap, getNameMap, getNonLinkedDataColumns, getObjectIcon, getParentSet, getPopupMenu, getSourceURL, getUnit, getUrlReference, getVariables, getVariableType, getVariableValue, getVariableValues, getVertexData, getVertexData, getVertexDataColumn, getVertexDataColumnCount, getVertexDataColumnNames, getVertexDataColumns, getVertexDataMap, getWriterOptions, getXML, getXML, getXML, getXMLSchema, handleXMLString, hasAttribute, hasColumn, hasData, inheritAttributesFromParent, isAuxiliaryShape, isAuxiliaryShape, isDestroyed, isDrawable, isImageShape, isLegalName, isLight, isSelectable, isVisible, newVertexData, queryObject, queryShapeAtVertex, register, removeColourMap, removeDataLink, removeNameMap, removeShapeListener, setAttribute, setAttributes, setColourMap, setColourMap, setConstraint, setCurrentColumn, setDataMax, setDataMax, setDataMax, setDataMin, setDataMin, setDataMin, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDefaultColourMap, setDefaultColourMap, setFileLoader, setFileLoader, setFileWriter, setID, setLoaderOptions, setName, setNameMap, setOverride, setSelectable, setTreeNode, setUnit, setUrlReference, setVariableValues, setVariableValues, setVertexData, setVertexData, setVertexData, setVertexDataMap, setVisible, setWriterOptions, setXMLRoot, show2D, show2D, show3D, show3D, showData, showData, supportsVariableType, toVariable, unsetOverride, writeXML, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface mgui.interfaces.util.CleanableObject
clean
Methods inherited from interface mgui.interfaces.shapes.util.ShapeListener
destroy, isDestroyed
-
Field Details
-
renderer
-
textureSet
protected boolean textureSet -
updater
protected org.jogamp.java3d.ImageComponent3D.Updater updater -
dataFile
protected java.io.File dataFile -
loader
-
intRect3D
-
colour_models
-
masks
protected java.util.HashMap<java.lang.String,boolean[][][]> masks -
apply_mask
protected java.util.HashMap<java.lang.String,java.lang.Boolean> apply_mask -
composite_alphas
protected java.util.HashMap<java.lang.String,java.lang.Double> composite_alphas -
show_in_composite
protected java.util.HashMap<java.lang.String,java.lang.Boolean> show_in_composite -
composite_column_order
protected java.util.ArrayList<java.lang.String> composite_column_order -
group_node
protected org.jogamp.java3d.BranchGroup group_node -
render_node
protected org.jogamp.java3d.BranchGroup render_node -
box_node
protected org.jogamp.java3d.BranchGroup box_node -
xml_is_reading_header
protected boolean xml_is_reading_headerSets the variable's values with thevalues
object, which must be one of the following types:ArrayList<BufferedImage[]>
DataBufferDouble
false
is returned. -
xml_is_reading_composite_order
protected boolean xml_is_reading_composite_order -
xml_composite_column_order
protected java.util.ArrayList<java.lang.String> xml_composite_column_order -
xml_composite_alphas
protected java.util.HashMap<java.lang.String,java.lang.Double> xml_composite_alphas -
xml_show_in_composite
protected java.util.HashMap<java.lang.String,java.lang.Boolean> xml_show_in_composite
-
-
Constructor Details
-
Volume3DInt
public Volume3DInt() -
Volume3DInt
-
Volume3DInt
-
-
Method Details
-
updateDataColumns
protected void updateDataColumns()- Overrides:
updateDataColumns
in classInterfaceShape
-
renameVertexDataColumn
public boolean renameVertexDataColumn(java.lang.String old_name, java.lang.String new_name)Description copied from class:InterfaceShape
Renames the current column.- Overrides:
renameVertexDataColumn
in classInterfaceShape
- Returns:
false
if a column namednew_name
already exists, or no column namedold_name
exists;true
otherwise
-
setCompositeIndex
public void setCompositeIndex(java.lang.String column, int index)Adjusts the order of columncolumn
in the composite rendering stack.- Parameters:
column
-index
-
-
setCompositeIndex
public void setCompositeIndex(java.lang.String column, int index, boolean notify)Adjusts the order of columncolumn
in the composite rendering stack.- Parameters:
column
-index
-
-
getCompositeOrderedColumns
public java.util.ArrayList<java.lang.String> getCompositeOrderedColumns() -
getGeometryInstance
Description copied from class:InterfaceShape
Returns an instance of thisInterfaceShape
's geometry class.- Overrides:
getGeometryInstance
in classShape3DInt
- Returns:
-
setParentSet
OverridesInterfaceShape.setParentSet
to add itself as a listener to the parent- Overrides:
setParentSet
in classInterfaceShape
-
getClosestVertex
public int getClosestVertex(org.jogamp.vecmath.Point3f point)Description copied from class:Shape3DInt
Returns the index of the vertex of this shape which is closest topoint
.- Overrides:
getClosestVertex
in classShape3DInt
- Returns:
-
shapeUpdated
Description copied from interface:ShapeListener
A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdated
in interfaceShapeListener
-
setIcon
protected void setIcon()- Overrides:
setIcon
in classShape3DInt
-
init
protected void init()- Overrides:
init
in classShape3DInt
-
getMasks
public java.util.HashMap<java.lang.String,boolean[][][]> getMasks() -
addVertexData
public boolean addVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data, NameMap nmap, ColourMap cmap)Description copied from class:InterfaceShape
Adds vertex-wise data to this shape.- Overrides:
addVertexData
in classInterfaceShape
- Parameters:
column
- The key by which this column is to be referreddata
- The values for this columnnmap
- Name map [optionally null] associating integer keys to namescmap
- Colour map [optionally null] associating values to colours- Returns:
-
addVertexData
Description copied from class:InterfaceShape
Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.- Overrides:
addVertexData
in classInterfaceShape
-
addVertexData
public boolean addVertexData(java.lang.String column, int data_type)Description copied from class:InterfaceShape
Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
. If an incorrect type is specified, this method creates a column of typeDataBuffer.TYPE_DOUBLE
.- Overrides:
addVertexData
in classInterfaceShape
- Parameters:
column
- The key associated with the data columndata_type
- The data type with which to store the data
-
removeVertexData
public void removeVertexData(java.lang.String column)Description copied from class:InterfaceShape
Remove a vertex data column from this shape. This also removes all associated data, and calls listeners to update, for instance, tree nodes.- Overrides:
removeVertexData
in classInterfaceShape
-
isComposite
public void isComposite(boolean show)Set the flag which determines whether this volume should render as a composite of its columnsshow == true
, or as the current column onlyshow == false
.- Parameters:
show
-
-
isComposite
public void isComposite(boolean show, boolean update)Set the flag which determines whether this volume should render as a composite of its columnsshow == true
, or as the current column onlyshow == false
.- Parameters:
show
-update
- Whether to notify attribute listeners
-
isComposite
public boolean isComposite()Determines whether this volume is current set to render as a composite of its columnstrue
, or as the current column onlyfalse
. -
setCompositeAlpha
public void setCompositeAlpha(java.lang.String column, double value)Sets the alpha value forcolumn
, which determines its transparency if composite mode is set. Also fires aShapeEvent
.- Parameters:
key
-value
-
-
setCompositeAlpha
public void setCompositeAlpha(java.lang.String column, double value, boolean update)Sets the alpha value forcolumn
, which determines its transparency if composite mode is set.- Parameters:
key
-value
-update
- Whether to notify listeners of the change
-
getCompositeAlpha
public double getCompositeAlpha(java.lang.String column) -
showInComposite
public void showInComposite(java.lang.String column, boolean show)Sets whether to includecolumn
's data in the composite image- Parameters:
column
-show
-
-
showInComposite
public void showInComposite(java.lang.String column, boolean show, boolean update)Sets whether to includecolumn
's data in the composite image.- Parameters:
column
-show
-update
- Whether to notify this volume's listeners
-
showInComposite
public boolean showInComposite(java.lang.String column)Returns whethercolumn
's data is to be included in the composite image.- Parameters:
column
-- Returns:
-
addMask
public void addMask(java.lang.String name, boolean[][][] mask)Adds a boolean mask to this volume. Set = true by default.- Parameters:
name
-mask
-
-
addMask
public void addMask(java.lang.String name, boolean[][][] mask, boolean apply)Adds a boolean mask to this volume.- Parameters:
name
-mask
-set
-
-
clearMask
public void clearMask(java.lang.String name) -
invertMask
public void invertMask(java.lang.String name) -
isMaskedAtPoint
public boolean isMaskedAtPoint(org.jogamp.vecmath.Point3f point)Determines whether the voxel enclosingpoint
is masked.- Parameters:
p
-- Returns:
-
isMaskedAtVoxel
public boolean isMaskedAtVoxel(int[] voxel)Determines whethervoxel
is masked by any active mask- Parameters:
voxel
-- Returns:
-
isMaskedAtVoxel
public boolean isMaskedAtVoxel(int i, int j, int k)Determines whethervoxel
is masked by any active mask- Parameters:
voxel
-- Returns:
-
getCenterOfVoxel
public org.jogamp.vecmath.Point3f getCenterOfVoxel(int i, int j, int k) -
isMaskApplied
public boolean isMaskApplied(java.lang.String name) -
getMaskNames
public java.util.ArrayList<java.lang.String> getMaskNames()Returns an ordered list of mask names for this volume.- Returns:
-
getEffectiveMask
public boolean[][][] getEffectiveMask()Returns the union of all masks which are currently set.- Returns:
-
setMaskApplied
public void setMaskApplied(java.lang.String name, boolean b) -
removeMask
public void removeMask(java.lang.String name) -
getMask
public boolean[][][] getMask(java.lang.String name) -
setMask
public void setMask(java.lang.String name, boolean show) -
setMask
public void setMask(java.lang.String name, boolean[][][] mask) -
unionMaskWithVolume
Sets maskname
to a new mask which is a union between its current state and the mask specified byvolume
, where all zero-valued voxels are masked.- Parameters:
name
-volume
-column
- The data column ofvolume
containing the mask- Returns:
-
unionMaskWithVolume
public boolean unionMaskWithVolume(java.lang.String name, Volume3DInt volume, java.lang.String column)Sets maskname
to a new mask which is a union between its current state and the mask specified byvolume
, where all zero-valued voxels are masked.- Parameters:
name
-volume
-column
- The data column ofvolume
containing the mask- Returns:
-
unionMask
public boolean unionMask(java.lang.String name, boolean[][][] to_merge) -
setAllMasks
public void setAllMasks(boolean show) -
applyMask
public void applyMask()Applies the mask specified in params to the data in this volume. NOTE: temporary until I can get the updater to work. This function reloads data from the file filter and applies the given mask to it, whereas I'd prefer to update referenced data directly, since this is much quicker and more seamless.- Parameters:
params
-
-
setUpdater
Sets an updater class, descended from Volume3DUpdater, with which to update the data in this volume's grid. All updates to Volume3DInt data for objects with live scene nodes must be performed using such an updater. Grid data must be set by reference (isByRef() = true) in order to set an updater.- Parameters:
u
- Volume3DUpdater with which to update this volume's data
-
update
Updates this volume's grid data with the current Volume3DUpdater object. Does nothing if this Volume3DInt is not set by reference (isByRef() = true), or if no updater is currently set. Updaters can be set using the setUpdater method.- Parameters:
type
- The type of update to perform: Values only, Colour map only, or both
-
isByRef
public boolean isByRef() -
getGrid
Returns the Grid3D associated with this volume.- Returns:
-
getVertexIndex
public int getVertexIndex(int[] voxel)Obtains an absolute (vertex) index for the specified voxel indices- Parameters:
voxel
-- Returns:
-
getVertexIndex
public int getVertexIndex(int i, int j, int k)Obtains an absolute (vertex) index for the specified voxel indices- Parameters:
voxel
-- Returns:
-
getDatumAtVoxel
Returns the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
getDatumAtVoxel
Returns the datum fromcolumn
atindex
.- Parameters:
column
-i
-j
-k
-- Returns:
-
getDatumAtVoxel
Returns the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
getDatumAtVoxel
Returns the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVoxel
Sets the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
setDatumAtVoxel
Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVoxel
public boolean setDatumAtVoxel(int[] voxel, double datum)Sets the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
setDatumAtVoxel
public boolean setDatumAtVoxel(java.lang.String column, int[] voxel, double datum)Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVoxel
Sets the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
setDatumAtVoxel
Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVoxel
public boolean setDatumAtVoxel(int i, int j, int k, double datum)Sets the datum from the current column atindex
.- Parameters:
index
-- Returns:
-
setDatumAtVoxel
public boolean setDatumAtVoxel(java.lang.String column, int i, int j, int k, double datum)Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
getDatumAtPoint
Returns the datum from the current column for the voxel enclosingpoint
.- Parameters:
point
-- Returns:
- The value, or
Double.NaN
ispoint
is not enclosed by this volume
-
getDatumAtPoint
Returns the datum from thecolumn
for the voxel enclosingpoint
.- Parameters:
column
-point
-- Returns:
- The value, or
null
ifpoint
is not enclosed by this volume
-
getInterpolatedValueAtPoint
public double getInterpolatedValueAtPoint(org.jogamp.vecmath.Point3f p, int t)Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours. Interpolation is an average weighted by the inverse distance of the center points of these neighbouring voxels top
. Uses the current data column.- Parameters:
p
- The geometric point at which to samplet
- The time, if this is a stack of time points- Returns:
- The sampled value, or
Double.NaN
if this point is not within the bounds of this grid
-
getInterpolatedValueAtPoint
public double getInterpolatedValueAtPoint(org.jogamp.vecmath.Point3f p)Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours. Interpolation is an average weighted by the inverse distance of the center points of these neighbouring voxels top
. Time point is assumed to be 1. Uses the current data column.- Parameters:
p
- The geometric point at which to sample- Returns:
- The sampled value, or
Double.NaN
if this point is not within the bounds of this grid
-
getInterpolatedValueAtPoint
public double getInterpolatedValueAtPoint(java.lang.String column, org.jogamp.vecmath.Point3f p)Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours. Interpolation is an average weighted by the inverse distance of the center points of these neighbouring voxels top
. Time point is assumed to be 1. Uses the current data column.- Parameters:
column
- The vertex data columnp
- The geometric point at which to sample- Returns:
- The sampled value, or
Double.NaN
if this point is not within the bounds of this grid
-
getInterpolatedValueAtPoint
public double getInterpolatedValueAtPoint(java.lang.String column, org.jogamp.vecmath.Point3f p, int t)Returns a value which is interpolated from the voxel enclosingp
and its nearest neighbours. Interpolation is an average weighted by the inverse distance of the center points of these neighbouring voxels top
.- Parameters:
column
- The vertex data columnp
- The geometric point at which to samplet
- The time, if this is a stack of time points- Returns:
- The sampled value, or
Double.NaN
if this point is not within the bounds of this grid
-
sampleFromVolume
Samplessample_volume
where its geometric bounds cross the bounds of this volume. All non-crossing voxels will be assigned a value ofdata_min
. Source and target columns are the current columns of either volume.- Parameters:
sample_grid
-- Returns:
-
sampleFromVolume
Samplessample_volume
where its geometric bounds cross the bounds of this volume. All non-crossing voxels will be assigned a value ofnan_value
. Source and target columns are the current columns of either volume.- Parameters:
sample_grid
-nan_value
- Value to assign if voxel is outsidesample_volume
- Returns:
-
sampleFromVolume
public boolean sampleFromVolume(Volume3DInt sample_volume, java.lang.String source_column, java.lang.String target_column)Samplessample_volume
where its geometric bounds cross the bounds of this volume. All non-crossing voxels will be assigned a value ofdata_min
.- Parameters:
sample_grid
-source_column
- The column insample_volume
from which to sample.target_column
- The target column in this volume. Will be created if it does not exist; otherwise, will be overwritten- Returns:
-
sampleFromVolume
public boolean sampleFromVolume(Volume3DInt sample_volume, java.lang.String source_column, java.lang.String target_column, double nan_value)Samplessample_volume
where its geometric bounds cross the bounds of this volume. All non-crossing voxels will be assigned a value ofnan_value
.- Parameters:
sample_grid
-source_column
- The column insample_volume
from which to sample.target_column
- The target column in this volume. Will be created if it does not exist; otherwise, will be overwrittennan_value
- Value to assign if voxel is outsidesample_volume
- Returns:
-
getDataType
public int getDataType()Returns the data type of the current column. Returns -1 if no current column is set.- Returns:
-
getDataType
public int getDataType(java.lang.String column)Returns the data type ofcolumn
. Returns -1 if there is no column by that name.- Returns:
-
vertexDataColumnColourMapChanged
- Specified by:
vertexDataColumnColourMapChanged
in interfaceVertexDataColumnListener
- Overrides:
vertexDataColumnColourMapChanged
in classInterfaceShape
-
vertexDataColumnChanged
- Specified by:
vertexDataColumnChanged
in interfaceVertexDataColumnListener
- Overrides:
vertexDataColumnChanged
in classInterfaceShape
-
setMapMax
public void setMapMax(float m) -
getMapMax
public float getMapMax() -
setMapMin
public void setMapMin(float m) -
getMapMin
public float getMapMin() -
setGrid
-
setGrid
-
registerCameraListener
- Overrides:
registerCameraListener
in classShape3DInt
-
deregisterCameraListener
- Overrides:
deregisterCameraListener
in classShape3DInt
-
getCameraListener
- Overrides:
getCameraListener
in classShape3DInt
-
setTexture
public void setTexture()Resets the texture for this volume's renderer. -
setTexture
public void setTexture(boolean setModel)Resets the texture for this volume's renderer.- Parameters:
setModel
- - Also resets the colour model
-
updateTextureValues
public void updateTextureValues()Texture values have changed, so the texture must be updated. Does not reset the colour model; use updateTextureColourMap() to do this. -
updateTextureColourMap
public void updateTextureColourMap()Texture values have changed, so the texture must be updated. Does not reset the colour model; use updateTextureColourMap() to do this. -
updateTexture
public void updateTexture()Texture has changed, so the texture must be updated. Also resets the colour model. -
getColourModel
Returns the colour model for the current column, ornull
if there is no current column.- Returns:
-
getColourModel
-
attributeUpdated
Description copied from class:Shape3DInt
Responds to an update in one of this shape's attributes.Subclasses should override and call this super method AFTER handling the attribute change appropriately. Subclasses should also override needsRedraw() to indicate whether the scene node should be regenerated.
- Specified by:
attributeUpdated
in interfaceAttributeListener
- Overrides:
attributeUpdated
in classShape3DInt
- Parameters:
e
- anAttributeEvent
specifying which attribute has been changed
-
setApplyMasks
public void setApplyMasks(boolean b)Sets whether currently set masks are to be applied or not. -
getApplyMasks
public boolean getApplyMasks()Whether currently set masks are to be applied or not.- Returns:
-
getTexture
-
setBounds
-
updateShape
public void updateShape()Description copied from class:Shape3DInt
Updates the geometric bounds of this ShapeInt. Does not callShape3DInt.setScene3DObject()
.- Overrides:
updateShape
in classShape3DInt
-
updateSceneNode
protected void updateSceneNode() -
updateData
public void updateData(org.jogamp.java3d.ImageComponent3D imageComponent, int index, int x, int y, int width, int height)Updates the underlying images for by-reference textures- Specified by:
updateData
in interfaceorg.jogamp.java3d.ImageComponent3D.Updater
-
setScene3DObject
public void setScene3DObject(boolean make_live)Description copied from class:Shape3DInt
Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes. This node should be retrieved using theShape3DInt.getShapeSceneNode()
method. A scene node will only created if one of these conditions is met:- The shape is auxiliary (i.e., not a model shape, but a helper shape such as a section polygon)
- The shape is associated with a ShapeModel3D, and this model is live (is associated with at least one Java3D scene graph).
- Overrides:
setScene3DObject
in classShape3DInt
-
getRenderMode
public java.lang.String getRenderMode()Returns the current render mode of this volume- Returns:
-
setRenderMode
public void setRenderMode(java.lang.String mode)Sets the current render mode of this volume- Parameters:
mode
-
-
getBox
-
hasAlpha
public boolean hasAlpha()Description copied from class:InterfaceShape
Queries whether this shape has transparency.- Overrides:
hasAlpha
in classShape3DInt
- Returns:
-
getShape2D
protected Shape2DInt getShape2D(Plane3D plane, float above_dist, float below_dist, org.jogamp.vecmath.Matrix4d transform)Description copied from class:Shape3DInt
To be overridden by subclasses implementing a 2D representation- Overrides:
getShape2D
in classShape3DInt
- Parameters:
plane
- Plane on which to renderabove_dist
- Distance above plane within which to project a shapebelow_dist
- Distance below plane within which to project a shape- Returns:
-
colourMapChanged
- Specified by:
colourMapChanged
in interfaceColourMapListener
-
hasAlpha
public void hasAlpha(boolean b)Description copied from class:InterfaceShape
Specifies whether this shape has transparency.- Overrides:
hasAlpha
in classShape3DInt
-
hasAlpha
public void hasAlpha(java.lang.String column, boolean b) -
toString
public java.lang.String toString()- Overrides:
toString
in classShape3DInt
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the start of an XML element.- Specified by:
handleXMLElementStart
in interfaceXMLObject
- Overrides:
handleXMLElementStart
in classInterfaceShape
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Overrides:
handleXMLElementEnd
in classInterfaceShape
- Parameters:
localName
- Local name of the element- Throws:
org.xml.sax.SAXException
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Specified by:
writeXML
in interfaceXMLObject
- Overrides:
writeXML
in classInterfaceShape
- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writeroptions
- XMLOutputOptions defining the write parametersprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-
writeFullXML
protected void writeFullXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException- Throws:
java.io.IOException
-