Sometimes it is necessary to transform masks into polygons to use polygon operations. The way to transform a raster or a binary mask into a polygon is pretty easy. Most of the solutions I found online were the other way (from polygon to a mask). But for my project I needed to convert the mask to a polygon.