Next step of the algorithm is graph cut segmentation.
The GrabCut method from the OpenCV library is used.
The method needs input rectangle or a mask which represents
foreground. The rest is background. In this step
rectangle is used as foreground initialization to prevent
removal of the brain mass parts (brain without the cranium).
Initial rectangle is created depending on the previous
thresholding as shown in Figure 7. GrabCut is explained
in chapter 4.5. Result is contour which border
brain and also cranium.