visad
Class ImageFlatField
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.FunctionImpl
-
- visad.FieldImpl
-
- visad.FlatField
-
- visad.ImageFlatField
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Data, Field, FlatFieldIface, Function, Thing
public class ImageFlatField extends FlatField
ImageFlatField is a VisAD FlatField backed by a java.awt.image.BufferedImage object, instead of the usual float[][] or double[][] samples array. Expands the samples into floats or doubles on demand usingunpackFloats(boolean), which can be expensive for repeated operations of certain types. Such calls can be avoided for certain types of visualization using an 8-bit image withShadowImageFunctionTypeJ3D.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
-
-
Field Summary
Fields Modifier and Type Field and Description static booleanDEBUGDebugging flag.-
Fields inherited from interface visad.Data
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE
-
-
Constructor Summary
Constructors Constructor and Description ImageFlatField(java.awt.image.BufferedImage img)Constructs an ImageFlatField around the given BufferedImage.ImageFlatField(FunctionType type)ImageFlatField(FunctionType type, Set domain_set)ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units)ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units)ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, Set[] range_sets, Unit[] units)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description DataShadowcomputeRanges(ShadowType type, DataShadow shadow)This method has been overridden to avoid a call to unpackValues or unpackFloats during range computation.RealType[]getDomainTypes()Gets RealType for each domain component (X and Y).java.awt.image.BufferedImagegetImage()Gets the image backing this FlatField.RealType[]getRangeTypes()Gets RealType for each range component.DatagetSample(int index)Get the range value at the index-th sample.byte[][]grabBytes()static byte[][]grabBytes(java.awt.image.BufferedImage image)static java.awt.image.BufferedImagemake3ByteRGB(java.awt.image.BufferedImage image)Converts the given BufferedImage to a format efficient with ImageFlatField's grabBytes method and usable with Java3D texturing by reference.static SetmakeDomainSet(java.awt.image.BufferedImage img)Constructs a domain Set suitable for use with the given image.static FunctionTypemakeFunctionType(java.awt.image.BufferedImage img)Constructs a FunctionType suitable for use with the given image.voidsetImage(java.awt.image.BufferedImage image)Sets the image backing this FlatField.voidsetSamples(Data[] range, boolean copy)set the range values of the function; the order of range values must be the same as the order of domain indices in the DomainSet; copy argument included for consistency with Field, but ignoredvoidsetSamples(double[][] range, boolean copy)set range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is truevoidsetSamples(double[][] range, ErrorEstimate[] errors, boolean copy)set the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(float[][] range, boolean copy)set range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is truevoidsetSamples(float[][] range, ErrorEstimate[] errors, boolean copy)set the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(int start, double[][] range)update a subset of a FlatField's range samples, where start is the index of the first sample to update and range[0].length is the number of samples to update; the array is dimensioned double[number_of_range_components][number_of_range_samples]-
Methods inherited from class visad.FlatField
adjustSamplingError, binary, clearMissing, clone, convertToField, derivative, derivative, derivative, derivative, derivative, equals, extract, extract, fillField, getDefaultRangeUnits, getFloats, getFloats, getRangeCoordinateSystem, getRangeCoordinateSystem, getRangeDimension, getRangeErrors, getRangeSets, getRangeUnits, getSample, getStringValues, getValues, getValues, getValues, isFlatField, isMissing, longString, main, makeField, makeField1, makeField2, resample, resampleDouble, setRangeErrors, setSample, setSample, setSamples, setSamples, setSamples, toString, unary, unpackFloats, unpackValues
-
Methods inherited from class visad.FieldImpl
__getitem__, __len__, __setitem__, __setitem__, combine, combine, combine, combine, combine, domainEnumeration, domainFactor, domainFactor, domainMultiply, domainMultiply, domainMultiply, domainMultiply, extract, extract, getDomainCoordinateSystem, getDomainSet, getDomainUnits, getLength, setSample, setSample, setSample, setSamples
-
Methods inherited from class visad.FunctionImpl
__getitem__, __getitem__, evaluate, evaluate, evaluate, evaluate, getDomainDimension, resample
-
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __radd__, __rdiv__, __rmod__, __rmul__, __rpow__, __rsub__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
-
Methods inherited from class visad.ThingImpl
addReference, removeReference
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface visad.Field
domainEnumeration, domainFactor, domainMultiply, domainMultiply, getDomainSet, getLength, setSample, setSample
-
Methods inherited from interface visad.Function
evaluate, evaluate, evaluate, evaluate, getDomainCoordinateSystem, getDomainDimension, getDomainUnits, resample
-
Methods inherited from interface visad.Data
abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
-
Methods inherited from interface visad.Thing
addReference, removeReference
-
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
Debugging flag.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ImageFlatField
public ImageFlatField(java.awt.image.BufferedImage img) throws VisADException, java.rmi.RemoteExceptionConstructs an ImageFlatField around the given BufferedImage.- Throws:
VisADExceptionjava.rmi.RemoteException
-
ImageFlatField
public ImageFlatField(FunctionType type) throws VisADException
- Throws:
VisADException
-
ImageFlatField
public ImageFlatField(FunctionType type, Set domain_set) throws VisADException
- Throws:
VisADException
-
ImageFlatField
public ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, Set[] range_sets, Unit[] units) throws VisADException
- Throws:
VisADException
-
ImageFlatField
public ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units) throws VisADException
- Throws:
VisADException
-
ImageFlatField
public ImageFlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units) throws VisADException
- Throws:
VisADException
-
-
Method Detail
-
make3ByteRGB
public static java.awt.image.BufferedImage make3ByteRGB(java.awt.image.BufferedImage image)
Converts the given BufferedImage to a format efficient with ImageFlatField's grabBytes method and usable with Java3D texturing by reference.
-
makeFunctionType
public static FunctionType makeFunctionType(java.awt.image.BufferedImage img) throws VisADException
Constructs a FunctionType suitable for use with the given image.- Throws:
VisADException
-
makeDomainSet
public static Set makeDomainSet(java.awt.image.BufferedImage img) throws VisADException
Constructs a domain Set suitable for use with the given image.- Throws:
VisADException
-
getImage
public java.awt.image.BufferedImage getImage()
Gets the image backing this FlatField.
-
setImage
public void setImage(java.awt.image.BufferedImage image) throws VisADException, java.rmi.RemoteExceptionSets the image backing this FlatField.- Throws:
VisADExceptionjava.rmi.RemoteException
-
getDomainTypes
public RealType[] getDomainTypes()
Gets RealType for each domain component (X and Y).
-
getRangeTypes
public RealType[] getRangeTypes()
Gets RealType for each range component.
-
setSamples
public void setSamples(Data[] range, boolean copy) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldset the range values of the function; the order of range values must be the same as the order of domain indices in the DomainSet; copy argument included for consistency with Field, but ignored- Specified by:
setSamplesin interfaceField- Overrides:
setSamplesin classFlatField- Parameters:
range- The range valuescopy- should the range values be copied- Throws:
VisADExceptionjava.rmi.RemoteException
-
computeRanges
public DataShadow computeRanges(ShadowType type, DataShadow shadow) throws VisADException
This method has been overridden to avoid a call to unpackValues or unpackFloats during range computation.- Specified by:
computeRangesin interfaceData- Overrides:
computeRangesin classFlatField- Parameters:
type- ShadowType generated for MathType of thisshadow- DataShadow instance whose contained double[][] array and animation sampling Set are modified according to RealType values in this, and used as return value- Returns:
- DataShadow instance containing double[][] array of RealType ranges, and an animation sampling Set
- Throws:
VisADException- a VisAD error occurred
-
getSample
public Data getSample(int index) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldGet the range value at the index-th sample. FlatField does not override evaluate, but the correctness of FlatField.evaluate depends on overriding getSample- Specified by:
getSamplein interfaceField- Overrides:
getSamplein classFlatField- Parameters:
index- index of requested range sample- Returns:
- Data object (Real, RealTuple, or Tuple) corresponding to the range at the index-th sample.
- Throws:
VisADException- problem getting datajava.rmi.RemoteException- problem getting data from remote object
-
setSamples
public void setSamples(double[][] range, boolean copy) throws java.rmi.RemoteException, VisADExceptionDescription copied from class:FlatFieldset range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is true- Specified by:
setSamplesin interfaceFlatFieldIface- Overrides:
setSamplesin classFlatField- Throws:
java.rmi.RemoteExceptionVisADException
-
setSamples
public void setSamples(float[][] range, boolean copy) throws java.rmi.RemoteException, VisADExceptionDescription copied from class:FlatFieldset range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is true- Specified by:
setSamplesin interfaceFlatFieldIface- Overrides:
setSamplesin classFlatField- Throws:
java.rmi.RemoteExceptionVisADException
-
setSamples
public void setSamples(double[][] range, ErrorEstimate[] errors, boolean copy) throws java.rmi.RemoteException, VisADExceptionDescription copied from class:FlatFieldset the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceFlatFieldIface- Overrides:
setSamplesin classFlatField- Throws:
java.rmi.RemoteExceptionVisADException
-
setSamples
public void setSamples(int start, double[][] range) throws java.rmi.RemoteException, VisADExceptionDescription copied from class:FlatFieldupdate a subset of a FlatField's range samples, where start is the index of the first sample to update and range[0].length is the number of samples to update; the array is dimensioned double[number_of_range_components][number_of_range_samples]- Specified by:
setSamplesin interfaceFlatFieldIface- Overrides:
setSamplesin classFlatField- Throws:
java.rmi.RemoteExceptionVisADException
-
setSamples
public void setSamples(float[][] range, ErrorEstimate[] errors, boolean copy) throws java.rmi.RemoteException, VisADExceptionDescription copied from class:FlatFieldset the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceFlatFieldIface- Overrides:
setSamplesin classFlatField- Throws:
java.rmi.RemoteExceptionVisADException
-
grabBytes
public byte[][] grabBytes()
- Specified by:
grabBytesin interfaceFlatFieldIface- Overrides:
grabBytesin classFlatField
-
grabBytes
public static byte[][] grabBytes(java.awt.image.BufferedImage image)
-
-
DMelt 3.0 © DataMelt by jWork.ORG