Package 'BoneProfileR'

Title: Tools to Study Bone Compactness
Description: Bone Profiler is a scientific method and a software used to model bone section for paleontological and ecological studies. See Girondot and Laurin (2003) <https://www.researchgate.net/publication/280021178_Bone_profiler_A_tool_to_quantify_model_and_statistically_compare_bone-section_compactness_profiles> and Gônet, Laurin and Girondot (2022) <https://palaeo-electronica.org/content/2022/3590-bone-section-compactness-model>.
Authors: Marc Girondot [aut, cre]
Maintainer: Marc Girondot <[email protected]>
License: GPL-2
Version: 3.1
Built: 2024-11-23 03:19:02 UTC
Source: https://github.com/cran/BoneProfileR

Help Index


A Model for Bone Compactness.

Description

A Model for Bone Compactness.
The lastest version of this package can always been installed using:
install.packages(c("imager", "tiff", "ijtiff", "HelpersMG", "knitr", "rmarkdown", "openxlsx", "shiny"))
install.packages("https://hebergement.universite-paris-saclay.fr/marcgirondot/CRAN/HelpersMG.tar.gz", repos=NULL, type="source")
install.packages("https://hebergement.universite-paris-saclay.fr/marcgirondot/CRAN/BoneProfileR.tar.gz", repos=NULL, type="source")
BoneProfileR uses a new results management software that is developed as part of the HelpersMG package. Using this results management system (RM), all the results are stored as part of the analyzed image.
This results management software has been developed to help users to maintain the results associated with the methodology used to obtain it. It is part of the large movement in science of replicative research.
An analysis is then stored with the image in a single file with the following information:
name, timestamp, bg, fg, threshold, contour, centers, peripherie, compactness, array.compactness, cut.distance.center, cut.angle, used.centers, compactness.synthesis, partial, rotation.angle, global.compactness, optim, optimRadial
Several analyses can be stored within a single file.
BoneProfileR logo

Details

A model for bone compactness.

Package: BoneProfileR
Type: Package
Version: 3.1 build 802
Date: 2024-08-24
License: GPL (>= 2)
LazyLoad: yes

Author(s)

Marc Girondot [email protected]

References

Girondot M, Laurin M (2003) Bone Profiler: a tool to quantify, model, and statistically compare bone-section compactness profiles. Journal of Vertebrate Paleontology 23: 458-461

Laurin M, Girondot M, Loth M-M (2004) The evolution of long bone microstructure and lifestyle in lissamphibians. Paleobiology 30: 589-613

Gônet, Jordan, Michel Laurin, and Marc Girondot. 2022. BoneProfileR: The Next Step to Quantify, Model and Statistically Compare Bone Section Compactness Profiles. Paleontologica Electronica. 25(1): a12

Gônet, J., Bardin, J., Girondot, M., Hutchinson, J., Laurin, M., (2023). Deciphering locomotion in reptiles: application of elliptic Fourier transforms to femoral microanatomy. Zoological Journal of the Linnean Society 198, 1070-1091.

Gônet, J., Bardin, J., Girondot, M., Hutchinson, J.R., Laurin, M., (2023). Locomotor and postural diversity among reptiles viewed through the prism of femoral microanatomy: palaeobiological implications for some Permian and Mesozoic taxa. Journal of Anatomy 242, 891-916.

