frankkramer-lab / miseval

a metric library for Medical Image Segmentation EVALuation
GNU General Public License v3.0
107 stars 22 forks source link

How to use miseval to evaluate BraTS 3D segmentation mask? #14

Closed panovr closed 1 year ago

panovr commented 2 years ago

Hi, I want to use miseval to evaluate BraTS 3D segmentation mask. (1) The BraTS segmentation mask is 3D, after converted to numpy array, the mask shape is (155, 240, 240); (2) The BraTS segmentation mask label is [0,1,2,4], not [0,1,2,3]. Thanks!

muellerdo commented 2 years ago

Hey @panovr,

1) The majority of metrics in MISeval also supports 3D masks like Dice Similarity Coefficient (DSC). Distance based metrics have to be tried but are often 2D specific.

2) Mhm. As far as I can see you have 3 options here

Option A): You convert the data to have a consistent class order. This can be done quiete easily with NumPy. Something like this

mask_processed = np.where(mask_original==4, 3, mask_original)  

Option B): You just run the evaluate interface but with a number of classes of 5 instead of 4. The scores are computed class-wise, which is why this gives you an additional artificial class-score you can just drop. However, not only metrics support the evaluation of non existing classes. But MISeval includes enhancement metric computations for popular metrics like the DSC.

Option C): You call the metric function manually instead through the evaluate interface. This way you can pass the class index for which the metric should be computed.

Something like this:

from miseval import calc_DSC
score = calc_DSC(truth, pred, c=4)

Cheers, Dominik

panovr commented 2 years ago

@muellerdo I tried Option A) and Option B), they both worked for DSC, thanks! By the way, the literature of BraTS choose 95% Hausdorf (HD95) as another evaluation metric. Does MISEval support HD95 metric?