coldcuts is an R package to automatically generate and plot segmentation drawings in R

Overview

R-CMD-check

coldcuts

coldcuts is an R package that allows you to draw and plot automatically segmentations from 3D voxel arrays.

The name is inspired by one of Italy's best products.

🎓 You can find the documentation and a tutorial to get started at the package's page: https://langleylab.github.io/coldcuts

🗂 You can find additional segmentation files, ontologies and other information at https://langleylab.github.io/coldcuts/articles/segmentations.html

📄 You can read the preprint on arXiv at https://arxiv.org/abs/2201.10116

Citation

If you use coldcuts in your research, cite the preprint:

Giuseppe D'Agostino and Sarah Langley, Automated brain parcellation rendering and visualization in R with coldcuts, arXiv 2022, arXiv:2201.10116

Motivation

When dealing with neuroimaging data, or any other type of numerical data derived from brain tissues, it is important to situate it in its anatomical and structural context. Various authors provide parcellations or segmentations of the brain, according to their best interpretation of which functional and anatomical boundaries make sense for our understanding of the brain. There are several stand-alone tools that allow to visualize and manipulate segmentations. However, neuroimaging data, together with other functional data such as transcriptomics, is often manipulated in a statistical programming language such as R which does not have trivial implementations for the visualization of segmentations.

To bridge this gap, some R packages have been recently published:

  • ggseg by Athanasia Mo Mowinckel and Didac Vidal-Piñeiro
  • cerebroViz by Ethan Bahl, Tanner Koomar, and Jacob J Michaelson
  • fsbrain by Tim Schäfer and Christine Ecker

ggseg and cerebroviz offer 2D (and 3D in the case of ggseg3d) visualizations of human brain segmentations, with the possibility of integration with external datasets. These segmentations are manually curated, which means that new datasets must be manually inserted, and they are limited to the human brain in scope. ggseg in particular has made available several segmentations of human cortical surface atlases. fsbrain focuses on 3D visualization of human MRI data with external data integration and visualization in both native space and transformed spaces. It does not depend on manually curated datastes (beyond segmentations).

While these tools provide a wealth of beautiful visualization interfaces, we felt the need to implement a tool to systematically create 2D (and potentially 3D) objects that are easily shared and manipulated in R, with the addition of labels, external datasets and simple operations such as subsetting and projecting, with minimal need for manual curation and without limiting ourselves to a particular species.

Thus, coldcuts is our attempt at bridging the gap between imaging/high throughput brain data and R through data visualization.

Installing the package

⬇️ You can install this package using devtools::install_github():

devtools::install_github("langleylab/coldcuts")

Nota bene: coldcuts uses smoothr to smooth 2D polygons. This package requires the installation of terra which has some system dependencies for spatial data, such as GDAL, GEOS and PROJ that can sometimes be difficult to install, especially in machines on which you do not have admin rights.

One possible workaround when you do not have admin rights is to use conda virtual environments to install GDAL and other libraries using the conda-forge channel: link

Getting started

🏃🏽‍♀️ You can find a small example to get started here

You might also like...
Mae segmentation - Reproduction of semantic segmentation using masked autoencoder (mae)

ADE20k Semantic segmentation with MAE Getting started Install the mmsegmentation

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation
Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation. Generally, MAS methods register multiple atlases, i.e., medical images with corresponding labels, to a target image;

Automatically download the cwru data set, and then divide it into training data set and test data set

Automatically download the cwru data set, and then divide it into training data set and test data set.自动下载cwru数据集,然后分训练数据集和测试数据集

DiffQ performs differentiable quantization using pseudo quantization noise. It can automatically tune the number of bits used per weight or group of weights, in order to achieve a given trade-off between model size and accuracy.

Differentiable Model Compression via Pseudo Quantization Noise DiffQ performs differentiable quantization using pseudo quantization noise. It can auto

An easy way to build PyTorch datasets. Modularly build datasets and automatically cache processed results

