Skip to content

Conversation

@EikeHeinz
Copy link
Member

@EikeHeinz EikeHeinz commented Feb 10, 2016

This adds an implementation of a separated sobel kernel, a sobel filter and a hessian filter. Both filters use a derivative filter that uses the separated sobel kernel. Tests are included.
I've tested the sobel filter on several images and compared these to the already filtered versions.
If required I can add some assert statements to the SobelFilterTest case.

}

@OpMethod(op = net.imagej.ops.create.kernelSobel.CreateKernelSobelSeparated.class)
public <T extends ComplexType<T>> Img<T> kernelSobelSeparated(final Type<T> outType) {
Copy link
Member

Choose a reason for hiding this comment

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

can't you use final T outType rather than final Type<T> outType? @ctrueden?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, always use T, not Type<T>. I actually just fixed all of the known offenders with 9316184. Let's try to keep things clean!

@EikeHeinz EikeHeinz force-pushed the sobel-hessian-filter branch 2 times, most recently from 5b724bb to 1bbbf2d Compare February 17, 2016 17:39

derivativeComputers = new UnaryComputerOp[in().numDimensions()];
for (int i = 0; i < in().numDimensions(); i++) {
derivativeComputers[i] = RAIs.computer(ops(), Ops.Filter.DirectionalDerivative.class, in(), i);
Copy link
Member

Choose a reason for hiding this comment

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

only works if DirectionalDerivative is also working for n-d...

@dietzc
Copy link
Member

dietzc commented Feb 17, 2016

@iarganda do you want to review? do the implementations make sense to you? if you have questions about ops, just ping me and I can explain.

@iarganda
Copy link

Sure, I'll have a look as soon as possible! Thanks!

@dietzc
Copy link
Member

dietzc commented Mar 4, 2016

@iarganda @hornm any comments?

@@ -0,0 +1,51 @@
package net.imagej.ops.filter.derivative;
Copy link
Member

Choose a reason for hiding this comment

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

License header is missing.

@stelfrich
Copy link
Member

stelfrich commented Apr 15, 2016

Hey @EikeHeinz,
I have added some code-related comments to your latest commits. Some general remarks that I couldn't pin to a specific location in the commits:

  • Missing license headers
  • Rename the test to PartialDerivativeFilterTest
  • Fix the coding style in an individual commit

@@ -0,0 +1,69 @@
package net.imagej.ops.create.kernelSobel;
Copy link
Member

Choose a reason for hiding this comment

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

Missing license header.

@EikeHeinz
Copy link
Member Author

Thank you for your comments @stelfrich, I'll look into them as soon as possible.
Note: I think, that the returned CompositeView doesn't contain all derivatives (I'm looking into this). Please keep that in mind, if you are planning to use it.

// add dimensions to kernel if input has more than 2 dimensions to
// properly rotate the kernel
if (in().numDimensions() > 2) {
MixedTransformView<T> expandedKernelA = Views.addDimension(kernelA);
Copy link
Member

Choose a reason for hiding this comment

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

Generalize expandedKernelA to be RandomAccessible<T>.

@stelfrich
Copy link
Member

Note: I think, that the returned CompositeView doesn't contain all derivatives (I'm looking into this). Please keep that in mind, if you are planning to use it.

I won't be using it until some time next week. No worries 😄

@ctrueden
Copy link
Member

Thanks everyone for reviewing.

Regarding the license headers, I am less worried about these, since they can be easily added after the fact using mvn license:update-file-header. The other comments, though, would be good to resolve. I especially would like to see no WIP commits in the commit history. Every commit needs to compile with passing tests.

@stelfrich
Copy link
Member

I stumbled across an issue with using PartialDerivativesRAI on the shape-index-map branch. There, I am reusing an instance of PartialDerivativesRAI for the second-order partial derivatives (see DefaultHessian#L95). When used the second time, the input will be of type ConvertedRandomAccessibleInterval which cannot be cast to Img in PartialDerivative#createOutput.

I have added a dirty hack on that branch to circumvent a matching of CreateImgFromImg to Ops.Create.Img. But doesn't solve the underlying issue that Ops.Create.Img is matched too specifically to be reused later on. Maybe @dietzc has an opinion on that?

@dietzc
Copy link
Member

dietzc commented May 4, 2016

why do we need to cast it to Img at all? This shouldn't ever be required.

@ctrueden
Copy link
Member

@EikeHeinz Awesome, thank you!

@stelfrich
Copy link
Member

@EikeHeinz Have you gotten around to working on the issues?

@EikeHeinz
Copy link
Member Author

@stelfrich Yes, I think I have resolved most or all issues, except the one I'm having with the CompositeView. I'll look into that one again tomorrow and hopefully fix it.

@EikeHeinz EikeHeinz force-pushed the sobel-hessian-filter branch from a6c18fa to 1791778 Compare July 20, 2016 10:52
@EikeHeinz
Copy link
Member Author

@stelfrich Seems like the rebase requires some more work to do. I'm going to solve the new issues over the next few days.

@stelfrich
Copy link
Member

@EikeHeinz Were you able to resolve the issues and compute all derivatives? If you need a second opinion/review, I'd be glad to help!

@dietzc
Copy link
Member

dietzc commented Aug 24, 2016

did you see: imglib/imglib2-algorithm#29? does this help?

@EikeHeinz
Copy link
Member Author

Sorry for the late answer.
@stelfrich yes I've been able to resolve the remaining issues. I'm currently working on some of the points you've mentioned that I haven't fixed until now.
@dietzc Thanks for the info. I'll have a look.


/** Executes the "directional derivative" operation on the given arguments */
@OpMethod(op = net.imagej.ops.filter.derivative.PartialDerivativeRAI.class)
public <T extends RealType<T>> RandomAccessibleInterval<T> directionalDerivative(final RandomAccessibleInterval<T> in, final int dimension) {
Copy link
Member

Choose a reason for hiding this comment

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

This one and the next method are a left-over from the rename to partialDerivative, I guess? If so, they can now be removed.

@EikeHeinz EikeHeinz force-pushed the sobel-hessian-filter branch from 85366c0 to d0c573e Compare September 8, 2016 13:51
@EikeHeinz
Copy link
Member Author

@stelfrich Thanks for your comments and help.
@hornm @dietzc I've made a rebase and cleaned up the commit history. Can one of you have a look please?

@EikeHeinz EikeHeinz force-pushed the sobel-hessian-filter branch 2 times, most recently from 94724f4 to 713f9ce Compare November 7, 2016 13:15
@ctrueden ctrueden force-pushed the sobel-hessian-filter branch from 713f9ce to 9a3d7e8 Compare December 5, 2017 23:39
@ctrueden
Copy link
Member

ctrueden commented Dec 5, 2017

Rebased over the latest master to resolve conflicts.

I almost merged this, but there is one inconsistency I want to fix first: is the op name create.kernelSobel Or create.kernelSobelSeparated? We need to make the naming consistent before we can merge it. @EikeHeinz Any preference?

@EikeHeinz
Copy link
Member Author

We can name it kernelSobel, because it's the shorter call, but if there are plans to add the not separated Sobel Kernel we might also call it kernelSobelSeparated. I have no preference.

@ctrueden
Copy link
Member

ctrueden commented Dec 7, 2017

I tried to research the difference between separable and non-separable Sobel operators, but wikipedia just describes it as separable. I assume the separable version is the original/canonical one? In which case, calling it only kernelSobel here makes sense. If a non-separable version is added, we could call it kernelSobelNonSeparable or some other distinguishing name.

@ctrueden ctrueden force-pushed the sobel-hessian-filter branch from 9a3d7e8 to 8e4061c Compare December 7, 2017 16:52
@ctrueden ctrueden merged commit 341758c into master Dec 7, 2017
@ctrueden ctrueden deleted the sobel-hessian-filter branch December 7, 2017 16:54
@ctrueden
Copy link
Member

ctrueden commented Dec 7, 2017

Woo hoo, merged! Thank you @EikeHeinz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants