Skip to content

Commit 5a443de

Browse files
authored
Merge pull request #4375 from melissalinkert/gh-4225
FV1000: fix some small ROI parsing issues
2 parents 01d1dc3 + 5ecc56d commit 5a443de

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

components/formats-gpl/src/loci/formats/in/FV1000Reader.java

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,8 @@ else if (tableName.equals("ROIBase Body")) {
12421242
Length font = FormatTools.getFontSize(fontSize);
12431243

12441244
lineWidth = Integer.parseInt(table.get("LINEWIDTH"));
1245+
Length l = new Length((double) lineWidth, UNITS.PIXEL);
1246+
12451247
name = table.get("NAME");
12461248
angle = Integer.parseInt(table.get("ANGLE"));
12471249
xc = table.get("X").split(",");
@@ -1282,27 +1284,26 @@ else if (tableName.equals("ROIBase Body")) {
12821284
if (font != null) {
12831285
store.setPointFontSize(font, nextROI, shape);
12841286
}
1285-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
12861287
store.setPointStrokeWidth(l, nextROI, shape);
12871288

12881289
store.setPointX(DataTools.parseDouble(xc[0]), nextROI, shape);
12891290
store.setPointY(DataTools.parseDouble(yc[0]), nextROI, shape);
12901291
}
12911292
else if (shapeType == GRID || shapeType == RECTANGLE) {
12921293
if (shapeType == RECTANGLE) divide = 1;
1293-
width /= divide;
1294-
height /= divide;
1294+
double dividedWidth = (double) width / divide;
1295+
double dividedHeight = (double) height / divide;
12951296
for (int row=0; row<divide; row++) {
12961297
for (int col=0; col<divide; col++) {
1297-
double realX = x + col * width;
1298-
double realY = y + row * height;
1298+
double realX = x + col * dividedWidth;
1299+
double realY = y + row * dividedHeight;
12991300

13001301
shapeID = MetadataTools.createLSID("Shape", nextROI, shape);
13011302
store.setRectangleID(shapeID, nextROI, shape);
13021303
store.setRectangleX(realX, nextROI, shape);
13031304
store.setRectangleY(realY, nextROI, shape);
1304-
store.setRectangleWidth((double) width, nextROI, shape);
1305-
store.setRectangleHeight((double) height, nextROI, shape);
1305+
store.setRectangleWidth(dividedWidth, nextROI, shape);
1306+
store.setRectangleHeight(dividedHeight, nextROI, shape);
13061307

13071308
store.setRectangleTheZ(
13081309
new NonNegativeInteger(zIndex), nextROI, shape);
@@ -1311,12 +1312,8 @@ else if (shapeType == GRID || shapeType == RECTANGLE) {
13111312
if (font != null) {
13121313
store.setRectangleFontSize(font, nextROI, shape);
13131314
}
1314-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
13151315
store.setRectangleStrokeWidth(l, nextROI, shape);
13161316

1317-
double centerX = realX + (width / 2);
1318-
double centerY = realY + (height / 2);
1319-
13201317
store.setRectangleTransform(
13211318
getRotationTransform(angle), nextROI, shape);
13221319

@@ -1336,17 +1333,12 @@ else if (shapeType == LINE) {
13361333
if (font != null) {
13371334
store.setLineFontSize(font, nextROI, shape);
13381335
}
1339-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
13401336
store.setLineStrokeWidth(l, nextROI, shape);
1341-
1342-
int centerX = x + (width / 2);
1343-
int centerY = y + (height / 2);
1344-
13451337
store.setLineTransform(getRotationTransform(angle), nextROI, shape);
13461338
}
13471339
else if (shapeType == CIRCLE || shapeType == ELLIPSE) {
1348-
double rx = width / 2;
1349-
double ry = shapeType == CIRCLE ? rx : height / 2;
1340+
double rx = width / 2.0;
1341+
double ry = shapeType == CIRCLE ? rx : height / 2.0;
13501342
store.setEllipseID(shapeID, nextROI, shape);
13511343
store.setEllipseX(x + rx, nextROI, shape);
13521344
store.setEllipseY(y + ry, nextROI, shape);
@@ -1360,7 +1352,6 @@ else if (shapeType == CIRCLE || shapeType == ELLIPSE) {
13601352
if (font != null) {
13611353
store.setEllipseFontSize(font, nextROI, shape);
13621354
}
1363-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
13641355
store.setEllipseStrokeWidth(l, nextROI, shape);
13651356
store.setEllipseTransform(
13661357
getRotationTransform(angle), nextROI, shape);
@@ -1387,7 +1378,6 @@ else if (shapeType == POLYGON || shapeType == FREE_SHAPE ||
13871378
if (font != null) {
13881379
store.setPolylineFontSize(font, nextROI, shape);
13891380
}
1390-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
13911381
store.setPolylineStrokeWidth(l, nextROI, shape);
13921382
}
13931383
else {
@@ -1402,7 +1392,6 @@ else if (shapeType == POLYGON || shapeType == FREE_SHAPE ||
14021392
if (font != null) {
14031393
store.setPolygonFontSize(font, nextROI, shape);
14041394
}
1405-
Length l = new Length((double) lineWidth, UNITS.PIXEL);
14061395
store.setPolygonStrokeWidth(l, nextROI, shape);
14071396
}
14081397
}

0 commit comments

Comments
 (0)