convertFromJafroc {tpfp} | R Documentation |
Convert .xlsx
File
of Jafroc
into R object
Description
Convert an FROC dataset
- from
-
.xlsx
file of Jafroc - into
-
R object
Usage
convertFromJafroc(No.of.Modalities, No.of.readers, No.of.confidence.levels)
Arguments
No.of.Modalities |
A positive integer, indicating the number of modalities for FROC data-set in |
No.of.readers |
A positive integer, indicating the number of readers for FROC data-set in an |
No.of.confidence.levels |
A positive integer, indicating the number of confidence levels for FROC data-set in |
Format
The .xlsx
file of Jafroc
consists of three sheets named TP, FP, Truth, precisely! Correctly!
(other names never be permitted !!)
———————————– TP ——————————————
A sheet named TP consists of five columns precisely named from the right hand side:
ReaderID, ModalityID, CaseID, LesionID, TP_Rating.
NOTE.
- CaseID
Note that the above word CaseID means the Image ID vectors indicating the ID of radiographs. That is "case = image = radiograph".
- the first row
Note that the first row of each sheat of
.xlsx
file is constructed by the names of column as follows:
An Example of the sheet named TP in a .xlsx
file for the Jafroc software
Interpretation of table
Throughout this explanation, we follow the convention that readers are male.
For example, the first row means the first reader (ReaderID=1) correctly find the first lesion (LesionID = 1) in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 5 (TP_Rating =5).
Similarly, the second row means the first reader (ReaderID=1) correctly find the 4-th lesion (LesionID = 4) in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 4 (TP_Rating = 4).
ReaderID | ModalityID | CaseID | LesionID | TP_Rating. |
------------------- | ------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 1 | 5 |
1 | 2 | 2 | 1 | 4 |
1 | 3 | 4 | 1 | 5 |
1 | 1 | 8 | 1 | 3 |
1 | 2 | 8 | 2 | 4 |
1 | 3 | 9 | 1 | 4 |
1 | 1 | 9 | 2 | 3 |
1 | 2 | 9 | 3 | 5 |
1 | 3 | 11 | 1 | 3 |
2 | 1 | 1 | 1 | 4 |
2 | 2 | 4 | 1 | 4 |
2 | 3 | 5 | 1 | 4 |
2 | 1 | 8 | 1 | 1 |
2 | 2 | 8 | 2 | 2 |
2 | 3 | 8 | 3 | 2 |
2 | 1 | 10 | 1 | 3 |
2 | 2 | 10 | 2 | 2 |
2 | 3 | 11 | 1 | 2 |
: | : | : | : | : |
: | : | : | : | : |
———————————– 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 file of extension ".xlsx
" file for the Jafroc software
Interpretation of table
For example, the first row means that 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).
Similarly, the second row means that 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).
Similarly, 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, namely LesionID = 1,2,3. For example, the second image (CaseID = 2) contains two lesions each of which is named 1,2, namely LesionID = 1,2. For example, the third image (CaseID = 3) contains a sinle lesion named 1, namely LesionID = 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) will have 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.
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.
Details
Convert an Excel file whose extension
is .xlsx
of Jafroc format to
an R object representing FROC data
Revised 2019 Jun 19 Revised 2019 Dec 13
The return values include a
list which can be passed to the function fit_Bayesian_FROC
.
For data of Jafroc, running this function,
we immediately can fit the author's Bayesian
FROC model to this return value.
The Jafroc software's format consists of suspicious locations marked by readers and true locations. Such data is redundant for our Bayesian statistical models. So, we reduce the information of data to the number of false positives and number of hits for each confidence levels by this function.
Data can be calculated from the following Jafroc data, in which there are more information than TP and FP. In fact, in the Jafroc data, the FP and TP are counted for each images, each lesions etc. So, it has more information.
It causes limitation of our model. So, our model start to fit a model to the reduced data from Jafroc. So, the redunction will cause the non accuracy evaluation of the observer performance. The future research I should start the Jafroc formulation.
Value
A list, representing FROC data.
References
Bayesian Models for Free-response Receiver Operating Characteristic Analysis,pre-print
See Also
Rjafroc, which is unfortunately not on CRAN, now 2019 Jun 19. Or JAFROC software in the Chakarboty's Web page. Unfortunately, this software is no longer supported.
Examples
## Only run examples in interactive R sessions
if (interactive()) {
#========================================================================================
# Example for convert the Jafroc data
#========================================================================================
# Work Flow
# step 0) Make an .xlsx file "JafrocDatasetExample.xlsx" as example data
# to be passed to the function by an interactive manner.
# step 1) Convert the "JafrocDatasetExample.xlsx" file to an R object
# In the following code, when dialog box asks users to select a file, then
# Select "JafrocDatasetExample.xlsx" in working directory.
# This is important, so I write twice, again.
# In the following code, when dialog box asks you to select a file, then
# Select "JafrocDatasetExample.xlsx" in Working directory.
# In the following code, when dialog box asks you to select a file, then
# Select "JafrocDatasetExample.xlsx" in Working directory.
#========================================================================================
# step 0) Make a Jafroc data as an example dataset
#========================================================================================
# If you can find the xlsx file named JAFROC_data.xlsx
# in the director "inst/extdata" of this package,
# Then this step 0) is redundant. The author prepares this example for the people who
# cannot find the xlsx file in the "inst/extdata" of this package.
# Using an xlsx file ( which is named JAFROC_data.xlsx and
# included in the director "inst/extdata" of this package,)
# we can reconstruct it as follows:(If someone can obtain the Excel file
# from the path tpfp/inst/extdata/JAFROC_data.xlsx, then the following code
# is not required to run, because the same xlsx file is created.
Truth <- readxl::read_excel(system.file("extdata",
"JAFROC_data.xlsx",
package="tpfp"),
sheet = "Truth")
##### utils::View(Truth)
TP <- readxl::read_excel( system.file("extdata",
"JAFROC_data.xlsx",
package="tpfp"),
sheet = "TP")
#### utils::View(TP)
FP <- readxl::read_excel( system.file("extdata",
"JAFROC_data.xlsx",
package="tpfp"),
sheet = "FP")
#### utils::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 obtain an excel file named "JafrocDatasetExample.xlsx", which is same as
# the JAFROC_data.xlsx.
# whose format is available in the Jafroc software developed by Chakraborty.
# Note that if you have an excel file
# which is formulated correctolly for our package,
# then the above process does not be required.
# (0) From the above, we obtain "JafrocDatasetExample.xlsx"
# which is the multiple reader and multiple modality dataset
# for Jafroc analysis which is Chakraborty's software Jafroc or the R package Rjafroc
# but NOT implemented in our package,.
#========================================================================================
# step 1) Convert the Jafroc data obtained in the above
#========================================================================================
# (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 files, since it is selected by interactive manner.
# So, please select the xlsx file, i.e., "JafrocDatasetExample.xlsx" obtained
# in step 0) or your own Jafroc .xlsx file.
}### Only run examples in interactive R sessions