private static void CheckMaskProperties(PixelFormat maskFormat, Size maskSize, Size sourceImageSize)
{
if (maskFormat != PixelFormat.Format8bppIndexed)
{
throw new ArgumentException("Mask image must be 8 bpp grayscale image.");
}
if ((maskSize.Width != sourceImageSize.Width) || (maskSize.Height != sourceImageSize.Height))
{
throw new ArgumentException("Mask must have the same size as the source image to get statistics for.");
}
}
}