ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Fuzzy spatial c-means #339

Closed ntustison closed 3 years ago

ntustison commented 3 years ago

Hey @stnava,

In working on this histograms paper, I implemented a version of the fuzzy spatial c-means since I couldn't find it anywhere. It's pretty quick

fuzzySpatialCMeansSegmentation <- function( image, mask, numberOfClusters = 4,
  m = 2, p = 1, q = 1, radius = 2, maxNumberOfIterations = 20, convergenceThreshold = 0.2,
  verbose = FALSE )
seg <- fuzzySpatialCMeansSegmentation( image, mask, numberOfClusters = 3, convergenceThreshold = 0.01, verbose = TRUE )
Cluster centers:  63.5 127 190.5 
Iteration 1 (out of 20) --- Dice overlap = 0
Iteration 2 (out of 20) --- Dice overlap = 0.8941908
Iteration 3 (out of 20) --- Dice overlap = 0.9218776
Iteration 4 (out of 20) --- Dice overlap = 0.9493425
Iteration 5 (out of 20) --- Dice overlap = 0.9635466
Iteration 6 (out of 20) --- Dice overlap = 0.9742551
Iteration 7 (out of 20) --- Dice overlap = 0.9824668
Iteration 8 (out of 20) --- Dice overlap = 0.9885702
Iteration 9 (out of 20) --- Dice overlap = 0.9902902
Screen Shot 2021-02-12 at 8 57 01 AM

Was wondering if it'd be worth having in ANTsR?

stnava commented 3 years ago

yes - I have a few implementations of this lying around as well but never added it ... probably worth having due to speed.

ntustison commented 3 years ago

Okay, will put that in.

ntustison commented 3 years ago

https://github.com/ANTsX/ANTsR/pull/341