Added max threshold parameter to PartsLayer.

- Also fixed bug in oriented_parts_layer.py.