Gônet, J., Bardin, J., Girondot, M., Hutchinson, J.R., Laurin, M., (2023). Unravelling the postural diversity of mammals: contribution of humeral cross-sections to palaeobiological inferences. Journal of Mamalian Evolution 30, 321-337.

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 plot(bone, type="original")
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic", method="Accurate")
 # Note that some parts of the section are concave but it does not give problems in the analysis
 # For section with very strong concavity, it is safer to use:
 # bone <- BP_DetectCenters(bone=bone, analysis="logistic", method="AccurateConvex")
 plot(bone, type="original")
 plot(bone, type="mineralized")
 plot(bone, type="unmineralized")
 plot(bone, type="section")
 plot(bone, type="colors")
 plot(bone, type="3Dcolors")
 bone <- BP_EstimateCompactness(bone, analysis="logistic", center="ontogenetic")
 plot(bone, type="original")
 plot(bone, type="mineralized")
 plot(bone, type="observations")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone, type="model", analysis=1)
 plot(bone, type="observations+model", analysis=1)
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1, K2=1), 
                fixed.parameters=NULL, analysis="flexit")
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
# pdf(file = "Figure 2.pdf", width = 8, height = 10, pointsize = 12)
layout(1:2)
plot(bone, type="observations+model", analysis="logistic", restorePar=FALSE, mar=c(4, 4, 2, 5))
plot(bone, type="observations+model", analysis="flexit", restorePar=FALSE, mar=c(4, 4, 2, 5))
layout(1)
# dev.off()
 out4p <- plot(bone, type="observations+model", analysis="logistic")
 out6p <- plot(bone, type="observations+model", analysis="flexit")
 bone <- BP_FitBayesianCompactness(bone, analysis="logistic")
 plot(bone, type="observations+model", CI="MCMC")
 bone <- BP_FitBayesianCompactness(bone, analysis="flexit")
 plot(bone, type="observations+model", CI="MCMC", analysis="flexit")
 plot(bone, type="mcmc", parameter="P", 
      options.mcmc=list(xlim=c(0.55, 0.57), breaks=seq(from=0, to=1, by=0.001)))
 plot(bone, type="mcmc", parameter="S", 
      options.mcmc=list(xlim=c(0.02, 0.05), breaks=seq(from=0.02, to=.05, by=0.001)))
 plot(bone, type="mcmc", parameter="Min", 
      options.mcmc=list(xlim=c(0.05, 0.08), breaks=seq(from=0, to=1, by=0.001)))
 plot(bone, type="mcmc", parameter="Max", 
      options.mcmc=list(xlim=c(0.95, 0.97), breaks=seq(from=0, to=1, by=0.001)))
 outMCMC <- RM_get(x = bone, RM = "RM", RMname = "logistic", valuename = "mcmc")
 summary(outMCMC)
 outMCMC <- RM_get(x = bone, RM = "RM", RMname = "flexit", valuename = "mcmc")
 summary(outMCMC)
 # pdf(file = "Figure 3.pdf", width = 8, height = 10, pointsize = 12)
 layout(1:2)
 plot(bone, type="mcmc", parameter="K1", analysis="flexit", 
      options.mcmc=list(xlim=c(-1, 3), ylim=c(0,10), 
      breaks=seq(from=-1, to=3, by=0.001), 
      legend = FALSE, show.prior = FALSE, mar=c(4, 4, 1, 6)), restorePar=FALSE)
 segments(x0=1, x1=1, 
         y0=0, y1=10, lty=4, lwd=3)
 text(x=ScalePreviousPlot(x=0.95, y=0.95)$x, 
      y=ScalePreviousPlot(x=0.95, y=0.95)$y, labels="A", cex=3)
 plot(bone, type="mcmc", parameter="K2", analysis="flexit", 
      options.mcmc=list(xlim=c(-1, 3), ylim=c(0,10), 
      breaks=seq(from=-1, to=3, by=0.001), 
      legend = FALSE, show.prior = FALSE, mar=c(4, 4, 1, 6)), restorePar=FALSE)
 segments(x0=1, x1=1, 
         y0=0, y1=10, lty=4, lwd=3)
 text(x=ScalePreviousPlot(x=0.95, y=0.95)$x, 
      y=ScalePreviousPlot(x=0.95, y=0.95)$y, labels="B", cex=3)
 # dev.off()
 
 bone <- BP_FitMLRadialCompactness(bone, analysis = "flexit")
 plot(bone, type="radial", radial.variable=c("P", "S"), analysis = "flexit")
 plot(bone, type="radial", radial.variable=c("P", "S", "Min", "Max"), analysis = "flexit")
 out <- RM_get(x=bone, RMname="flexit", valuename = "optimRadial")$synthesis
 mean(out[, "P"]); sd(out[, "P"])
 range(out[, "S"])
 quantile(out[, "S"])
 # pdf(file = "Figure 4.pdf", width=7, height = 9, pointsize = 12)
 layout(1:2)
 plot(bone, type="radial", radial.variable="P", analysis = "flexit", restorePar=FALSE)
 text(x=ScalePreviousPlot(x=0.95, y=0.95)$x, 
      y=ScalePreviousPlot(x=0.95, y=0.95)$y, labels="A", cex=3)
 plot(bone, type="radial", radial.variable="S", analysis = "flexit", restorePar=FALSE)
 text(x=ScalePreviousPlot(x=0.95, y=0.95)$x, 
      y=ScalePreviousPlot(x=0.95, y=0.95)$y, labels="B", cex=3)
 # dev.off()
 #' # How many times this package has been download
