public class MouseLightLoader
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AXON
The Constant AXON.
|
static java.lang.String |
DENDRITE
The Constant DENDRITE.
|
static java.lang.String |
SOMA
The Constant SOMA.
|
Constructor and Description |
---|
MouseLightLoader(java.lang.String id)
Instantiates a new loader.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.util.TreeSet<SWCPoint>> |
extractNodes(java.io.File jsonFile,
java.lang.String compartment)
Extracts reconstruction(s) from a JSON file.
|
static java.util.Map<java.lang.String,Tree> |
extractTrees(java.io.File jsonFile,
java.lang.String compartment)
Extracts reconstruction(s) from a JSON file.
|
java.util.List<java.lang.String> |
getAllNeuronIDs()
Gets the IDs of all the cells publicly available in the MouseLight database.
|
java.lang.String |
getID() |
org.json.JSONObject |
getJSON()
Gets all the data associated with this reconstruction as a JSON object.
|
static int |
getNeuronCount()
Gets the number of cells publicly available in the MouseLight database.
|
java.util.TreeSet<SWCPoint> |
getNodes()
Extracts the nodes (single-point soma, axonal and dendritic arbor) of the
loaded neuron.
|
java.util.TreeSet<SWCPoint> |
getNodes(java.lang.String compartment)
Script-friendly method to extract the nodes of a cellular compartment.
|
java.lang.String |
getSWC()
Gets all the data associated with this reconstruction in the SWC format.
|
Tree |
getTree()
Script-friendly method to extract the entire neuron as a collection of Paths.
|
Tree |
getTree(java.lang.String compartment)
Script-friendly method to extract a compartment as a collection of Paths.
|
Tree |
getTree(java.lang.String compartment,
org.scijava.util.ColorRGB color)
Extracts a cell compartment as a collection of Paths.
|
boolean |
idExists()
Checks whether the neuron to be loaded was found in the database.
|
static boolean |
isDatabaseAvailable()
Checks whether a connection to the MouseLight database can be established.
|
static void |
main(java.lang.String... args) |
boolean |
saveAsJSON(java.lang.String outputDirectory)
Convenience method to save JSON data to a local directory.
|
boolean |
saveAsSWC(java.lang.String outputDirectory)
Convenience method to save SWC data to a local directory.
|
public static final java.lang.String AXON
public static final java.lang.String DENDRITE
public static final java.lang.String SOMA
public MouseLightLoader(java.lang.String id)
id
- the neuron id (e.g., "AA0001"). Note that DOIs are not allowedpublic java.lang.String getID()
public java.util.TreeSet<SWCPoint> getNodes()
SWCPoint
s.public java.util.TreeSet<SWCPoint> getNodes(java.lang.String compartment)
compartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedSWCPoint
s.public static java.util.Map<java.lang.String,Tree> extractTrees(java.io.File jsonFile, java.lang.String compartment) throws java.io.FileNotFoundException
jsonFile
- the JSON file to be parsedcompartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedTree
sjava.io.FileNotFoundException
- if file could not be retrievedextractNodesFromJSONObject(String, JSONObject)
public static java.util.Map<java.lang.String,java.util.TreeSet<SWCPoint>> extractNodes(java.io.File jsonFile, java.lang.String compartment) throws java.io.FileNotFoundException
jsonFile
- the JSON file to be parsedcompartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedSWCPoint
sjava.io.FileNotFoundException
- if file could not be retrievedextractTrees(File, String)
public org.json.JSONObject getJSON()
public boolean idExists()
public java.lang.String getSWC()
public boolean saveAsSWC(java.lang.String outputDirectory) throws java.io.IOException
outputDirectory
- the output directoryjava.io.IOException
- if an I/O exception occurred during savingpublic boolean saveAsJSON(java.lang.String outputDirectory) throws java.io.IOException
outputDirectory
- the output directoryjava.io.IOException
- if an I/O exception occurred during savingpublic Tree getTree(java.lang.String compartment, org.scijava.util.ColorRGB color) throws java.lang.IllegalArgumentException
compartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive)color
- the color to be applied to the Tree. Null not expected.Tree
, or null if data could not be
retrievedjava.lang.IllegalArgumentException
- if compartment is not recognized or
retrieval of data for this neuron is not possiblepublic Tree getTree(java.lang.String compartment) throws java.lang.IllegalArgumentException
compartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive)Tree
, or null if data could not be
retrievedjava.lang.IllegalArgumentException
- if compartment is not recognized or
retrieval of data for this neuron is not possiblepublic Tree getTree() throws java.lang.IllegalArgumentException
Tree
, or null if data could not be retrievedjava.lang.IllegalArgumentException
- if retrieval of data for this neuron is not
possiblepublic static boolean isDatabaseAvailable()
public static int getNeuronCount()
public java.util.List<java.lang.String> getAllNeuronIDs()
public static void main(java.lang.String... args) throws java.io.IOException
java.io.IOException