Class ContourPlot
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
computeContourLines(double[][], double, int)
and computeContourBands(double[][], double, double, int, int)- Author:
- hageldave
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe AdaptableView interface defines theContourPlot.AdaptableView.setView(Rectangle2D)method.classThe BarycentricGradientPaint class provides a way to fill aShapewith a triangular color gradient.classThis class is implements thePaintContextforContourPlot.BarycentricGradientPaint.classFallback implementation forfor systems that do not support OpenGL 3 throughinvalid reference
BlankCanvas(e.g. macOS).invalid reference
org.lwjgl.opengl.awt.AWTGLCanvasstatic classClass providing convenience methods for converting Images to BufferedImages.static classThe CharacterAtlas class is a texture atlas for looking up character textures.static interfaceThe ColorMap interface defines discrete mapping from a fixed integer interval [0..N-1] to colors through theContourPlot.ColorMap.getColor(int)method.static classThe ColorOperations class contains methods for manipulating 32bit ARGB color values.classThe ColorScheme is responsible for storing and providing color information, which other components can use.classTheContourPlot.CompleteRenderercomprises aContourPlot.LinesRenderer, a, ainvalid reference
PointsRendererContourPlot.TextRendererand aContourPlot.TrianglesRenderer.static interfaceThe CoordinateViewListener is a listener that listens on changes to aContourPlot.CoordSysRenderer's coordinate view (i.e.classThe CoordSysPanning class implements aandinvalid reference
MouseListenerthat realize panning functionality for the coordinate view of theinvalid reference
MouseMotionListenerContourPlot.CoordSysRenderer.classThe CoordSysRenderer is aContourPlot.Rendererthat displays a coordinate system.classThe CoordSysScrollZoom class implements aMouseWheelListenerthat realize zooming functionality for the coordinate view of theContourPlot.CoordSysRenderer.static enumstatic enumEnum containing predefinedContourPlot.ColorSchemes, which can be accessed throughContourPlot.DefaultColorScheme.get().static classImplementation of the extended Wilkinson algorithm for tick label positioning.static final classclassThe GenericKey class can be used as key inHashMaps when multiple objects should be combined to a single key.classstatic interfaceThe Glyph interface has to be implemented by a class that realizes a graphical representation of a 2D point (e.g. a cross or a circle).static classClass providing convenience methods for saving Images to file.classImage class with data stored in an int array.static interfaceContourPlot.ImgBase<P extends ContourPlot.PixelBase>Base interface for imagingkit's Img classes.static interfacestatic final classClass holding all of theIteratorandSpliteratorclasses used in theContourPlot.ImgBaseinterface.static interfaceThis interface defines the methods required by an implementation of a canvasComponentfor use with JPlotterContourPlot.Renderers such asorinvalid reference
BlankCanvasContourPlot.BlankCanvasFallback.static classThe Legend class isContourPlot.Renderableand its ownContourPlot.Rendererat once.classThe Lines class is a collection of linear line segments.classThe LinesRenderer is an implementation of theContourPlot.GenericRendererforContourPlot.Lines.static classPair class.final classCountedCompleter class for multithreaded execution of a Consumer on a Spliterator.static interfaceThe PDFRenderer interface defines the methodContourPlot.PDFRenderer.renderPDF(PDDocument, PDPage, int, int, int, int)which 'renders' the PDFRenderers's content as pdf objects in content streams, i.e. fills content streams with elements and appends them to the specified page.classPixel class for retrieving a value from anContourPlot.Img.static interfaceBasic interface for Pixel classes ofContourPlot.ImgBaseimplementations.static classThe PixelConvertingSpliterator enables iterating anContourPlot.Imgwith a different datatype thanContourPlot.Pixel(ContourPlot.ImgBase.spliterator()).static interfaceThe PixelManipulator interface defines an action to be performed on a pixel.static classClass for storing all the details of a single point to be rendered.classThe PointeredPoint2D class is an implementation of thePoint2Dclass that uses two double arrays of size 1 to store its x and y coordinate.classThe Points class is a collection of 2D points that are to be represented using the sameContourPlot.Glyph(the graphical representation of a point).static interfaceInterface for an object that can be rendered by aContourPlot.Renderere.g. theContourPlot.GenericRenderer.static interfaceThe Renderer interface defines methods to initialize the renderer, execute a rendering pass, close the renderer.classSpecification of a line segment which comprises vertex locations, colors, picking color, and thicknesses.static classThe SignedDistanceCharacters class comprises signed distance fields of a set of characters.classImplementation of theContourPlot.ColorMapinterface.classAbstract class forContourPlot.Renderables representing text that can be rendered using theContourPlot.TextRenderer.classThe TrianglesRenderer is an implementation of theContourPlot.GenericRendererforContourPlot.Text.static interfaceThe TickMarkGenerator interface provides theContourPlot.TickMarkGenerator.genTicksAndLabels(double, double, int, boolean)method.classThe TranslatedPoint2D is an implementation ofPoint2Dthat references another Point2D and has a certain fixed translation from that point.classSpecification of a triangle which comprises vertex locations, colors and picking color.classThe Triangles class is a collection of 2D triangles.classThe TrianglesRenderer is an implementation of theContourPlot.GenericRendererforContourPlot.Triangles.static classClass containing utility methodsNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static ContourPlotExample from source ContourPlot.java draws contour plot of function surface correctly.Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final inta(int color) static final doublea_normalized(int color) static final intargb_bounded(int a, int r, int g, int b) Packs 8bit ARGB color components into a single 32bit integer value.static final intargb_fast(int a, int r, int g, int b) Packs 8bit ARGB color components into a single 32bit integer value.static final intargb_fromNormalized(double a, double r, double g, double b) Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value.static final intb(int color) static final doubleb_normalized(int color) (package private) static intcelltype(boolean v1, boolean v2, boolean v3) (package private) static intcelltype(boolean v11, boolean v21, boolean v31, boolean v12, boolean v22, boolean v32) static doubleclamp_0_1(double val) Clamps a value to the range [0.0, 1.0].final intclamp_0_255(int val) Clamps a value to the range [0,255].static List<ContourPlot.TriangleDetails> computeContourBands(double[][] X, double[][] Y, double[][] Z, double isoValue1, double isoValue2, int c1, int c2) Computes the contour bands from the grid samples of a bivariate function z(x,y).static List<ContourPlot.TriangleDetails> computeContourBands(double[][] uniformGridSamples, double isoValue1, double isoValue2, int c1, int c2) Computes the contour bands from the grid samples of a bivariate function z(x,y)
with implicit integer valued (x,y) = (i,j).
The resulting triangles are solutions to the equation { (x,y) | iso1 < z(x,y) < iso2 } within the grid.static List<ContourPlot.SegmentDetails> computeContourLines(double[][] X, double[][] Y, double[][] Z, double isoValue, int color) Computes the contour lines from the grid samples of a bivariate function z(x,y).static List<ContourPlot.SegmentDetails> computeContourLines(double[][] uniformGridSamples, double isoValue, int color) Computes the contour lines from the grid samples of a bivariate function z(x,y)
with implicit integer valued (x,y) = (i,j).
The resulting line segments are solutions to the equation { (x,y) | z(x,y)=iso } within the grid.static final intg(int color) static final doubleg_normalized(int color) static intinterpolateColor(int c1, int c2, double m) Linearly interpolates between the two specified colors.
c = c1*(1-m) + c2*m(package private) static doubleinterpolateToValue(double lower, double upper, double iso) Returns m of the equation: iso = lower*(1-m) + upper*m
which is: m = (iso-lower)/(upper-lower)static final intr(int color) static final doubler_normalized(int color) static voidrequireAreaInImageBounds(int xStart, int yStart, int width, int height, ContourPlot.ImgBase<?> img) Throws anIllegalArgumentExceptionwhen the specified area is not within the bounds of the specified image, or if the area is not positive.static final intrgb_bounded(int r, int g, int b) Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).static final intrgb_fast(int r, int g, int b) Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).static final intrgb_fromNormalized(double r, double g, double b) Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value with alpha=255 (opaque).voidActually runs the algorithm.voidvoidMethods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
cp
Example from source ContourPlot.java draws contour plot of function surface correctly. Need to work on example in IsolinesViz.java.
-
-
Constructor Details
-
ContourPlot
public ContourPlot()
-
-
Method Details
-
testIsolinesViz
public void testIsolinesViz() -
testContourPlot
public void testContourPlot() -
runAlgorithm
public void runAlgorithm()Description copied from class:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin classAlgorithmBase
-
b
public static final int b(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- blue component(8bit) of specified color.
- Since:
- 1.0
- See Also:
-
g
public static final int g(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- green component(8bit) of specified color.
- Since:
- 1.0
- See Also:
-
r
public static final int r(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- red component(8bit) of specified color.
- Since:
- 1.0
- See Also:
-
a
public static final int a(int color) - Parameters:
color- ARGB(32bit) value- Returns:
- alpha component(8bit) of specified color.
- Since:
- 1.0
- See Also:
-
b_normalized
public static final double b_normalized(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- normalized blue component of specified color
(value in [0.0 .. 1.0]). - Since:
- 1.2
- See Also:
-
g_normalized
public static final double g_normalized(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- normalized green component of specified color
(value in [0.0 .. 1.0]). - Since:
- 1.2
- See Also:
-
r_normalized
public static final double r_normalized(int color) - Parameters:
color- ARGB(32bit) or RGB(24bit) value- Returns:
- normalized red component of specified color
(value in [0.0 .. 1.0]). - Since:
- 1.2
- See Also:
-
a_normalized
public static final double a_normalized(int color) - Parameters:
color- ARGB(32bit) value- Returns:
- normalized alpha component of specified color
(value in [0.0 .. 1.0]). - Since:
- 1.2
- See Also:
-
argb_fast
public static final int argb_fast(int a, int r, int g, int b) Packs 8bit ARGB color components into a single 32bit integer value. Components larger than 8bit are NOT truncated and will result in a broken, malformed value.- Parameters:
a- alphar- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.0
- See Also:
-
argb_bounded
public static final int argb_bounded(int a, int r, int g, int b) Packs 8bit ARGB color components into a single 32bit integer value. Components are clamped to [0,255].- Parameters:
a- alphar- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.0
- See Also:
-
argb_fromNormalized
public static final int argb_fromNormalized(double a, double r, double g, double b) Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value. Component values less than 0 or greater than 1 are clamped to fit the range.- Parameters:
a- alphar- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.2
- See Also:
-
rgb_fast
public static final int rgb_fast(int r, int g, int b) Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque). Components larger than 8bit are NOT truncated and will result in a broken, malformed value.- Parameters:
r- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.0
- See Also:
-
rgb_bounded
public static final int rgb_bounded(int r, int g, int b) Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque). Components are clamped to [0,255].- Parameters:
r- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.0
- See Also:
-
rgb_fromNormalized
public static final int rgb_fromNormalized(double r, double g, double b) Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value with alpha=255 (opaque). Component values less than 0 or greater than 1 clamped to fit the range.- Parameters:
r- redg- greenb- blue- Returns:
- packed ARGB value
- Since:
- 1.2
- See Also:
-
interpolateColor
public static int interpolateColor(int c1, int c2, double m) Linearly interpolates between the two specified colors.
c = c1*(1-m) + c2*m- Parameters:
c1- integer packed ARGB color valuec2- integer packed ARGB color value, e.g. 0xff00ff00 for opaque greenm- in [0,1]- Returns:
- interpolated color
-
computeContourLines
public static List<ContourPlot.SegmentDetails> computeContourLines(double[][] X, double[][] Y, double[][] Z, double isoValue, int color) Computes the contour lines from the grid samples of a bivariate function z(x,y). The resulting line segments are solutions to the equation { (x,y) | z(x,y)=iso } within the grid.About indices For cartesian or rectilinear grids, x varies with the inner index of the 2D array, y with the outer index:
Xij=X[i][j]=X[?][j].
Yij=Y[i][j]=Y[i][?]- Parameters:
X- x-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )Y- y-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )Z- z-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )isoValue- the iso value for which the contour (iso) lines should be computedcolor- integer packed ARGB color value the returned line segments should have, e.g. 0xff00ff00 for opaque green.- Returns:
- list of line segments that form the contour lines. There is no particular order so subsequent segments are not necessarily adjacent.
-
computeContourBands
public static List<ContourPlot.TriangleDetails> computeContourBands(double[][] X, double[][] Y, double[][] Z, double isoValue1, double isoValue2, int c1, int c2) Computes the contour bands from the grid samples of a bivariate function z(x,y). The resulting triangles are solutions to the equation { (x,y) | iso1 < z(x,y) < iso2 } within the grid.About indices For cartesian or rectilinear grids, x varies with the inner index of the 2D array, y with the outer index:
Xij=X[i][j]=X[?][j].
Yij=Y[i][j]=Y[i][?]- Parameters:
X- x-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )Y- y-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )Z- z-coordinates of the grid points ( (x,y,z)ij = (Xij,Yij,Zij) )isoValue1- the lower bound for values of the iso bandsisoValue2- the upper bound for values of the iso bandsc1- color for the isoValue1c2- color for the isoValue2, values in between iso1 and iso2 will have their color linearly interpolated- Returns:
- list of triangles that form the iso bands. The order of triangles does NOT imply any adjacency between them.
-
computeContourLines
public static List<ContourPlot.SegmentDetails> computeContourLines(double[][] uniformGridSamples, double isoValue, int color) Computes the contour lines from the grid samples of a bivariate function z(x,y)
with implicit integer valued (x,y) = (i,j).
The resulting line segments are solutions to the equation { (x,y) | z(x,y)=iso } within the grid.The lines are computed using the Meandering Triangles algorithm which divides each square cell of the grid into 2 triangle cells first before computing isovalue intersections on the triangle sides. The more well known Marching Squares algorithm has significantly more cell cases to check, which is why Meandering Triangles was preferred here.
- Parameters:
uniformGridSamples- z-coordinates of the grid points ( (x,y,z)ij = (i,j,Zij) )isoValue- the iso value for which the contour (iso) lines should be computedcolor- integer packed ARGB color value the returned line segments should have, e.g. 0xff00ff00 for opaque green.- Returns:
- list of line segments that form the contour lines. There is no particular order so subsequent segments are not necessarily adjacent.
-
computeContourBands
public static List<ContourPlot.TriangleDetails> computeContourBands(double[][] uniformGridSamples, double isoValue1, double isoValue2, int c1, int c2) Computes the contour bands from the grid samples of a bivariate function z(x,y)
with implicit integer valued (x,y) = (i,j).
The resulting triangles are solutions to the equation { (x,y) | iso1 < z(x,y) < iso2 } within the grid.The triangles are computed using the Meandering Triangles algorithm which divides each square cell of the grid into 2 triangle cells first before computing isovalue intersections on the triangle sides. The more well known Marching Squares algorithm has significantly more cell cases to check, which is why Meandering Triangles was preferred here.
- Parameters:
uniformGridSamples- z-coordinates of the grid points ( (x,y,z)ij = (i,j,Zij) )isoValue1- the lower bound for values of the iso bandsisoValue2- the upper bound for values of the iso bandsc1- color for the isoValue1c2- color for the isoValue2, values in between iso1 and iso2 will have their color linearly interpolated- Returns:
- list of triangles that form the iso bands. The order of triangles does NOT imply any adjacency between them.
-
celltype
static int celltype(boolean v1, boolean v2, boolean v3) -
celltype
static int celltype(boolean v11, boolean v21, boolean v31, boolean v12, boolean v22, boolean v32) -
interpolateToValue
static double interpolateToValue(double lower, double upper, double iso) Returns m of the equation: iso = lower*(1-m) + upper*m
which is: m = (iso-lower)/(upper-lower)- Parameters:
lower- valueupper- valueiso- value in between lower and upper- Returns:
- m
-
clamp_0_255
public final int clamp_0_255(int val) Clamps a value to the range [0,255]. Returns 0 for values less than 0, 255 for values greater than 255, and the value it self when in range.- Parameters:
val- value to be clamped- Returns:
- value clamped to [0,255]
-
clamp_0_1
public static double clamp_0_1(double val) Clamps a value to the range [0.0, 1.0]. Returns 0.0 for values less than 0, 1.0 for values greater than 1.0, and the value it self when in range.- Parameters:
val- value to be clamped- Returns:
- value clamped to [0.0, 1.0]
-
requireAreaInImageBounds
public static void requireAreaInImageBounds(int xStart, int yStart, int width, int height, ContourPlot.ImgBase<?> img) Throws anIllegalArgumentExceptionwhen the specified area is not within the bounds of the specified image, or if the area is not positive. This is used for parameter evaluation.- Parameters:
xStart- left boundary of the areayStart- top boundary of the areawidth- of the areaheight- of the areaimg- the area has to fit in.- Throws:
IllegalArgumentException- when area not in image bounds or not area not positive
-