Learning Descriptions of 2D Shapes for Object Recognition and X-Ray Images