Hypercube algorithms for image processing and pattern recognition