Add method to find image ids in tree and to find minumum distance between two image ids

Also add output
Merge remote-tracking branch 'origin/master'
Combine SQL queries for image ids with algorithm, calculate two averages

Calculate averages for
 - same object (including same object in same context)
 - same object in same context