hajicj / MUSCIMarker

Tool for annotating objects in musical scores.
http://muscimarker.readthedocs.io/en/latest/
Apache License 2.0
7 stars 2 forks source link

Change CropObject definition to be either X/Y/Width/Height, or Top/Left/Bottom/Right #15

Open hajicj opened 8 years ago

hajicj commented 8 years ago

X and Y is really ambiguous. There is an ugly coord-swap step in parsing, beccause X in CropObjects is originally column (horizontal direction) and Y is row (vertical direction), while Python uses row-first indexing. At the same time, it is not self-explanatory, which is always worse than self-explanatory in a data format. Top/Left/Bottom/Right is obvious, whether you need row-major or column-major ordering, top to bottom vs. bottom to top, etc.

Proposed fix: make it possible to encode CropObjects using both X/Y/W/H and T/L/B/R.

hajicj commented 7 years ago

The minimum change to make the data format explicit is to use Top/Left/Height/Width. This is the minimum unambiguous change.

The following needs to be done:

  1. [x] Incorporate change CropObject initialization: accept top, left, height, width as well as x, y, height, width. (This duality is because I don't want to change how CropObjects are generated in MUSCIMarkerApp methods, at least not yet.)
  2. [x] Create test data for converting XML data from XY to TopLeft.
  3. [x] Reimplement parsing CropObjects to use TopLeft as well as XY. (This is because the older CropObjects should still be valid and parseable.)
  4. [x] Reimplement export of CropObjects to use TopLeft instead of XY. (This is because anything we save should already be in the new TopLeft format, and the old XY format should be phased out.)
  5. [ ] Create script for converting XML data from XY to TopLeft.
  6. [x] Recode examples in MUSCIMarker to use TopLeft.
hajicj commented 7 years ago

The reencoding is just import-export, easier done from a shell.