Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create utility method for computing new bounding box after a transform #6

Open
ctrueden opened this issue Aug 21, 2016 · 7 comments
Open
Assignees

Comments

@ctrueden
Copy link
Member

At least for affine transforms, it is reasonable to take the corners of the source interval, and feed them into the transform to discern the boundaries of the target interval. This is the default expected behavior when performing common image processing operations such as shearing. See this forum thread.

@ctrueden
Copy link
Member Author

ctrueden commented Aug 21, 2016

@lnyng We can discuss when you get back to LOCI. I would like to add shearing to the Ops transform package. We will need this utility method as part of that.

@hanslovsky
Copy link
Member

As an inspiration, you could have a look at BoundingBox and BoundingBoxTransform. This class/interface can be easily extended to the RealTransform case and could be implemented by any RealTransform that transforms the bounding box in a trivial way.

@bogovicj
Copy link
Contributor

What should the behavior be for non-linear (e.g. ThinPlateSpline) transforms?

It could:

  • apply the transform on the corners only anyway (with the understanding the the box is an approximation for non-linear xfms)
  • apply the transform along many (all?) points along the faces of the source interval
  • throw an exception
  • something else?

@ctrueden
Copy link
Member Author

ctrueden commented Sep 12, 2016

For non-linear transforms, we should extend the interface (or provide an optional add-on interface—although with Java 8 default methods, this trick is no longer as necessary for backwards compatibility) so that the transform itself can offer its new bounding box. Of course, with arbitrary transforms the new bounding box could be infinite.

I really want to solve the 99% common cases though, where users want to apply some transform in ImageJ and then have the new image window match the new bounds. Otherwise, even simple things like shearing are not really usable for end users.

Note that @lnyng won't actually be working on this soon, since we have other priorities right now. I may try to tackle the very simple "corners" version of this utility method, but probably not for at least several weeks. And I would like to have @axtimwalde or @tpietzsch on board with the existence of such a utility method, before investing any time in it.

@ctrueden
Copy link
Member Author

I just ran across Intervals.smallestContainingInterval(RealInterval) which is a similar thing.

@axtimwalde
Copy link
Member

I agree with @hanslovsky, this has to be a complementary interface that is implemented by RealTransforms that can calculate or know their bounding box.

@ctrueden
Copy link
Member Author

Thanks @axtimwalde, I agree as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants