Package sc.fiji.snt.util
Class SWCPoint
java.lang.Object
sc.fiji.snt.util.PointInImage
sc.fiji.snt.util.SWCPoint
- All Implemented Interfaces:
Cloneable,Comparable<SWCPoint>,SNTPoint
Defines a node in an SWC reconstruction. The SWC file format is detailed
here.
- Author:
- Tiago Ferreira
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe sample number of this nodeintThe parent id of this nodeintThe SWC-type flag of this node (Path.SWC_SOMA,Path.SWC_DENDRITE, etc.) -
Constructor Summary
ConstructorsConstructorDescriptionSWCPoint(int id, int type, double x, double y, double z, double radius, int parent) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReadercollectionAsReader(Collection<SWCPoint> points) Converts a collection of SWC points into a Reader.intbooleanstatic voidflush(Collection<SWCPoint> points, PrintWriter pw) Prints a list of points as space-separated values.getColor()Gets the color of this point.Returns the list holding the subsequent nodes in the reconstructed structure after this one.getTags()Gets the tags associated with this point.doublegetX()doublegetY()doublegetZ()inthashCode()previous()Returns the preceding node (if any)voidsetAnnotation(BrainAnnotation annotation) Assigns a neuropil annotation (e.g., atlas compartment) to this point.voidSets the color of this point.voidsetPrevious(SWCPoint previousNode) Sets the preceding node in the reconstructionvoidSets the tags associated with this point.toString()doubleReturns the X-distance from previous point.doubleReturns the Y-distance from previous point.doubleReturns the Z-distance from previous point.Methods inherited from class sc.fiji.snt.util.PointInImage
chebyshevDxTo, chebyshevXYdxTo, chebyshevZdxTo, clone, distanceSquaredTo, distanceSquaredTo, distanceTo, euclideanDxTo, getCoordinateOnAxis, getHemisphere, getPath, getUnscaledPoint, getUnscaledPoint, isReal, isSameLocation, scale, setHemisphere, setPath, transform
-
Field Details
-
id
public int idThe sample number of this node -
type
public int typeThe SWC-type flag of this node (Path.SWC_SOMA,Path.SWC_DENDRITE, etc.) -
parent
public int parentThe parent id of this node
-
-
Constructor Details
-
SWCPoint
public SWCPoint(int id, int type, double x, double y, double z, double radius, int parent)
-
-
Method Details
-
xSeparationFromPreviousPoint
public double xSeparationFromPreviousPoint()Returns the X-distance from previous point.- Returns:
- the X-distance from previous point or
Double.NaNif no previousPoint exists.
-
ySeparationFromPreviousPoint
public double ySeparationFromPreviousPoint()Returns the Y-distance from previous point.- Returns:
- the Y-distance from previous point or
Double.NaNif no previousPoint exists.
-
zSeparationFromPreviousPoint
public double zSeparationFromPreviousPoint()Returns the Z-distance from previous point.- Returns:
- the Z-distance from previous point or
Double.NaNif no previousPoint exists.
-
toString
- Overrides:
toStringin classPointInImage
-
compareTo
- Specified by:
compareToin interfaceComparable<SWCPoint>
-
equals
- Overrides:
equalsin classPointInImage
-
hashCode
public int hashCode()- Overrides:
hashCodein classPointInImage
-
collectionAsReader
Converts a collection of SWC points into a Reader.- Parameters:
points- the collection of SWC points to be converted into a space separated String. Points should be sorted by sample number to ensure valid connectivity.- Returns:
- the Reader
-
flush
Prints a list of points as space-separated values.- Parameters:
points- the collections of SWC points to be printed.pw- the PrintWriter to write to.- See Also:
-
getX
public double getX()- Specified by:
getXin interfaceSNTPoint- Overrides:
getXin classPointInImage- Returns:
- the X-coordinate of the point
-
getY
public double getY()- Specified by:
getYin interfaceSNTPoint- Overrides:
getYin classPointInImage- Returns:
- the Y-coordinate of the point
-
getZ
public double getZ()- Specified by:
getZin interfaceSNTPoint- Overrides:
getZin classPointInImage- Returns:
- the Z-coordinate of the point
-
setAnnotation
Description copied from interface:SNTPointAssigns a neuropil annotation (e.g., atlas compartment) to this point.- Specified by:
setAnnotationin interfaceSNTPoint- Overrides:
setAnnotationin classPointInImage- Parameters:
annotation- the annotation to be assigned to this point
-
getAnnotation
- Specified by:
getAnnotationin interfaceSNTPoint- Overrides:
getAnnotationin classPointInImage- Returns:
- the neuropil annotation assigned to this point
-
previous
Returns the preceding node (if any)- Returns:
- the previous node or null if set by
setPrevious(SWCPoint)has not been called
-
setPrevious
Sets the preceding node in the reconstruction- Parameters:
previousNode- the previous node preceding this one
-
getNextPoints
Returns the list holding the subsequent nodes in the reconstructed structure after this one.- Returns:
- the list of "next points"
-
setTags
Sets the tags associated with this point.- Parameters:
tags- the tags string
-
setColor
Sets the color of this point.- Parameters:
color- the color to set
-
getTags
Gets the tags associated with this point.- Returns:
- the tags string
-
getColor
Gets the color of this point.- Returns:
- the color
-