Add getSegmented method for ImagePotHandler.

We do the mask property calculation in two steps, separating the actual
calculation from the assignment to self._mask. This is important because
the getSegmented code might run in parallel in different processes that
do not share memory
* timestream/manipulate/plantSegmenter.py (ImagePotHandler.getSegmented):
New method, replacing the "mask" property.
(ImagePotHandler.mask): Do basic checks and call getSegmented when we
(ImagePotHandler.mask.setter): Be very picky when we assign mask. Only
the correct type int64, the correct shape and ndarray can be set.
need the actual mask.
(PotSegmenter_KmeansSquare, ImagePotHandler) Make sure that the mask is
float64
Execute plant segmentation in separate process.

Use os.fork to spwan a proces for each segementation calculation.
* timestream/manipulate/pipecomponents.py(PlantExtractor.__call__): Call new
method segAllPosts.
(segAllPots): New method to segment all pots. When in parallel, it uses cPickle
to marshal mask objects and pass them back to the parent. The parent process,
collects all masks and assignes them to its ImagePots.
Add compactness and eccentricity dependant on skimage version.

* timestream/manipulate/plantSegmenter.py(compactness, eccentricity): We
reactivate these to methods with the condition that they only get calculated
when skimage veresion is after 0.10
Write message on every pipeline component

* timestream/manipulate/pipecomponents.py(FeatureExtractor): Print component
message.
(Resultingimagewriter_ndarray): Likewise
(Resultingimagewriter_csv): Likewise
add writing positions of tray and pot to timestream
Update for new YAML setting file. Things to consider:
- The output root folder now should contains corrected images and segmented images. So the name should not contain "orig" or "corr" or "segm"
- The output streams should be "corr" and "segm" and the folder of these stream should contain the base folder as the affix. An example is "/mnt/phenocam/a_data/TimeStreams/Borevitz/BVZ0018/BVZ0018-GC05L-C01~fullres"
- The CVS file should be in "*-segm/_data/" folder
- The timestream should allow to update timestream.image_data for existing images.
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
[test data] add TS with data jsons
[test data] fix name of timestream data json
Correctly load image_data & new test case for this

We now correctly load ts.data and ts.image_data, and test that these are
loaded correctly. We also make ts.iter_by_whatever set the resulting
image.data to the data for that timepoint from ts.image_data, if that
timepoint is in the image_data dict. There's a new test case for this
too.