| 456 | } |
| 457 | |
| 458 | public Roi getShapeRoi() throws IOException { |
| 459 | int type = getByte(TYPE); |
| 460 | if (type!=rect) |
| 461 | throw new IllegalArgumentException("Invalid composite ROI type"); |
| 462 | int top= getShort(TOP); |
| 463 | int left = getShort(LEFT); |
| 464 | int bottom = getShort(BOTTOM); |
| 465 | int right = getShort(RIGHT); |
| 466 | int width = right-left; |
| 467 | int height = bottom-top; |
| 468 | int n = getInt(SHAPE_ROI_SIZE); |
| 469 | |
| 470 | ShapeRoi roi = null; |
| 471 | float[] shapeArray = new float[n]; |
| 472 | int base = COORDINATES; |
| 473 | for(int i=0; i<n; i++) { |
| 474 | shapeArray[i] = getFloat(base); |
| 475 | base += 4; |
| 476 | } |
| 477 | roi = new ShapeRoi(shapeArray); |
| 478 | roi.setName(getRoiName()); |
| 479 | return roi; |
| 480 | } |
| 481 | |
| 482 | Roi getTextRoi(Roi roi, int version) { |
| 483 | Rectangle r = roi.getBounds(); |