library(cranlogs)
BoneProfileR <- cran_downloads("BoneProfileR", from = "2021-10-07", 
                            to = Sys.Date() - 1) 
sum(BoneProfileR$count)
plot(BoneProfileR$date, BoneProfileR$count, type="l", bty="n", 
     xlab="Download date", ylab="Number of downloads")

## End(Not run)

Run a shiny application to fit bone section

Description

Run a shiny application to fit bone section

Usage

BP()

Details

BP runs a shiny application to fit bone section

Value

Nothing

Author(s)

Marc Girondot [email protected]

Examples

## Not run: 
# Not run:
library(BoneProfileR)
BP()

## End(Not run)

Fit model automatically

Description

Open an image, fit a model and generate a report.

Usage

BP_AutoFit(
  file = file.choose(),
  xlsx = TRUE,
  rotation.angle = 0,
  center = "ontogenetic"
)

Arguments

file

The file to be opened

xlsx

TRUE, FALSE or the name and path of the report

rotation.angle

The angle of rotation for analysis

center

Which center to be used.

Details

BP_AutoFit fits model automatically

Value

Characteristics of an image with all the fit information

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_AutoFit(file=path_Hedgehog, xlsx=TRUE)
 # or to open a dialog box
 bone <- BP_AutoFit()

## End(Not run)

Let the use to choose the background color of an image

Description

Let the user to choose the background color of an image.

Usage

BP_ChooseBackground(bone, analysis = 1)

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

Details

BP_ChooseBackground lets the use to choose the background color of an image

Value

The orignial bone object with a new attribute for background color

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
 path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.tif", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_ChooseBackground(bone=bone)
 bone <- BP_ChooseForeground(bone=bone)
 plot(bone)
 
## End(Not run)

Let the user to choose the center of the bone

Description

Let the user to choose the center of the bone.

Usage

BP_ChooseCenter(bone, analysis = 1)

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

Details

BP_ChooseCenter lets the use to choose the center of the bone

Value

