MATLAB: Unit test in image segmentation

Image Processing Toolboxunit test

Hi,
I am working on medical image segmentation (images acquired with several machines, several patients) and I have questions on how to do unit testing in Matlab: So far, I found this https://www.mathworks.com/help/matlab/class-based-unit-tests.html
but it is very general and i'd like to understand the procedure for image segmentation.
I searched for examples and I found this response:
who says that: "TDD in image processing only makes sense for deterministic problems like:
image arithmetic histogram generation and so on.. However TDD is not suitable for feature extraction algorithms like:
edge detection segmentation corner detection … since no algorithm can solve this kind of problems for all images perfectly."
Do you agree with the above statement ?
I'd like to know how do you perform unit testing or TDD in your image segmentation.
Thanks a lot, Maia

Best Answer

Maia, The stackoverflow link you found has a lot of relevant detail, especially the one from user "jilles de wit".
I would create some manual segmentation (for e.g using the image segmenter app) and then use that mask as the 'golden data' to compare against whatever new automated approach I am trying to develop. You could use one of these functions: jaccard, bfscore or dice metric to compare the results of the ground truth/golden data against the algorithm you are developing with some allowance/tolerance to account for variability.