merged with Eliot's 914
is basically ImageSegments integration
and some bugfixes