Learn R Programming

BoneProfileR (version 4.0)

BP_Report: Generate a pdf report for the analyzed bone

Description

Generate a docx, xlsx, or pdf report.
In the xlsx report, the observed compactness is simply the ratio of the number of mineralized pixels to the number of total pixels.
The corrected modelled compactness is the compactness if the bone had the same number of pixels in the centre as on the periphery So it's a compactness that corrects for the shape of the bone.

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
)

Value

Nothing

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

Author

Marc Girondot marc.girondot@gmail.com

Details

BP_Report save a pdf report for the analyzed bone

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_FitBayesianPeriodicCompactness(), BP_FitMLCompactness(), BP_FitMLPeriodicCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

Run this code
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)
 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", 
                                     ML=TRUE, return.all = FALSE)[, "mean"]
 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", 
                                             ML=TRUE, return.all = TRUE), 
             Flexit=BP_GetFittedParameters(bone, analysis="flexit", 
                                           ML=TRUE, return.all = 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")
 # Periodic analysis
 par <- BP_GetFittedParameters(bone, analysis="logistic", ML=TRUE, return.all = FALSE)[, "mean"]
 options(mc.cores=parallel::detectCores())
 bone <- BP_FitMLPeriodicCompactness(bone, analysis="logistic", control.optim=list(trace=2), 
                                     fitted.parameters=c(par, PSin=0.001, PCos=0.001, 
                                     SSin=0.001, SCos=0.001, MinSin=0.001, MinCos=0.001, 
                                     MaxSin=0.001, MaxCos=0.001), replicates.CI=2000)
                                     
 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)
}

Run the code above in your browser using DataLab