detect_pith | R Documentation |
Automatically detect pith in a CT scan image
detect_pith(
im,
toPlot = TRUE,
n_segments = 25,
flag = TRUE,
x_0 = 0.5,
y_0 = 0.5,
n_run_max = 15,
threshold = 0.1,
pixel = TRUE
)
im |
Matrix of the CT scan image |
toPlot |
Boolean to plot the location of the pith on the image |
n_segments |
Number of segements used to locate pith |
flag |
FALSE if pith location is known |
x_0 |
Estimate of pith location in x |
y_0 |
Estimate of pith location in y |
n_run_max |
Maximum number of iterations |
threshold |
Thershold value for identifying ring transition points |
pixel |
If TRUE, returns x,y coordinates in pixel numbers, else FALSE returns x,y coordinates in relative values of x and y |
x,y pith coordinates
library(oro.dicom)
file_path <- system.file("extdata", "disk.dcm", package = "CTRing")
dcm <- readDICOM(file_path)
hdr_df <- dcm$hdr[[1]]
image_info <- getImageInfo(hdr = hdr_df)
im <- imageToMatrix(dcm$img)
im_8bit <- xBitTo8Bit(im, image_info$grayScale)
im_dens <- grayToDensity(im_8bit)
pith_coord <- detect_pith(im_dens, n_segments = 12, pixel = TRUE, toPlot = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.