Note that this package is obsolete. Active development has moved to s3pipe.
Python-based spherical cortical surface processing tools, including spherical resampling, interpolation, parcellation, registration, atlas construction, etc. It provides fast and accurate cortical surface-based data analysis using deep learning techniques.
It can be installed from PyPI using:
pip install sphericalunet
Or download packed ready-to-use tools from Nitrc
I/O vtk file. Python function for reading and writing .vtk surface file. Example code:
from sphericalunet.utils.vtk import read_vtk, write_vtk
surf = read_vtk(file_name)
# some operations to the surface
write_vtk(surf, new_file_name)
For matlab users, please refer to this issue and this repository.
Layers provide basic spherical convolution, pooling, upsampling layers for constructing spherical convolutional neural networks.
Models provide some baseline spherical convolutional neural networks, e.g., Spherical U-Net, Spherical VGG, Spherical ResNet, Spherical CycleGAN, etc.
Resample feature on spherical surface to standard icosahedron subdivision spheres. Example code:
from sphericalunet.utils.interp_numpy import resampleSphereSurf
from sphericalunet.utils.vtk import read_vtk, write_vtk
template_163842 = read_vtk('/media/fenqiang/DATA/unc/Data/Template/sphere_163842.vtk')
neigh_orders_163842 = get_neighs_order(163842)
data = read_vtk(file)
resampled_feat = resampleSphereSurf(data['vertices'], template_163842['vertices'],
np.concatenate((data['sulc'][:,np.newaxis], data['curv'][:,np.newaxis]), axis=1),
neigh_orders=neigh_orders_163842)
surf = {'vertices': template_163842['vertices'],
'faces': template_163842['faces'],
'sulc': resampled_feat[:,0],
'curv': resampled_feat[:,1]}
write_vtk(surf, file.replace('.vtk', '.resample.vtk'))
Note if you want to run it on GPU, change interp_numpy
to interp_torch
.
Resample label on spherical surface to standard icosahedron subdivision spheres. Example code:
from sphericalunet.utils.vtk import read_vtk, write_vtk, resample_label
template_163842 = read_vtk('/media/ychenp/DATA/unc/Data/Template/sphere_163842.vtk')
surf = read_vtk(file)
resampled_par = resample_label(surf['vertices'], template_163842['vertices'], surf['par_fs_vec'])
Smooth feature on spherical surface.
Cortical surface parcellation with trained models based on this package.
Deformable cortical surface registration with trained models based on this package.
Rigid cortical surface registration. An example code can be found here.
Chcek folded triangles, and correct them (not implemented yet...).
If you use this code, please cite:
Fenqiang Zhao, et.al. Spherical U-Net on Cortical Surfaces: Methods and Applications. Information Processing in Medical Imaging (IPMI), 2019.
Fenqiang Zhao, et.al. Spherical Deformable U-Net: Application to Cortical Surface Parcellation and Development Prediction. IEEE Transactions on Medical Imaging, 2021.
Fenqiang Zhao, et.al. S3Reg: Superfast Spherical Surface Registration Based on Deep Learning. IEEE Transactions on Medical Imaging, 2021.