Connectivity Projection Nodes

Good afternoon,
I am working with the connectivity data. In the viewer, there is a square at what appears to be the terminal end of each branch of the projection (See below). I am interested in obtaining a list of coordinates for each of these squares for a particular projection. Can you provide some direction as to how I should go about this?
image

Hi April,

Which viewer are you using? Can you provide a link?

Tyler

Hi Tyler, I had been using the 3d Viewer :: Allen Brain Atlas: Mouse Connectivity browser.
I ended up writing a script to access the terminal endpoints from each neuron. It’s definitely not pretty, and I’m sure there are much better/simpler ways to do it, but in case anybody else encounters the same need, I have posted it below:
library(dplyr)
library(rgl)
library(rjson)
‘%notin%’ = Negate(‘%in%’)
streamline ← fromJSON(file = “streamlines_100141219.json”)
lines ← streamline$lines
curr_mesh ← mesh3d(x = NULL, y = NULL) #starting over with a fresh object
for (i in 1:length(lines)) {
curr_df ← as.data.frame(do.call(rbind, lines[[i]]))
curr_df$x = as.numeric(curr_df$x)
curr_df$y = as.numeric(curr_df$y)
curr_df$z = as.numeric(curr_df$z)
segments ← rbind(1:(nrow(curr_df) - 1), 2:nrow(curr_df))
curr_mesh ← merge(curr_mesh, mesh3d(x = curr_df$x, y = curr_df$y, z = curr_df$z, segments = segments))

}
indices = curr_mesh$is %>% data.frame()
listIndices = unlist(as.list(indices))
duplicatedIndices = listIndices[duplicated(listIndices)]
uniqueIndices = subset(listIndices, listIndices %notin% duplicatedIndices)
#for each of the unique Indices, find the start, stop, and distance
indicesBegin = uniqueIndices[c(TRUE, FALSE)]
indicesEnd = uniqueIndices[c(FALSE, TRUE)]
#You need to add the very last end to the indices begin so that we can calculate how long this segment is
indicesBegin = c(indicesBegin,indicesEnd[length(indicesEnd)] + 1)
#Now, to capture each end, we select the coordinates for each segment, and then select the last one
for(x in 1:(length(indicesBegin)-1)){
segmentCoords = curr_mesh$vb[1:3,indicesBegin:(indicesBegin[x+1]-1)]
startCoord = t(segmentCoords[,ncol(segmentCoords)]) %>% data.frame()
endCoord = t(segmentCoords[,1]) %>% data.frame()
colnames(endCoord) = c(“End_X”, “End_Y”, “End_Z”)
colnames(startCoord) = c(“Start_X”, “Start_Y”, “Start_Z”)
bothCoord = cbind(endCoord, startCoord)
bothCoord$Segment = x
bothCoord$IndexStart = indicesBegin
bothCoord$IndexEnd = indicesBegin[x+1]-1
if(x == 1){
allCoords = bothCoord
} else{
allCoords = rbind(allCoords, bothCoord)
}
}
plot3d(curr_mesh, add = TRUE, col = “black”)
plot3d(allCoords$Start_X, allCoords$Start_Y, allCoords$Start_Z, add = TRUE, col = “red”, alpha = 4)
plot3d(allCoords$End_X, allCoords$End_Y, allCoords$End_Z, col = “blue”, alpha = 4, add = TRUE)