Class NeurolucidaImporter

java.lang.Object
sc.fiji.snt.io.NeurolucidaImporter

public class NeurolucidaImporter extends Object
Importer for Neurolucida XML files (Neuromorphological File Specification / NMF format). Parses <tree> elements into SNT Path/Tree objects and <marker> elements into bookmark data (centroid coordinates). Contours and vessels are skipped in this implementation.
Author:
Tiago Ferreira
See Also:
  • Constructor Details

    • NeurolucidaImporter

      public NeurolucidaImporter(String filePath) throws IOException
      Creates a new importer from a file path.
      Parameters:
      filePath - the absolute path to the Neurolucida XML file
      Throws:
      IOException - if the file cannot be read or parsed
    • NeurolucidaImporter

      public NeurolucidaImporter(File file) throws IOException
      Creates a new importer from a File.
      Parameters:
      file - the Neurolucida XML file
      Throws:
      IOException - if the file cannot be read or parsed
    • NeurolucidaImporter

      public NeurolucidaImporter(InputStream is) throws IOException
      Creates a new importer from an InputStream.
      Parameters:
      is - the input stream containing the Neurolucida XML data
      Throws:
      IOException - if the stream cannot be read or parsed
  • Method Details

    • getTrees

      public Collection<Tree> getTrees()
      Returns the parsed trees (one per <tree> element in the file).
      Returns:
      collection of Tree objects; may be empty if no trees were found
    • getMarkerPoints

      public List<double[]> getMarkerPoints()
      Returns the marker centroids parsed from <marker> elements. Each entry is a double[3] array of {x, y, z} coordinates in the file's coordinate system (typically micrometers).
      Returns:
      list of marker centroid positions
    • getMarkerLabels

      public List<String> getMarkerLabels()
      Returns the labels for each parsed marker, in the same order as getMarkerPoints().
      Returns:
      list of marker labels
    • getMarkerColors

      public List<Color> getMarkerColors()
      Returns the colors for each parsed marker, in the same order as getMarkerPoints().
      Returns:
      list of marker colors (may contain nulls)
    • getCalibration

      public double[] getCalibration()
      Returns the spatial calibration parsed from the file header.
      Returns:
      a double array {xScale, yScale, zSpacing} in the file's units
    • getSpacingUnits

      public String getSpacingUnits()
      Returns the spacing units string (default "um").
      Returns:
      the spacing units
    • isNeurolucidaXML

      public static boolean isNeurolucidaXML(InputStream is) throws IOException
      Checks whether the given input stream starts with Neurolucida XML content. The stream must support InputStream.mark(int).
      Parameters:
      is - a mark-supported input stream positioned at the start of the file
      Returns:
      true if the content appears to be a Neurolucida XML file
      Throws:
      IOException - if the stream cannot be read