Package sc.fiji.snt.io
Class NeurolucidaImporter
java.lang.Object
sc.fiji.snt.io.NeurolucidaImporter
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 Summary
ConstructorsConstructorDescriptionNeurolucidaImporter(File file) Creates a new importer from a File.Creates a new importer from an InputStream.NeurolucidaImporter(String filePath) Creates a new importer from a file path. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Returns the spatial calibration parsed from the file header.Returns the colors for each parsed marker, in the same order asgetMarkerPoints().Returns the labels for each parsed marker, in the same order asgetMarkerPoints().List<double[]> Returns the marker centroids parsed from<marker>elements.Returns the spacing units string (default "um").getTrees()Returns the parsed trees (one per<tree>element in the file).static booleanChecks whether the given input stream starts with Neurolucida XML content.
-
Constructor Details
-
NeurolucidaImporter
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
Creates a new importer from a File.- Parameters:
file- the Neurolucida XML file- Throws:
IOException- if the file cannot be read or parsed
-
NeurolucidaImporter
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
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
Returns the marker centroids parsed from<marker>elements. Each entry is adouble[3]array of {x, y, z} coordinates in the file's coordinate system (typically micrometers).- Returns:
- list of marker centroid positions
-
getMarkerLabels
Returns the labels for each parsed marker, in the same order asgetMarkerPoints().- Returns:
- list of marker labels
-
getMarkerColors
Returns the colors for each parsed marker, in the same order asgetMarkerPoints().- 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
Returns the spacing units string (default "um").- Returns:
- the spacing units
-
isNeurolucidaXML
Checks whether the given input stream starts with Neurolucida XML content. The stream must supportInputStream.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
-