The orignal bone object with a new attribute for center

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 bone <- BP_ChooseCenter(bone=bone)
 # For partial section, only BP_ChooseCenter() must be used
 path_Dicynodon <- system.file("extdata", "Dicynodon_tibia_11.11.1.T_b_b-1.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Dicynodon)
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 bone <- BP_ChooseCenter(bone=bone)
 bone <- BP_EstimateCompactness(bone, center="user", partial=TRUE)
 bone <- BP_FitMLCompactness(bone, analysis=1)
 plot(bone, type="observations+model")

## End(Not run)

Let the user to choose the foreground color of an image

Description

Let the user to choose the foreground color of an image.

Usage

BP_ChooseForeground(bone, analysis = 1)

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

Details

BP_ChooseForeground let the user to choose the foreground color of an image

Value

The orignial bone object with a new attribute for foreground color

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
 bone <- BP_OpenImage()
 bone <- BP_ChooseBackground(bone=bone)
 bone <- BP_ChooseForeground(bone=bone)
 plot(bone)

## End(Not run)

Detects the background color of an image

Description

Detects the background color of an image.

Usage

BP_DetectBackground(bone, analysis = 1, show.plot = TRUE)

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

show.plot

should plot is shown ?

Details

BP_DetectBackground detects the background color of an image

Value

The orignial bone object with a new attribute for background color

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
 bone <- BP_OpenImage()
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 plot(bone)

## End(Not run)

Detect the centers of an image

Description

Detects the centers of an image. Note that this function must not be used with partial bone section.
The method Fast works well with the convex bone section while if the section is concave, Accurate is slower but works well in all circonstances.
Fast method is maintained here only for compatibility with versions <3.1 of BoneProfileR.
If the section is concave, the methods FastConvex and AccurateConvex return a minimum convex section.

Usage

BP_DetectCenters(bone, analysis = 1, show.plot = TRUE, method = "Accurate")

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

show.plot

should plot is shown ?

method

Can be Fast, Accurate, FastConvex, or AccurateConvex

Details

BP_DetectCenters detects the centers of an image

Value

The orignial bone object with a new attribute for centers

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
 bone <- BP_OpenImage()
 # or 
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 bone <- BP_DetectCenters(bone=bone)
 plot(bone, type="mineralized", show.grid=FALSE)
 plot(bone, type="unmineralized", show.grid=FALSE)
 plot(bone, type="section", show.grid=FALSE)
 # Note that some parts of the section are concave but it does not give problems in the analysis
 # For section with very strong concavity, it could be safer to use:
 bone <- BP_DetectCenters(bone=bone, analysis="logistic", method="AccurateConvex")
 plot(bone, type="mineralized", show.grid=FALSE)
 plot(bone, type="unmineralized", show.grid=FALSE)
 plot(bone, type="section", show.grid=FALSE)

## End(Not run)

Detects the foreground color of an image

Description

Detects the foreground color of an image.

Usage

BP_DetectForeground(bone, analysis = 1, show.plot = TRUE)

Arguments

bone

The bone image to be used

analysis

The name or rank of analysis

show.plot

should plot is shown ?

Details

BP_DetectForeground detects the foreground color of an image

Value

The orignial bone object with a new attribute for foreground color

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
 bone <- BP_OpenImage()
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 plot(bone)

## End(Not run)

Duplicates an analysis stored in an object

Description

Duplicates an analysis stored in an object.

Usage

BP_DuplicateAnalysis(bone, from = 1, to = 2)

Arguments

bone

The bone image to be used

from

The name or rank of analysis to be duplicated

to

The name or rank of analysis to be created

Details

BP_DuplicateAnalysis duplicates an analysis stored in an object

Value

The orignial bone object with a new analysis

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")

## End(Not run)

Estimation of the compactness of a bone section

Description

Estimation of the compactness of a bone section.
The reference for radial estimation of compactness is the trigonometric circle for rotation.angle=0 in BP_EstimateCompactness():
- The top of the section is located at -pi/2.
- The left of the section is located at -pi and +pi.
- The bottom of the section is located at pi/2.
- The right of the section is 0.
If rotation.angle is different from 0, the value of rotation.angle is added to the angle modulo 2.pi.
The method Fast works well with the convex bone section while if the section is concave, Accurate is slower but works well in all circonstances.
Fast method is maintained here only for compatibility with versions <3.1 of BoneProfileR.
If the section is concave, the methods FastConvex and AccurateConvex return a minimum convex section.
If the center has been automatically detected, the method parameter is ignored because it has already been used with the function BP_DetectCenters().

Usage

BP_EstimateCompactness(
  bone,
  center = "ontogenetic",
  partial = FALSE,
  cut.angle = 60,
  cut.distance = 100,
  rotation.angle = 0,
  analysis = 1,
  method = "Accurate",
  show.plot = TRUE
)

Arguments

bone

The bone image to be used

center

Which center to be used: user, mineralized, unmineralized, section, ontogenetic

partial

Is the section partial?

cut.angle

Number of angles

cut.distance

Number of distances

rotation.angle

The angle of rotation for analysis

analysis

The name or rank of analysis

method

Can be Fast, Accurate, FastConvex, or AccurateConvex

show.plot

should plot is shown ?

Details

BP_EstimateCompactness estimates the compactness of a bone section

Value

The orignial bone object with a new attribute for compactness

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
 bone <- BP_OpenImage()
 # or 
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 bone <- BP_DetectCenters(bone=bone)
 bone <- BP_EstimateCompactness(bone)
 plot(bone, type="original", show.grid=FALSE)
 plot(bone, type="mineralized", show.grid=FALSE)
 plot(bone, type="unmineralized", show.grid=FALSE)
 plot(bone, type="section", show.grid=FALSE)

## End(Not run)

Estimation of Bayesian model of a bone section

Description

Estimation of Bayesian model of a bone section.

Usage

BP_FitBayesianCompactness(
  bone = stop("A result from BP_FitMLCompactness() must be provided"),
  priors = NULL,
  n.iter = 10000,
  n.chains = 1,
  n.adapt = 100,
  thin = 1,
  analysis = 1,
  silent = TRUE
)

Arguments

bone

The bone image to be used

priors

Priors

n.iter

Number of iterations

n.chains

Number of chains

n.adapt

Number of iteration to adapt

thin

Thin parameter for analysis

analysis

Name or rank of analysis

silent

Should some information must me shown ?

Details

BP_FitBayesianCompactness estimates Bayesian model of a bone section

Value

The -Ln L

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
 library(BoneProfileR)
 path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1, K2=1), 
                fixed.parameters=NULL, analysis="flexit")
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
 out4p <- plot(bone, type="observations+model", analysis="logistic")
 out6p <- plot(bone, type="observations+model", analysis="flexit")
 bone <- BP_FitBayesianCompactness(bone, analysis="logistic")
 plot(bone, type="observations+model", CI="MCMC", analysis="logistic")
 bone <- BP_FitBayesianCompactness(bone, analysis="flexit")
 plot(bone, type="observations+model", CI="MCMC", analysis="flexit")

