MATLAB: Chan Vese Segmentation mask is not working Properly

active contourchan-vesedicomimage processingImage Processing Toolboximcrop

I cropped my DICOM image so the active contour be faster and segment between the black area and soft tissue.
Instead, I got a contour that overlaps the edge of the image and goes beyond this. How can this happen? See attached image.
Let me know if you need the m files.

Best Answer

Your image appears to be "padded" on the top and bottom with gray values. The transition between the black background (containing the region of interest; ROI) and these gray regions, has large gradient that will attract the contour during segmentation; because evolution of the contour is guided by the strength of the image intensity gradient. My suggestions to you, (1) remove the padding, (2) initialize contour close to the ROI you want to segment.