Proper way to calculate mean Dice coefficient on a dataset I would like to ask a question about the proper way to calculate the Dice coefficient for an image dataset. We know that the Dice coefficient is calculated via the following equation:
$$Dice = \frac{TP +TP}{TP +TP +FP +FN}$$
However, how do we calculate the mean Dice coefficient for the entire dataset ? For example, suppose we have $N$ images, each having size $(H, W)$. There might be two ways:

*

*We calculate the Dice coefficient for each image, and then take the average for all images


*We flatten all of them into an array of size $N \times H \times W$, then calculate the Dice coefficient for this array.
I do not know which way is usually used in medical image segmentation. I have tried to search for some papers, but they do not go into details about this. It would be great if someone could reference some paper about this.

In my research group, we calculate the Dice coefficient for the separate image sets. Here are some papers in which this method is used: [1,2,3]. We are currently writing another paper in which we use the same method.
The reason for this is that you can not only report the average Dice, but also the range (worst Dice - best Dice) and standard deviation. In my opinion, this is a far more intuitive way of calculating the Dice than concatenating all image sets into one. Good luck!
[1] Linderup BW, Küseler A, Jensen J, Cattaneo PM (2015). A Novel Semiautomatic Technique for Volumetric Assessment of the Alveolar Bone Defect Using Cone Beam Computed Tomography.
[2] Vinayahalingam S, Xi T, Bergé S, Maal T, de Jong G (2019). Automated detection of third molars and mandibular nerve by deep learning.
[3] Xi T, Schreurs R, Heerink WJ, Bergé SJ, Maal TJJ (2014). A Novel Region-Growing Based Semi-Automatic Segmentation Protocol for Three-Dimensional Condylar Reconstruction Using Cone Beam Computed Tomography (CBCT).
