Package sc.fiji.snt.viewer
Class Viewer2D
java.lang.Object
sc.fiji.snt.analysis.ColorMapper
sc.fiji.snt.analysis.TreeColorMapper
sc.fiji.snt.viewer.Viewer2D
Class for rendering
Trees as 2D plots that can be exported as SVG,
PNG or PDF.- Author:
- Tiago Ferreira
-
Field Summary
FieldsFields inherited from class sc.fiji.snt.analysis.TreeColorMapper
INTER_NODE_ANGLE, INTER_NODE_DISTANCE, N_BRANCH_POINTS, N_NODES, N_SPINES, NODE_RADIUS, PATH_AVG_SPINE_DENSITY, PATH_DISTANCE, PATH_EXT_ANGLE, PATH_EXT_ANGLE_REL, PATH_EXT_ANGLE_XY, PATH_EXT_ANGLE_XZ, PATH_EXT_ANGLE_ZY, PATH_FRAME, PATH_LENGTH, PATH_MEAN_RADIUS, PATH_ORDER, paths, SHOLL_COUNTS, STRAHLER_ORDERS, TAG_FILENAME, VALUES, X_COORDINATES, Y_COORDINATES, Z_COORDINATESFields inherited from class sc.fiji.snt.analysis.ColorMapper
colorTable, integerScale, luts, lutService, max, min -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppends a single tree, a single Polygon2D, a collection of Trees, or a collection of Polygon2D to the viewer using default options.voidAdds a list of trees while assigning each tree to a LUT index.voidAppends a tree to the viewer.voidAppends a tree to the viewer rendered after the specified measurement.voidAppends a tree to the viewer rendered after the specified measurement.voidadd(Tree tree, String measurement, net.imglib2.display.ColorTable colorTable, double min, double max) Appends a tree to the viewer rendered after the specified measurement.voidAppends a tree to the viewer.voidAdds a color bar legend (LUT ramp) to the viewer.protected voidaddColorBarLegend(String colorTable, double min, double max) voidaddColorBarLegend(net.imglib2.display.ColorTable colorTable, double min, double max) Adds a color bar legend (LUT ramp).<T extends ColorMapper>
voidaddColorBarLegend(T colorMapper) Adds a color bar legend (LUT ramp) from aColorMapper.voidaddNodes(Collection<SNTPoint> points, String color, String label) voidvoidaddPolygon(net.imglib2.roi.geom.real.Polygon2D poly, String label) voidDeprecated.voidaddTrees(Collection<Tree> trees) Deprecated.useadd(Object)insteadgetChart()Gets the current viewer as aSNTChartobjectorg.jfree.chart.JFreeChartGets the current viewer as aJFreeChartobjectorg.scijava.plot.XYPlotgetPlot()Gets the current plot as aXYPlotobjectgetTitle()Gets the plot display title.static voidvoidsetAxesVisible(boolean visible) voidsetDefaultColor(org.scijava.util.ColorRGB color) Sets the default (fallback) color for plotting paths.voidsetEqualizeAxes(boolean equalizeAxes) /** Sets whether the axes should be equalized (same scale).voidsetGridlinesVisible(boolean visible) voidsetOutlineVisible(boolean visible) voidsetPreferredSize(int width, int height) Sets the preferred size of the plot to a constant value.voidSets the plot display title.voidsetXrange(double xMin, double xMax) Sets a manual range for the viewers' X-axis.voidsetYrange(double yMin, double yMax) Sets a manual range for the viewers' Y-axis.voidshow()Displays the current plot on a dedicated framevoidshow(int width, int height) Displays the current plot on a dedicated frame *voidshowPlot()Deprecated.Useshow()instead.Methods inherited from class sc.fiji.snt.analysis.TreeColorMapper
getAvailableLuts, getColorTable, getMetrics, getMultiViewer, getNormalizedMeasurement, isNodeMapping, map, map, map, map, map, mapToProperty, mapTreesMethods inherited from class sc.fiji.snt.analysis.ColorMapper
getColor, getColorRGB, getColorTable, getMinMax, getNaNColor, initLuts, isIntegerScale, map, setMinMax, setNaNColor, unMap, unMap
-
Field Details
-
plot
protected org.scijava.plot.XYPlot plot
-
-
Constructor Details
-
Viewer2D
public Viewer2D()Instantiates an empty 2D viewer using SNT's default context. -
Viewer2D
public Viewer2D(org.scijava.Context context) Instantiates an empty 2D viewer.- Parameters:
context- the SciJava application context providing the services required by the viewer.
-
Viewer2D
Instantiates an empty 2D viewer.- Parameters:
context- the SciJava application context providing the services required by the viewer.template- a viewer instance from which properties (axes visibility, title, etc.) will be applied
-
-
Method Details
-
addNodes
-
addNodes
-
addPolygon
-
addColorBarLegend
-
addColorBarLegend
public void addColorBarLegend(net.imglib2.display.ColorTable colorTable, double min, double max) Adds a color bar legend (LUT ramp).- Parameters:
colorTable- the color tablemin- the minimum value in the color tablemax- the maximum value in the color table
-
addColorBarLegend
Adds a color bar legend (LUT ramp) from aColorMapper.- Parameters:
colorMapper- the class extending ColorMapper (TreeColorMapper, etc.)
-
addColorBarLegend
public void addColorBarLegend()Adds a color bar legend (LUT ramp) to the viewer. Does nothing if no measurement mapping occurred successfully. Note that when performing mapping to different measurements, the legend reflects only the last mapped measurement. -
addTree
Deprecated.Useadd(Object)insteadAppends a tree to the viewer using default options.- Parameters:
tree- the Collection of paths to be plotted
-
addTrees
Deprecated.useadd(Object)insteadAdds a collection of trees. Each tree will be rendered using a unique color.- Parameters:
trees- the list of trees to be plotted
-
add
Appends a single tree, a single Polygon2D, a collection of Trees, or a collection of Polygon2D to the viewer using default options.- Parameters:
object- the tree(s) or Polygon2D(s) to be added
-
add
Adds a list of trees while assigning each tree to a LUT index.- Parameters:
trees- the list of trees to be plottedlut- the lookup table specifying the color mapping
-
add
Appends a tree to the viewer.- Parameters:
tree- the Collection of paths to be plottedcolor- the color to render the Tree
-
add
Appends a tree to the viewer.- Parameters:
tree- the Collection of paths to be plottedcolor- a string representation of the color to render the Tree
-
add
public void add(Tree tree, String measurement, net.imglib2.display.ColorTable colorTable, double min, double max) Appends a tree to the viewer rendered after the specified measurement.- Parameters:
tree- the tree to be plottedmeasurement- the measurement (TreeColorMapper.PATH_ORDER}TreeColorMapper.PATH_LENGTH, etc.)colorTable- the color table specifying the color mappingmin- the mapping lower bound (i.e., the highest measurement value for the LUT scale)max- the mapping upper bound (i.e., the highest measurement value for the LUT scale)
-
add
Appends a tree to the viewer rendered after the specified measurement. Mapping bounds are automatically determined.- Parameters:
tree- the tree to be plottedmeasurement- the measurement (TreeColorMapper.PATH_ORDER}TreeColorMapper.PATH_LENGTH, etc.)lut- the lookup table specifying the color mapping
-
add
Appends a tree to the viewer rendered after the specified measurement.- Parameters:
tree- the tree to be plottedmeasurement- the measurement (TreeColorMapper.PATH_ORDER}TreeColorMapper.PATH_LENGTH, etc.)lut- the lookup table specifying the color mappingmin- the mapping lower bound (i.e., the highest measurement value for the LUT scale)max- the mapping upper bound (i.e., the highest measurement value for the LUT scale)
-
getJFreeChart
public org.jfree.chart.JFreeChart getJFreeChart()Gets the current viewer as aJFreeChartobject- Returns:
- the converted viewer
-
getChart
Gets the current viewer as aSNTChartobject- Returns:
- the converted viewer
-
getPlot
public org.scijava.plot.XYPlot getPlot()Gets the current plot as aXYPlotobject- Returns:
- the current plot
-
setDefaultColor
public void setDefaultColor(org.scijava.util.ColorRGB color) Sets the default (fallback) color for plotting paths.- Parameters:
color- null not allowed
-
setPreferredSize
public void setPreferredSize(int width, int height) Sets the preferred size of the plot to a constant value.- Parameters:
width- the preferred widthheight- the preferred height
-
setTitle
Sets the plot display title.- Parameters:
title- the new title
-
getTitle
Gets the plot display title.- Returns:
- the current display title
-
setXrange
public void setXrange(double xMin, double xMax) Sets a manual range for the viewers' X-axis. CallingsetXrange(-1, -1)enables auto-range (the default). Must be called before Viewer is fully assembled.- Parameters:
xMin- the lower-limit for the X-axisxMax- the upper-limit for the X-axis
-
setYrange
public void setYrange(double yMin, double yMax) Sets a manual range for the viewers' Y-axis. CallingsetYrange(-1, -1)enables auto-range (the default). Must be called before Viewer is fully assembled.- Parameters:
yMin- the lower-limit for the Y-axisyMax- the upper-limit for the Y-axis
-
showPlot
Deprecated.Useshow()instead. -
show
public void show()Displays the current plot on a dedicated frame -
show
public void show(int width, int height) Displays the current plot on a dedicated frame *- Parameters:
width- the preferred frame widthheight- the preferred frame height
-
setGridlinesVisible
public void setGridlinesVisible(boolean visible) -
setAxesVisible
public void setAxesVisible(boolean visible) -
setOutlineVisible
public void setOutlineVisible(boolean visible) -
setEqualizeAxes
public void setEqualizeAxes(boolean equalizeAxes) /** Sets whether the axes should be equalized (same scale).When enabled, both X and Y axes will use the same scale to maintain equal aspect ratio. When disabled, each axis maximizes its range.
- Parameters:
equalizeAxes- true to equalize axes, false otherwise
-
main
-
add(Object)instead