## End(Not run)

Estimation of the likelihood of a bone section

Description

Estimation of the model of compactness of a bone section.
The two-steps analysis performs first a quasi-Newton method, then a Bayesian MCMC and finally again a quasi-Newton method. It generally ensures that global minimum is found. On the other hand, it doubles the time to complete.

Usage

BP_FitMLCompactness(
  bone,
  fitted.parameters = c(P = 0.5, S = 0.05, Min = 0.001, Max = 0.999),
  priors = NULL,
  fixed.parameters = c(K1 = 1, K2 = 1),
  twosteps = TRUE,
  replicates.CI = 10000,
  analysis = 1,
  silent = FALSE
)

Arguments

bone

The bone image to be used

fitted.parameters

Parameters of the model to be fitted

priors

Priors used for intermediate estimations

fixed.parameters

Fixed parameters of the model

twosteps

Does a 2-steps analysis be performed?

replicates.CI

Number of replicates to estimate confidence interval

analysis

Name or rank of analysis

silent

Should information be shown?

Details

BP_FitMLCompactness estimates likelihood of model of a bone section

Value

The -Ln L

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
 bone <- BP_OpenImage()
 # or, to use the package imager to open a tiff image
 bone <- BP_OpenImage(ijtiff=TRUE)
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 plot(bone, type="mineralized", show.grid=FALSE)
 plot(bone, type="unmineralized", show.grid=FALSE)
 plot(bone, type="section", show.grid=FALSE)
 bone <- BP_FitMLCompactness(bone, analysis="logistic", twosteps=TRUE)
 BP_GetFittedParameters(bone)
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 BP_ListAnalyses(bone)
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1, K2=1), 
                fixed.parameters=NULL, analysis="flexit", twosteps=TRUE)
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
 out4p <- plot(bone, type="observations+model", analysis="logistic")
 out6p <- plot(bone, type="observations+model", analysis="flexit")

## End(Not run)

Estimation of the likelihood of a bone section

Description

Estimation of the compactness of a bone section using radial model.
If the fitted.parameters and fixed.parameters are NULL and the analysis includes a BP_FitMLCompactness() result, the values of this result is used as a reference for fitted.parameters and fixed.parameters.
If no BP_FitMLCompactness() result is available, it will use:
fitted.parameters=c(P=0.5, S=0.05, Min=-2, Max=5); fixed.parameters=c(K1=1, K2=1).
The reference for radial estimation of compactness is the trigonometric circle for rotation.angle=0 in BP_EstimateCompactness():
- The top of the section is located at -pi/2.
- The left of the section is located at -pi and +pi.
- The bottom of the section is located at pi/2.
- The right of the section is 0.
If rotation.angle is different from 0, the value of rotation.angle is added to the angle modulo 2.pi.
The two-steps analysis performs first a quasi-Newton method, then a Bayesian MCMC and finally again a quasi-Newton method. It generally ensures that global minimum is found. On the other hand, it doubles the time to complete for each angle.
To control the parallel computing, use:
options(mc.cores = [put here the number of cores you want use])
options(forking = FALSE)
The maximum number of cores is obtained by: parallel::detectCores()

