Skip to content

Commit

Permalink
- Point labeling support.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjzazuet committed Mar 31, 2022
1 parent eea96c5 commit 4486927
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/vacco/kimaris/impl/KmDetPup.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static KmCoord runCascade(int perturbs, KmCoord pl, KmImageParams img, bo
(int) detRows[(int) Math.round(perturbs / 2d)],
(int) detCols[(int) Math.round(perturbs / 2d)],
detScale[(int) Math.round(perturbs / 2d)]
);
).withLabel(String.format("%s%s", plc.id, flipV ? "-flp" : ""));
}

}
2 changes: 2 additions & 0 deletions src/main/java/io/vacco/kimaris/io/KmCascades.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.vacco.kimaris.schema.*;
import java.net.URL;
import java.nio.*;
import java.nio.file.Paths;
import java.util.ArrayList;

import static io.vacco.kimaris.io.KmArrays.*;
Expand All @@ -15,6 +16,7 @@ public static KmCascade unpackCascade(URL url) {
var bb = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
var pup = new KmCascade();

pup.id = Paths.get(url.getFile()).getFileName().toString();
pup.stages = bb.getInt();
pup.scales = bb.getFloat();
pup.trees = bb.getInt();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/vacco/kimaris/schema/KmCascade.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.vacco.kimaris.schema;

public class KmCascade {
public String id;
public long stages; // uint32
public float scales;
public long trees; // uint32
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/io/vacco/kimaris/schema/KmCoord.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class KmCoord {

public String label;
public int row;
public int col;
public double scale;
Expand All @@ -10,6 +11,11 @@ public boolean valid() {
return row > 0 && col > 0;
}

public KmCoord withLabel(String label) {
this.label = label;
return this;
}

public static KmCoord from(int row, int col, double scale) {
var c = new KmCoord();
c.col = col;
Expand All @@ -19,6 +25,6 @@ public static KmCoord from(int row, int col, double scale) {
}

@Override public String toString() {
return String.format("crd[r: %d, c: %d, s: %.3f]", row, col, scale);
return String.format("crd[l: %s, r: %d, c: %d, s: %.3f]", label, row, col, scale);
}
}

0 comments on commit 4486927

Please sign in to comment.