private void SetMask(Bitmap bitmap)
        {
            var regionGrowing = new RegionGrowing();
            var result        = regionGrowing.SetMask(OriginalBitmap, bitmap);

            ImageWithMaskBitmap = result;
            ImageWithMask       = ImageGdiHelper.LoadBitmap(result);
        }
        private async void ApplyOperation()
        {
            var regionGrowing = new RegionGrowing();

            var results = new List <Bitmap>();

            await Task.Run(() =>
            {
                results = regionGrowing.CreateMasks(OriginalBitmap, Threshold, MinPixelNumber, SaveFolderPath);
            });

            SegmentedBitmap = results[0];
            SegmentedImage  = ImageGdiHelper.LoadBitmap(results[0]);

            Masks = new ObservableCollection <MaskVM>();

            foreach (var mask in results.Skip(1))
            {
                Masks.Add(new MaskVM {
                    Image = ImageGdiHelper.LoadBitmap(mask), Bitmap = mask
                });
            }
        }