public class Profile extends Displayable implements VectorData
Displayable.DataPackage, Displayable.DoEdit, Displayable.DoEdits, Displayable.DoTransforms, Displayable.SliderListener| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closed
Paint/behave as open or closed curve.
|
protected int |
n_points
The number of points.
|
protected double[][] |
p
The array of clicked points.
|
protected double[][] |
p_i
The array of interpolated points generated from p, p_l and p_r.
|
protected double[][] |
p_l
The array of left control points, one for each clicked point.
|
protected double[][] |
p_r
The array of right control points, one for each clicked point.
|
alpha, annotation, at, color, COMPOSITE_ADD, COMPOSITE_COLOR_YCBCR, COMPOSITE_DIFFERENCE, COMPOSITE_MULTIPLY, COMPOSITE_NORMAL, COMPOSITE_SUBTRACT, compositeModes, height, hs_linked, last_color, layer, linked_props, linked_props_origins, locked, props, TAG_ATTR1, TAG_ATTR2, title, visible, width| Constructor and Description |
|---|
Profile(Project project,
long id,
HashMap<String,String> ht,
HashMap<Displayable,String> ht_links)
Construct a Bezier Profile from an XML entry.
|
Profile(Project project,
long id,
String title,
float alpha,
boolean visible,
Color color,
double[][][] bezarr,
boolean closed,
boolean locked,
AffineTransform at)
Construct a Bezier Profile from the database.
|
Profile(Project project,
long id,
String title,
float width,
float height,
float alpha,
boolean visible,
Color color,
boolean closed,
boolean locked,
AffineTransform at)
Construct a Bezier Profile from the database, but the points will be loaded later, when actually needed, by calling setupForDisplay().
|
Profile(Project project,
String title,
double x,
double y)
A new user-requested Profile.
|
Profile(Project project,
String title,
double x,
double y,
Point2D.Double[] points)
Construct a Bezier Profile object from a set of points mixed in this pattern: PCCPCCPCCPCCP , so, [PCC]n where P = backbone point and C = control point.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
addPoint(double x_p,
double y_p,
double magnification,
double bezier_finess)
Add a point either at the end or between two existing points, with accuracy depending on magnification.
|
protected void |
addPointsAtBegin(double[][] new_p_l,
double[][] new_p,
double[][] new_p_r) |
protected void |
addPointsAtEnd(double[][] new_p_l,
double[][] new_p,
double[][] new_p_r) |
boolean |
apply(Layer la,
Area roi,
CoordinateTransform ict)
Applies the 2D transform @ict (which is expected to operate on the
world coordinates version of the data contained here) only to the
data that falls within the @param roi (in world coords), and then
recomputes the bounding box and affine transform (to a translation
or identity).
|
boolean |
apply(VectorDataTransform vdt) |
void |
cache()
Cache this Profile if needed.
|
protected void |
calculateBoundingBox() |
protected void |
calculateBoundingBox(boolean adjust_position)
Calculate the bounding box of the curve in the shape of a Rectangle defined by x,y,width,height.
|
boolean |
canSendTo(Layer target_layer)
Returns false if the target_layer contains a profile that is directly linked to this profile.
|
Displayable |
clone(Project pr,
boolean copy_id)
Performs a deep copy of this object, unlocked and visible.
|
double |
computeArea()
Calibrated, in units as specified at getLayerSet().getCalibration().getUnit() -- returns zero if this profile is not closed.
|
double |
computeLength()
Calibrated for pixel width only (that is, it assumes pixel aspect ratio 1:1), in units as specified at getLayerSet().getCalibration().getUnit()
|
boolean |
containsPoint(int x_p,
int y_p)
Check if the given point (usually from a MOUSE_PRESSED MouseEvent) is contained within the boundaries of this object.
|
void |
destroy()
Release all memory resources taken by this object.
|
protected double |
distance(double x1,
double y1,
double x2,
double y2)
Calculate distance from one point to another.
|
protected void |
dragControlPoint(int index,
double x_d,
double y_d,
double[][] p_dragged,
double[][] p_adjusted,
boolean symmetric)
Drag a control point and adjust the other, dependent one, in a symmetric way or not.
|
protected void |
dragPoint(int index,
int dx,
int dy)
Move backbone point.
|
protected void |
enlargeArrays()
Increase the size of the arrays by 5 points.
|
static void |
exportDTD(StringBuilder sb_header,
HashSet<String> hs,
String indent) |
void |
exportSVG(StringBuffer data,
double z_scale,
String indent)
Does nothing unless overriden.
|
void |
exportXML(StringBuilder sb_body,
String indent,
XMLOptions options)
The oid is this objects' id, whereas the 'id' tag will be the id of the wrapper Thing object.
|
protected int |
findClosestPoint(double x_p,
double y_p,
double magnification,
double bezier_finess)
Find the closest point to an interpolated point with precision depending upon magnification.
|
protected int |
findPoint(double[][] a,
double x_p,
double y_p,
double magnification)
Find a point in an array 'a', with a precision dependent on the magnification.
|
void |
flush()
Release memory resources used by this object: namely the arrays of points, which can be reloaded with a call to setupForDisplay()
|
protected void |
generateInterpolatedPoints(double bezier_finess) |
static List<Point3f> |
generateTriangles(ProjectThing pt,
double scale)
Takes a profile_list, scans for its Profile children, makes sublists of continuous profiles (if they happen to be branched), and then creates triangles for them using weighted vector strings.
|
double[][][] |
getBezierArrays()
Returns a triple array, each containing a [2][n_points] array
specifiying the x,y of each left control point, backbone point
and right control point respectively.
|
protected double[][] |
getFirstPoint() |
protected double[][] |
getLastPoint() |
int |
getNearestPointIndex(double x_p,
double y_p) |
Polygon |
getPerimeter()
The perimeter of this profile, in integer precision.
|
VectorString2D |
getPerimeter2D()
Returns the interpolated points as a VectorString2D, calibrated.
|
int |
getPointCount()
Returns the number of backbone points.
|
boolean |
hasPoints() |
void |
insertBetween(int startIndex,
int endIndex,
double[][] tmp_p_l,
double[][] tmp_p,
double[][] tmp_p_r) |
boolean |
isClosed() |
boolean |
isDeletable() |
boolean |
isLinked()
Returns true if it's linked to at least one patch in the same Layer.
|
boolean |
isRoughlyInside(Layer layer,
Rectangle r)
If this Displayable intersects with @param r or almost intersects, then returns true.
|
void |
keyPressed(KeyEvent ke) |
static ij.measure.ResultsTable |
measure(Profile[] profiles,
ij.measure.ResultsTable rt,
long profile_list_id)
Assumes Z-coord sorted list of profiles, as stored in a "profile_list" ProjectThing type.
|
ij.measure.ResultsTable |
measure(ij.measure.ResultsTable rt)
Measures the calibrated length, the lateral surface as the length times the layer thickness, and the volume (if closed) as the area times the layer thickness.
|
void |
mouseDragged(MouseEvent me,
Layer layer,
int x_p,
int y_p,
int x_d,
int y_d,
int x_d_old,
int y_d_old)
Execute the mouseDragged MouseEvent on this Profile.
|
void |
mousePressed(MouseEvent me,
Layer layer,
int x_p,
int y_p,
double mag)
Execute the mousePressed MouseEvent on this Profile.
|
void |
mouseReleased(MouseEvent me,
Layer layer,
int x_p,
int y_p,
int x_d,
int y_d,
int x_r,
int y_r)
Execute the mouseReleased MouseEvent on this Profile.
|
void |
paint(Graphics2D g,
Rectangle srcRect,
double magnification,
boolean active,
int channels,
Layer active_layer,
List<Layer> layers) |
void |
printPoints() |
protected boolean |
remove2(boolean check)
Remove also from the trees if present; does nothing more than remove(boolean) unless overriden.
|
protected void |
removePoint(int index)
Remove a point from the bezier backbone and its two associated control points.
|
void |
repaint()
Repaint this Displayable in all Display instances that are showing it.
|
void |
repaint(boolean repaint_navigator)
Repaints in the given ImageCanvas only the area corresponding to the bounding box of this Profile.
|
protected void |
resetControlPoints(int index)
Set the control points to the same value as the backbone point which they control.
|
void |
setColor(Color c) |
protected void |
setPoints(double[][] p_l,
double[][] p,
double[][] p_r) |
void |
setPoints(double[][] p_l,
double[][] p,
double[][] p_r,
boolean update) |
void |
snapTo(int cx,
int cy,
int x_p,
int y_p)
x,y is the cursor position in offscreen coordinates.
|
boolean |
softRemove()
Does nothing.
|
void |
toggleClosed()
Toggle curve closed/open.
|
void |
toShapesFile(StringBuffer data,
String group,
String color,
double z_scale)
Writes the data of this object as a Bezier object in the .shapes file represented by the 'data' StringBuffer.
|
adjustProperties, areThereLayerCrossLinks, clone, clone, commonDTDChildren, contains, contains, deselect, displacePoints, exportDTD, findById, findNearestPoint, findNearestPoint, getAffineTransform, getAffineTransformCopy, getAlpha, getAnnotation, getArea, getAreaAt, getAreaForBucket, getBoundingBox, getBoundingBox, getBoundingBox, getBounds, getBounds, getBucketable, getColor, getComposite, getComposite, getCompositeMode, getHeight, getIntersection, getLayer, getLayerIds, getLayerSet, getLayersWithData, getLinked, getLinked, getLinkedBox, getLinkedGroup, getLinkedProperties, getLinkedProperties, getLinkedProperty, getLinkedProperty, getMinimalBoundingBox, getNameId, getPerimeter, getProperties, getProperty, getProperty, getShortTitle, getTitle, getWidth, getX, getXMLSafeValue, getXMLSafeValue, getY, hasLinkedGroupWithinLayer, hasProperties, intersects, intersects, intersects, intersects, inverseTransformPoint, isLinked, isLinked, isLocked, isLocked2, isOnlyLinkedTo, isOnlyLinkedTo, isOutOfRepaintingClip, isOutOfRepaintingClip, isVisible, link, link, linkPatches, makeAdjustPropertiesDialog, mouseWheelMoved, paintAsBox, paintOffscreen, paintSnapshot, preConcatenate, prePaint, preTransform, processAdjustPropertiesDialog, remove, removeLinkedProperties, removeLinkedPropertiesFromOrigins, restXML, rotate, rotate, rotatePoints, scale, scale, scalePoints, setAffineTransform, setAlpha, setAlpha, setAnnotation, setCompositeMode, setDimensions, setDimensions, setLayer, setLayer, setLinkedProperties, setLinkedProperty, setLocation, setLocked, setProperty, setTitle, setVisible, setVisible, toString, transform, transformPoint, transformPoint, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformRectangle, translate, translate, unlink, unlink, unlinkAll, updateBucket, updateInDatabase, xmlError, xmlErroraddToDatabase, getId, getInfo, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabaseprotected int n_points
protected double[][] p
protected double[][] p_l
protected double[][] p_r
protected double[][] p_i
protected boolean closed
public Profile(Project project, String title, double x, double y)
public Profile(Project project, String title, double x, double y, Point2D.Double[] points)
public Profile(Project project, long id, String title, float alpha, boolean visible, Color color, double[][][] bezarr, boolean closed, boolean locked, AffineTransform at)
public Profile(Project project, long id, String title, float width, float height, float alpha, boolean visible, Color color, boolean closed, boolean locked, AffineTransform at)
protected void enlargeArrays()
public int getPointCount()
public boolean isClosed()
protected int findPoint(double[][] a,
double x_p,
double y_p,
double magnification)
protected void removePoint(int index)
protected double distance(double x1,
double y1,
double x2,
double y2)
protected void dragPoint(int index,
int dx,
int dy)
protected void resetControlPoints(int index)
protected void dragControlPoint(int index,
double x_d,
double y_d,
double[][] p_dragged,
double[][] p_adjusted,
boolean symmetric)
protected int addPoint(double x_p,
double y_p,
double magnification,
double bezier_finess)
protected int findClosestPoint(double x_p,
double y_p,
double magnification,
double bezier_finess)
public void toggleClosed()
protected void generateInterpolatedPoints(double bezier_finess)
public void paint(Graphics2D g, Rectangle srcRect, double magnification, boolean active, int channels, Layer active_layer, List<Layer> layers)
paint in interface Paintablepaint in class Displayablepublic void mousePressed(MouseEvent me, Layer layer, int x_p, int y_p, double mag)
mousePressed in class Displayablepublic void mouseDragged(MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_d_old, int y_d_old)
mouseDragged in class Displayablepublic void mouseReleased(MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_r, int y_r)
mouseReleased in class Displayableprotected void calculateBoundingBox()
protected void calculateBoundingBox(boolean adjust_position)
public void repaint()
Displayablerepaint in class Displayablepublic void repaint(boolean repaint_navigator)
public boolean containsPoint(int x_p,
int y_p)
public void destroy()
destroy in class Displayablepublic void cache()
public void flush()
public Polygon getPerimeter()
getPerimeter in class Displayablepublic void toShapesFile(StringBuffer data, String group, String color, double z_scale)
public void exportSVG(StringBuffer data, double z_scale, String indent)
DisplayableexportSVG in class Displayablepublic double[][][] getBezierArrays()
public boolean isDeletable()
isDeletable in class Displayablepublic boolean isLinked()
isLinked in class Displayablepublic boolean canSendTo(Layer target_layer)
canSendTo in class Displayableprotected double[][] getFirstPoint()
protected double[][] getLastPoint()
public boolean hasPoints()
protected void setPoints(double[][] p_l,
double[][] p,
double[][] p_r)
public void setPoints(double[][] p_l,
double[][] p,
double[][] p_r,
boolean update)
protected void addPointsAtBegin(double[][] new_p_l,
double[][] new_p,
double[][] new_p_r)
protected void addPointsAtEnd(double[][] new_p_l,
double[][] new_p,
double[][] new_p_r)
public int getNearestPointIndex(double x_p,
double y_p)
public void insertBetween(int startIndex,
int endIndex,
double[][] tmp_p_l,
double[][] tmp_p,
double[][] tmp_p_r)
public void printPoints()
public void snapTo(int cx,
int cy,
int x_p,
int y_p)
snapTo in class Displayablepublic void exportXML(StringBuilder sb_body, String indent, XMLOptions options)
DisplayableexportXML in class Displayablepublic static void exportDTD(StringBuilder sb_header, HashSet<String> hs, String indent)
public VectorString2D getPerimeter2D()
public void keyPressed(KeyEvent ke)
keyPressed in class Displayablepublic void setColor(Color c)
setColor in class Displayablepublic Displayable clone(Project pr, boolean copy_id)
clone in class Displayablepublic static List<Point3f> generateTriangles(ProjectThing pt, double scale)
public boolean softRemove()
softRemove in class Displayableprotected boolean remove2(boolean check)
Displayableremove2 in class Displayablepublic double computeLength()
public double computeArea()
public ij.measure.ResultsTable measure(ij.measure.ResultsTable rt)
measure in class Displayablepublic static ij.measure.ResultsTable measure(Profile[] profiles, ij.measure.ResultsTable rt, long profile_list_id)
public boolean apply(Layer la, Area roi, CoordinateTransform ict) throws Exception
VectorDataapply in interface VectorDatala - Only data at this Layer may be transformed.roi - Only data inside this world-coordinates Area may be transformed.ict - The transform to apply to the data that is in @param la and within @param roi.Exceptionpublic boolean apply(VectorDataTransform vdt) throws Exception
apply in interface VectorDataExceptionpublic boolean isRoughlyInside(Layer layer, Rectangle r)
DisplayableisRoughlyInside in class DisplayableCopyright © 2015–2021 Fiji. All rights reserved.