Usage

BP_FitMLRadialCompactness(
  bone,
  fitted.parameters = NULL,
  priors = NULL,
  fixed.parameters = NULL,
  analysis = 1,
  silent = FALSE,
  twosteps = TRUE
)

Arguments

bone

The bone image to be used

fitted.parameters

Parameters of the model to be fitted

priors

If twosteps is TRUE, tell what prior should be used.

fixed.parameters

Fixed parameters of the model

analysis

Name or rank of analysis

silent

Should the function displays some information?

twosteps

Should a 2-steps analysis be performed?

Details

BP_FitMLRadialCompactness estimates likelihood of model of a bone section

Value

The -Ln L

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 # or 
 bone <- BP_OpenImage(ijtiff=TRUE)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic", cut.angle=30)
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1.01, K2=1.01), 
                fixed.parameters=NULL, analysis="flexit")
 bone <- BP_FitBayesianCompactness(bone, analysis="flexit")
 mcmc <- RM_get(bone, RMname = "flexit", value="mcmc")
 fittedpar <- as.parameters(mcmc)
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=fittedpar, 
                fixed.parameters=NULL, analysis="flexit")
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
 out4p <- plot(bone, type="observations+model", analysis="logistic")
 out6p <- plot(bone, type="observations+model", analysis="flexit")
 # The twosteps fit is more acurate but is around 100 times slower
 bone <- BP_FitMLRadialCompactness(bone, analysis="logistic", twosteps=TRUE)
 bone <- BP_FitMLRadialCompactness(bone, analysis="logistic", twosteps=FALSE)
 plot(bone, type="observations", angle=0)
 plot(bone, type="model", analysis="logistic", angle=0)
 plot(bone, type="observations+model", angle=0)
 plot(bone, type="observations+model", angle=pi)
 plot(bone, type="radial", radial.variable=c("P", "S"), analysis="logistic")
 plot(bone, type="radial", radial.variable=c("P", "S", "Min", "Max"), analysis="logistic")
 plot(bone, type="radial", radial.variable=c("TRC"), analysis="logistic")
 # Test using the change of orientation using default.angle from BP_EstimateCompactness():
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="logistic_rotation_pi")
 # With a pi rotation, the top moves to the bottom and the left moves to the right
 bone <- BP_EstimateCompactness(bone, rotation.angle=pi, analysis="logistic_rotation_pi")
 bone <- BP_FitMLRadialCompactness(bone, analysis="logistic_rotation_pi")
 plot(bone, type="radial", radial.variable=c("P", "S"), analysis="logistic")
 plot(bone, type="radial", radial.variable=c("P", "S"), analysis="logistic_rotation_pi")
 BP_Report(bone=bone, 
           analysis=1,
           docx=NULL, 
           pdf=NULL, 
           xlsx=file.path(getwd(), "report.xlsx"), 
           author="Marc Girondot", 
           title=attributes(bone)$name)

## End(Not run)

Return the fitted parameters

Description

Return the fitted parameters.

Usage

BP_GetFittedParameters(bone, analysis = 1, alloptim = FALSE)

Arguments

bone

The bone image to be used

analysis

Name or rank of analysis

alloptim

If TRUE, return the complete object returned by optim

Details

BP_GetFittedParameters returns the fitted parameters

Value

The fitted parameters

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 BP_GetFittedParameters(bone, analysis="logistic")

## End(Not run)

List the analyses stored in an object

Description

Get the analyses stored in an object.

Usage

BP_ListAnalyses(bone, silent = TRUE, max.level = FALSE)

Arguments

bone

The bone image to be used

silent

Should the results be shown ?

max.level

If TRUE, will return all list element of the objects

Details

BP_ListAnalyses lists the analyses stored in an object

