convertFromJafroc: Convert '.xlsx' File of *_Jafroc_* into R object

Description Usage Arguments Format Details Value References See Also Examples

View source: R/convertFromJafroc.R

Description

Convert an FROC dataset

from

.xlsx file of Jafroc

into

R object

Usage

1
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 .xlsx file.

No.of.readers

A positive integer, indicating the number of readers for FROC data-set in an .xlsx file.

No.of.confidence.levels

A positive integer, indicating the number of confidence levels for FROC data-set in .xlsx file.

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).

Similarily 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 .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, 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.

Revised 2019 Dec 13; 2020 May 27

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.

Details

Create a dataset to be passed into the function fit_Bayesian_FROC. Convert an Excel file whose extension is .xlsx of Jafroc format to an R object representing FROC data to which we will apply functions in this package such as fit_Bayesian_FROC().

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

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## Not run: 
## Only run examples in interactive R sessions
if (interactive()) {
#========================================================================================
#                  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 as an example dataset
#========================================================================================

# 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")
##### utils::View(Truth)

TP <- readxl::read_excel( system.file("extdata",
                                      "JAFROC_data.xlsx",
                                       package="BayesianFROC"),
                           sheet = "TP")
#### utils::View(TP)

FP <- readxl::read_excel( system.file("extdata",
                                      "JAFROC_data.xlsx",
                                        package="BayesianFROC"),
                          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.
# 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 an excel file
# which is formulated correctolly  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 your own Jafroc
# .xlsx file.

#========================================================================================
#         step 2)     Fitting a model to data converted from Jafroc
#========================================================================================


#  (2)   Now, we obtain a list of an FROC dataset as an R object named "dataList".
#        Using this, we can fit a model to the dataset by the following code.



          fit  <-  fit_Bayesian_FROC(dataList )



}### Only run examples in interactive R sessions


           
## End(Not run)

           # Revised 2019. Jun 19
           # Revised 2019. Dec 13
           # Revised 2020 Feb
           # Revised 2020 April

BayesianFROC documentation built on Jan. 13, 2021, 5:22 a.m.