Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reader for Ventana .bif files #3336

Merged
merged 27 commits into from Jul 3, 2019
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
920eaf1
Initial Ventana .bif reader
melissalinkert Sep 26, 2018
98b43cd
Progress on tile stitching for the full resolution image
melissalinkert Oct 12, 2018
99d12a2
Use full resolution tile positions to assemble lower resolution images
melissalinkert Nov 15, 2018
21520c1
Average a subset of recorded overlaps instead of using overlap list
melissalinkert Nov 15, 2018
7facfbe
Add "ventana.split_tiles" boolean option
melissalinkert Nov 15, 2018
5a2e134
Populate physical pixel sizes
melissalinkert Nov 16, 2018
fb93dd7
Speed up subresolution reading by reducing the number of tile decodes
melissalinkert Nov 16, 2018
cf53b8e
Reduce image width and height by the total number of overlap pixels
melissalinkert Nov 17, 2018
5017ee1
Fix overlap removal for images with multiple AOIs
melissalinkert Nov 17, 2018
4d65cde
Always adjust the Y coordinate of every other column in an AOI
melissalinkert Nov 17, 2018
6a70853
Fix image names when resolutions are not flattened
melissalinkert Nov 17, 2018
72f10bf
Clean up line lengths and add a few more comments
melissalinkert Nov 17, 2018
e4f3dc6
Use the same units for physical sizes and positions
melissalinkert Nov 19, 2018
c30bc2c
Fix compile errors
melissalinkert Feb 27, 2019
01a8116
Ventana: fix magnification
melissalinkert Feb 20, 2019
17eb6fc
Ventana: adjust XY size to match AOI bounds
melissalinkert Feb 21, 2019
1579fb1
Adjust XY coordinate calculation for low resolution tiles
melissalinkert Feb 25, 2019
6da415d
Define a bounding box for each AOI so that column offsetting is trimmed
melissalinkert Feb 28, 2019
6c31571
Ventana: treat as normal TIFF if no scanned areas defined
melissalinkert Mar 25, 2019
d72e180
Ventana: turn off series splitting in underlying TIFF reader
melissalinkert Mar 29, 2019
8f2f8cd
Ventana: override getThumbSize* to match openThumbBytes
melissalinkert Mar 29, 2019
99540c7
Ventana: fall back to AOI position if the index field is missing
melissalinkert Mar 29, 2019
e5dfe3f
Fix warnings
melissalinkert Mar 30, 2019
ffc72c7
Check for "iScan" in the XML tag during isThisType
melissalinkert Apr 1, 2019
a054b17
Ventana: don't allow the same tile to be decompressed twice in a sing…
melissalinkert Apr 9, 2019
1d0bc44
TIFF: reduce array allocations and unpacking method calls
melissalinkert Apr 9, 2019
a875a23
Fix typo in setting up pixel unpacking for <8 bit data
melissalinkert Apr 25, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Average a subset of recorded overlaps instead of using overlap list

A lot of trial and error indicates that the recorded overlap list for
each AOI does not indicate the total number of overlaps to be removed.
Individual overlap values are also sometimes incorrect by a significant
amount.

This takes the approach of averaging high-confidence overlaps to produce
a single value for each of X and Y, which are then applied to all tiles
in the AOI.
  • Loading branch information...
melissalinkert committed Nov 15, 2018
commit 21520c1e5b269df015a71881216d9592cd12e502
@@ -380,6 +380,8 @@ else if (v[0].equals("mag")) {
}

// now process TIFF tiles and overlap data to get the real coordinates for each tile
// largest tile index is in upper right corner
// smallest tile index is in lower left corner (snake ordering)
int tileCols = core.get(0).sizeX / tileWidth;
for (AreaOfInterest area : areas) {
int tileRow = area.yOrigin / tileHeight;
@@ -393,30 +395,51 @@ else if (v[0].equals("mag")) {
}
}

// largest tile index is in upper right corner
// smallest tile index is in lower left corner (snake ordering)
// list of overlaps is not authoritative
// some values will be wrong, and some overlaps will be missing
// average the RIGHT values and apply the average to all tiles
// then average the UP values and apply to all tiles

HashMap<Integer, Integer> columnYAdjust = new HashMap<Integer, Integer>();
double rightSum = 0.0;
double upSum = 0.0;
int rightCount = 0;
int upCount = 0;
for (Overlap overlap : area.overlaps) {
int thisRow = getTileRow(overlap.a, area.tileRows, area.tileColumns);
int thisCol = getTileColumn(overlap.a, area.tileRows, area.tileColumns);
if (overlap.confidence < 98) {
continue;
}
if (overlap.direction.equals("RIGHT")) {
for (int col=0; col<=thisCol; col++) {
int currentIndex = (tileRow + thisRow) * tileCols + (tileCol + col);
tiles[currentIndex].realX += overlap.x;
}
int currentIndex = (tileRow + thisRow) * tileCols + (tileCol + thisCol);
tiles[currentIndex].realY += overlap.y;
rightSum += overlap.x;
rightCount++;
columnYAdjust.put(getTileColumn(overlap.a, area.tileRows, area.tileColumns), overlap.y);
}
else if (overlap.direction.equals("UP")) {
for (int row=thisRow; row<area.tileRows; row++) {
int currentIndex = (tileRow + row) * tileCols + (tileCol + thisCol);
tiles[currentIndex].realY -= overlap.y;
}
upSum += overlap.y;
upCount++;
}
else {
throw new FormatException("Unsupported overlap direction: " + overlap.direction);
}
}
if (rightCount > 0) {
rightSum /= rightCount;
}
if (upCount > 0) {
upSum /= upCount;
}

for (int row=0; row<area.tileRows; row++) {
for (int col=0; col<area.tileColumns; col++) {
int index = (tileRow + row) * tileCols + (tileCol + col);
tiles[index].realX -= (rightSum * col);
tiles[index].realY -= (upSum * row);
if (columnYAdjust.containsKey(col) && columnYAdjust.get(col) > 0) {
tiles[index].realY += columnYAdjust.get(col);
}
}
}

}
}

@@ -499,6 +522,7 @@ private void parseXML(String xml) throws IOException {
overlap.x = DataTools.parseDouble(joint.getAttribute("OverlapX")).intValue();
overlap.y = DataTools.parseDouble(joint.getAttribute("OverlapY")).intValue();
overlap.direction = joint.getAttribute("Direction");
overlap.confidence = Integer.parseInt(joint.getAttribute("Confidence"));
aoi.overlaps.add(overlap);
}
}
@@ -545,6 +569,7 @@ public String toString() {
public int b;
public int x;
public int y;
public int confidence;
public String direction;

public int compareTo(Overlap o) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.