Search code examples
rgeometryphotoimagej

R/ImageJ: Measuring shortest distance between points and curves


I have some experience with R as a statistics platform, but am inexperienced in image based maths. I have a series of photographs (tiff format, px/µm is known) with holes and irregular curves. I'd like to measure the shortest distance between a hole and the closest curve for that particular hole. I'd like to do this for each hole in a photograph. The holes are not regular either, so maybe I'd need to tell the program what are holes and what are curves (ImageJ has a point and segmented line functions).

Any ideas how to do this? Which package should I use in R? Would you recommend another program for this kind of task?

Example image


Solution

  • EDIT: Doing this is now possible using sclero package. The package is currently available on GitHub and the procedure is described in detail in the tutorial. Just to illustrate, I use an example from the tutorial:

    library(devtools)
    install_github("MikkoVihtakari/sclero", dependencies = TRUE)
    library(sclero)
    path <- file.path(system.file("extdata", package = "sclero"), "shellspots.zip")
    dat <- read.ijdata(path, scale = 0.7812, unit = "um") 
    shell <- convert.ijdata(dat)
    aligned <- spot.dist(shell)
    plot(aligned)
    

    enter image description here

    It is also possible to add sample spot sizes using the functions provided by the sclero package. Please see Section 2.5 in the tutorial.