Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #@File(style="directory", label="Output directory") destinationDirectory
  2. #@String(label="CCF Compartment (acronym, id, or label)", value="Isocortex") compartmentName
  3. #@String(label="What to save?", choices={"dendrites", "axons", "all"}) subTreeName
  4.  
  5. import sc.fiji.snt.io.MouseLightLoader
  6. import sc.fiji.snt.annotation.AllenCompartment
  7. import sc.fiji.snt.annotation.AllenUtils
  8. import sc.fiji.snt.Tree
  9. import java.text.DecimalFormat
  10.  
  11. compartmentOfInterest = AllenUtils.getCompartment(compartmentName)
  12. if (!MouseLightLoader.isDatabaseAvailable() || !compartmentOfInterest) {
  13. println("""Aborting: Can only proceed with valid compartment and
  14. successful connection to database""")
  15. return
  16. }
  17.  
  18. println("ML Database is online")
  19. for (neuron in 1..MouseLightLoader.getNeuronCount()) {
  20.  
  21. // Define a valid cell ID
  22. id = "AA" + new DecimalFormat("0000").format(neuron)
  23. loader = loader = new MouseLightLoader(id)
  24. print("Parsing " + id + "...")
  25. if (!loader.idExists()) {
  26. println(" id not found. Skipping...")
  27. continue
  28. }
  29.  
  30. // Retrieve the 1st node of the soma and its annotated compartment
  31. soma = loader.getNodes("soma")[0]
  32. somaCompartment = (AllenCompartment) soma.getAnnotation()
  33.  
  34. if (compartmentOfInterest.contains(somaCompartment)) {
  35. print(" Downloading dendrites...")
  36. dendroTree = loader.getTree(subTreeName)
  37. println("\tSWC saved: " + dendroTree.saveAsSWC(""+destinationDirectory+"/"+id+".swc"))
  38. } else {
  39. println(" Soma not associated with " + compartmentOfInterest + ". Skipping...")
  40. }
  41.  
  42. }
  43. println("Finished parsing of all " + MouseLightLoader.getNeuronCount() + " available neurons")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement