Open rtobar opened 5 years ago
The work in this pull request comes from the fact that we are currently doing a watershed over slightly big images that need to be filtered first to cancel out some background noise.
To do that we do something like this:
> image[image < 1.5] = 0 > EBImage::watershed(image, tolerance=0)
The problem is that the cost of doing this filtering ourselves is a fair amount of the total cost:
> dim(image) [1] 2848 2848 > microbenchmark({image[image < 1.5]=0}, times=100) Unit: milliseconds expr min lq mean median uq max neval { image[image < 1.5] = 0 } 62.7114 70.7209 105.7809 88.69216 101.6094 276.556 100 > microbenchmark(EBImage::watershed(image, tolerance = 0)) Unit: milliseconds expr min lq mean median uq max neval EBImage::watershed(image, tolerance = 0) 629.0318 660.6444 687.8925 676.6159 699.1388 865.2657 100
Based on the median and mean values of these measurements we are observing an approximate filtering cost of 10%-15%.
Doing the watershed with the internal filtering (what we are proposing in this pull request) we should be able to do:
> EBImage::watershed(image, tolerance = 0, bg=1.5)
The cost is negligible, as the current watershed algorithm is already filtering positive pixels:
> microbenchmark(EBImage::watershed(image, tolerance = 0, bg=1.5)) Unit: milliseconds expr min lq mean median uq max neval EBImage::watershed(image, tolerance=0, bg=1.5) 581.5359 645.1499 664.3851 660.9021 675.6802 770.4231 100
The work in this pull request comes from the fact that we are currently doing a watershed over slightly big images that need to be filtered first to cancel out some background noise.
To do that we do something like this:
The problem is that the cost of doing this filtering ourselves is a fair amount of the total cost:
Based on the median and mean values of these measurements we are observing an approximate filtering cost of 10%-15%.
Doing the watershed with the internal filtering (what we are proposing in this pull request) we should be able to do:
The cost is negligible, as the current watershed algorithm is already filtering positive pixels: