Patch-Based Segmentation With Spatial Context For Medical Image Analysis