Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@File(style="directory", label="Output directory") destinationDirectory
- #@String(label="CCF Compartment (acronym, id, or label)", value="Isocortex") compartmentName
- #@String(label="What to save?", choices={"dendrites", "axons", "all"}) subTreeName
- import sc.fiji.snt.io.MouseLightLoader
- import sc.fiji.snt.annotation.AllenCompartment
- import sc.fiji.snt.annotation.AllenUtils
- import sc.fiji.snt.Tree
- import java.text.DecimalFormat
- compartmentOfInterest = AllenUtils.getCompartment(compartmentName)
- if (!MouseLightLoader.isDatabaseAvailable() || !compartmentOfInterest) {
- println("""Aborting: Can only proceed with valid compartment and
- successful connection to database""")
- return
- }
- println("ML Database is online")
- for (neuron in 1..MouseLightLoader.getNeuronCount()) {
- // Define a valid cell ID
- id = "AA" + new DecimalFormat("0000").format(neuron)
- loader = loader = new MouseLightLoader(id)
- print("Parsing " + id + "...")
- if (!loader.idExists()) {
- println(" id not found. Skipping...")
- continue
- }
- // Retrieve the 1st node of the soma and its annotated compartment
- soma = loader.getNodes("soma")[0]
- somaCompartment = (AllenCompartment) soma.getAnnotation()
- if (compartmentOfInterest.contains(somaCompartment)) {
- print(" Downloading dendrites...")
- dendroTree = loader.getTree(subTreeName)
- println("\tSWC saved: " + dendroTree.saveAsSWC(""+destinationDirectory+"/"+id+".swc"))
- } else {
- println(" Soma not associated with " + compartmentOfInterest + ". Skipping...")
- }
- }
- println("Finished parsing of all " + MouseLightLoader.getNeuronCount() + " available neurons")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement