Interface ICoordinateSystem
- All Known Implementing Classes:
RegionCoordinateSystem
public interface ICoordinateSystem
Interface for converting between index value and coordinate in plotting system
(which is screen pixels).
Each region receives their own copy of ICoordinateSystem and this is
disposed when the region is. This avoids memory leaks on any listeners added
to the axes.
For regions over images there are addition methods for dealing with custom axes
(because the ROIs are in the image coordinates by default). So the image indices
can then be converted to whatever custom axis labels are set.
-
Method Summary
Modifier and TypeMethodDescriptionvoidListen to the coordinates changing, zoom in or image rotated usually.voiddispose()Called when the region is removed.doubleRatio of x axis to y axis scalingdouble[]getAxisLocationValue(double... axisLocation) For regions over images: if the axis data set has been set, this method will return a point in the coordinates of the image indices rather than the axes.double[]getPositionFromValue(double... value) The position in pixels of a given value.double[]getPositionValue(int... position) Deprecated.double[]getValueAxisLocation(double... values) For regions over images: if the axis data set has been set, this method will return a point in the coordinates of the axes labels rather than the indices.double[]getValueFromPosition(double... position) The value for a position in pixels.int[]getValuePosition(double... value) Deprecated.UsegetPositionFromValue(double...)The position in pixels of a given value.getX()Get x-axis when the orientation is standard.doublegetY()Get x-axis when the orientation is standard.booleanHas the image been transposed, flipping the coordinate systembooleanbooleanTrue if the x axis goes from high in the left to low in the right (Ie opposite to the way it is in TOP_LEFT orientation)booleanTrue if the y axis goes from low in the bottom to high in the top.voidRemoving listening to the coordinates changing, zoom in or image rotated usually.voidupdate(IImageTrace imageTrace, IAxis x, IAxis y) Update with new info
-
Method Details
-
getValuePosition
Deprecated.UsegetPositionFromValue(double...)The position in pixels of a given value.- Parameters:
value-- Returns:
-
getPositionValue
Deprecated.UsegetValueFromPosition(double...)The value for a position in pixels.- Parameters:
position-- Returns:
-
getValueFromPosition
double[] getValueFromPosition(double... position) The value for a position in pixels.- Parameters:
position-- Returns:
- value
-
getPositionFromValue
double[] getPositionFromValue(double... value) The position in pixels of a given value.- Parameters:
value-- Returns:
- position
-
addCoordinateSystemListener
Listen to the coordinates changing, zoom in or image rotated usually.- Parameters:
l-
-
removeCoordinateSystemListener
Removing listening to the coordinates changing, zoom in or image rotated usually.- Parameters:
l-
-
getX
IAxis getX()Get x-axis when the orientation is standard.- Returns:
-
getY
IAxis getY()Get x-axis when the orientation is standard.- Returns:
-
dispose
void dispose()Called when the region is removed. This assumes each ICoordinateSystem instance is unique to each region. -
isXReversed
boolean isXReversed()True if the x axis goes from high in the left to low in the right (Ie opposite to the way it is in TOP_LEFT orientation)- Returns:
-
isYReversed
boolean isYReversed()True if the y axis goes from low in the bottom to high in the top. (Ie opposite to the way it is in TOP_LEFT orientation)- Returns:
-
getXAxisRotationAngleDegrees
double getXAxisRotationAngleDegrees()- Returns:
- rotation angle of x axis in degrees (positive is clockwise, 0 is when x is horizontal and left to right)
-
getAspectRatio
double getAspectRatio()Ratio of x axis to y axis scaling- Returns:
-
getValueAxisLocation
For regions over images: if the axis data set has been set, this method will return a point in the coordinates of the axes labels rather than the indices. If no axes are set, then the original point is returned. If the plot is 1D then the original values are returned.NOTE the double[] passed in is not the pixel coordinates point from events like a mouse click (int[]). It is the data point (indices of real data the case of the image). The return value is the data point looked up in the image custom axes. If no custom axes are set (via the setAxes(..) method) then you will simply get the same double passed back.
- Parameters:
point- in image index coordinates.- Returns:
- point in label coordinates.
- Throws:
Exception- if the point could not be transformed or the point type is unknown.
-
getAxisLocationValue
For regions over images: if the axis data set has been set, this method will return a point in the coordinates of the image indices rather than the axes. If no axes are set, then the original point is returned. If the plot is 1D then the original values are returned.- Parameters:
point- in axis coordinates.- Returns:
- point in image coordinates.
- Throws:
Exception- if the point could not be transformed or the point type is unknown.
-
isDisposed
boolean isDisposed()- Returns:
- true if coordinates have been dispose because the region has been removed.
-
update
Update with new info- Parameters:
imageTrace-x-y-
-
isCoordsFlipped
boolean isCoordsFlipped()Has the image been transposed, flipping the coordinate system- Returns:
-
getValueFromPosition(double...)The value for a position in pixels.