public class MouseLightLoader extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AXON
The Constant AXON.
|
static String |
DENDRITE
The Constant DENDRITE.
|
static String |
SOMA
The Constant SOMA.
|
Constructor and Description |
---|
MouseLightLoader(String id)
Instantiates a new loader.
|
Modifier and Type | Method and Description |
---|---|
static Map<String,TreeSet<SWCPoint>> |
extractNodes(File jsonFile,
String compartment)
Extracts reconstruction(s) from a JSON file.
|
static Map<String,TreeSet<SWCPoint>> |
extractNodes(InputStream stream,
String compartment) |
static Map<String,Tree> |
extractTrees(File jsonFile,
String compartment)
Extracts reconstruction(s) from a JSON file.
|
static Map<String,Tree> |
extractTrees(InputStream stream,
String compartment) |
static List<MouseLightLoader> |
getAllLoaders()
Gets the loaders for all the cells publicly available in the MouseLight database.
|
String |
getDOI() |
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.
|
TreeSet<SWCPoint> |
getNodes()
Extracts the nodes (single-point soma, axonal and dendritic arbor) of the
loaded neuron.
|
TreeSet<SWCPoint> |
getNodes(String compartment)
Script-friendly method to extract the nodes of a cellular compartment.
|
String |
getSampleInfo() |
AllenCompartment |
getSomaCompartment() |
SWCPoint |
getSomaLocation() |
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(String compartment)
Script-friendly method to extract a compartment as a collection of Paths.
|
Tree |
getTree(String compartment,
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(String... args) |
boolean |
save(File file)
Convenience method to save JSON data.
|
boolean |
save(String path)
Convenience method to save JSON data.
|
boolean |
saveAsJSON(String outputDirectory)
Convenience method to save JSON data to a local directory.
|
boolean |
saveAsSWC(String outputDirectory)
Convenience method to save SWC data to a local directory.
|
public static final String AXON
public static final String DENDRITE
public static final String SOMA
public MouseLightLoader(String id)
id
- the neuron id (e.g., "AA0001"). Note that DOIs are not allowedpublic String getID()
public String getDOI()
public String getSampleInfo()
public TreeSet<SWCPoint> getNodes()
SWCPoint
s.public TreeSet<SWCPoint> getNodes(String compartment)
compartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedSWCPoint
s.public SWCPoint getSomaLocation()
public AllenCompartment getSomaCompartment()
public static Map<String,Tree> extractTrees(File jsonFile, String compartment) throws FileNotFoundException
jsonFile
- the JSON file to be parsedcompartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedTree
sFileNotFoundException
- if file could not be retrievedextractNodesFromJSONObject(String, JSONObject)
public static Map<String,Tree> extractTrees(InputStream stream, String compartment)
public static Map<String,TreeSet<SWCPoint>> extractNodes(File jsonFile, String compartment) throws org.json.JSONException, FileNotFoundException
jsonFile
- the JSON file to be parsedcompartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive). All
nodes are retrieved if compartment
is not
recognizedSWCPoint
sorg.json.JSONException
- if file is malformedFileNotFoundException
- if file could not be retrievedextractTrees(File, String)
public static Map<String,TreeSet<SWCPoint>> extractNodes(InputStream stream, String compartment) throws org.json.JSONException
org.json.JSONException
public org.json.JSONObject getJSON()
public boolean save(String path)
path
- the absolute path to output directory/filesaveAsJSON(String)
public boolean save(File file)
file
- the output directory or the output filesaveAsJSON(String)
public boolean idExists()
public String getSWC()
public boolean saveAsSWC(String outputDirectory) throws IOException
outputDirectory
- the output directoryIOException
- if an I/O exception occurred during savingpublic boolean saveAsJSON(String outputDirectory) throws IOException
outputDirectory
- the output directoryIOException
- if an I/O exception occurred during savingpublic Tree getTree(String compartment, ColorRGB color) throws 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
retrievedIllegalArgumentException
- if compartment is not recognized or
retrieval of data for this neuron is not possiblepublic Tree getTree(String compartment) throws IllegalArgumentException
compartment
- 'soma', 'axon', 'dendrite', 'all' (case insensitive)Tree
, or null if data could not be
retrievedIllegalArgumentException
- if compartment is not recognized or
retrieval of data for this neuron is not possiblepublic Tree getTree() throws IllegalArgumentException
Tree
, or null if data could not be retrievedIllegalArgumentException
- if retrieval of data for this neuron is not
possiblepublic static boolean isDatabaseAvailable()
public static int getNeuronCount()
public static List<MouseLightLoader> getAllLoaders() throws IllegalArgumentException
IllegalArgumentException
- if the ML database could not be reached.public static void main(String... args) throws IOException
IOException
Copyright © 2015–2021 Fiji. All rights reserved.