Package sc.fiji.snt.annotation
Class AllenUtils
java.lang.Object
sc.fiji.snt.annotation.AllenUtils
Utility methods for accessing/handling
AllenCompartments- Author:
- Tiago Ferreira, Cameron Arshadi
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAssigns brain annotations (interpreted as CCF IDs) to node values for all paths in a Tree.static voidAssigns hemisphere tags to all nodes in a graph.static voidassignHemisphereTags(Tree tree) static voidassignToLeftHemisphere(Tree tree) Assigns a tree to the left hemisphere by mirroring it if necessary.static voidassignToRightHemisphere(Tree tree) Assigns a tree to the right hemisphere by mirroring it if necessary.static SNTPointReturns the spatial centroid of the Allen CCF.static StringgetAnatomicalPlane(String cartesianPlane) Retrieves the anatomical plane matching the specified cartesian plane.static intGets the axis defining the sagittal plane.protected static org.json.JSONObjectprotected static org.json.JSONObjectprotected static org.json.JSONArraystatic StringgetCartesianPlane(String anatomicalPlane) Retrieves the Cartesian plane matching the specified anatomical plane.static AllenCompartmentgetCompartment(int id) Constructs a compartment from its CCF idstatic AllenCompartmentgetCompartment(String nameOrAcronym) Constructs a compartment from its CCF name or acronymstatic StringgetHemisphere(Tree tree) Checks the hemisphere a neuron belongs to.static intGets the maximum number of ontology levels in the Allen CCF.static List<AllenCompartment> Gets the Allen CCF as a flat (non-hierarchical) collection of ontologies.static List<AllenCompartment> getOntologies(int depth, boolean meshes) Gets a flat (non-hierarchical) list of all the compartments of the specified ontology depth.static OBJMeshgetRootMesh(org.scijava.util.ColorRGB color) Retrieves the surface contours for the Allen Mouse Brain Atlas (CCF), bundled with SNT.static DefaultTreeModelgetTreeModel(boolean meshesOnly) Retrieves the Allen CCF hierarchical tree data.static String[]protected static Stringstatic booleanisLeftHemisphere(double x, double y, double z) static booleanisLeftHemisphere(Tree tree) Checks the hemisphere a neuron belongs to.static booleanisLeftHemisphere(SNTPoint point) Checks the hemisphere a reconstruction node belongs to.static voidstatic List<DirectedWeightedSubgraph> static voidTransfers brain annotation IDs to node values for all paths in a Tree.
-
Field Details
-
VERSION
- See Also:
-
BRAIN_ROOT_ID
public static final int BRAIN_ROOT_ID- See Also:
-
-
Method Details
-
getBrainAreasList
protected static org.json.JSONArray getBrainAreasList() -
hostedMeshesLocation
-
getBrainAreasByStructureId
protected static org.json.JSONObject getBrainAreasByStructureId() -
getBrainAreasByUUID
protected static org.json.JSONObject getBrainAreasByUUID() -
getCompartment
Constructs a compartment from its CCF id- Parameters:
id- the integer identifier- Returns:
- the compartment matching the id or null if id is not valid
-
getCompartment
Constructs a compartment from its CCF name or acronym- Parameters:
nameOrAcronym- the name or acronym (case-insensitive) identifying the compartment- Returns:
- the compartment whose name or acronym matches the specified string or null if no match was found
-
assignToLeftHemisphere
Assigns a tree to the left hemisphere by mirroring it if necessary.- Parameters:
tree- the tree to assign to the left hemisphere
-
assignToRightHemisphere
Assigns a tree to the right hemisphere by mirroring it if necessary.- Parameters:
tree- the tree to assign to the right hemisphere
-
isLeftHemisphere
Checks the hemisphere a neuron belongs to.- Parameters:
tree- the Tree to be tested- Returns:
- true, if soma (or root node) is in the left hemisphere, false otherwise
-
getHemisphere
Checks the hemisphere a neuron belongs to.- Parameters:
tree- the Tree to be tested- Returns:
- the hemisphere label: either "left", or "right"
-
assignHemisphereTags
Assigns hemisphere tags to all nodes in a graph.- Parameters:
graph- the DirectedWeightedGraph to tag
-
getAxisDefiningSagittalPlane
public static int getAxisDefiningSagittalPlane()Gets the axis defining the sagittal plane.- Returns:
- the axis defining the sagittal plane where X=0; Y=1; Z=2;
-
assignHemisphereTags
-
splitByHemisphere
-
isLeftHemisphere
Checks the hemisphere a reconstruction node belongs to.- Parameters:
point- the point- Returns:
- true, if is left hemisphere, false otherwise
-
isLeftHemisphere
public static boolean isLeftHemisphere(double x, double y, double z) -
brainCenter
Returns the spatial centroid of the Allen CCF.- Returns:
- the SNT point defining the (X,Y,Z) center of the ARA
-
getHighestOntologyDepth
public static int getHighestOntologyDepth()Gets the maximum number of ontology levels in the Allen CCF.- Returns:
- the max number of ontology levels.
-
getTreeModel
Retrieves the Allen CCF hierarchical tree data.- Parameters:
meshesOnly- Whether only compartments with known meshes should be included- Returns:
- the Allen CCF tree data model
-
getOntologies
Gets the Allen CCF as a flat (non-hierarchical) collection of ontologies.- Returns:
- the "flattened" ontologies list
-
getOntologies
Gets a flat (non-hierarchical) list of all the compartments of the specified ontology depth.- Parameters:
depth- the ontology depthmeshes- If true, only compartments with known meshes are retrieved- Returns:
- the "flattened" list of compartment
-
getRootMesh
Retrieves the surface contours for the Allen Mouse Brain Atlas (CCF), bundled with SNT.- Parameters:
color- the color to be assigned to the mesh- Returns:
- a reference to the retrieved mesh
-
getXYZLabels
- Returns:
- the anatomical descriptions associated with the Cartesian X,Y,Z axes
-
getCartesianPlane
Retrieves the Cartesian plane matching the specified anatomical plane.- Parameters:
anatomicalPlane- either "sagittal", "coronal", or "transverse"- Returns:
- the cartesian plane. Either "xy", "yz", "xz", or null if
anatomicalPlanewas not recognized.
-
getAnatomicalPlane
Retrieves the anatomical plane matching the specified cartesian plane.- Parameters:
cartesianPlane- either "xy", "yz", or "xz"- Returns:
- the cartesian plane. Either "coronal", "sagittal", "transverse", or null
if
cartesianPlanewas not recognized.
-
transferAnnotationIdsToNodeValues
Transfers brain annotation IDs to node values for all paths in a Tree.This is useful for preserving annotation information when saving data to TRACES files. Note that this method overwrites any existing node values. Nodes without annotations (null) are assigned
BRAIN_ROOT_ID.- Parameters:
tree- the Tree containing paths with brain annotations to be transferred. Must not be null and must contain valid annotations.- Throws:
IllegalArgumentException- if the tree contains no brain annotations- See Also:
-
assignAnnotationsFromNodeValues
Assigns brain annotations (interpreted as CCF IDs) to node values for all paths in a Tree.This method is the inverse operation of
transferAnnotationIdsToNodeValues(Tree).- Parameters:
tree- the Tree containing paths with node values to be converted to annotations. Must not be null. Paths without node values are skipped. Invalid node values result in null annotations.- See Also:
-
main
-