Class SWCPoint

All Implemented Interfaces:
Cloneable, Comparable<SWCPoint>, SNTPoint

public class SWCPoint extends PointInImage implements Comparable<SWCPoint>
Defines a node in an SWC reconstruction. The SWC file format is detailed here.
Author:
Tiago Ferreira
  • Field Details

    • id

      public int id
      The sample number of this node
    • type

      public int type
      The SWC-type flag of this node (Path.SWC_SOMA, Path.SWC_DENDRITE, etc.)
    • parent

      public int parent
      The 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.NaN if no previousPoint exists.
    • ySeparationFromPreviousPoint

      public double ySeparationFromPreviousPoint()
      Returns the Y-distance from previous point.
      Returns:
      the Y-distance from previous point or Double.NaN if no previousPoint exists.
    • zSeparationFromPreviousPoint

      public double zSeparationFromPreviousPoint()
      Returns the Z-distance from previous point.
      Returns:
      the Z-distance from previous point or Double.NaN if no previousPoint exists.
    • toString

      public String toString()
      Overrides:
      toString in class PointInImage
    • compareTo

      public int compareTo(SWCPoint o)
      Specified by:
      compareTo in interface Comparable<SWCPoint>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class PointInImage
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class PointInImage
    • collectionAsReader

      public static StringReader collectionAsReader(Collection<SWCPoint> points)
      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

      public static void flush(Collection<SWCPoint> points, PrintWriter pw)
      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:
      getX in interface SNTPoint
      Overrides:
      getX in class PointInImage
      Returns:
      the X-coordinate of the point
    • getY

      public double getY()
      Specified by:
      getY in interface SNTPoint
      Overrides:
      getY in class PointInImage
      Returns:
      the Y-coordinate of the point
    • getZ

      public double getZ()
      Specified by:
      getZ in interface SNTPoint
      Overrides:
      getZ in class PointInImage
      Returns:
      the Z-coordinate of the point
    • setAnnotation

      public void setAnnotation(BrainAnnotation annotation)
      Description copied from interface: SNTPoint
      Assigns a neuropil annotation (e.g., atlas compartment) to this point.
      Specified by:
      setAnnotation in interface SNTPoint
      Overrides:
      setAnnotation in class PointInImage
      Parameters:
      annotation - the annotation to be assigned to this point
    • getAnnotation

      public BrainAnnotation getAnnotation()
      Specified by:
      getAnnotation in interface SNTPoint
      Overrides:
      getAnnotation in class PointInImage
      Returns:
      the neuropil annotation assigned to this point
    • previous

      public SWCPoint previous()
      Returns the preceding node (if any)
      Returns:
      the previous node or null if set by setPrevious(SWCPoint) has not been called
    • setPrevious

      public void setPrevious(SWCPoint previousNode)
      Sets the preceding node in the reconstruction
      Parameters:
      previousNode - the previous node preceding this one
    • getNextPoints

      public List<SWCPoint> getNextPoints()
      Returns the list holding the subsequent nodes in the reconstructed structure after this one.
      Returns:
      the list of "next points"
    • setTags

      public void setTags(String tags)
      Sets the tags associated with this point.
      Parameters:
      tags - the tags string
    • setColor

      public void setColor(Color color)
      Sets the color of this point.
      Parameters:
      color - the color to set
    • getTags

      public String getTags()
      Gets the tags associated with this point.
      Returns:
      the tags string
    • getColor

      public Color getColor()
      Gets the color of this point.
      Returns:
      the color