Skip to content

Real transform #533

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Real transform #533

wants to merge 6 commits into from

Conversation

bnorthan
Copy link
Contributor

@bnorthan bnorthan commented Dec 12, 2017

This commit applies a realtransform to an input image.

Round 2

The Op is now called DefaultTransformView and wraps Views.transformReal. And the transforms are more "intuitive" (trans.scale(0.5) makes the image smaller. Use case is below

AffineTransform2D transform = new AffineTransform2D();

transform.translate(-image.dimension(0)/2,-image.dimension(0)/2);
transform.rotate(1);
transform.scale(0.5);
transform.translate(image.dimension(0)/2,image.dimension(0)/2);

RandomAccessibleInterval<UnsignedByteType> actualOutput=ops.transform().realTransform(image, transform);

image

image

@bnorthan bnorthan force-pushed the real_transform branch 3 times, most recently from ece2370 to 8bed815 Compare December 13, 2017 18:25
final RandomAccessibleInterval<T> result =
(RandomAccessibleInterval<T>) ops().run(
net.imagej.ops.transform.realTransform.DefaultTransformView.class, in,
transform);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ops().run(Ops.Transform.RealTransform.class, in, transform). That way, in the future, someone could write an op which is a specialized version of this and it could also be matched.

Please change this for all your other realTransform(...) namespace methods as well.

InvertibleRealTransform transform;

@Parameter(required = false)
private Interval outputInterval = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be explicitly set to null. You can just have private Interval outputInterval.

private Interval outputInterval = null;

@Parameter(required = false)
private InterpolatorFactory<T, RandomAccessible<T>> interpolator = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be private InterpolatorFactory<T, RandomAccessible<T>> interpolator;. There's no need for the = null.


@Parameter(required = false)
private OutOfBoundsFactory<T, RandomAccessibleInterval<T>> outOfBoundsFactory =
new OutOfBoundsMirrorFactory<>(OutOfBoundsMirrorFactory.Boundary.SINGLE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used (unless I'm missing something?). On line 97 you call Views.extendZero(input), so zero padding is always the out of bounds strategy. Do you want the user to be able to specify their own out of bounds strategy?

transform.translate(image.dimension(0) / 2, image.dimension(0) / 2);

final RandomAccessibleInterval<UnsignedByteType> actualOutput = ops
.transform().realTransform(image, transform);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you should use ops().run(net.imagej.ops.transform.realTransform.DefaultTransformView.class, image, transform);, to ensure that DefaultTransformView is always tested.

@awalter17
Copy link
Contributor

@bnorthan I've rebased this branch over master, updated the license header, and fixed a few whitespace issues. I've also noted a few minor changes that need to be fixed, but after that this should be good to merge.

Thank you for all your work on this! 😺

@bnorthan
Copy link
Contributor Author

bnorthan commented Jun 8, 2018

@awalter17 I just did all the changes you requested. Please let me know if there is anything else. Thanks.

@ctrueden ctrueden added the to do label Oct 3, 2018
@imagejan imagejan mentioned this pull request Dec 3, 2019
4 tasks
@imagejan
Copy link
Member

@ctrueden @bnorthan are there any plans to merge this one soon? Or is it on hold until scijava-ops are out?
I'm asking because I'd like to use some of this functionality, but I can also fall back to using ImgLib2 directly.

@bnorthan
Copy link
Contributor Author

Hi @imagejan

It's been a while... I made some changes to this over a year ago but it looks like it slipped through the cracks after that. I'm not sure what the best approach is for changes to imagej-ops/scijava-ops right now. I've only made a couple of small changes in the last few months, and just flagged @gselzer so he can make the same change in scijava-ops.

@ctrueden
Copy link
Member

@gselzer How much effort do you think it would be to port this to scijava-ops soon? I'd rather not add more new features to imagej-ops at this juncture—but I really want this function in the new ops. 😄

@gselzer
Copy link
Contributor

gselzer commented Jan 23, 2020

@ctrueden I only have time to quickly glance over this, but we can probably add all this functionality with a couple of OpFields. I will add it to the TODO list

@imagejan
Copy link
Member

@gselzer @ctrueden is anything like this usable in the new scijava-ops (https://github.com/scijava/incubator) yet?

It would be a good argument for me to get started exploring your recent work of overhauling the ops framework 🙂

gselzer added a commit to scijava/incubator that referenced this pull request Jun 24, 2021
@gselzer
Copy link
Contributor

gselzer commented Jun 24, 2021

@imagejan scijava/incubator#36 😉

gselzer added a commit to scijava/incubator that referenced this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants