menpo/menpo — pull request #395 by jabooth (2014-07-15 08:41:01+00:00)
Title: remove cyclic target reference from landmarks

Following from #394 we identified Landmarks and Image Features as the two places in Menpo where we had circular references. Although weakref sorted out the memory problems, we still have to handle the complexity of holding onto a target in Landmarks - a complexity that we arguably don't gain much from. This PR removes `.target` from `LandmarkManager` and `LandmarkGroup` entirely. As a result:

- Landmarks are nicely simplified
- Landmarks can no longer expect to be able to view their target. Where previously we did
```python
foo.landmarks.view() # view foo and it's landmarks
foo.landmarks[None].lms.view() # view landmarks on their own as PC
```
we now more explicitly do
```python
foo.view_landmarks() # view foo and it's landmarks
foo.landmarks.view() # view landmarks on their own.
```

this method is provided by a new mixin, `LandmarkableViewable(Landmarkable, Viewable)`. This is actually a very simple change (only `Shape` and `Image` need to be updated to this superclass). We now also gain the ability to customise the logic for this method on a class by class basis, so this means we can fix the multi-chanenel viewer/landmark viewer problem (although I'll leave that for someone else to tackle!

I've fixed all unit tests and everything seems to be working, this could do with some testing though.

### TODO
- [ ] Fix documentation for LandmarkableViewable