data-raw/BANC.R

## code to prepare `BANC` dataset goes here
banc.mesh.nl=fafbseg::read_cloudvolume_meshes(1,
  cloudvolume.url = 'precomputed://gs://lee-lab_brain-and-nerve-cord-fly-connectome/volume_meshes')
banc.mesh.nl.orig=banc.mesh.nl
banc.mesh.nl[[1]]=Rvcg::vcgUpdateNormals(banc.mesh.nl[[1]])
nat::write.neurons(banc.mesh.nl, format = 'ply', dir='.', Force = T)


# the processing in meshlab ...
# Opened mesh /Users/jefferis/dev/R/fancr/1.ply in 205 msec
# Applied filter HC Laplacian Smooth in 154 msec
# PostSimplification Cleaning: Removed 135 unreferenced vertices
# Applied filter Simplification: Quadric Edge Collapse Decimation in 3720 msec
# Started Mode Select Connected Components in a region
# Applied filter Invert Selection in 7 msec
# Applied filter Delete Selected Vertices in 12 msec
# Deleted 2506 faces, 1319 vertices.
# Saved Mesh /Users/jefferis/dev/R/fancr/1_100k.ply in 71 msec


ply=read.neurons('1_100k.ply')
ply.i=read.neurons('1_100k_inv.ply')
nopen3d()
nclear3d()
shade3d(ply[[1]], col='grey')

# eventually chose the one with inverted normals (pointing out)
BANC.surf <- as.hxsurf(ply.i[[1]])
usethis::use_data(BANC.surf, overwrite = TRUE)


BANC=nat.templatebrains::templatebrain("BANC",
                   # BoundingBox = structure(c(79392.9, 966179.9, 35524.5, 1131169.6, -62.8, 315466.7), dim = 2:3, class = "boundingbox"),
                   units='nm',
                   voxdims = c(4,4,45),dims = c(262144, 294912, 7010),
                   type='single brain',
                   sex='F',
                   description=paste0(
"The BANC (said 'the bank') is the Brain And Nerve Cord, a GridTape transmission\n",
"electron microscopy dataset of a female adult Drosophila melanogaster's entire\n",
"central nervous system. This dataset was generated by Jasper Phelps and \n",
"Minsu Kim in Wei-Chung Lee's lab at Harvard Medical School.\n",
"3D segmentation to extract the shapes of neurons and other objects in the\n",
"dataset was performed by Zetta AI. The community proofreading and annotation\n",
"effort is coordinated by FlyWire.\n",
"See https://github.com/jasper-tms/the-BANC-fly-connectome/wiki for details."))
usethis::use_data(BANC, overwrite = TRUE)

nclear3d()


ply2=as.hxsurf(ply[[1]])
nclear3d()
plot3d(ply2)
flyconnectome/fanc documentation built on Sept. 6, 2024, 9:56 a.m.