if (FALSE) {
# 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)
}
Run the code above in your browser using DataLab