37
37
import java .util .List ;
38
38
import java .util .function .Predicate ;
39
39
40
- import net .imglib2 .Cursor ;
41
- import net .imglib2 .Dimensions ;
42
- import net .imglib2 .Point ;
43
- import net .imglib2 .RandomAccess ;
44
- import net .imglib2 .RandomAccessibleInterval ;
40
+ import net .imglib2 .*;
45
41
import net .imglib2 .algorithm .localextrema .LocalExtrema ;
46
42
import net .imglib2 .algorithm .localextrema .LocalExtrema .MaximumCheck ;
47
43
import net .imglib2 .type .numeric .IntegerType ;
@@ -201,14 +197,14 @@ public static < T extends Comparable< T > > List< Point > pickLinePeaks(
201
197
* Runs a Hough Line Tranform on an image and populates the vote space
202
198
* parameter with the results.
203
199
*
200
+ * @implNote op names='voteLines',
201
+ * type='org.scijava.function.Computers.Arity1'
204
202
* @param input
205
203
* - the {@link RandomAccessibleInterval} to run the Hough Line
206
204
* Transform over
207
205
* @param votespace
208
206
* - the {@link RandomAccessibleInterval} in which the results
209
207
* are stored
210
- * @implNote op names='hough.lines',
211
- * type='org.scijava.function.Computers.Arity1'
212
208
*/
213
209
public static < T extends Comparable < T >, U extends IntegerType < U > > void voteLines (
214
210
final RandomAccessibleInterval < T > input ,
@@ -238,6 +234,34 @@ public static < T extends Comparable< T >, U extends IntegerType< U > > void vot
238
234
voteLines ( input , votespace , nTheta , defaultRho ( input ), Util .getTypeFromInterval ( input ) );
239
235
}
240
236
237
+ /**
238
+ * Runs a Hough Line Tranform on an image and populates the vote space
239
+ * parameter with the results.
240
+ * <p>
241
+ * This method differs from
242
+ * {@link #voteLines(RandomAccessibleInterval, RandomAccessibleInterval, int)}
243
+ * only in that its parameter order is tailored to an Op. The output comes
244
+ * last, and the primary input (the input image) comes first.
245
+ * </p>
246
+ *
247
+ * @implNote op name='voteLines', type='org.scijava.function.Computers.Arity2'
248
+ * @param input
249
+ * - the {@link RandomAccessibleInterval} to run the Hough Line
250
+ * Transform over
251
+ * @param nTheta
252
+ * - the number of bins for theta resolution
253
+ * @param votespace
254
+ * - the {@link RandomAccessibleInterval} in which the results
255
+ * are stored
256
+ */
257
+ public static < T extends Comparable < T >, U extends IntegerType < U > > void voteLines (
258
+ final RandomAccessibleInterval < T > input ,
259
+ final int nTheta ,
260
+ final RandomAccessibleInterval < U > votespace )
261
+ {
262
+ voteLines ( input , votespace , nTheta );
263
+ }
264
+
241
265
/**
242
266
* Runs a Hough Line Tranform on an image and populates the vote space
243
267
* parameter with the results.
@@ -262,6 +286,37 @@ public static < T extends Comparable< T >, U extends IntegerType< U > > void vot
262
286
voteLines ( input , votespace , nTheta , nRho , Util .getTypeFromInterval ( input ) );
263
287
}
264
288
289
+ /**
290
+ * Runs a Hough Line Tranform on an image and populates the vote space
291
+ * parameter with the results.
292
+ * <p>
293
+ * This method differs from
294
+ * {@link #voteLines(RandomAccessibleInterval, RandomAccessibleInterval, int, int)}
295
+ * only in that its parameter order is tailored to an Op. The output comes
296
+ * last, and the primary input (the input image) comes first.
297
+ * </p>
298
+ *
299
+ * @implNote op names='voteLines', type='org.scijava.function.Computers.Arity3'
300
+ * @param input
301
+ * - the {@link RandomAccessibleInterval} to run the Hough Line
302
+ * Transform over
303
+ * @param votespace
304
+ * - the {@link RandomAccessibleInterval} in which the results
305
+ * are stored
306
+ * @param nTheta
307
+ * - the number of bins for theta resolution
308
+ * @param nRho
309
+ * - the number of bins for rho resolution
310
+ */
311
+ public static < T extends Comparable < T >, U extends IntegerType < U > > void voteLines (
312
+ final RandomAccessibleInterval < T > input ,
313
+ final int nTheta ,
314
+ final int nRho ,
315
+ final RandomAccessibleInterval < U > votespace )
316
+ {
317
+ voteLines (input , votespace , nTheta , nRho );
318
+ }
319
+
265
320
/**
266
321
* Runs a Hough Line Tranform on an image and populates the vote space
267
322
* parameter with the results.
@@ -292,6 +347,42 @@ public static < T extends Comparable< T >, U extends IntegerType< U > > void vot
292
347
voteLines ( input , votespace , nTheta , nRho , p );
293
348
}
294
349
350
+ /**
351
+ * Runs a Hough Line Tranform on an image and populates the vote space
352
+ * parameter with the results.
353
+ * <p>
354
+ * This method differs from
355
+ * {@link #voteLines(RandomAccessibleInterval, RandomAccessibleInterval, int, int, Comparable)}
356
+ * only in that its parameter order is tailored to an Op. The output comes
357
+ * last, and the primary input (the input image) comes first.
358
+ * </p>
359
+ *
360
+ * @implNote op name='voteLines', type='org.scijava.function.Computers.Arity4'
361
+ * @param input
362
+ * - the {@link RandomAccessibleInterval} to run the Hough Line
363
+ * Transform over
364
+ * @param nTheta
365
+ * - the number of bins for theta resolution
366
+ * @param nRho
367
+ * - the number of bins for rho resolution
368
+ * @param threshold
369
+ * - the minimum value allowed by the populator. Any input less
370
+ * than this value will be disregarded by the populator.
371
+ * @param votespace
372
+ * - the {@link RandomAccessibleInterval} in which the results
373
+ * are stored
374
+ */
375
+ public static < T extends Comparable < T >, U extends IntegerType < U > > void voteLines (
376
+ final RandomAccessibleInterval < T > input ,
377
+ final int nTheta ,
378
+ final int nRho ,
379
+ final T threshold ,
380
+ final RandomAccessibleInterval < U > votespace )
381
+
382
+ {
383
+ voteLines (input , votespace , nTheta , nRho , threshold );
384
+ }
385
+
295
386
/**
296
387
*
297
388
* Runs a Hough Line Tranform on an image and populates the vote space
@@ -405,12 +496,85 @@ public static < T, U extends IntegerType< U > > void voteLines(
405
496
}
406
497
}
407
498
499
+ /**
500
+ *
501
+ * Runs a Hough Line Tranform on an image and populates the vote space
502
+ * parameter with the results.
503
+ * <p>
504
+ * Vote space here has two dimensions: {@code rho} and {@code theta}.
505
+ * {@code theta} is measured in radians {@code [-pi/2 pi/2)}, {@code rho} is
506
+ * measured in {@code [-rhoMax, rhoMax)}.
507
+ * </p>
508
+ * <p>
509
+ * Lines are modeled as
510
+ * </p>
511
+ *
512
+ * <pre>
513
+ * l(t) = | x | = rho * | cos(theta) | + t * | sin(theta) |
514
+ * | y | | -sin(theta) | | cos(theta) |
515
+ * </pre>
516
+ * <p>
517
+ * In other words, {@code rho} represents the signed minimum distance from
518
+ * the image origin to the line, and {@code theta} indicates the angle
519
+ * between the row-axis and the minimum offset vector.
520
+ * </p>
521
+ * <p>
522
+ * For a given point, then, votes are placed along the curve
523
+ * </p>
524
+ *
525
+ * <pre>
526
+ * rho = y * sin( theta ) + x * cos( theta )
527
+ * </pre>
528
+ * <p>
529
+ * It is important to note that the interval of the first dimension of the
530
+ * vote space image is NOT {@code [-maxRho, maxRho)} but instead
531
+ * {@code [0, maxRho * 2)}; the same applies to the second dimension of the
532
+ * vote space as well. Thus if {@link HoughTransforms#pickLinePeaks} is not
533
+ * used to retrieve the maxima from the vote space, the vote space will have
534
+ * to be translated by {@code -maxRho} in dimension 0 to get the correct
535
+ * {@code rho} and {@code theta} values from the vote space.
536
+ * </p>
537
+ * <p>
538
+ * This method differs from
539
+ * {@link #voteLines(RandomAccessibleInterval, RandomAccessibleInterval, int, int, Predicate)}
540
+ * only in that its parameter order is tailored to an Op. The output comes
541
+ * last, and the primary input (the input image) comes first.
542
+ * </p>
543
+ *
544
+ * @implNote op name='voteLines', type='org.scijava.function.Computers.Arity4'
545
+ * @param input
546
+ * - the {@link RandomAccessibleInterval} to run the Hough Line
547
+ * Transform over
548
+ * @param nTheta
549
+ * - the number of bins for theta resolution
550
+ * @param nRho
551
+ * - the number of bins for rho resolution
552
+ * @param filter
553
+ * - a {@link Predicate} judging whether or not the a value is
554
+ * above the minimum value allowed by the populator. Any input
555
+ * less than or equal to this value will be disregarded by the
556
+ * populator.
557
+ * @param votespace
558
+ * - the {@link RandomAccessibleInterval} in which the results
559
+ * are stored
560
+ */
561
+ public static < T , U extends IntegerType < U > > void voteLines (
562
+ final RandomAccessibleInterval < T > input ,
563
+ final int nTheta ,
564
+ final int nRho ,
565
+ final Predicate < T > filter ,
566
+ final RandomAccessibleInterval < U > votespace )
567
+ {
568
+ voteLines (input , votespace , nTheta , nRho , filter );
569
+ }
570
+
408
571
/**
409
572
* Method used to convert the {rho, theta} output of the
410
573
* {@link HoughTransforms#voteLines} algorithm into a more useful
411
574
* y-intercept value. Used with {@link HoughTransforms#getSlope} to create
412
575
* line equations.
413
576
*
577
+ * @implNote op name='getIntercept', type='java.util.function.BiFunction'
414
578
* @param rho
415
579
* - the {@code rho} of the line
416
580
* @param theta
@@ -429,6 +593,7 @@ public static double getIntercept( final long rho, final long theta )
429
593
* value. Used with {@link HoughTransforms#getIntercept} to create line
430
594
* equations.
431
595
*
596
+ * @implNote op name='getSlope', type='java.util.function.Function'
432
597
* @param theta
433
598
* - the {@code theta} of the line
434
599
* @return {@code double} - the y-intercept of the line
0 commit comments