Package mgui.interfaces.shapes.volume
Class GridVertexDataColumn
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.VertexDataColumn
mgui.interfaces.shapes.volume.GridVertexDataColumn
- All Implemented Interfaces:
java.lang.Comparable<VertexDataColumn>
,AttributeListener
,InterfaceObject
,PopupMenuObject
,NamedObject
,TreeObject
,CleanableObject
,XMLObject
,IconObject
public class GridVertexDataColumn extends VertexDataColumn
Vertex data column defined for a
Volume3DInt
.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected Volume3DInt
volume
Fields inherited from class mgui.interfaces.shapes.VertexDataColumn
attributes, data, link_name_mapped, linked_data, listeners, xml_attribute_handler, xml_cmap_handler, xml_current_block, xml_current_cmap, xml_data, xml_data_encoding, xml_data_size, xml_data_type, xml_nmap_handler
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description GridVertexDataColumn(java.lang.String name, Volume3DInt volume)
GridVertexDataColumn(java.lang.String name, Volume3DInt volume, java.util.ArrayList<MguiNumber> data)
-
Method Summary
Modifier and Type Method Description void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.void
colourModelChanged(boolean update)
Called when some process has altered the colour model.void
fillWithValues(int data_type, double value)
Fills this column withvalue
.java.lang.String
getByReferenceUrl()
Returns a URL string for the latest call to writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater).WindowedColourModel
getColourModel()
Returns the current colour modelprotected int
getDataBufferType()
double
getDoubleValueAtVoxel(int i, int j, int k)
Returns the value at voxel index [i, j, k]java.lang.String
getLocalName()
Returns the local name associated with this XML object.java.awt.image.BufferedImage
getRSliceImage(int r)
Returns a slice image at the plane R=r
.java.awt.image.BufferedImage
getRSliceImage(int r, WindowedColourModel colour_model)
Returns a slice image at the plane R=r
.java.awt.Color
getSolidColour()
Returns the colour for solid colour rendering.java.awt.image.BufferedImage
getSSliceImage(int s)
Returns a slice image at the plane S=s
.java.awt.image.BufferedImage
getSSliceImage(int s, WindowedColourModel colour_model)
Returns a slice image at the plane S=s
.java.awt.image.BufferedImage
getTSliceImage(int t)
Returns a slice image at the plane T=t
.java.awt.image.BufferedImage
getTSliceImage(int t, WindowedColourModel colour_model)
Returns a slice image at the plane T=t
.MguiNumber
getValueAtVoxel(int i, int j, int k)
Returns the value in this column at voxel index [i, j, k]double[][][]
getVoxelsAsDouble()
Returns the voxel-wise data as a 3D array of typedouble
void
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
isSolidColour()
Whether this column should be rendered as a solid colour (for values > 0).protected void
loadAsciiData(java.lang.String string_data)
Load vertices from Ascii encoded dataprotected void
loadBinaryData(java.lang.String string_data, int compression)
Load vertices from Base64 binary encoded data.void
setColourLimits(double min, double max, boolean update)
Sets the colour limits for this column; fires an event ifupdate
istrue
.void
setColourMap(ColourMap map, boolean update)
Sets the colour map associated with this column.void
setColourMap(ColourMap map, double min, double max, boolean update)
Sets the colour map associated with this column.void
setColourMax(double max, boolean update)
Sets the data maximum for this column; fires an event ifupdate
istrue
.void
setColourMin(double min, boolean update)
Sets the data maximum for this column; fires an event ifupdate
istrue
.void
setDataLimits(double min, double max, boolean update)
Sets the data limits for this column; fires an event ifupdate
istrue
.void
setFromVertexDataColumn(VertexDataColumn column)
Set this data column to match the values, limits, and colour map ofcolumn
.void
setIsSolidColour(boolean b)
Sets whether this column should be rendered as a solid colour (for values > 0).void
setParent(Volume3DInt parent)
Sets the parent volume for this vertex datavoid
setSolidColour(java.awt.Color clr)
Sets the colour for solid colour rendering.void
setValueAtVoxel(int i, int j, int k, MguiNumber value)
Sets the value at voxel index [i, j, k]void
setXMLRoot(java.lang.String root_dir)
void
updateColourModel()
Updates this data column's colour model from its current colour map.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.protected void
writeXMLFull(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Methods inherited from class mgui.interfaces.shapes.VertexDataColumn
addDataLink, addDataLink, addListener, compareTo, copyAttributes, fireDataColumnChanged, fireDataColumnColourMapChanged, getAttributes, getColourMap, getColourMax, getColourMin, getData, getDataAsDouble, getDataMax, getDataMin, getDataTransferType, getDoubleValueAtVertex, getDTD, getIcon, getLinkedData, getLinkedDataNames, getName, getNameMap, getObjectIcon, getPopupMenu, getPopupMenu, getShortXML, getTreeLabel, getValueAtVertex, getXML, getXML, getXMLSchema, handlePopupEvent, handleXMLString, hasNameMap, isNameMapped, removeDataLink, removeListener, resetDataLimits, setColourLimits, setColourMap, setColourMax, setColourMin, setDataLimits, setDataMax, setDataMax, setDataMin, setDataMin, setDoubleValueAtVertex, setName, setNameMap, setTreeNode, setValueAtVertex, setValues, setValues, setValues, showPopupMenu, updateDataLimits, updateDataLimits, writeAsciiData, writeBinaryData, writeXML, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, isDestroyed, issueTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
volume
-
-
Constructor Details
-
GridVertexDataColumn
-
GridVertexDataColumn
public GridVertexDataColumn(java.lang.String name, Volume3DInt volume, java.util.ArrayList<MguiNumber> data)
-
-
Method Details
-
fillWithValues
public void fillWithValues(int data_type, double value)Fills this column withvalue
.- Parameters:
data_type
- The DataBuffer type
-
isSolidColour
public boolean isSolidColour()Whether this column should be rendered as a solid colour (for values > 0). Otherwise, renders as a colour map.- Returns:
-
setIsSolidColour
public void setIsSolidColour(boolean b)Sets whether this column should be rendered as a solid colour (for values > 0). Iffalse
, renders as a colour map. -
getSolidColour
public java.awt.Color getSolidColour()Returns the colour for solid colour rendering. Requires "IsSolid" to be true.- Returns:
-
setSolidColour
public void setSolidColour(java.awt.Color clr)Sets the colour for solid colour rendering. Requires "IsSolid" to be true. -
getDoubleValueAtVoxel
public double getDoubleValueAtVoxel(int i, int j, int k)Returns the value at voxel index [i, j, k]- Parameters:
i
-j
-k
-- Returns:
-
getVoxelsAsDouble
public double[][][] getVoxelsAsDouble()Returns the voxel-wise data as a 3D array of typedouble
- Returns:
-
getValueAtVoxel
Returns the value in this column at voxel index [i, j, k]- Parameters:
index
-- Returns:
-
setValueAtVoxel
Sets the value at voxel index [i, j, k]- Parameters:
i
-j
-k
-
-
setParent
Sets the parent volume for this vertex data- Parameters:
parent
-
-
setColourMap
Description copied from class:VertexDataColumn
Sets the colour map associated with this column. Sets data min and data max to the limits of the colour map- Overrides:
setColourMap
in classVertexDataColumn
min
- Sets the colour minimumupdate
- Whether to fire an event to this column's listeners
-
setColourMap
Description copied from class:VertexDataColumn
Sets the colour map associated with this column. Sets data min and data max to the limits of the colour map- Overrides:
setColourMap
in classVertexDataColumn
update
- Whether to fire an event to this column's listeners
-
setDataLimits
public void setDataLimits(double min, double max, boolean update)Description copied from class:VertexDataColumn
Sets the data limits for this column; fires an event ifupdate
istrue
.- Overrides:
setDataLimits
in classVertexDataColumn
-
getColourModel
Returns the current colour model- Returns:
-
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
- Overrides:
attributeUpdated
in classVertexDataColumn
-
colourModelChanged
public void colourModelChanged(boolean update)Called when some process has altered the colour model. Updates the max and min accordingly- Parameters:
update
- Whether to notify listeners after change is applied
-
setFromVertexDataColumn
Description copied from class:VertexDataColumn
Set this data column to match the values, limits, and colour map ofcolumn
.- Overrides:
setFromVertexDataColumn
in classVertexDataColumn
-
setColourMin
public void setColourMin(double min, boolean update)Description copied from class:VertexDataColumn
Sets the data maximum for this column; fires an event ifupdate
istrue
.- Overrides:
setColourMin
in classVertexDataColumn
-
setColourMax
public void setColourMax(double max, boolean update)Description copied from class:VertexDataColumn
Sets the data maximum for this column; fires an event ifupdate
istrue
.- Overrides:
setColourMax
in classVertexDataColumn
-
setColourLimits
public void setColourLimits(double min, double max, boolean update)Description copied from class:VertexDataColumn
Sets the colour limits for this column; fires an event ifupdate
istrue
.- Overrides:
setColourLimits
in classVertexDataColumn
-
updateColourModel
public void updateColourModel()Updates this data column's colour model from its current colour map. This requires that this column currently has data set (required to determine the data type for the colour model). -
getRSliceImage
public java.awt.image.BufferedImage getRSliceImage(int r)Returns a slice image at the plane R=r
.- Parameters:
r
-- Returns:
-
getRSliceImage
Returns a slice image at the plane R=r
.- Parameters:
r
-- Returns:
-
getSSliceImage
public java.awt.image.BufferedImage getSSliceImage(int s)Returns a slice image at the plane S=s
.- Parameters:
s
-- Returns:
-
getSSliceImage
Returns a slice image at the plane S=s
.- Parameters:
z
-- Returns:
-
getTSliceImage
public java.awt.image.BufferedImage getTSliceImage(int t)Returns a slice image at the plane T=t
.- Parameters:
z
-- Returns:
-
getTSliceImage
Returns a slice image at the plane T=t
.- Parameters:
z
-- Returns:
-
setXMLRoot
public void setXMLRoot(java.lang.String root_dir) -
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 classVertexDataColumn
- 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 classVertexDataColumn
- Parameters:
localName
- Local name of the element- Throws:
org.xml.sax.SAXException
-
getByReferenceUrl
public java.lang.String getByReferenceUrl()Returns a URL string for the latest call to writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater). Isnull
if no call has yet been made, or the latest write was not by reference.- Returns:
-
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 classVertexDataColumn
- 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
-
writeXMLFull
protected void writeXMLFull(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException- Throws:
java.io.IOException
-
getDataBufferType
protected int getDataBufferType() -
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Overrides:
getLocalName
in classVertexDataColumn
- Returns:
-
loadBinaryData
protected void loadBinaryData(java.lang.String string_data, int compression)Description copied from class:VertexDataColumn
Load vertices from Base64 binary encoded data.- Overrides:
loadBinaryData
in classVertexDataColumn
compression
- Compression; 0 for none, 1 for zip, 2 for gzip
-
loadAsciiData
protected void loadAsciiData(java.lang.String string_data)Description copied from class:VertexDataColumn
Load vertices from Ascii encoded data- Overrides:
loadAsciiData
in classVertexDataColumn
-