-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add Op discovery annotations to ImgLib2-algorithm #94
base: master
Are you sure you want to change the base?
Changes from all commits
ceaf0f8
827947f
ababdc6
7d02571
4836d65
a6393d0
80a0dfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ public final class PixelListComponentTree< T extends Type< T > > implements Comp | |
* using an {@link ArrayImgFactory} or {@link CellImgFactory} depending on | ||
* input image size. | ||
* | ||
* @implNote op name='create.pixelListComponentTree',type=Function | ||
* @param input | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like above, should these be ops? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use a sub-namespace of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually... are these really "create" Ops? I think of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It actually seems to be like the tree best belongs to the |
||
* the input image. | ||
* @param type | ||
|
@@ -92,6 +93,7 @@ public static < T extends RealType< T > > PixelListComponentTree< T > buildCompo | |
/** | ||
* Build a component tree from an input image. | ||
* | ||
* @implNote op name='create.pixelListComponentTree',type=Function | ||
* @param input | ||
* the input image. | ||
* @param type | ||
|
@@ -120,6 +122,7 @@ public static < T extends RealType< T > > PixelListComponentTree< T > buildCompo | |
* using an {@link ArrayImgFactory} or {@link CellImgFactory} depending on | ||
* input image size. | ||
* | ||
* @implNote op name='create.pixelListComponentTree',type=Function | ||
* @param input | ||
* the input image. | ||
* @param maxValue | ||
|
@@ -138,6 +141,7 @@ public static < T extends Type< T > > PixelListComponentTree< T > buildComponent | |
/** | ||
* Build a component tree from an input image. | ||
* | ||
* @implNote op name='create.pixelListComponentTree',type=Function | ||
* @param input | ||
* the input image. | ||
* @param maxValue | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,11 +88,23 @@ public class FastGauss | |
return new LineConvolution<>( new FastGaussConvolverRealType( sigma ), direction ); | ||
} | ||
|
||
/** | ||
* @param sigmas the standard deviations of the Gaussian blur (in each dimension) | ||
* @param input the input data to blur | ||
* @param output the preallocated output buffer | ||
* @implNote op name='filter.gauss', type=Computer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, interesting. We may want to make a post on Image.sc asking for people's suggestions on what Ops should do for naming w.r.t. approximate vs. exact algorithms like this. Is it OK for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
As is, we need to prioritize one of the Ops before we merge this PR, and we may want to implement the Precision Hint upstream beforehand as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the idra of a precision hint. It is more general than only this Op. E.g. arbitrary precision arithmetic. |
||
*/ | ||
public static void convolve( final double[] sigmas, final RandomAccessible< ? extends RealType< ? > > input, final RandomAccessibleInterval< ? extends RealType< ? > > output ) | ||
{ | ||
convolution( sigmas ).process( input, output ); | ||
} | ||
|
||
/** | ||
* @param sigma the standard deviation of the Gaussian blur (in all dimensions) | ||
* @param input the input data to blur | ||
* @param output the preallocated output buffer | ||
* @implNote op name='filter.gauss', type=Computer | ||
*/ | ||
public static void convolve( final double sigma, final RandomAccessible< ? extends RealType< ? > > input, final RandomAccessibleInterval< ? extends RealType< ? > > output ) | ||
{ | ||
convolution( sigma ).process( input, output ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,8 @@ public class Kernel1D | |
* @param halfKernel | ||
* the upper half (starting at the center pixel) of the symmetric | ||
* convolution kernel. | ||
* @return a {@link Kernel1D} used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DSymmetric' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these be Ops? What is the right name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to group all the kernel creation ops into |
||
*/ | ||
public static Kernel1D symmetric( final double... halfKernel ) | ||
{ | ||
|
@@ -68,6 +70,9 @@ public static Kernel1D symmetric( final double... halfKernel ) | |
/** | ||
* Similar to {@link #symmetric(double[])} but creates an array of | ||
* one-dimensional convolution kernels. | ||
* @param halfKernels the upper halves (starting at the center pixel) of the symmetric convolution kernels | ||
* @return an array of {@link Kernel1D}s used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DSymmetric' | ||
*/ | ||
public static Kernel1D[] symmetric( final double[][] halfKernels ) | ||
{ | ||
|
@@ -82,6 +87,8 @@ public static Kernel1D[] symmetric( final double[][] halfKernels ) | |
* @param originIndex | ||
* the index of the array element which is the origin of the | ||
* kernel | ||
* @return an asymmetric {@link Kernel1D} used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DAsymmetric' | ||
*/ | ||
public static Kernel1D asymmetric( final double[] fullKernel, final int originIndex ) | ||
{ | ||
|
@@ -94,6 +101,9 @@ public static Kernel1D asymmetric( final double[] fullKernel, final int originIn | |
/** | ||
* Creates a one-dimensional asymmetric convolution kernel, where the origin | ||
* of the kernel is in the middle. | ||
* @param kernel the raw data of the symmetric convolution kernel | ||
* @return a {@link Kernel1D} used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DCentralAsymmetric' | ||
*/ | ||
public static Kernel1D centralAsymmetric( final double... kernel ) | ||
{ | ||
|
@@ -103,6 +113,13 @@ public static Kernel1D centralAsymmetric( final double... kernel ) | |
/** | ||
* Similar to {@link #asymmetric(double[], int)} but creates an array of | ||
* one-dimensional convolution kernels. | ||
* @param fullKernels | ||
* arrays containing the values of each kernel | ||
* @param originIndices | ||
* the indices of the array elements at the origin of each | ||
* kernel | ||
* @return an array of {@link Kernel1D}s used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DAsymmetric' | ||
*/ | ||
public static Kernel1D[] asymmetric( final double[][] fullKernels, final int[] originIndices ) | ||
{ | ||
|
@@ -113,6 +130,9 @@ public static Kernel1D[] asymmetric( final double[][] fullKernels, final int[] o | |
/** | ||
* Similar to {@link #centralAsymmetric(double...)} but creates an array of | ||
* one-dimensional convolution kernels. | ||
* @param kernels the upper halves (starting at the center pixel) of the symmetric convolution kernels | ||
* @return an array of {@link Kernel1D}s used for one dimensional convolutions | ||
* @implNote op name='create.kernel1DCentralAsymmetric' | ||
*/ | ||
public static Kernel1D[] centralAsymmetric( final double[][] kernels ) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opinions on whether these should be Ops? I'm not totally sure what they're used for...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/imglib/imglib2-tests/blob/180e0f988c572518e0b35bedc558186a5b79be8a/src/test/java/net/imglib2/algorithm/componenttree/mser/MserTreeExample.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I guess this article is relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are figuring this stuff out, we should improve the javadoc. Every algorithm should cite the paper(s) it is about in its class javadoc. A "component tree" in the context of the
componenttree
packages is explained in papers like this one; without that context, it is difficult to understand what all this code is for.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concepts of level sets, mathematical morphology, and connected component analysis are very related. We have CCA currently in
labeling
, but other morphology operators inmorphology
. What about level sets? FWIW, I checked scikit-image for comparison, and use of level sets mostly takes place inskimage.segmentation.morphsnakes
.