Using SNT in other projects
Currently, the easiest way to improve the code base is by following the guidance of the source-code repository. You will likely need an IDE and some basic familiarity with maven.
To use SNT as a software library in your own project, simply add SNT as a maven dependency in your project’s pom, e.g.:
<!-- https://mvnrepository.com/artifact/org.morphonets/SNT -->
<dependency>
<groupId>org.morphonets</groupId>
<artifactId>SNT</artifactId>
<version>4.2.0</version> <!-- only required if pom-scijava is not being used as parent pom -->
</dependency>
See e.g., this forum thread for a concrete example of SNT being used as a software library.
Tubular Geodesics
The Tubular Geodesics plugins were developed several years ago for Simple Neurite Tracer but remain functional in modern SNT. They can be installed manually as an SNT add-on. Once installed, they allow you to trace on a filtered-version of your image in which neuronal processes (or other tubular structures) are significantly enhanced using ITK segmentation. More details on the following pages:
- Tubular Geodesics homepage
- Tracing on Filtered Images
- Secondary Image Screencast
- Generating Filtered Images
Tubular geodesics reference: doi:10.1109/cvpr.2012.6247722
TRACES File Format
The .traces files that are saved by SNT are gzipped compressed XML. SNT will also load/save uncompressed XML files, but by default, they are saved in the compressed form.
The XML DTD is included in the DOCTYPE of each file. The root element is always <tracings>, and this can contain the following elements:
<imagesize>
There must be exactly one of these elements present, with attributes that describe the size of the image in terms of number of voxels across, up and down, e.g.:
<imagesize width="520" height="434" depth="117"/>
<samplespacing>
There must be exactly one of these elements present, with attributes that describe the spacing of the samples in the image (voxels) in world-coordinates, e.g.:
<samplespacing x="0.28838738962693633" y="0.28838738962693633" z="1.2" units="micrometers"/>
<path>
The <path>
element can have the following attributes:
id
: a non-negative integer ID unique among the<path>
s in this filestartson
: if this is present, it gives the ID of the path which the beginning of this path branches off from. Ifstartson
is specified, then either the deprecated attributestartsindex
or the recommended attributesstartsx
,startsy
startsz
must be specified as well.- [deprecated]
startsindex
: This attribute used to indicate the 0-based index of the point in the other Path where the branch occurred. Please usestartsx
,startsy
andstartsz
instead. startsx
,startsy
andstartsz
: These attributes indicate where on the path specified bystartson
the branch occurs. If one of these is attributes is specified, all must be specified.endson
: if this is present, it gives the ID of the path which the branch ends on. Ifendson
is specified, then either the deprecated attributeendsindex
or the recommended attributesendsx
,endsy
endsz
must be specified as well.- [deprecated]
endsindex
: This attribute used to indicate the 0-based index of the point in the other Path where this path joins it. Please useendsx
,endsy
andendsz
instead. endsx
,endsy
andendsz
: These attributes indicate where on the path specified byendson
this path ends. If one of these is attributes is specified, all must be specified.name
: A string giving the name of this pathreallength
: The length of this path found by summing the Euclidean distance between each consecutive pair of points, in the units specified in <samplespacing>fitted
: If present, this attribute gives the ID of another path which is a version of this path after the centre-line has been adjusted and radiuses at each point found. If this attribute is present, thefittedversionof
attribute may not be.fittedversionof
: If present, this attribute gives the ID of another path which was the source version for this one. Typically the path specified does not have radiusese defined for each point, although this is not always the case. If this attribute is present, thefitted
attribute may not be.usefitted
: This attribute must be present if either thefitted
orfittedversionof
attributes are. This attribute is either"true"
or"false"
. It should only be “true” for paths that have a fitted version, when it implies that the user wants the fitted path to be display in favour of this (the unfitted) one. If “false” and this path has a fitted version, it means that this path should not be displayed. It should always be “false” for paths that are fitted versions of other paths.
This is confusing and regrettable; in later versions this will be replaced by attributes with simpler semantics.
swctype
: This should be an integer from 0 to 7 inclusive, indicating what the SWC type of the path is. If not present, the default value is 0. The conventional meaning of these values is:- 0: UNDEFINED
- 1: SOMA
- 2: AXON
- 3: DENDRITE
- 4: APICAL_DENDRITE
- ~
5: FORK_POINT~ (Deprecated) - ~
6: END_POINT~ (Deprecated) - 7: CUSTOM
The <path> element may contain zero or more <point> elements. These are described below:
<point>
This represents a point in a path. A point element may have the following attributes:
xd
,yd
,zd
: These three attributes give the position of the point in world coordinates. e.g. you can use these coordinates directly to calculate the length of paths.- [deprecated]
x
,y
,z
: These attributes represent the position of the point in image coordinates (i.e. indices of voxels in each axis). They are still generated for backwards compatibility, but it’s better to usexd
,yd
andzd
. r
: If present, this attribute gives the radius of the neuron at that point.tx
,ty
,tz
: If present, these attributes give the tangent vector along the neuron at (xd
,yd
,zd
)
<fill>
The <fill>
element represents a fill around a path. It contains all the points found in the search starting from points on the path, but those that actually make up the fill are just those below the threshold specified in the attributes. (This is so that the search can be restarted if the fill is reloaded.) The <fill>
element can have the following attributes:
id
: The ID of the fill, a non-negative integer unique among all the other fill IDs in this file.frompaths
: A comma ( optional space) separated IDs of the paths from which this fill started. e.g. if this attribute isfrompaths="2, 0"
then there are nodes with distance 0 at each of the points on<path id="2" ...
and<path id="0" ...
in this fill.metric
: The cost function used during the fill.metric
is a bad name for this attribute, but it was kept for backwards compatibility.threshold
: The search threshold. All the points with a “distance” less than this path are considered to be part of the fill.
<node>
id
: Each node in the search has a non-negative integer ID which is unique within the enclosing fill.x
,y
,z
: the position of the node in the image stack in image co-ordinates, i.e. 0-based indices in voxels.previousid
: If present, this ID gives you previous node on the shortest route from the original paths to this point. It is not present for the points on the original paths, which also have adistance
attribute equal to 0.distance
: This is the minimum “distance” so far found for any route moving from any point on the original paths to this node. (The complete route can be reconstructed by followingpreviousid
s.)status
: this attribute can either have the valueopen
orclosed
, which have their conventional meanings in A* search.