----------------------------------- FP ------------------------------------------
A sheet named FP consists of four columns precisely named from the right hand side: ReaderID, ModalityID, CaseID, FP_Rating
An Example of a sheet named FP in a .xlsx
file for the Jafroc software
Interpretation of table
For example, the first row means the first reader (ReaderID=1) makes a false alarm location in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 2 (TP_Rating =2).
Similarily the second row means the first reader (ReaderID=1) makes a false alarm location in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 1 (TP_Rating = 1).
Similarily the 6-th and 7-th rows mean that the first reader (ReaderID=1) makes two false alarm location in the second patient (CaseID = 2). The first false alarm is in the image taken by the 1-st modality (ModalityID = 1) with his rating 1 (TP_Rating = 1). The second false alarm is in the image taken by the 3-rd modality (ModalityID = 3) with his rating 2 (TP_Rating = 2).
ReaderID | ModalityID | CaseID | FP_Rating. |
------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 2 |
1 | 2 | 2 | 1 |
1 | 3 | 3 | 1 |
1 | 1 | 5 | 2 |
1 | 2 | 7 | 1 |
1 | 3 | 7 | 2 |
1 | 1 | 9 | 3 |
1 | 2 | 9 | 4 |
1 | 3 | 10 | 1 |
2 | 1 | 1 | 2 |
2 | 2 | 2 | 3 |
2 | 3 | 3 | 4 |
2 | 1 | 8 | 1 |
2 | 2 | 9 | 1 |
2 | 3 | 11 | 1 |
2 | 1 | 14 | 1 |
2 | 2 | 15 | 1 |
2 | 3 | 21 | 2 |
: | : | : | : |
: | : | : | : |
----------------------------------- Truth ------------------------------------------
A sheet named Truth consists of three columns precisely named from the right hand side:CaseID, LesionID, Weight .
An Example of a sheet named Truth in a .xlsx
file for the Jafroc software
Interpretation of table
For example, the first image (CaseID = 1) contains three lesions each of which is named 1,2,3. For example, the second image (CaseID = 2) contains two lesions each of which is named 1,2. For example, the third image (CaseID = 3) contains a sinle lesion named 1.
CaseID | LesionID | Weight |
------------------- | ------------------- | ------------------ |
1 | 1 | 0.3333... |
1 | 2 | 0.3333... |
1 | 3 | 0.3333... |
2 | 1 | 0.5 |
2 | 2 | 0.5 |
3 | 1 | 1 |
4 | 1 | 0.25 |
4 | 2 | 0.25 |
4 | 3 | 0.25 |
4 | 4 | 0.25 |
5 | 1 | 0.5 |
5 | 2 | 0.5 |
6 | 1 | 0.3333... |
6 | 2 | 0.3333... |
6 | 3 | 0.3333... |
7 | 1 | 0.3333... |
7 | 2 | 0.3333... |
7 | 3 | 0.3333... |
8 | 1 | 0.25 |
8 | 2 | 0.25 |
8 | 3 | 0.25 |
8 | 4 | 0.25 |
: | : | : |
: | : | : |
Note that the weght are used such that each image influences a same effect on the esimates. Without weight, the images including many targets (lesions) has very strong effect on the estimates. To avoid such bias, Jafroc uses weight. In another context, weight would be used to specify more important lesions in each image.
Revised 2019 Dec 13
However, in this package, we do not use the information of weight. Since the theory of the author of this package did not consider such weight. In the future I have to include the notion of weight. Jafroc use the notion fo figure of metric as non parametric manner. So, it seems difficult to include it in the Bayesian model, since generally speaking, Bayesian methodology is parametric.
# NOT RUN {
# }
# NOT RUN {
#--------------------------------------------------------------------------------------
# Example for convert the Jafroc data to the BayesianFROC
#--------------------------------------------------------------------------------------
# Work Flow of this example
# step 0) Prepare Jafroc .xlsx file contained in this package
# step 1) Convert the .xlxs file obtained in step 0)
# step 2) Fit a model to data object obtained in step 1)
#--------------------------------------------------------------------------------------
# step 0) Make a Jafroc data
#--------------------------------------------------------------------------------------
# If you can search the xlsx file named JAFROC_data.xlsx
# in the director "inst/extdata" of this package,
# Then this step 0) is redundant. The author prepare this example for the people who
# cannot search the xlsx file in the "inst/extdata" of this package.
# By an xlsx file named JAFROC_data.xlsx in the director "inst/extdata" of this package,
# we can reconstruct it as follows:(If someone can obtain the Excel file
# from the path BayesianFROC/inst/extdata/JAFROC_data.xlsx, then the following code
# is not required to run. If searching bother you, then run the R script to obtain the
# Excel file.)
# I do not know how to users refer the JAFROC_data.xlsx in this package,
# so I provide it by making the same xlsx file as the JAFROC_data.xlsx.
# Note that JAFROC_data.xlsx cannot remove,
# if it is removed, then devtools::run_examples() make an error.
Truth <- readxl::read_excel(system.file("extdata",
"JAFROC_data.xlsx",
package="BayesianFROC"),
sheet = "Truth")
View(Truth)
TP <- readxl::read_excel( system.file("extdata",
"JAFROC_data.xlsx",
package="BayesianFROC"),
sheet = "TP")
View(TP)
FP <- readxl::read_excel( system.file("extdata",
"JAFROC_data.xlsx",
package="BayesianFROC"),
sheet = "FP")
View(FP)
sample <- list(TP=TP,FP=FP,Truth=Truth)
openxlsx::write.xlsx(sample,"JafrocDatasetExample.xlsx")
tcltk::tkmessageBox(
message="A file named
JafrocDatasetExample.xlsx
is created in the working directory")
# Now, we get excel file named "JafrocDatasetExample.xlsx", which is same as
# the JAFROC_data.xlsx.
# whose format is available in the Jafroc software developed by Chakraborty.
# If you use your data, your data must has same format of "JafrocDatasetExample.xlsx".
# Note that other excel data must comply with the above format.
# Note that if you have proper format excel file for our package,
# this process does not need.
# (0) From the above, we obtain "JafrocDatasetExample.xlsx"
# which is the multiple reader and multiple modality dataset
# for Jfroc analysis which is NOT implemented in our package,
# but Chakraborty's software called Jafroc or the R package Rjafroc.
#--------------------------------------------------------------------------------------
# step 1) Convert a Jafroc data
#--------------------------------------------------------------------------------------
# (1) Using "JafrocDatasetExample.xlsx" as an example excel file,
# we run the function to convert the excel file from Jafroc format
# to our format:
dataList <- convertFromJafroc(
No.of.Modalities =5,
No.of.readers =4,
No.of.confidence.levels = 5
)
# In the variable, there is no xlsx file, since it is selected by interactive manner.
# So, please select the xlsx file obtained in step 0) or if have your own Jafroc
# .xlsx file.
#--------------------------------------------------------------------------------------
# step 2) Fitting a model to the converted data
#--------------------------------------------------------------------------------------
# (2) Now, we obtain a data list as the return value.
# Using this list, we run the function "fit_Bayesian_FROC":
fit <- fit_Bayesian_FROC(dataList )
# }
# NOT RUN {
# Revised 2019. Jun 19
# Revised 2019. Dec 13
# }
Run the code above in your browser using DataLab