-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 1D specializations of Point and PointMatch for intensity matching
- Loading branch information
Showing
3 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...a-client/src/main/java/org/janelia/render/client/newsolver/solvers/intensity/Point1D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.janelia.render.client.newsolver.solvers.intensity; | ||
|
||
import mpicbg.models.CoordinateTransform; | ||
import mpicbg.models.Point; | ||
|
||
/** | ||
* A 1D point. This is used in the intensity matching algorithm and adds an optimized method for applying a | ||
* transformation a 1D point. The method doesn't overwrite {@link Point#apply(CoordinateTransform)} since this method | ||
* is marked as final in the superclass. | ||
*/ | ||
public class Point1D extends Point { | ||
public Point1D(final double l, final double w) { | ||
super(new double[] { l }, new double[] { w }); | ||
} | ||
|
||
public Point1D(final double l) { | ||
this(l, l); | ||
} | ||
|
||
public void applyFast(final CoordinateTransform t) { | ||
w[0] = l[0]; | ||
t.applyInPlace(w); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...ent/src/main/java/org/janelia/render/client/newsolver/solvers/intensity/PointMatch1D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.janelia.render.client.newsolver.solvers.intensity; | ||
|
||
import mpicbg.models.CoordinateTransform; | ||
import mpicbg.models.PointMatch; | ||
|
||
/** | ||
* A match of two 1D points. This is used in the intensity matching algorithm and adds an optimized method for computing | ||
* the distance of two 1D points. | ||
*/ | ||
public class PointMatch1D extends PointMatch { | ||
public PointMatch1D(final Point1D p1, final Point1D p2) { | ||
super(p1, p2); | ||
} | ||
|
||
public PointMatch1D(final Point1D p1, final Point1D p2, final double weight) { | ||
super(p1, p2, weight); | ||
} | ||
|
||
@Override | ||
public void apply(final CoordinateTransform t) { | ||
final Point1D p1 = (Point1D) this.p1; | ||
p1.applyFast(t); | ||
} | ||
|
||
@Override | ||
public double getDistance(){ | ||
final Point1D p1 = (Point1D) this.p1; | ||
final Point1D p2 = (Point1D) this.p2; | ||
return Math.abs(p1.getL()[0] - p2.getL()[0]); | ||
} | ||
} |