Skip to content

Commit

Permalink
Make DirectionalStatistic work for 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
minnerbe committed Oct 18, 2024
1 parent c727f1b commit 3595313
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Random;

/**
* A statistic that yields a small perturbation of a given direction for each sample.
* A statistic that yields a small perturbation of a given 2D direction for each sample.
*/
public class AnisotropicDirection2D implements DirectionalStatistic {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Random;

/**
* A statistic that yields a completely random direction for each sample.
* A statistic that yields a completely random 2D direction for each sample.
*/
public class RandomDirection2D implements DirectionalStatistic {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


/**
* Infer missing values in a 2D image by ray casting (which is equivalent to diffusion of image values).
* Infer missing values in an image (up to 3D) by ray casting (which is equivalent to diffusion of image values).
* <p>
* This is adapted from the hotknife repository for testing purposes.
*/
Expand All @@ -23,7 +23,7 @@ public class RayCastingInpainter {
private final long maxRayLength;
private final DirectionalStatistic directionStatistic;

private final double[] direction = new double[2];
private final double[] direction = new double[3];
private final Result result = new Result();

public RayCastingInpainter(final int nRays, final int maxInpaintingDiameter, final DirectionalStatistic directionStatistic) {
Expand All @@ -43,8 +43,8 @@ private static boolean isInside(final RealLocalizable p, final RealInterval r) {
}

/**
* Inpaints missing values in a 2D image by casting rays in random directions and averaging the values of the
* first non-masked pixel.
* Inpaints missing values in an image (up to 3D) by casting rays in random directions and averaging the values of
* the first non-masked pixel.
*
* @param img the image to inpaint
* @param mask the mask
Expand Down Expand Up @@ -122,7 +122,7 @@ private Result castRay(final RealRandomAccess<FloatType> mask, final Interval in


private static class Result {
public double[] position = new double[2];
public double[] position = new double[3];
public double distance = 0;
}
}

0 comments on commit 3595313

Please sign in to comment.