Put more logic in the calcKmeans method

* timestream/manipulate/plantSegmenter.py (calcKmeans): Put the check for the
correctness of BG-vs-FG in the calcKmeans method.
Fix bug introduced in 1717e01

1717e01 put pot positions and tray positions in the output timestream metadata.
It would fail when `ts_out.image_data[parse.ts_format_date(date)]` was called
and the image was not there because it had not been written yet.

Relevant Traceback:
ceback (most recent call last):
  File "pipeline_demo.py", line 106, in <module>
    result = pl.process(context, [img.pixels], visualise)
  File "build/bdist.linux-x86_64/egg/timestream/manipulate/pipeline.py", line 82, in process
  File "build/bdist.linux-x86_64/egg/timestream/manipulate/pipecomponents.py", line 328, in __call__
KeyError: '2014_06_19_09_00_00'

The bug would only be seen on pipelines that called traydetector or potdetector
without calling resultingimagewriter.

* timestream/manipulate/pipecomponents.py (TrayDetector.__call__): Add relevant
value to context["outputwithimage"] so it can be output when the image is
written.
* timestream/manipulate/pipecomponents.py (PotDetector.__call__): Likewise
* timestream/manipulate/pipecomponents.py (ResultingImageWriter.__call__): Take
all values in context["outputwithimage"] and write them as metadata.
* util/pipeline_demo.py: Initializle context["outputwithimage"] to an empty dict.
* util/pipeline_demo_correct_images_daytime.py: Likewise
Add time interval to pipeline_demo.py

I stole this from pipeline_demo_correct_images_daytime.py. This is a copy of
what Chuong's logic with small changes here and there.
* util/pipeline_demo.py: In the yaml file we expect "starthourrange" and
"endhourrange" from the yaml file. We only analyze an image if its between the
ranges.
Remove pipeline_demo_correct_images.

We have all the functionality that this file provides in the pipeline.
* util/pipeline_demo_correct_images.py: Remove file.
Implement output directory suffixes.

* util/pipeline_demo.py: We now just need one input argument: the directory
for the timestream.
We create the output stream directories by appending their names as suffixes
to the original input timestream directory.
Everything else that is not a timestream will go in "-results" directory.
* timestream/manipulate/pipecomponents.py: Fix small bug that was reporting the
outputroot from a wrong source.
Remove pipeline_demo_correct_images_daytime.

* util/pipeline_demo_correct_images_daytime.py: All unique code that was
implemented in this file, we have moved to pipeline_demo.py.
[README] Add gitter badge & trim whitespace