Processing on external disk.
Added segmentation to mask creation.