Value

The list of analyses

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 BP_ListAnalyses(bone)

## End(Not run)

Estimation of the likelihood of a bone section

Description

Estimation of the compactness of a bone section.

Usage

BP_LnLCompactness(
  par,
  bone = NULL,
  data_m = NULL,
  data_nm = NULL,
  distance.center = NULL,
  fixed.parameters = NULL,
  analysis = 1
)

Arguments

par

Parameters of the model

bone

The bone image to be used

data_m

Number of mineralized pixels

data_nm

Number of non-mineralized pixels

distance.center

Distances to the center

fixed.parameters

Fixed parameters of the model

analysis

Name or rank of analysis

Details

BP_LnLCompactness estimates likelihood of model of a bone section

Value

The -Ln L

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone)
 bone <- BP_DetectForeground(bone=bone)
 bone <- BP_DetectCenters(bone=bone)
 bone <- BP_EstimateCompactness(bone)
 plot(bone)

## End(Not run)

Open an image

Description

Open an image.

Usage

BP_OpenImage(file = file.choose(), name = NULL, ijtiff = FALSE)

Arguments

file

The file to be opened

name

Name of this slice

ijtiff

Should the ijtiff must be used to read tiff image

Details

BP_OpenImage opens an image

Value

Characteristics of an image

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 plot(bone)
 path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.tif", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 plot(bone)
 bone <- BP_OpenImage(file=path_Hedgehog, ijtiff=TRUE)
 plot(bone)
 # A partial section
 path_Dicynodon <- system.file("extdata", "Dicynodon_tibia_11.11.1.T_b_b-1.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Dicynodon)
 plot(bone)
 # To open a file with a dialog:
 bone <- BP_OpenImage()

## End(Not run)

Generate a pdf report for the analyzed bone

Description

Generate a docx, xlsx, or pdf report.

Usage

BP_Report(
  bone = stop("A bone section must be provided"),
  control.plot = list(message = NULL, show.centers = TRUE, show.colors = TRUE, show.grid
    = TRUE, CI = "ML", show.legend = TRUE),
  analysis = 1,
  docx = file.path(getwd(), "report.docx"),
  pdf = file.path(getwd(), "report.pdf"),
  xlsx = file.path(getwd(), "report.xlsx"),
  author = NULL,
  title = attributes(bone)$name
)

Arguments

bone

The bone image

control.plot

A list with the parameters used for plot

analysis

Indicate analysis name or rank that you want report

docx

Name of Word file

pdf

Name of pdf file

xlsx

Name of Excel file

author

Name indicated in the report

title

Title of the report

Details

BP_Report save a pdf report for the analyzed bone

Value

Nothing

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1, K2=1), 
                fixed.parameters=NULL, analysis="flexit")
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
 bone <- BP_FitMLRadialCompactness(bone, analysis="logistic")
 # Test using the change of orientation using default.angle from BP_EstimateCompactness():
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="logistic_rotation_pi")
 # With a pi rotation, the top moves to the bottom and the left moves to the right
 bone <- BP_EstimateCompactness(bone, rotation.angle=pi, analysis="logistic_rotation_pi")
 bone <- BP_FitMLRadialCompactness(bone, analysis="logistic_rotation_pi")
 BP_Report(bone=bone, 
           analysis=1,
           docx=NULL, 
           pdf=NULL, 
           xlsx=file.path(getwd(), "report.xlsx"), 
           author="Marc Girondot", 
           title=attributes(bone)$name)
           
 BP_Report(bone=bone, 
           analysis=1,
           docx=NULL, 
           pdf=file.path(getwd(), "report.pdf"), 
           xlsx=NULL, 
           author="Marc Girondot", 
           title=attributes(bone)$name)
           
 BP_Report(bone=bone, 
           analysis=1,
           docx=file.path(getwd(), "report.docx"), 
           pdf=NULL, 
           xlsx=NULL, 
           author="Marc Girondot", 
           title=attributes(bone)$name)

## End(Not run)

Example of hedgehog femur

Description

Example of hedgehog femur. A drawing produced by Michel Laurin.

Usage

Erinaceus_europaeus

Format

A png image.

