How to crop a region with smooth edge and without holes?

I'm trying to extract a single region from the image in matlab. The light region looks well connected and distinct from surrounding.

However, I applied a hard threshold B = A(A>1e-3) and it produced

The edge of the extracted shape is not smoothing at all and there are lots of isolated pixels.

For an image as simple as this, it might work to just perform opening or closing on the image to smooth out the edges before thresholding. Opening will remove any small, disconnected parts of the object, leading to an undersegmented image (smaller than the actual size). Closing will fill in any small holes in the object, leading to an oversegmented image (larger than the actual object size).

However, I think your image here is clean enough that thresholding should still work. Try a smaller value for the thresold, or use a MATLAB function like imbinarize to threshold it for you.

ex. thresholded_image = imbinarize(image, 'global');