How to obtain the bounding box?

How do I make a Region of Interest image with a bounding box like the one in the third image? both images are in Nifti format
Figure

forgive me for being “mr. obvious” here, but shouldnt you be reading about
“Graph Cut Segmentation and morphological operations” now ?

https://docs.opencv.org/4.x/d9/d61/tutorial_py_morphological_ops.html

also, your illustration sems to be from some paper – you have a link for us ?