Skip to content

Commit

Permalink
Add Op annotations to relevant static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gselzer committed Jan 3, 2024
1 parent 2d8ae77 commit 411339f
Show file tree
Hide file tree
Showing 52 changed files with 3,119 additions and 117 deletions.
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<net.imglib2.imglib2.version>6.2.0</net.imglib2.imglib2.version>
<scijava.parse.ops>true</scijava.parse.ops>
</properties>

<repositories>
Expand Down Expand Up @@ -280,6 +280,24 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.scijava</groupId>
<artifactId>scijava-ops-indexer</artifactId>
<version>0-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
<fork>true</fork>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Aparse.ops=${scijava.parse.ops}</arg>
<arg>-Aop.version=${project.version}</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class Thresholder
* Returns a new boolean {@link Img} generated by thresholding the values of
* the source image.
*
* @implNote op name='threshold.value',type=Function
* @param source
* the image to threshold.
* @param threshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public final class BuildComponentTree< T extends Type< T >, C extends PartialCom
* {@link PartialComponent.Handler} which is responsible for building up the
* tree structure. An implementations of {@link PartialComponent.Handler} is
* provided for example by {@link PixelListComponentTree}.
*
*
* @implNote op name='componenttree.buildComponentTree',type=Function
* @param input
* input image.
* @param componentGenerator
Expand All @@ -110,7 +111,8 @@ public static < T extends Type< T >, C extends PartialComponent< T, C > > void b
* {@link PartialComponent.Handler} which is responsible for building up the
* tree structure. An implementations of {@link PartialComponent.Handler} is
* provided for example by {@link PixelListComponentTree}.
*
*
* @implNote op name='componenttree.buildComponentTree',type=Function
* @param input
* input image of a comparable value type.
* @param componentGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public final class MserTree< T extends Type< T > > implements ComponentForest< M
* {@link #buildMserTree(RandomAccessibleInterval, RealType, long, long, double, double, ImgFactory, boolean)}
* using an {@link ArrayImgFactory} or {@link CellImgFactory} depending on
* input image size.
*
*
* @implNote op name='componenttree.buildMserTree',type=Function
* @param input
* the input image.
* @param delta
Expand Down Expand Up @@ -133,7 +134,8 @@ public static < T extends RealType< T > > MserTree< T > buildMserTree( final Ran
* {@link #buildMserTree(RandomAccessibleInterval, RealType, long, long, double, double, ImgFactory, boolean)}
* using an {@link ArrayImgFactory} or {@link CellImgFactory} depending on
* input image size.
*
*
* @implNote op name='componenttree.buildMserTree',type=Function
* @param input
* the input image.
* @param delta
Expand All @@ -159,7 +161,8 @@ public static < T extends RealType< T > > MserTree< T > buildMserTree( final Ran

/**
* Build a MSER tree from an input image.
*
*
* @implNote op name='componenttree.buildMserTree',type=Function
* @param input
* the input image.
* @param delta
Expand Down Expand Up @@ -198,7 +201,8 @@ public static < T extends RealType< T > > MserTree< T > buildMserTree( final Ran
* {@link #buildMserTree(RandomAccessibleInterval, ComputeDelta, long, long, double, double, ImgFactory, Type, Comparator)}
* using an {@link ArrayImgFactory} or {@link CellImgFactory} depending on
* input image size.
*
*
* @implNote op name='componenttree.buildMserTree',type=Function
* @param input
* the input image.
* @param computeDelta
Expand Down Expand Up @@ -226,7 +230,8 @@ public static < T extends Type< T > > MserTree< T > buildMserTree( final RandomA

/**
* Build a MSER tree from an input image.
*
*
* @implNote op name='componenttree.buildMserTree',type=Function
* @param input
* the input image.
* @param computeDelta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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='componenttree.buildPixelListComponentTree',type=Function
* @param input
* the input image.
* @param type
Expand All @@ -92,6 +93,7 @@ public static < T extends RealType< T > > PixelListComponentTree< T > buildCompo
/**
* Build a component tree from an input image.
*
* @implNote op name='componenttree.buildPixelListComponentTree',type=Function
* @param input
* the input image.
* @param type
Expand Down Expand Up @@ -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='componenttree.buildPixelListComponentTree',type=Function
* @param input
* the input image.
* @param maxValue
Expand All @@ -138,6 +141,7 @@ public static < T extends Type< T > > PixelListComponentTree< T > buildComponent
/**
* Build a component tree from an input image.
*
* @implNote op name='componenttree.buildPixelListComponentTree',type=Function
* @param input
* the input image.
* @param maxValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,33 @@ public class FastGauss
return Convolution.concat( steps );
}

/**
* @implNote op name='convolve.fastGauss',type=Function
*/
public static Convolution< RealType< ? > > convolution( final double sigma )
{
return new MultiDimensionConvolution<>( k -> convolution( nCopies( k, sigma ) ) );
}

/**
* @implNote op name='convolve.fastGauss',type=Function
*/
public static Convolution< RealType< ? > > convolution1d( final double sigma, final int direction )
{
return new LineConvolution<>( new FastGaussConvolverRealType( sigma ), direction );
}

/**
* @implNote op name='convolve.fastGauss',type=Computer
*/
public static void convolve( final double[] sigmas, final RandomAccessible< ? extends RealType< ? > > input, final RandomAccessibleInterval< ? extends RealType< ? > > output )
{
convolution( sigmas ).process( input, output );
}

/**
* @implNote op name='convolve.fastGauss',type=Computer
*/
public static void convolve( final double sigma, final RandomAccessible< ? extends RealType< ? > > input, final RandomAccessibleInterval< ? extends RealType< ? > > output )
{
convolution( sigma ).process( input, output );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public class Kernel1D
/**
* Creates a one-dimensional symmetric convolution kernel.
*
* @implNote op name='create.kernel1DSymmetric',type=Function
* @param halfKernel
* the upper half (starting at the center pixel) of the symmetric
* convolution kernel.
* @return a {@link Kernel1D} used for one dimensional convolutions
*/
public static Kernel1D symmetric( final double... halfKernel )
{
Expand All @@ -68,6 +70,7 @@ public static Kernel1D symmetric( final double... halfKernel )
/**
* Similar to {@link #symmetric(double[])} but creates an array of
* one-dimensional convolution kernels.
* @implNote op name='create.kernel1DSymmetric',type=Function
*/
public static Kernel1D[] symmetric( final double[][] halfKernels )
{
Expand All @@ -77,11 +80,13 @@ public static Kernel1D[] symmetric( final double[][] halfKernels )
/**
* Creates a one-dimensional asymmetric convolution kernel.
*
* @implNote op name='create.kernel1DAsymmetric',type=Function
* @param fullKernel
* an array containing the values of the kernel
* @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
*/
public static Kernel1D asymmetric( final double[] fullKernel, final int originIndex )
{
Expand All @@ -94,6 +99,7 @@ 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.
* @implNote op name='create.kernel1DCentralAsymmetric',type=Function
*/
public static Kernel1D centralAsymmetric( final double... kernel )
{
Expand All @@ -103,6 +109,7 @@ public static Kernel1D centralAsymmetric( final double... kernel )
/**
* Similar to {@link #asymmetric(double[], int)} but creates an array of
* one-dimensional convolution kernels.
* @implNote op name='create.kernel1DAsymmetric',type=Function
*/
public static Kernel1D[] asymmetric( final double[][] fullKernels, final int[] originIndices )
{
Expand All @@ -113,6 +120,7 @@ public static Kernel1D[] asymmetric( final double[][] fullKernels, final int[] o
/**
* Similar to {@link #centralAsymmetric(double...)} but creates an array of
* one-dimensional convolution kernels.
* @implNote op name='create.kernel1DCentralAsymmetric',type=Function
*/
public static Kernel1D[] centralAsymmetric( final double[][] kernels )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class SeparableKernelConvolution
* }
* </pre>
*
* @param kernels the kernel(s) to use in the convolution
* @return a {@link Convolution} object that can convolve an image
* @implNote op name='filter.convolveSeparable',type=Function
* @see Convolution
*/
public static Convolution< NumericType< ? > > convolution( final Kernel1D... kernels )
Expand All @@ -89,6 +92,10 @@ public class SeparableKernelConvolution
* }
* </pre>
*
* @param kernel the kernel to use in the convolution
* @param direction the direction to use in the convolution
* @return a {@link Convolution} object that can convolve an image
* @implNote op name='filter.convolveSeparable',type=Function
* @see Convolution
*/
public static Convolution< NumericType< ? > > convolution1d( final Kernel1D kernel, final int direction )
Expand All @@ -106,6 +113,7 @@ public class SeparableKernelConvolution
* in their own precision. The source type S and target type T are either
* both {@link RealType RealTypes} or both the same type.
*
* @implNote op name='filter.convolveSeparable',type=Computer
* @param kernels
* an array containing kernels for every dimension.
* @param source
Expand Down
76 changes: 76 additions & 0 deletions src/main/java/net/imglib2/algorithm/dog/DifferenceOfGaussian.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,44 @@
*/
public class DifferenceOfGaussian
{
/**
* Compute the difference of Gaussian for the input. Input convolved with
* Gaussian of sigmaSmaller is subtracted from input convolved with Gaussian
* of sigmaLarger (where {@code sigmaLarger > sigmaSmaller}).
* <p>
* Creates an appropriate temporary image and calls
* {@link #DoG(double[], double[], RandomAccessible, RandomAccessible, RandomAccessibleInterval, ExecutorService)}
* .
* </p>
* This method differs from
* {@link #DoG(double[], double[], RandomAccessible, RandomAccessibleInterval, ExecutorService)}
* only in that its parameter order is tailored to an Op. The output comes
* last, and the primary input (the input image) comes first.
*
* @implNote op name="filter.DoG", type=Computer
* @param input
* the input image extended to infinity (or at least covering the
* same interval as the dog result image, plus borders for
* convolution).
* @param sigmaSmaller
* stddev (in every dimension) of smaller Gaussian.
* @param sigmaLarger
* stddev (in every dimension) of larger Gaussian.
* @param service
* service providing threads for multi-threading
* @param dog
* the Difference-of-Gaussian result image.
*/
public static < I extends NumericType< I >, T extends NumericType< T > & NativeType< T > > void DoG(
final RandomAccessible< I > input,
final double[] sigmaSmaller,
final double[] sigmaLarger,
final ExecutorService service,
final RandomAccessibleInterval< T > dog)
{
DoG( sigmaSmaller, sigmaLarger, input, dog, service );
}

/**
* Compute the difference of Gaussian for the input. Input convolved with
* Gaussian of sigmaSmaller is subtracted from input convolved with Gaussian
Expand Down Expand Up @@ -97,6 +135,44 @@ public static < I extends NumericType< I >, T extends NumericType< T > & NativeT
DoG( sigmaSmaller, sigmaLarger, input, Views.translate( g1, translation ), dog, service );
}

/**
* Compute the difference of Gaussian for the input. Input convolved with
* Gaussian of sigmaSmaller is subtracted from input convolved with Gaussian
* of sigmaLarger (where sigmaLarger &gt; sigmaSmaller).
* </p>
* This method differs from
* {@link #DoG(double[], double[], RandomAccessible, RandomAccessible, RandomAccessibleInterval, ExecutorService)}
* only in that its parameter order is tailored to an Op. The output comes
* last, and the primary input (the input image) comes first.
*
* @implNote op name="filter.DoG", type=Computer
* @param input
* the input image extended to infinity (or at least covering the
* same interval as the dog result image, plus borders for
* convolution).
* @param sigmaSmaller
* stddev (in every dimension) of smaller Gaussian.
* @param sigmaLarger
* stddev (in every dimension) of larger Gaussian.
* @param tmp
* temporary image, must at least cover the same interval as the
* dog result image.
* @param service
* how many threads to use for the computation.
* @param dog
* the Difference-of-Gaussian result image.
*/
public static < I extends NumericType< I >, T extends NumericType< T > & NativeType< T > > void DoG(
final RandomAccessible< I > input,
final double[] sigmaSmaller,
final double[] sigmaLarger,
final RandomAccessible< T > tmp,
final ExecutorService service,
final RandomAccessibleInterval< T > dog)
{
DoG(sigmaSmaller, sigmaLarger, input, tmp, dog, service);
}

/**
* Compute the difference of Gaussian for the input. Input convolved with
* Gaussian of sigmaSmaller is subtracted from input convolved with Gaussian
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public class SubpixelEdgelDetection
* <p>
* Note: The input image type must be a signed type! Otherwise gradient
* computation will not work.
*
*
* @implNote op name='image.subpixelEdgels', type=Function
* @param input
* input image
* @param factory
Expand Down
Loading

0 comments on commit 411339f

Please sign in to comment.