Title: | Programmatic Analysis of Sediment Cores Using Computed Tomography Imaging |
---|---|
Description: | Computed tomography (CT) imaging is a powerful tool for understanding the composition of sediment cores. This package streamlines and accelerates the analysis of CT data generated in the context of environmental science. Included are tools for processing raw DICOM images to characterize sediment composition (sand, peat, etc.). Root analyses are also enabled, including measures of external surface area and volumes for user-defined root size classes. For a detailed description of the application of computed tomography imaging for sediment characterization, see: Davey, E., C. Wigand, R. Johnson, K. Sundberg, J. Morris, and C. Roman. (2011) <DOI: 10.1890/10-2037.1>. |
Authors: | Troy D. Hill [aut, cre] |
Maintainer: | Troy D. Hill <[email protected]> |
License: | GPL-3 |
Version: | 1.3.3 |
Built: | 2025-01-31 04:10:00 UTC |
Source: | https://github.com/troyhill/corect |
Converts raw CT units to material classes for each CT slice, directly replicating Earl Davey's manual classification approach. This method is deprecated as of coreCT version 1.3.0.
conv(mat.list, upperLim = 3045, lowerLim = -1025, pixelA, thickness = 0.625, # all in mm airHU = -850.3233, airSD = 77.6953, SiHU = 271.7827, SiSD = 39.2814, glassHU = 1345.0696, glassSD = 45.4129, waterHU = 63.912, waterSD = 14.1728, densities = c(0.0012, 1, 1.23, 2.2))
conv(mat.list, upperLim = 3045, lowerLim = -1025, pixelA, thickness = 0.625, # all in mm airHU = -850.3233, airSD = 77.6953, SiHU = 271.7827, SiSD = 39.2814, glassHU = 1345.0696, glassSD = 45.4129, waterHU = 63.912, waterSD = 14.1728, densities = c(0.0012, 1, 1.23, 2.2))
mat.list |
list of DICOM images for a sediment core (values in Hounsfield Units) |
upperLim |
upper bound cutoff for pixels (Hounsfield Units) |
lowerLim |
lower bound cutoff for pixels (Hounsfield Units) |
pixelA |
pixel area (mm2) |
thickness |
CT image thickness (mm) |
airHU |
mean value for air-filled calibration rod (Hounsfield Units) |
airSD |
standard deviation for air-filled calibration rod |
SiHU |
mean value for colloidal silica calibration rod |
SiSD |
standard deviation for colloidal Si calibration rod |
glassHU |
mean value for glass calibration rod |
glassSD |
standard deviation for glass calibration rod |
waterHU |
mean value for water filled calibration rod |
waterSD |
standard deviation for water filled calibration rod |
densities |
numeric vector of known cal rod densities. Format must be c(air, water, Si, glass) |
Calculates average Hounsfield units, cross-sectional areas (cm2), volumes (cm3), and masses (g) of material classes for each CT slice. This function assumes that core walls and all non-sediment material have been removed from the raw DICOM imagery. This function converts data from raw x-ray attenuation values to Hounsfield Units, and then uses user-defined calibration rod inputs to categorize sediment components: air, roots and rhizomes, peat, water, particulates, sand, and rock/shell.
value conv
returns a dataframe with one row per CT slice. Values returned are the average Hounsfield Unit value, the area (cm2), volume (cm3), and mass (grams) of 7 material classes: gas, peat, roots and rhizomes, particulates, sand, water, and rock/shell. If <code>rootData = TRUE</code>, data for specified root size classes are also returned. See <code>rootSize</code> for more detail on those values.
rootSize
operates similarly.
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- conv(HU_426, pixelA = 0.0596) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- conv(HU_426, pixelA = 0.0596) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
Calculates the area and volume of material classes for each CT slice in a directory. This approach directly replicates Earl Davey's manual classification approach. This method is deprecated as of coreCT version 1.3.0.
convDir(directory = file.choose(), upperLim = 3045, lowerLim = -1025, airHU = -850.3233, airSD = 77.6953, SiHU = 271.7827, SiSD = 39.2814, glassHU = 1345.0696, glassSD = 45.4129, waterHU = 63.912, waterSD = 14.1728, densities = c(0.0012, 1, 1.23, 2.2), rootData = TRUE, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, pixel.minimum = 4)
convDir(directory = file.choose(), upperLim = 3045, lowerLim = -1025, airHU = -850.3233, airSD = 77.6953, SiHU = 271.7827, SiSD = 39.2814, glassHU = 1345.0696, glassSD = 45.4129, waterHU = 63.912, waterSD = 14.1728, densities = c(0.0012, 1, 1.23, 2.2), rootData = TRUE, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, pixel.minimum = 4)
directory |
a character string that can be a matrix of DICOM images or the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
upperLim |
upper bound cutoff for pixels (Hounsfield Units) |
lowerLim |
lower bound cutoff for pixels (Hounsfield Units) |
airHU |
mean value for air-filled calibration rod (Hounsfield Units) |
airSD |
standard deviation for air-filled calibration rod |
SiHU |
mean value for colloidal silica calibration rod |
SiSD |
standard deviation for colloidal Si calibration rod |
glassHU |
mean value for glass calibration rod |
glassSD |
standard deviation for glass calibration rod |
waterHU |
mean value for water filled calibration rod |
waterSD |
standard deviation for water filled calibration rod |
densities |
numeric vector of known cal rod densities. Format must be c(air, water, Si, glass) |
rootData |
if TRUE, |
diameter.classes |
if rootData is TRUE, this argument provides an integer vector of diameter cut points used by |
class.names |
placeholder, not used presently |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the area and volume of material classes for each CT slice in a directory. Unlike conv
, convDir
accepts a folder of raw values and makes the conversion to Hounsfield Units using the metadata associated with the DICOM images.
value convDir
returns a dataframe with one row per CT slice. Values returned are the area and volume of seven material classes: gas, peat, roots and rhizomes, rock and shell, fine mineral particles, sand, and water. If rootData = TRUE
, the output will also contain data on the abundance (number of particles), volume (cm3), and external surface area (cm2) of the root size classes specified in the diameter.classes
argument.
convDir
is a wrapper for conv
. rootSizeDir
operates similarly.
materials <- convDir("core_426", rootData = FALSE) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
materials <- convDir("core_426", rootData = FALSE) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
Converts raw CT units to material classes for each CT slice. This version accommodates calibration curves with >4 calibrants, and uses density thresholds converted to Hounsfield Units using the calibration curve (rather than direct calibration rod values) to partition sediment components.
convert(mat.list, upperLim = 3045, lowerLim = -1025, pixelA, thickness = 0.625, # all in mm means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2))
convert(mat.list, upperLim = 3045, lowerLim = -1025, pixelA, thickness = 0.625, # all in mm means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2))
mat.list |
list of DICOM images for a sediment core (values in Hounsfield Units) |
upperLim |
upper bound cutoff for pixels (Hounsfield Units) |
lowerLim |
lower bound cutoff for pixels (Hounsfield Units) |
pixelA |
pixel area (mm2) |
thickness |
slice thickness for computed tomography image series (mm) |
means |
mean values (units = Hounsfield Units) for calibration rods used. |
sds |
standard deviations (units = Hounsfield Units) for calibration rods used. Must be in the same order as |
densities |
numeric vector of known cal rod densities. Must be in the same order as |
Calculates average Hounsfield units, cross-sectional areas (cm2), volumes (cm3), and masses (g) of material classes for each CT slice. This function assumes that core walls and all non-sediment material have been removed from the raw DICOM imagery. This function converts data from raw x-ray attenuation values to Hounsfield Units, and then uses user-defined calibration rod inputs to categorize sediment components: air, roots and rhizomes, peat, water, particulates, sand, and rock/shell. The input style for calibration rods ensures sediment components are partitioned following the density divisions in Davey et al. 2011. Calibration rods and are used to develop the calibration curve. Separately, the densities used for partitioning in Davey et al. 2011 (0.0012, 1, 1.23, 2.2 g/cm3) are converted to Hounsfield Units and used for partitioning sediment components. The standard deviation for the calibration rod nearest to the target value is used for the standard deviation for the division between two sediment components.
value convert
returns a dataframe with one row per CT slice. Values returned are the average Hounsfield Unit value, the area (cm2), volume (cm3), and mass (grams) of 7 material classes: gas, peat, roots and rhizomes, particulates, sand, water, and rock/shell. If <code>rootData = TRUE</code>, data for specified root size classes are also returned. See <code>getRoots</code> for more detail on those values.
getRoots
operates similarly.
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- convert(HU_426, pixelA = 0.0596) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- convert(HU_426, pixelA = 0.0596) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
Calculates the area and volume of material classes for each CT slice in a directory. This version accommodates calibration curves with >4 calibrants, and uses density thresholds converted to Hounsfield Units using the calibration curve (rather than direct calibration rod values) to partition sediment components.
convertDir(directory = file.choose(), upperLim = 3045, lowerLim = -1025, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), rootData = TRUE, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, pixel.minimum = 4)
convertDir(directory = file.choose(), upperLim = 3045, lowerLim = -1025, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), rootData = TRUE, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, pixel.minimum = 4)
directory |
a character string that can be a matrix of DICOM images or the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
upperLim |
upper bound cutoff for pixels (Hounsfield Units) |
lowerLim |
lower bound cutoff for pixels (Hounsfield Units) |
means |
mean values (units = Hounsfield Units) for calibration rods used. |
sds |
standard deviations (units = Hounsfield Units) for calibration rods used. Must be in the same order as |
densities |
numeric vector of known cal rod densities. Format must be c(air, water, Si, glass) |
rootData |
if TRUE, |
diameter.classes |
if rootData is TRUE, this argument provides an integer vector of diameter cut points used by |
class.names |
placeholder, not used presently |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the area and volume of material classes for each CT slice in a directory. Unlike conv
, convDir
accepts a folder of raw values and makes the conversion to Hounsfield Units using the metadata associated with the DICOM images.
value convertDir
returns a dataframe with one row per CT slice. Values returned are the area and volume of seven material classes: gas, peat, roots and rhizomes, rock and shell, fine mineral particles, sand, and water. If rootData = TRUE
, the output will also contain data on the abundance (number of particles), volume (cm3), and external surface area (cm2) of the root size classes specified in the diameter.classes
argument.
convertDir
is a wrapper for convert
. getRootsDir
operates similarly.
materials <- convertDir("core_426", rootData = FALSE) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
materials <- convertDir("core_426", rootData = FALSE) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package mass.long <- reshape2::melt(materials, id.vars = c("depth"), measure.vars = grep(".g", names(materials))) ggplot2::ggplot(data = mass.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("mass per section (g)") ## End(Not run)
Three computed tomography scans from a Spartina alterniflora core
data(core_426)
data(core_426)
A list of 3 matrices, each with two elements: header and image data
Provides the raw data and plots a frequency distibution for Hounsfield Units in the entire core, also delineating material classes. As of coreCT version 1.3.0, this code accommodates calibration curves with >4 calibrants, and uses density thresholds converted to Hounsfield Units using the calibration curve (rather than direct calibration rod values) to partition sediment components.
coreHist(directory = file.choose(), units = "percent", upperLim = 3045, lowerLim = -1025, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), returnData = TRUE, pngName = NULL)
coreHist(directory = file.choose(), units = "percent", upperLim = 3045, lowerLim = -1025, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), returnData = TRUE, pngName = NULL)
directory |
a character string that can be (1) a matrix of DICOM images that exists in the global environment, or (2) the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
units |
units to be used for plotting purposes: either "percent" (the default) or "absolute" |
upperLim |
upper bound cutoff for pixels (Hounsfield Units); upper bound is inclusive |
lowerLim |
lower bound cutoff for pixels (Hounsfield Units); lower bound is exclusive |
means |
mean values (units = Hounsfield Units) for calibration rods used. |
sds |
standard deviations (units = Hounsfield Units) for calibration rods used. Must be in the same order as |
densities |
numeric vector of known cal rod densities. Must be in the same order as |
returnData |
if |
pngName |
if this is not |
list if returnData = TRUE
, a list is returned containing (1) the frequencies for each Hounsfield unit value from lowerLim
to upperLim
, (2) the boundaries for material classes, and (3) a summary of the calibration curve applied. Lower boundaries for a component class are exclusive, while upper bounds are inclusive. These materials allow the frequency distribution to be plotted by the user. If returnData = FALSE
the data are plotted in the graphics window, but nothing is preserved.
# data(core_426) coreHist("core_426", returnData = FALSE)
# data(core_426) coreHist("core_426", returnData = FALSE)
Calculates the number of root/rhizome particles, volumes, and surface areas, for different size classes. This version accommodates calibration curves with >4 calibrants, and uses density thresholds converted to Hounsfield Units using the calibration curve (rather than direct calibration rod values) to partition sediment components.
getRoots(mat.list, pixelA, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, thickness = 0.625, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), pixel.minimum = 4)
getRoots(mat.list, pixelA, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, thickness = 0.625, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), pixel.minimum = 4)
mat.list |
list of DICOM images for a sediment core (values in Hounsfield Units) |
pixelA |
pixel area (mm2) |
diameter.classes |
an integer vector of diameter cut points. Units are mm (zero is added in automatically). |
class.names |
not used presently |
thickness |
slice thickness for computed tomography image series (mm) |
means |
mean values (units = Hounsfield Units) for calibration rods used. |
sds |
standard deviations (units = Hounsfield Units) for calibration rods used. Must be in the same order as |
densities |
numeric vector of known cal rod densities. Must be in the same order as |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the number of root/rhizome particles, volumes, and surface areas, for different size classes. This function requires that values be Hounsfield Units (i.e., data must be semi-processed from the raw DICOM imagery).
value getRoots
returns a dataframe with one row per CT slice. Values returned are the number, volume (cm3), and surface area (cm2) of particles in each size class with an upper bound defined in diameter.classes
.
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) rootChars <- getRoots(HU_426, pixelA = 0.0596, diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) rootChars <- getRoots(HU_426, pixelA = 0.0596, diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
Calculates the number of root/rhizome particles and surface areas, for different size classes
getRootsDir(directory = file.choose(), diameter.classes = c(1, 2, 5, 10, 20), class.names = diameter.classes, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), pixel.minimum = 1)
getRootsDir(directory = file.choose(), diameter.classes = c(1, 2, 5, 10, 20), class.names = diameter.classes, means = c(-850.3233, 63.912, 271.7827, 1345.0696), sds = c(77.6953, 14.1728, 39.2814, 45.4129), densities = c(0.0012, 1, 1.23, 2.2), pixel.minimum = 1)
directory |
a character string that can be a matrix of DICOM images or the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
diameter.classes |
an integer vector of diameter cut points. Units are mm (zero is added in automatically). |
class.names |
not used presently |
means |
mean values (units = Hounsfield Units) for calibration rods used. |
sds |
standard deviations (units = Hounsfield Units) for calibration rods used. Must be in the same order as |
densities |
numeric vector of known cal rod densities. Must be in the same order as |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the number of root/rhizome particles and surface areas, for different size classes. Unlike getRoots
, getRootsDir
accepts a folder of raw values and makes the conversion to Hounsfield Units using the metadata associated with the DICOM images. This version accommodates calibration curves with >4 calibrants, and uses density thresholds converted to Hounsfield Units using the calibration curve (rather than direct calibration rod values) to partition sediment components.
value getRootData
returns a dataframe with one row per CT slice. Values returned are the number, volume (cm3), and surface area (cm2) of particles in each size class with an upper bound defined in diameter.classes
.
getRootsDir
is a wrapper for getRoots
. getRootsDir
operates similarly.
rootChars <- getRootsDir("core_426", diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
rootChars <- getRootsDir("core_426", diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
Identifies and removes artificial surface layers from processed CT data
getSurface(x, material = "particulates", threshold = 0.40, start = "top", thickness = 0.625)
getSurface(x, material = "particulates", threshold = 0.40, start = "top", thickness = 0.625)
x |
dataframe created by |
material |
material used for determining where the surface begins |
threshold |
decimal fraction of total area, used to determine the surface layer. Surface slices where |
start |
should core be processed from the top, bottom, or both? |
thickness |
CT image thickness (mm) |
Identifies and removes artificial surface layers from processed CT data. Areas can be removed from one or both ends of the core (set by start
), based on exceeding a threshold
proportion of material (e.g., 75
value getSurface
shortens the output of conv
to remove artificial surface layers. The output is thus a subset of the input, and identical in structure to the /codeconv output.
### Not run: ## Not run: data(core_426) ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- conv(HU_426) head(materials[, 1:6], 20) materials2 <- getSurface(materials) head(materials2[, 1:6]) ## End(Not run)
### Not run: ## Not run: data(core_426) ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) materials <- conv(HU_426) head(materials[, 1:6], 20) materials2 <- getSurface(materials) head(materials2[, 1:6]) ## End(Not run)
Calculates the number of root/rhizome particles, volumes, and surface areas, for different size classes. This approach directly replicates Earl Davey's manual classification approach. This method is deprecated as of coreCT version 1.3.0.
rootSize(mat.list, pixelA, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, thickness = 0.625, airHU = -850.3233, airSD = 77.6953, waterHU = 63.912, waterSD = 14.1728, pixel.minimum = 4)
rootSize(mat.list, pixelA, diameter.classes = c(1, 2, 2.5, 10), class.names = diameter.classes, thickness = 0.625, airHU = -850.3233, airSD = 77.6953, waterHU = 63.912, waterSD = 14.1728, pixel.minimum = 4)
mat.list |
list of DICOM images for a sediment core (values in Hounsfield Units) |
pixelA |
pixel area (mm2) |
diameter.classes |
an integer vector of diameter cut points. Units are mm (zero is added in automatically). |
class.names |
not used presently |
thickness |
CT image thickness (mm) |
airHU |
mean value for air-filled calibration rod (all rod arguments are in Hounsfield Units) |
airSD |
standard deviation for air-filled calibration rod |
waterHU |
mean value for water-filled calibration rod |
waterSD |
standard deviation for water-filled calibration rod |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the number of root/rhizome particles, volumes, and surface areas, for different size classes. This function requires that values be Hounsfield Units (i.e., data must be semi-processed from the raw DICOM imagery).
value rootSize
returns a dataframe with one row per CT slice. Values returned are the number, volume (cm3), and surface area (cm2) of particles in each size class with an upper bound defined in diameter.classes
.
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) rootChars <- rootSize(HU_426, pixelA = 0.0596, diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
ct.slope <- unique(extractHeader(core_426$hdr, "RescaleSlope")) ct.int <- unique(extractHeader(core_426$hdr, "RescaleIntercept")) # convert raw units to Hounsfield units HU_426 <- lapply(core_426$img, function(x) x*ct.slope + ct.int) rootChars <- rootSize(HU_426, pixelA = 0.0596, diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
Calculates the number of root/rhizome particles and surface areas, for different size classes. This approach directly replicates Earl Davey's manual classification approach. This method is deprecated as of coreCT version 1.3.0.
rootSizeDir(directory = file.choose(), diameter.classes = c(1, 2, 5, 10, 20), class.names = diameter.classes, airHU = -850.3233, airSD = 77.6953, waterHU = 63.912, waterSD = 14.1728, pixel.minimum = 1)
rootSizeDir(directory = file.choose(), diameter.classes = c(1, 2, 5, 10, 20), class.names = diameter.classes, airHU = -850.3233, airSD = 77.6953, waterHU = 63.912, waterSD = 14.1728, pixel.minimum = 1)
directory |
a character string that can be a matrix of DICOM images or the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
diameter.classes |
an integer vector of diameter cut points. Units are mm (zero is added in automatically). |
class.names |
not used presently |
airHU |
mean value for air-filled calibration rod (all rod arguments are in Hounsfield Units) |
airSD |
standard deviation for air-filled calibration rod |
waterHU |
mean value for water-filled calibration rod |
waterSD |
standard deviation for water-filled calibration rod |
pixel.minimum |
minimum number of pixels needed for a clump to be identified as a root |
Calculates the number of root/rhizome particles and surface areas, for different size classes. Unlike rootSize
, rootSizeDir
accepts a folder of raw values and makes the conversion to Hounsfield Units using the metadata associated with the DICOM images.
value rootSize
returns a dataframe with one row per CT slice. Values returned are the number, volume (cm3), and surface area (cm2) of particles in each size class with an upper bound defined in diameter.classes
.
rootSizeDir
is a wrapper for rootSize
. rootSizeDir
operates similarly.
rootChars <- rootSizeDir("core_426", diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
rootChars <- rootSizeDir("core_426", diameter.classes = c(2.5, 10)) ## Not run: # plot using "ggplot" package after transforming with "reshape2" package area.long <- reshape2::melt(rootChars, id.vars = c("depth"), measure.vars = grep("Area", names(rootChars))) ggplot2::ggplot(data = area.long, ggplot2::aes(y = -depth, x = value, color = variable)) + ggplot2::geom_point() + ggplot2::theme_classic() + ggplot2::xlab("root external surface area per slice (cm2)") ## End(Not run)
Extract pixel area and slice thickness from DICOM header to characterize voxel (3D pixel) dimensions.
voxDims(directory = file.choose())
voxDims(directory = file.choose())
directory |
a character string that can be a matrix of DICOM images or the address of an individual DICOM file in a folder of DICOM images. The default action is <code>file.choose()</code>; a browser menu appears so the user can select the the desired directory by identifying a single DICOM file in the folder of images. |
value voxDims
returns a two-column dataframe showing the pixel area and slice thickness. Values in the DICOM headers are assumed to be millimeters; pixel area and slice thickness columns are labeled based on this assumption.
# data(core_426) voxDims("core_426")
# data(core_426) voxDims("core_426")