EasyDatas An easy way to build PyTorch datasets. Modularly build datasets and automatically cache processed results Installation pip install git+https

E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero
E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

MagInkCal This repo contains the code needed to drive an E-Ink Magic Calendar that uses a battery powered (PiSugar2) Raspberry Pi Zero WH to retrieve

Automatically measure the facial Width-To-Height ratio and get facial analysis results provided by Microsoft Azure

fwhr-calc-website This project is to automatically measure the facial Width-To-Height ratio and get facial analysis results provided by Microsoft Azur

An auto discord account and token generator. Automatically verifies the phone number. Works without proxy.  Bypasses captcha.
An auto discord account and token generator. Automatically verifies the phone number. Works without proxy. Bypasses captcha.

JOIN DISCORD SERVER https://discord.gg/uAc3agBY FREE HCAPTCHA SOLVING API Discord-Token-Gen An auto discord token generator. Auto verifies phone numbe

This Artificial Intelligence program can take a black and white/grayscale image and generate a realistic or plausible colorized version of the same picture.

Colorizer The point of this project is to write a program capable of taking a black and white / grayscale image, and generating a realistic or plausib

Comments
  • Package issue(s)

    Package issue(s)

    Hi @gdagstn, great effort and great package! Looks incredible useful!

    I have some issues with the package and the HowTo in the vignette, maybe you can help me with those:

    the ontology(segmentation) method to get the ontology slot within the segmentation object somehow does not work:

    Error in ontology(seg) : could not find function "ontology"

    After using seg@ontology... to get the respective data within the ontology slot I can build the projection with the chosen structures using seg_projection_add as described in the vignette. However when I try to plot a feature using seg_feature_plot(segmentation = seg, assay = "gtex", feature = "APP") the following error message prompts:

    Error in data.frame(structures = rep(struct_available, lengths(segmentation@assays[[assay]]@mapping[struct_available])), : arguments imply differing number of rows: 46, 0

    R version 4.2.2 (2022-10-31 ucrt)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 22621)
    
    Matrix products: default
    
    locale:
    [1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8   
    [3] LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C                   
    [5] LC_TIME=German_Germany.utf8    
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     
    
    other attached packages:
    [1] coldcuts_0.0.0.900
    
    loaded via a namespace (and not attached):
     [1] viridis_0.6.2            tidyr_1.2.1             
     [3] tidygraph_1.2.2          viridisLite_0.4.1       
     [5] splines_4.2.2            foreach_1.5.2           
     [7] ggraph_2.1.0             freesurferformats_0.1.17
     [9] pkgfilecache_0.1.4       assertthat_0.2.1        
    [11] sp_1.5-1                 stats4_4.2.2            
    [13] yaml_2.3.6               ggrepel_0.9.2           
    [15] pillar_1.8.1             lattice_0.20-45         
    [17] glue_1.6.2               digest_0.6.29           
    [19] RColorBrewer_1.1-3       polyclip_1.10-4         
    [21] colorspace_2.0-3         plyr_1.8.8              
    [23] htmltools_0.5.3          pkgconfig_2.0.3         
    [25] GetoptLong_1.0.5         RNifti_1.4.3            
    [27] purrr_0.3.4              scales_1.2.1            
    [29] tweenr_2.0.2             ggforce_0.4.1           
    [31] tibble_3.1.8             generics_0.1.3          
    [33] farver_2.1.1             IRanges_2.32.0          
    [35] ggplot2_3.4.0            withr_2.5.0             
    [37] BiocGenerics_0.44.0      oro.nifti_0.11.4        
    [39] cli_3.3.0                magrittr_2.0.3          
    [41] crayon_1.5.2             evaluate_0.19           
    [43] fansi_1.0.3              doParallel_1.0.17       
    [45] MASS_7.3-58.1            xml2_1.3.3              
    [47] tools_4.2.2              data.table_1.14.6       
    [49] GlobalOptions_0.1.2      lifecycle_1.0.3         
    [51] matrixStats_0.63.0       stringr_1.5.0           
    [53] ComplexHeatmap_2.15.1    S4Vectors_0.36.1        
    [55] munsell_0.5.0            cluster_2.1.4           
    [57] isoband_0.2.7            compiler_4.2.2          
    [59] rlang_1.0.6              grid_4.2.2              
    [61] iterators_1.0.14         rstudioapi_0.14         
    [63] rjson_0.2.21             circlize_0.4.15         
    [65] igraph_1.3.5             bitops_1.0-7            
    [67] rmarkdown_2.19           gtable_0.3.1            
    [69] codetools_0.2-18         abind_1.4-5             
    [71] DBI_1.1.3                reshape2_1.4.4          
    [73] graphlayouts_0.8.4       R6_2.5.1                
    [75] splancs_2.01-43          gridExtra_2.3           
    [77] knitr_1.41               dplyr_1.0.10            
    [79] fastmap_1.1.0            utf8_1.2.2              
    [81] clue_0.3-63              shape_1.4.6             
    [83] polylabelr_0.2.0         stringi_1.7.8           
    [85] parallel_4.2.2           Rcpp_1.0.9              
    [87] vctrs_0.5.1              png_0.1-8               
    [89] tidyselect_1.2.0         xfun_0.36
    

    I would very much appreciate your help with these issues

    Cheers, Stefanos

    bug 
    opened by StefanosVoglis 4
  • subset segmentation by slices

    subset segmentation by slices

    Allow users to subset a segmentation selecting a range of slices (continuous) or single slices, selecting one plane only. Special case: splitting a segmentation in half.

    enhancement todo high priority 
    opened by gdagstn 0
PerfFuzz: Automatically Generate Pathological Inputs for C/C++ programs

PerfFuzz Performance problems in software can arise unexpectedly when programs are provided with inputs that exhibit pathological behavior. But how ca

Caroline Lemieux 125 Nov 18, 2022
Experimenting with computer vision techniques to generate annotated image datasets from gameplay recordings automatically.

Experimenting with computer vision techniques to generate annotated image datasets from gameplay recordings automatically. The collected data will then be used to train a deep neural network that can detect enemy player models in real time, during gameplay. Finally, a virtual input device will adjust the player's crosshair based on live detections for greater accuracy.

Martin Valchev 3 Apr 24, 2022
With this package, you can generate mixed-integer linear programming (MIP) models of trained artificial neural networks (ANNs) using the rectified linear unit (ReLU) activation function

With this package, you can generate mixed-integer linear programming (MIP) models of trained artificial neural networks (ANNs) using the rectified linear unit (ReLU) activation function. At the moment, only TensorFlow sequential models are supported. Interfaces to either the Pyomo or Gurobi modeling environments are offered.

ChemEngAI 40 Dec 27, 2022
Python package to generate image embeddings with CLIP without PyTorch/TensorFlow

imgbeddings A Python package to generate embedding vectors from images, using OpenAI's robust CLIP model via Hugging Face transformers. These image em

Max Woolf 81 Jan 4, 2023
Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP

Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP Abstract: We introduce a method that allows to automatically se

Daniil Pakhomov 134 Dec 19, 2022
TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

yifan liu 147 Dec 3, 2022
Realtime segmentation with ENet, the fast and accurate segmentation net.

Enet This is a realtime segmentation net with almost 22 fps on GTX1080 ti, and the model size is very small with only 28M. This repo contains the infe

JinTian 14 Aug 30, 2022
CTC segmentation python package

CTC segmentation CTC segmentation can be used to find utterances alignments within large audio files. This repository contains the ctc-segmentation py

Ludwig Kürzinger 217 Jan 4, 2023
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
nnFormer: Interleaved Transformer for Volumetric Segmentation Code for paper "nnFormer: Interleaved Transformer for Volumetric Segmentation "

nnFormer: Interleaved Transformer for Volumetric Segmentation Code for paper "nnFormer: Interleaved Transformer for Volumetric Segmentation ". Please

jsguo 610 Dec 28, 2022