openmicroscopy/bioformats — pull request #1501 by rleigh-dundee (2014-12-19 11:44:32+00:00)
Title: FormatReader/FormatTools Modulo improvements

When implementing a modulo-aware viewer, it became quickly clear that computing dimension coordinates when using Modulo was a real pain. It requires all calculations to be done by the user, which quickly gets quite annoying. This PR implements Modulo-aware variants of getIndex and getZCTCoords in both FormatReader and FormatTools, and updates the dependent classes to use them. This allows direct computation of the full ZCTmZmCmT sextuple from an index and vice-versa. Here, the ZCT coordinates are modified to take the Modulo sizes into account, so the user can work easily using the effective ZCTmZmCmT ranges.

Outstanding question: getIndex overloads naturally due to having extra arguments. getZCTCoords does not, so was supplemented with getZCTModuloCoords. In FormatTools, the getZCTCoords parameters allow overloading, but this could be renamed to ModuloCoords if desired.

--------

Testing:

The C++ implementation has a comprehensive set of testcases. The Java code didn't have unit tests for ZCT, so ZCTmZmCmT variants were not added, but the logic is identical to the C++ implementation.