Details

Example of hedgehog femur

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), plot.BoneProfileR(), summary.BoneProfileR()

Examples

bone <- Erinaceus_europaeus
plot(bone)

Plot a bone section

Description

Display a bone section.
type value can be:
Image plot: 'original', 'mineralized', 'unmineralized', 'section'
Original is the original image, mineralized is the mineral interpretation of the section, unmineralized is the unmineralized interpretation of the section, section is the interpretation of the section.
'colors' shows the histograms of pixel information with foreground and background colors if they are defined.
'3Dcolors' show the pixels colors in 3D
Global analysis: 'observations', 'model', 'observations+model'
Radial analysis: 'radial'
If angle is not null and a radial analysis exists, it will show the model for this angle.
'mcmc': It will show the posterior distribution of parameter

Usage

## S3 method for class 'BoneProfileR'
plot(
  x,
  message = NULL,
  type = "original",
  angle = NULL,
  show.centers = TRUE,
  show.colors = TRUE,
  show.grid = TRUE,
  analysis = 1,
  parameter.mcmc = "S",
  options.mcmc = list(),
  restorePar = TRUE,
  mar = NULL,
  angle.3D = 55,
  CI = "ML",
  radial.variable = "S",
  show.legend = TRUE,
  ...
)

Arguments

x

The bone image

message

The message to be displayed

type

The type of plot; see description

angle

Which angle model to show

show.centers

Should the centers be shown?

show.colors

Should the background and foreground colors be shown?

show.grid

Should the grid be shown?

analysis

Name or number of analysis to be plotted

parameter.mcmc

The posterior parameter to show for type = "mcmc"

options.mcmc

The option to plot type mcmc output

restorePar

If TRUE, restore the par parameter at the exit

mar

The margin for type being "model" or "observations"

angle.3D

The angle between x and y for 3Dcolors graph

CI

Which confidence interval should be plotted: MCMC or ML

radial.variable

Name of the radial variable to plot

show.legend

Should a legend be shown?

...

Not used

Details

plot.BoneProfileR displays a bone section

Value

Nothing

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, summary.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
 bone <- BP_OpenImage()
 # or 
 path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 plot(bone, type="colors")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 plot(bone, type="3Dcolors")
 bone <- BP_EstimateCompactness(bone, analysis="logistic", rotation.angle = 1)
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 # 
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic")
 bone <- BP_FitMLCompactness(bone, analysis="logistic")
 plot(bone)
 plot(bone, type="observations")
 plot(bone, type="observations+model", analysis=1)
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 fittedpar <- BP_GetFittedParameters(bone, analysis="logistic")
 bone <- BP_DuplicateAnalysis(bone, from="logistic", to="flexit")
 bone <- BP_FitMLCompactness(bone, 
                fitted.parameters=c(fittedpar, K1=1, K2=1), 
                fixed.parameters=NULL, analysis="flexit")
 compare_AIC(Logistic=BP_GetFittedParameters(bone, analysis="logistic", alloptim=TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", alloptim=TRUE))
 out4p <- plot(bone, type="observations+model", analysis="logistic")
 out6p <- plot(bone, type="observations+model", analysis="flexit")
 bone <- BP_FitBayesianCompactness(bone, analysis="logistic")
 plot(bone, type="observations+model", CI="MCMC")
 bone <- BP_FitMLRadialCompactness(bone)
 plot(bone, type="radial", radial.variable=c("P", "S"))
 plot(bone, type="radial", radial.variable=c("P", "S", "Min", "Max"))

## End(Not run)

Plot a bone section

Description

Display information of bone section

Usage

## S3 method for class 'BoneProfileR'
summary(object, max.level = FALSE, analysis = 1, ...)

Arguments

object

The bone image

max.level

If TRUE, will return all list element of the objects

analysis

The analysis to report the global compacteness

...

Not used

Details

summary.BoneProfileR displays a bone section

Value

An invisible list with recorded information

Author(s)

Marc Girondot [email protected]

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR()

Examples

## Not run: 
# Not run:
library(BoneProfileR)
 bone <- BP_OpenImage()
 # or 
 path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 summary(bone)

## End(Not run)