001// 002// This file is auto-generated by wpilibj/wpilibJavaJNI/nivision/gen_java.py 003// Please do not edit! 004// 005 006package com.ni.vision; 007 008import java.lang.reflect.*; 009import java.io.UnsupportedEncodingException; 010import java.nio.Buffer; 011import java.nio.ByteBuffer; 012import java.nio.ByteOrder; 013 014public class NIVision { 015 private NIVision() {} 016 017 private static native void imaqDispose(long addr); 018 019 private static Constructor<?> constructDirectByteBuffer; 020 private static Field bufferAddressField; 021 022 static { 023 try { 024 Class<?>[] cArg = new Class[2]; 025 cArg[0] = long.class; 026 cArg[1] = int.class; 027 constructDirectByteBuffer = 028 Class.forName("java.nio.DirectByteBuffer").getDeclaredConstructor(cArg); 029 constructDirectByteBuffer.setAccessible(true); 030 031 bufferAddressField = Buffer.class.getDeclaredField("address"); 032 bufferAddressField.setAccessible(true); 033 } catch (ReflectiveOperationException e) { 034 throw new ExceptionInInitializerError(e); 035 } 036 } 037 038 private static ByteBuffer newDirectByteBuffer(long addr, int cap) { 039 try { 040 return ((ByteBuffer) (constructDirectByteBuffer.newInstance(addr, cap))).order(ByteOrder 041 .nativeOrder()); 042 } catch (ReflectiveOperationException e) { 043 throw new ExceptionInInitializerError(e); 044 } 045 } 046 047 private static long getByteBufferAddress(ByteBuffer bb) { 048 try { 049 return bufferAddressField.getLong(bb); 050 } catch (IllegalAccessException e) { 051 return 0; 052 } 053 } 054 055 public static ByteBuffer sliceByteBuffer(ByteBuffer bb, int offset, int size) { 056 int pos = bb.position(); 057 int lim = bb.limit(); 058 bb.position(offset); 059 bb.limit(offset + size); 060 ByteBuffer new_bb = bb.slice().order(ByteOrder.nativeOrder()); 061 bb.position(pos); 062 bb.limit(lim); 063 return new_bb; 064 } 065 066 public static ByteBuffer getBytes(ByteBuffer bb, byte[] dst, int offset, int size) { 067 int pos = bb.position(); 068 bb.position(offset); 069 bb.get(dst, 0, size); 070 bb.position(pos); 071 return bb; 072 } 073 074 public static ByteBuffer putBytes(ByteBuffer bb, byte[] src, int offset, int size) { 075 int pos = bb.position(); 076 bb.position(offset); 077 bb.put(src, 0, size); 078 bb.position(pos); 079 return bb; 080 } 081 082 private static abstract class DisposedStruct { 083 protected ByteBuffer backing; 084 private boolean owned; 085 086 protected DisposedStruct(int size) { 087 backing = ByteBuffer.allocateDirect(size); 088 backing.order(ByteOrder.nativeOrder()); 089 owned = false; 090 } 091 092 protected DisposedStruct(ByteBuffer backing, int offset, int size) { 093 this.backing = sliceByteBuffer(backing, offset, size); 094 owned = false; 095 } 096 097 private DisposedStruct(long nativeObj, boolean owned, int size) { 098 backing = newDirectByteBuffer(nativeObj, size); 099 this.owned = owned; 100 } 101 102 public void free() { 103 if (owned) { 104 imaqDispose(getByteBufferAddress(backing)); 105 owned = false; 106 backing = null; 107 } 108 } 109 110 @Override 111 protected void finalize() throws Throwable { 112 if (owned) 113 imaqDispose(getByteBufferAddress(backing)); 114 super.finalize(); 115 } 116 117 public long getAddress() { 118 if (backing == null) 119 return 0; 120 write(); 121 return getByteBufferAddress(backing); 122 } 123 124 protected void setBuffer(ByteBuffer backing, int offset, int size) { 125 this.backing = sliceByteBuffer(backing, offset, size); 126 } 127 128 abstract public void read(); 129 130 abstract public void write(); 131 132 abstract public int size(); 133 } 134 135 private static abstract class OpaqueStruct { 136 private long nativeObj; 137 private boolean owned; 138 139 protected OpaqueStruct() { 140 nativeObj = 0; 141 owned = false; 142 } 143 144 protected OpaqueStruct(long nativeObj, boolean owned) { 145 this.nativeObj = nativeObj; 146 this.owned = owned; 147 } 148 149 public void free() { 150 if (owned && nativeObj != 0) { 151 imaqDispose(nativeObj); 152 owned = false; 153 nativeObj = 0; 154 } 155 } 156 157 @Override 158 protected void finalize() throws Throwable { 159 if (owned && nativeObj != 0) 160 imaqDispose(nativeObj); 161 super.finalize(); 162 } 163 164 public long getAddress() { 165 return nativeObj; 166 } 167 } 168 169 public static class RawData { 170 private ByteBuffer buf; 171 private boolean owned; 172 173 public RawData() { 174 owned = false; 175 } 176 177 public RawData(ByteBuffer buf) { 178 this.buf = buf; 179 owned = false; 180 } 181 182 private RawData(long nativeObj, boolean owned, int size) { 183 buf = newDirectByteBuffer(nativeObj, size); 184 this.owned = owned; 185 } 186 187 public void free() { 188 if (owned) { 189 imaqDispose(getByteBufferAddress(buf)); 190 owned = false; 191 buf = null; 192 } 193 } 194 195 @Override 196 protected void finalize() throws Throwable { 197 if (owned) 198 imaqDispose(getByteBufferAddress(buf)); 199 super.finalize(); 200 } 201 202 public long getAddress() { 203 if (buf == null) 204 return 0; 205 return getByteBufferAddress(buf); 206 } 207 208 public ByteBuffer getBuffer() { 209 return buf; 210 } 211 212 public void setBuffer(ByteBuffer buf) { 213 if (owned) 214 free(); 215 this.buf = buf; 216 } 217 } 218 219 private static long getPointer(ByteBuffer bb, int offset) { 220 return (long) bb.getInt(offset); 221 } 222 223 private static void putPointer(ByteBuffer bb, int offset, long address) { 224 bb.putInt(offset, (int) address); 225 } 226 227 private static void putPointer(ByteBuffer bb, int offset, ByteBuffer buf) { 228 if (buf == null) 229 bb.putInt(offset, 0); 230 else 231 bb.putInt(offset, (int) getByteBufferAddress(buf)); 232 } 233 234 private static void putPointer(ByteBuffer bb, int offset, DisposedStruct struct) { 235 if (struct == null) 236 bb.putInt(offset, 0); 237 else 238 bb.putInt(offset, (int) struct.getAddress()); 239 } 240 241 private static void putPointer(ByteBuffer bb, int offset, OpaqueStruct struct) { 242 if (struct == null) 243 bb.putInt(offset, 0); 244 else 245 bb.putInt(offset, (int) struct.getAddress()); 246 } 247 248 /** 249 * Opaque Structures 250 */ 251 252 public static class CharSet extends OpaqueStruct { 253 private CharSet() {} 254 255 private CharSet(long nativeObj, boolean owned) { 256 super(nativeObj, owned); 257 } 258 } 259 260 public static class ClassifierSession extends OpaqueStruct { 261 private ClassifierSession() {} 262 263 private ClassifierSession(long nativeObj, boolean owned) { 264 super(nativeObj, owned); 265 } 266 } 267 268 public static class Image extends OpaqueStruct { 269 private Image() {} 270 271 private Image(long nativeObj, boolean owned) { 272 super(nativeObj, owned); 273 } 274 } 275 276 public static class MultipleGeometricPattern extends OpaqueStruct { 277 private MultipleGeometricPattern() {} 278 279 private MultipleGeometricPattern(long nativeObj, boolean owned) { 280 super(nativeObj, owned); 281 } 282 } 283 284 public static class Overlay extends OpaqueStruct { 285 private Overlay() {} 286 287 private Overlay(long nativeObj, boolean owned) { 288 super(nativeObj, owned); 289 } 290 } 291 292 public static class ROI extends OpaqueStruct { 293 private ROI() {} 294 295 private ROI(long nativeObj, boolean owned) { 296 super(nativeObj, owned); 297 } 298 } 299 300 /** 301 * Manifest Constants 302 */ 303 public static final boolean DEFAULT_SHOW_COORDINATES = true; 304 public static final int DEFAULT_MAX_ICONS_PER_LINE = 4; 305 public static final boolean DEFAULT_BMP_COMPRESS = false; 306 public static final int DEFAULT_PNG_QUALITY = 750; 307 public static final int DEFAULT_JPEG_QUALITY = 750; 308 public static final int ALL_CONTOURS = -1; 309 public static final int ALL_WINDOWS = -1; 310 public static final int SHIFT = 1; 311 public static final int ALT = 2; 312 public static final int CTRL = 4; 313 public static final int CAPS_LOCK = 8; 314 public static final int MODAL_DIALOG = -1; 315 public static final int USE_DEFAULT_QUALITY = -1; 316 public static final int ALL_SAMPLES = -1; 317 public static final int ALL_OBJECTS = -1; 318 public static final int ALL_CHARACTERS = -1; 319 320 /** 321 * Predefined Valid Characters 322 */ 323 public static final byte[] ANY_CHARACTER = {0}; 324 public static final byte[] ALPHABETIC = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 325 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 326 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 327 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0}; 328 public static final byte[] ALPHANUMERIC = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 329 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 330 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 331 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 332 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0}; 333 public static final byte[] UPPERCASE_LETTERS = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 334 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 335 0x58, 0x59, 0x5a, 0}; 336 public static final byte[] LOWERCASE_LETTERS = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 337 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 338 0x78, 0x79, 0x7a, 0}; 339 public static final byte[] DECIMAL_DIGITS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 340 0x38, 0x39, 0}; 341 public static final byte[] HEXADECIMAL_DIGITS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 342 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0}; 343 public static final byte[] PATTERN = {0x5c, 0x78, 0x46, 0x46, 0}; 344 public static final byte[] FORCE_SPACE = {0x20, 0}; 345 346 /** 347 * Enumerated Types 348 */ 349 350 public static enum PointSymbol { 351 POINT_AS_PIXEL(0), // A single pixel represents a point in the overlay. 352 POINT_AS_CROSS(1), // A cross represents a point in the overlay. 353 POINT_USER_DEFINED(2), // The pattern supplied by the user represents a 354 // point in the overlay. 355 ; 356 private final int value; 357 358 private PointSymbol(int value) { 359 this.value = value; 360 } 361 362 public static PointSymbol fromValue(int val) { 363 try { 364 return values()[val]; 365 } catch (ArrayIndexOutOfBoundsException e) { 366 return null; 367 } 368 } 369 370 public int getValue() { 371 return value; 372 } 373 } 374 375 public static enum MeasurementValue { 376 AREA(0), // Surface area of the particle in pixels. 377 AREA_CALIBRATED(1), // Surface area of the particle in calibrated units. 378 NUM_HOLES(2), // Number of holes in the particle. 379 AREA_OF_HOLES(3), // Surface area of the holes in calibrated units. 380 TOTAL_AREA(4), // Total surface area (holes and particle) in calibrated 381 // units. 382 IMAGE_AREA(5), // Surface area of the entire image in calibrated units. 383 PARTICLE_TO_IMAGE(6), // Ratio, expressed as a percentage, of the surface 384 // area of a particle in relation to the total area of 385 // the particle. 386 PARTICLE_TO_TOTAL(7), // Ratio, expressed as a percentage, of the surface 387 // area of a particle in relation to the total area of 388 // the particle. 389 CENTER_MASS_X(8), // X-coordinate of the center of mass. 390 CENTER_MASS_Y(9), // Y-coordinate of the center of mass. 391 LEFT_COLUMN(10), // Left edge of the bounding rectangle. 392 TOP_ROW(11), // Top edge of the bounding rectangle. 393 RIGHT_COLUMN(12), // Right edge of the bounding rectangle. 394 BOTTOM_ROW(13), // Bottom edge of bounding rectangle. 395 WIDTH(14), // Width of bounding rectangle in calibrated units. 396 HEIGHT(15), // Height of bounding rectangle in calibrated units. 397 MAX_SEGMENT_LENGTH(16), // Length of longest horizontal line segment. 398 MAX_SEGMENT_LEFT_COLUMN(17), // Leftmost x-coordinate of longest horizontal 399 // line segment. 400 MAX_SEGMENT_TOP_ROW(18), // Y-coordinate of longest horizontal line segment. 401 PERIMETER(19), // Outer perimeter of the particle. 402 PERIMETER_OF_HOLES(20), // Perimeter of all holes within the particle. 403 SIGMA_X(21), // Sum of the particle pixels on the x-axis. 404 SIGMA_Y(22), // Sum of the particle pixels on the y-axis. 405 SIGMA_XX(23), // Sum of the particle pixels on the x-axis squared. 406 SIGMA_YY(24), // Sum of the particle pixels on the y-axis squared. 407 SIGMA_XY(25), // Sum of the particle pixels on the x-axis and y-axis. 408 PROJ_X(26), // Projection corrected in X. 409 PROJ_Y(27), // Projection corrected in Y. 410 INERTIA_XX(28), // Inertia matrix coefficient in XX. 411 INERTIA_YY(29), // Inertia matrix coefficient in YY. 412 INERTIA_XY(30), // Inertia matrix coefficient in XY. 413 MEAN_H(31), // Mean length of horizontal segments. 414 MEAN_V(32), // Mean length of vertical segments. 415 MAX_INTERCEPT(33), // Length of longest segment of the convex hull. 416 MEAN_INTERCEPT(34), // Mean length of the chords in an object perpendicular 417 // to its max intercept. 418 ORIENTATION(35), // The orientation based on the inertia of the pixels in 419 // the particle. 420 EQUIV_ELLIPSE_MINOR(36), // Total length of the axis of the ellipse having 421 // the same area as the particle and a major axis 422 // equal to half the max intercept. 423 ELLIPSE_MAJOR(37), // Total length of major axis having the same area and 424 // perimeter as the particle in calibrated units. 425 ELLIPSE_MINOR(38), // Total length of minor axis having the same area and 426 // perimeter as the particle in calibrated units. 427 ELLIPSE_RATIO(39), // Fraction of major axis to minor axis. 428 RECT_LONG_SIDE(40), // Length of the long side of a rectangle having the 429 // same area and perimeter as the particle in calibrated 430 // units. 431 RECT_SHORT_SIDE(41), // Length of the short side of a rectangle having the 432 // same area and perimeter as the particle in 433 // calibrated units. 434 RECT_RATIO(42), // Ratio of rectangle long side to rectangle short side. 435 ELONGATION(43), // Max intercept/mean perpendicular intercept. 436 COMPACTNESS(44), // Particle area/(height x width). 437 HEYWOOD(45), // Particle perimeter/perimeter of the circle having the same 438 // area as the particle. 439 TYPE_FACTOR(46), // A complex factor relating the surface area to the moment 440 // of inertia. 441 HYDRAULIC(47), // Particle area/particle perimeter. 442 WADDLE_DISK(48), // Diameter of the disk having the same area as the 443 // particle in user units. 444 DIAGONAL(49), // Diagonal of an equivalent rectangle in user units. 445 ; 446 private final int value; 447 448 private MeasurementValue(int value) { 449 this.value = value; 450 } 451 452 public static MeasurementValue fromValue(int val) { 453 try { 454 return values()[val]; 455 } catch (ArrayIndexOutOfBoundsException e) { 456 return null; 457 } 458 } 459 460 public int getValue() { 461 return value; 462 } 463 } 464 465 public static enum ScalingMode { 466 SCALE_LARGER(0), // The function duplicates pixels to make the image larger. 467 SCALE_SMALLER(1), // The function subsamples pixels to make the image 468 // smaller. 469 ; 470 private final int value; 471 472 private ScalingMode(int value) { 473 this.value = value; 474 } 475 476 public static ScalingMode fromValue(int val) { 477 try { 478 return values()[val]; 479 } catch (ArrayIndexOutOfBoundsException e) { 480 return null; 481 } 482 } 483 484 public int getValue() { 485 return value; 486 } 487 } 488 489 public static enum ScalingMethod { 490 SCALE_TO_PRESERVE_AREA(0), // Correction functions scale the image such that 491 // the features in the corrected image have the 492 // same area as the features in the input image. 493 SCALE_TO_FIT(1), // Correction functions scale the image such that the 494 // corrected image is the same size as the input image. 495 ; 496 private final int value; 497 498 private ScalingMethod(int value) { 499 this.value = value; 500 } 501 502 public static ScalingMethod fromValue(int val) { 503 try { 504 return values()[val]; 505 } catch (ArrayIndexOutOfBoundsException e) { 506 return null; 507 } 508 } 509 510 public int getValue() { 511 return value; 512 } 513 } 514 515 public static enum ReferenceMode { 516 COORD_X_Y(0), // This method requires three elements in the points array. 517 COORD_ORIGIN_X(1), // This method requires two elements in the points array. 518 ; 519 private final int value; 520 521 private ReferenceMode(int value) { 522 this.value = value; 523 } 524 525 public static ReferenceMode fromValue(int val) { 526 try { 527 return values()[val]; 528 } catch (ArrayIndexOutOfBoundsException e) { 529 return null; 530 } 531 } 532 533 public int getValue() { 534 return value; 535 } 536 } 537 538 public static enum RectOrientation { 539 BASE_INSIDE(0), // Specifies that the base of the rectangular image lies 540 // along the inside edge of the annulus. 541 BASE_OUTSIDE(1), // Specifies that the base of the rectangular image lies 542 // along the outside edge of the annulus. 543 ; 544 private final int value; 545 546 private RectOrientation(int value) { 547 this.value = value; 548 } 549 550 public static RectOrientation fromValue(int val) { 551 try { 552 return values()[val]; 553 } catch (ArrayIndexOutOfBoundsException e) { 554 return null; 555 } 556 } 557 558 public int getValue() { 559 return value; 560 } 561 } 562 563 public static enum ShapeMode { 564 SHAPE_RECT(1), // The function draws a rectangle. 565 SHAPE_OVAL(2), // The function draws an oval. 566 ; 567 private final int value; 568 569 private ShapeMode(int value) { 570 this.value = value; 571 } 572 573 public static ShapeMode fromValue(int val) { 574 for (ShapeMode v : values()) { 575 if (v.value == val) 576 return v; 577 } 578 return null; 579 } 580 581 public int getValue() { 582 return value; 583 } 584 } 585 586 public static enum PolarityType { 587 EDGE_RISING(1), // The edge is a rising edge. 588 EDGE_FALLING(-1), // The edge is a falling edge. 589 ; 590 private final int value; 591 592 private PolarityType(int value) { 593 this.value = value; 594 } 595 596 public static PolarityType fromValue(int val) { 597 for (PolarityType v : values()) { 598 if (v.value == val) 599 return v; 600 } 601 return null; 602 } 603 604 public int getValue() { 605 return value; 606 } 607 } 608 609 public static enum SizeType { 610 KEEP_LARGE(0), // The function keeps large particles remaining after the 611 // erosion. 612 KEEP_SMALL(1), // The function keeps small particles eliminated by the 613 // erosion. 614 ; 615 private final int value; 616 617 private SizeType(int value) { 618 this.value = value; 619 } 620 621 public static SizeType fromValue(int val) { 622 try { 623 return values()[val]; 624 } catch (ArrayIndexOutOfBoundsException e) { 625 return null; 626 } 627 } 628 629 public int getValue() { 630 return value; 631 } 632 } 633 634 public static enum Plane3D { 635 C3D_REAL(0), // The function shows the real part of complex images. 636 C3D_IMAGINARY(1), // The function shows the imaginary part of complex 637 // images. 638 C3D_MAGNITUDE(2), // The function shows the magnitude part of complex 639 // images. 640 C3D_PHASE(3), // The function shows the phase part of complex images. 641 ; 642 private final int value; 643 644 private Plane3D(int value) { 645 this.value = value; 646 } 647 648 public static Plane3D fromValue(int val) { 649 try { 650 return values()[val]; 651 } catch (ArrayIndexOutOfBoundsException e) { 652 return null; 653 } 654 } 655 656 public int getValue() { 657 return value; 658 } 659 } 660 661 public static enum PhotometricMode { 662 WHITE_IS_ZERO(0), // The function interprets zero-value pixels as white. 663 BLACK_IS_ZERO(1), // The function interprets zero-value pixels as black. 664 ; 665 private final int value; 666 667 private PhotometricMode(int value) { 668 this.value = value; 669 } 670 671 public static PhotometricMode fromValue(int val) { 672 try { 673 return values()[val]; 674 } catch (ArrayIndexOutOfBoundsException e) { 675 return null; 676 } 677 } 678 679 public int getValue() { 680 return value; 681 } 682 } 683 684 public static enum ParticleInfoMode { 685 BASIC_INFO(0), // The function returns only the following elements of each 686 // report: area, calibratedArea, boundingRect. 687 ALL_INFO(1), // The function returns all the information about each 688 // particle. 689 ; 690 private final int value; 691 692 private ParticleInfoMode(int value) { 693 this.value = value; 694 } 695 696 public static ParticleInfoMode fromValue(int val) { 697 try { 698 return values()[val]; 699 } catch (ArrayIndexOutOfBoundsException e) { 700 return null; 701 } 702 } 703 704 public int getValue() { 705 return value; 706 } 707 } 708 709 public static enum OutlineMethod { 710 EDGE_DIFFERENCE(0), // The function uses a method that produces continuous 711 // contours by highlighting each pixel where an 712 // intensity variation occurs between itself and its 713 // three upper-left neighbors. 714 EDGE_GRADIENT(1), // The function uses a method that outlines contours where 715 // an intensity variation occurs along the vertical axis. 716 EDGE_PREWITT(2), // The function uses a method that extracts the outer 717 // contours of objects. 718 EDGE_ROBERTS(3), // The function uses a method that outlines the contours 719 // that highlight pixels where an intensity variation 720 // occurs along the diagonal axes. 721 EDGE_SIGMA(4), // The function uses a method that outlines contours and 722 // details by setting pixels to the mean value found in their 723 // neighborhood, if their deviation from this value is not 724 // significant. 725 EDGE_SOBEL(5), // The function uses a method that extracts the outer 726 // contours of objects. 727 ; 728 private final int value; 729 730 private OutlineMethod(int value) { 731 this.value = value; 732 } 733 734 public static OutlineMethod fromValue(int val) { 735 try { 736 return values()[val]; 737 } catch (ArrayIndexOutOfBoundsException e) { 738 return null; 739 } 740 } 741 742 public int getValue() { 743 return value; 744 } 745 } 746 747 public static enum MorphologyMethod { 748 AUTOM(0), // The function uses a transformation that generates simpler 749 // particles that contain fewer details. 750 CLOSE(1), // The function uses a transformation that fills tiny holes and 751 // smooths boundaries. 752 DILATE(2), // The function uses a transformation that eliminates tiny holes 753 // isolated in particles and expands the contour of the particles 754 // according to the template defined by the structuring element. 755 ERODE(3), // The function uses a transformation that eliminates pixels 756 // isolated in the background and erodes the contour of particles 757 // according to the template defined by the structuring element. 758 GRADIENT(4), // The function uses a transformation that leaves only the 759 // pixels that would be added by the dilation process or 760 // eliminated by the erosion process. 761 GRADIENTOUT(5), // The function uses a transformation that leaves only the 762 // pixels that would be added by the dilation process. 763 GRADIENTIN(6), // The function uses a transformation that leaves only the 764 // pixels that would be eliminated by the erosion process. 765 HITMISS(7), // The function uses a transformation that extracts each pixel 766 // located in a neighborhood exactly matching the template 767 // defined by the structuring element. 768 OPEN(8), // The function uses a transformation that removes small particles 769 // and smooths boundaries. 770 PCLOSE(9), // The function uses a transformation that fills tiny holes and 771 // smooths the inner contour of particles according to the 772 // template defined by the structuring element. 773 POPEN(10), // The function uses a transformation that removes small 774 // particles and smooths the contour of particles according to 775 // the template defined by the structuring element. 776 THICK(11), // The function uses a transformation that adds to an image those 777 // pixels located in a neighborhood that matches a template 778 // specified by the structuring element. 779 THIN(12), // The function uses a transformation that eliminates pixels that 780 // are located in a neighborhood matching a template specified by 781 // the structuring element. 782 ; 783 private final int value; 784 785 private MorphologyMethod(int value) { 786 this.value = value; 787 } 788 789 public static MorphologyMethod fromValue(int val) { 790 try { 791 return values()[val]; 792 } catch (ArrayIndexOutOfBoundsException e) { 793 return null; 794 } 795 } 796 797 public int getValue() { 798 return value; 799 } 800 } 801 802 public static enum MeterArcMode { 803 METER_ARC_ROI(0), // The function uses the roi parameter and ignores the 804 // base, start, and end parameters. 805 METER_ARC_POINTS(1), // The function uses the base,start, and end parameters 806 // and ignores the roi parameter. 807 ; 808 private final int value; 809 810 private MeterArcMode(int value) { 811 this.value = value; 812 } 813 814 public static MeterArcMode fromValue(int val) { 815 try { 816 return values()[val]; 817 } catch (ArrayIndexOutOfBoundsException e) { 818 return null; 819 } 820 } 821 822 public int getValue() { 823 return value; 824 } 825 } 826 827 public static enum RakeDirection { 828 LEFT_TO_RIGHT(0), // The function searches from the left side of the search 829 // area to the right side of the search area. 830 RIGHT_TO_LEFT(1), // The function searches from the right side of the search 831 // area to the left side of the search area. 832 TOP_TO_BOTTOM(2), // The function searches from the top side of the search 833 // area to the bottom side of the search area. 834 BOTTOM_TO_TOP(3), // The function searches from the bottom side of the 835 // search area to the top side of the search area. 836 ; 837 private final int value; 838 839 private RakeDirection(int value) { 840 this.value = value; 841 } 842 843 public static RakeDirection fromValue(int val) { 844 try { 845 return values()[val]; 846 } catch (ArrayIndexOutOfBoundsException e) { 847 return null; 848 } 849 } 850 851 public int getValue() { 852 return value; 853 } 854 } 855 856 public static enum TruncateMode { 857 TRUNCATE_LOW(0), // The function truncates low frequencies. 858 TRUNCATE_HIGH(1), // The function truncates high frequencies. 859 ; 860 private final int value; 861 862 private TruncateMode(int value) { 863 this.value = value; 864 } 865 866 public static TruncateMode fromValue(int val) { 867 try { 868 return values()[val]; 869 } catch (ArrayIndexOutOfBoundsException e) { 870 return null; 871 } 872 } 873 874 public int getValue() { 875 return value; 876 } 877 } 878 879 public static enum AttenuateMode { 880 ATTENUATE_LOW(0), // The function attenuates low frequencies. 881 ATTENUATE_HIGH(1), // The function attenuates high frequencies. 882 ; 883 private final int value; 884 885 private AttenuateMode(int value) { 886 this.value = value; 887 } 888 889 public static AttenuateMode fromValue(int val) { 890 try { 891 return values()[val]; 892 } catch (ArrayIndexOutOfBoundsException e) { 893 return null; 894 } 895 } 896 897 public int getValue() { 898 return value; 899 } 900 } 901 902 public static enum WindowThreadPolicy { 903 CALLING_THREAD(0), // Using this policy, NI Vision creates windows in the 904 // thread that makes the first display function call for 905 // a given window number. 906 SEPARATE_THREAD(1), // Using this policy, NI Vision creates windows in a 907 // separate thread and processes messages for the 908 // windows automatically. 909 ; 910 private final int value; 911 912 private WindowThreadPolicy(int value) { 913 this.value = value; 914 } 915 916 public static WindowThreadPolicy fromValue(int val) { 917 try { 918 return values()[val]; 919 } catch (ArrayIndexOutOfBoundsException e) { 920 return null; 921 } 922 } 923 924 public int getValue() { 925 return value; 926 } 927 } 928 929 public static enum WindowOptions { 930 WIND_RESIZABLE(1), // When present, the user may resize the window 931 // interactively. 932 WIND_TITLEBAR(2), // When present, the title bar on the window is visible. 933 WIND_CLOSEABLE(4), // When present, the close box is available. 934 WIND_TOPMOST(8), // When present, the window is always on top. 935 ; 936 private final int value; 937 938 private WindowOptions(int value) { 939 this.value = value; 940 } 941 942 public static WindowOptions fromValue(int val) { 943 for (WindowOptions v : values()) { 944 if (v.value == val) 945 return v; 946 } 947 return null; 948 } 949 950 public int getValue() { 951 return value; 952 } 953 } 954 955 public static enum WindowEventType { 956 NO_EVENT(0), // No event occurred since the last call to imaqGetLastEvent(). 957 CLICK_EVENT(1), // The user clicked on a window. 958 DRAW_EVENT(2), // The user drew an ROI in a window. 959 MOVE_EVENT(3), // The user moved a window. 960 SIZE_EVENT(4), // The user sized a window. 961 SCROLL_EVENT(5), // The user scrolled a window. 962 ACTIVATE_EVENT(6), // The user activated a window. 963 CLOSE_EVENT(7), // The user closed a window. 964 DOUBLE_CLICK_EVENT(8), // The user double-clicked in a window. 965 ; 966 private final int value; 967 968 private WindowEventType(int value) { 969 this.value = value; 970 } 971 972 public static WindowEventType fromValue(int val) { 973 try { 974 return values()[val]; 975 } catch (ArrayIndexOutOfBoundsException e) { 976 return null; 977 } 978 } 979 980 public int getValue() { 981 return value; 982 } 983 } 984 985 public static enum VisionInfoType { 986 ANY_VISION_INFO(0), // The function checks if any extra vision information 987 // is associated with the image. 988 PATTERN_MATCHING_INFO(1), // The function checks if any pattern matching 989 // template information is associated with the 990 // image. 991 CALIBRATION_INFO(2), // The function checks if any calibration information 992 // is associated with the image. 993 OVERLAY_INFO(3), // The function checks if any overlay information is 994 // associated with the image. 995 ; 996 private final int value; 997 998 private VisionInfoType(int value) { 999 this.value = value; 1000 } 1001 1002 public static VisionInfoType fromValue(int val) { 1003 try { 1004 return values()[val]; 1005 } catch (ArrayIndexOutOfBoundsException e) { 1006 return null; 1007 } 1008 } 1009 1010 public int getValue() { 1011 return value; 1012 } 1013 } 1014 1015 public static enum SearchStrategy { 1016 CONSERVATIVE(1), // Instructs the pattern matching algorithm to use the 1017 // largest possible amount of information from the image at 1018 // the expense of slowing down the speed of the algorithm. 1019 BALANCED(2), // Instructs the pattern matching algorithm to balance the 1020 // amount of information from the image it uses with the speed 1021 // of the algorithm. 1022 AGGRESSIVE(3), // Instructs the pattern matching algorithm to use a lower 1023 // amount of information from the image, which allows the 1024 // algorithm to run quickly but at the expense of accuracy. 1025 VERY_AGGRESSIVE(4), // Instructs the pattern matching algorithm to use the 1026 // smallest possible amount of information from the 1027 // image, which allows the algorithm to run at the 1028 // highest speed possible but at the expense of 1029 // accuracy. 1030 ; 1031 private final int value; 1032 1033 private SearchStrategy(int value) { 1034 this.value = value; 1035 } 1036 1037 public static SearchStrategy fromValue(int val) { 1038 for (SearchStrategy v : values()) { 1039 if (v.value == val) 1040 return v; 1041 } 1042 return null; 1043 } 1044 1045 public int getValue() { 1046 return value; 1047 } 1048 } 1049 1050 public static enum TwoEdgePolarityType { 1051 NONE(0), // The function ignores the polarity of the edges. 1052 RISING_FALLING(1), // The polarity of the first edge is rising (dark to 1053 // light) and the polarity of the second edge is falling 1054 // (light to dark). 1055 FALLING_RISING(2), // The polarity of the first edge is falling (light to 1056 // dark) and the polarity of the second edge is rising 1057 // (dark to light). 1058 RISING_RISING(3), // The polarity of the first edge is rising (dark to 1059 // light) and the polarity of the second edge is rising 1060 // (dark to light). 1061 FALLING_FALLING(4), // The polarity of the first edge is falling (light to 1062 // dark) and the polarity of the second edge is falling 1063 // (light to dark). 1064 ; 1065 private final int value; 1066 1067 private TwoEdgePolarityType(int value) { 1068 this.value = value; 1069 } 1070 1071 public static TwoEdgePolarityType fromValue(int val) { 1072 try { 1073 return values()[val]; 1074 } catch (ArrayIndexOutOfBoundsException e) { 1075 return null; 1076 } 1077 } 1078 1079 public int getValue() { 1080 return value; 1081 } 1082 } 1083 1084 public static enum ObjectType { 1085 BRIGHT_OBJECTS(0), // The function detects bright objects. 1086 DARK_OBJECTS(1), // The function detects dark objects. 1087 ; 1088 private final int value; 1089 1090 private ObjectType(int value) { 1091 this.value = value; 1092 } 1093 1094 public static ObjectType fromValue(int val) { 1095 try { 1096 return values()[val]; 1097 } catch (ArrayIndexOutOfBoundsException e) { 1098 return null; 1099 } 1100 } 1101 1102 public int getValue() { 1103 return value; 1104 } 1105 } 1106 1107 public static enum Tool { 1108 NO_TOOL(-1), // No tool is in the selected state. 1109 SELECTION_TOOL(0), // The selection tool selects an existing ROI in an 1110 // image. 1111 POINT_TOOL(1), // The point tool draws a point on the image. 1112 LINE_TOOL(2), // The line tool draws a line on the image. 1113 RECTANGLE_TOOL(3), // The rectangle tool draws a rectangle on the image. 1114 OVAL_TOOL(4), // The oval tool draws an oval on the image. 1115 POLYGON_TOOL(5), // The polygon tool draws a polygon on the image. 1116 CLOSED_FREEHAND_TOOL(6), // The closed freehand tool draws closed freehand 1117 // shapes on the image. 1118 ANNULUS_TOOL(7), // The annulus tool draws annuluses on the image. 1119 ZOOM_TOOL(8), // The zoom tool controls the zoom of an image. 1120 PAN_TOOL(9), // The pan tool shifts the view of the image. 1121 POLYLINE_TOOL(10), // The polyline tool draws a series of connected straight 1122 // lines on the image. 1123 FREEHAND_TOOL(11), // The freehand tool draws freehand lines on the image. 1124 ROTATED_RECT_TOOL(12), // The rotated rectangle tool draws rotated 1125 // rectangles on the image. 1126 ZOOM_OUT_TOOL(13), // The zoom out tool controls the zoom of an image. 1127 ; 1128 private final int value; 1129 1130 private Tool(int value) { 1131 this.value = value; 1132 } 1133 1134 public static Tool fromValue(int val) { 1135 for (Tool v : values()) { 1136 if (v.value == val) 1137 return v; 1138 } 1139 return null; 1140 } 1141 1142 public int getValue() { 1143 return value; 1144 } 1145 } 1146 1147 public static enum TIFFCompressionType { 1148 NO_COMPRESSION(0), // The function does not compress the TIFF file. 1149 JPEG(1), // The function uses the JPEG compression algorithm to compress the 1150 // TIFF file. 1151 RUN_LENGTH(2), // The function uses a run length compression algorithm to 1152 // compress the TIFF file. 1153 ZIP(3), // The function uses the ZIP compression algorithm to compress the 1154 // TIFF file. 1155 ; 1156 private final int value; 1157 1158 private TIFFCompressionType(int value) { 1159 this.value = value; 1160 } 1161 1162 public static TIFFCompressionType fromValue(int val) { 1163 try { 1164 return values()[val]; 1165 } catch (ArrayIndexOutOfBoundsException e) { 1166 return null; 1167 } 1168 } 1169 1170 public int getValue() { 1171 return value; 1172 } 1173 } 1174 1175 public static enum ThresholdMethod { 1176 THRESH_CLUSTERING(0), // The function uses a method that sorts the histogram 1177 // of the image within a discrete number of classes 1178 // corresponding to the number of phases perceived in 1179 // an image. 1180 THRESH_ENTROPY(1), // The function uses a method that is best for detecting 1181 // particles that are present in minuscule proportions on 1182 // the image. 1183 THRESH_METRIC(2), // The function uses a method that is well-suited for 1184 // images in which classes are not too disproportionate. 1185 THRESH_MOMENTS(3), // The function uses a method that is suited for images 1186 // that have poor contrast. 1187 THRESH_INTERCLASS(4), // The function uses a method that is well-suited for 1188 // images in which classes have well separated pixel 1189 // value distributions. 1190 ; 1191 private final int value; 1192 1193 private ThresholdMethod(int value) { 1194 this.value = value; 1195 } 1196 1197 public static ThresholdMethod fromValue(int val) { 1198 try { 1199 return values()[val]; 1200 } catch (ArrayIndexOutOfBoundsException e) { 1201 return null; 1202 } 1203 } 1204 1205 public int getValue() { 1206 return value; 1207 } 1208 } 1209 1210 public static enum TextAlignment { 1211 LEFT(0), // Left aligns the text at the reference point. 1212 CENTER(1), // Centers the text around the reference point. 1213 RIGHT(2), // Right aligns the text at the reference point. 1214 ; 1215 private final int value; 1216 1217 private TextAlignment(int value) { 1218 this.value = value; 1219 } 1220 1221 public static TextAlignment fromValue(int val) { 1222 try { 1223 return values()[val]; 1224 } catch (ArrayIndexOutOfBoundsException e) { 1225 return null; 1226 } 1227 } 1228 1229 public int getValue() { 1230 return value; 1231 } 1232 } 1233 1234 public static enum SpokeDirection { 1235 OUTSIDE_TO_INSIDE(0), // The function searches from the outside of the 1236 // search area to the inside of the search area. 1237 INSIDE_TO_OUTSIDE(1), // The function searches from the inside of the search 1238 // area to the outside of the search area. 1239 ; 1240 private final int value; 1241 1242 private SpokeDirection(int value) { 1243 this.value = value; 1244 } 1245 1246 public static SpokeDirection fromValue(int val) { 1247 try { 1248 return values()[val]; 1249 } catch (ArrayIndexOutOfBoundsException e) { 1250 return null; 1251 } 1252 } 1253 1254 public int getValue() { 1255 return value; 1256 } 1257 } 1258 1259 public static enum SkeletonMethod { 1260 SKELETON_L(0), // Uses an L-shaped structuring element in the skeleton 1261 // function. 1262 SKELETON_M(1), // Uses an M-shaped structuring element in the skeleton 1263 // function. 1264 SKELETON_INVERSE(2), // Uses an L-shaped structuring element on an inverse 1265 // of the image in the skeleton function. 1266 ; 1267 private final int value; 1268 1269 private SkeletonMethod(int value) { 1270 this.value = value; 1271 } 1272 1273 public static SkeletonMethod fromValue(int val) { 1274 try { 1275 return values()[val]; 1276 } catch (ArrayIndexOutOfBoundsException e) { 1277 return null; 1278 } 1279 } 1280 1281 public int getValue() { 1282 return value; 1283 } 1284 } 1285 1286 public static enum VerticalTextAlignment { 1287 BOTTOM(0), // Aligns the bottom of the text at the reference point. 1288 TOP(1), // Aligns the top of the text at the reference point. 1289 BASELINE(2), // Aligns the baseline of the text at the reference point. 1290 ; 1291 private final int value; 1292 1293 private VerticalTextAlignment(int value) { 1294 this.value = value; 1295 } 1296 1297 public static VerticalTextAlignment fromValue(int val) { 1298 try { 1299 return values()[val]; 1300 } catch (ArrayIndexOutOfBoundsException e) { 1301 return null; 1302 } 1303 } 1304 1305 public int getValue() { 1306 return value; 1307 } 1308 } 1309 1310 public static enum CalibrationROI { 1311 FULL_IMAGE(0), // The correction function corrects the whole image, 1312 // regardless of the user-defined or calibration-defined 1313 // ROIs. 1314 CALIBRATION_ROI(1), // The correction function corrects the area defined by 1315 // the calibration ROI. 1316 USER_ROI(2), // The correction function corrects the area defined by the 1317 // user-defined ROI. 1318 CALIBRATION_AND_USER_ROI(3), // The correction function corrects the area 1319 // defined by the intersection of the 1320 // user-defined ROI and the calibration ROI. 1321 CALIBRATION_OR_USER_ROI(4), // The correction function corrects the area 1322 // defined by the union of the user-defined ROI 1323 // and the calibration ROI. 1324 ; 1325 private final int value; 1326 1327 private CalibrationROI(int value) { 1328 this.value = value; 1329 } 1330 1331 public static CalibrationROI fromValue(int val) { 1332 try { 1333 return values()[val]; 1334 } catch (ArrayIndexOutOfBoundsException e) { 1335 return null; 1336 } 1337 } 1338 1339 public int getValue() { 1340 return value; 1341 } 1342 } 1343 1344 public static enum ContourType { 1345 EMPTY_CONTOUR(0), // The contour is empty. 1346 POINT(1), // The contour represents a point. 1347 LINE(2), // The contour represents a line. 1348 RECT(3), // The contour represents a rectangle. 1349 OVAL(4), // The contour represents an oval. 1350 CLOSED_CONTOUR(5), // The contour represents a series of connected points 1351 // where the last point connects to the first. 1352 OPEN_CONTOUR(6), // The contour represents a series of connected points 1353 // where the last point does not connect to the first. 1354 ANNULUS(7), // The contour represents an annulus. 1355 ROTATED_RECT(8), // The contour represents a rotated rectangle. 1356 ; 1357 private final int value; 1358 1359 private ContourType(int value) { 1360 this.value = value; 1361 } 1362 1363 public static ContourType fromValue(int val) { 1364 try { 1365 return values()[val]; 1366 } catch (ArrayIndexOutOfBoundsException e) { 1367 return null; 1368 } 1369 } 1370 1371 public int getValue() { 1372 return value; 1373 } 1374 } 1375 1376 public static enum MathTransformMethod { 1377 TRANSFORM_LINEAR(0), // The function uses linear remapping. 1378 TRANSFORM_LOG(1), // The function uses logarithmic remapping. 1379 TRANSFORM_EXP(2), // The function uses exponential remapping. 1380 TRANSFORM_SQR(3), // The function uses square remapping. 1381 TRANSFORM_SQRT(4), // The function uses square root remapping. 1382 TRANSFORM_POWX(5), // The function uses power X remapping. 1383 TRANSFORM_POW1X(6), // The function uses power 1/X remapping. 1384 ; 1385 private final int value; 1386 1387 private MathTransformMethod(int value) { 1388 this.value = value; 1389 } 1390 1391 public static MathTransformMethod fromValue(int val) { 1392 try { 1393 return values()[val]; 1394 } catch (ArrayIndexOutOfBoundsException e) { 1395 return null; 1396 } 1397 } 1398 1399 public int getValue() { 1400 return value; 1401 } 1402 } 1403 1404 public static enum ComplexPlane { 1405 REAL(0), // The function operates on the real plane of the complex image. 1406 IMAGINARY(1), // The function operates on the imaginary plane of the complex 1407 // image. 1408 MAGNITUDE(2), // The function operates on the magnitude plane of the complex 1409 // image. 1410 PHASE(3), // The function operates on the phase plane of the complex image. 1411 ; 1412 private final int value; 1413 1414 private ComplexPlane(int value) { 1415 this.value = value; 1416 } 1417 1418 public static ComplexPlane fromValue(int val) { 1419 try { 1420 return values()[val]; 1421 } catch (ArrayIndexOutOfBoundsException e) { 1422 return null; 1423 } 1424 } 1425 1426 public int getValue() { 1427 return value; 1428 } 1429 } 1430 1431 public static enum PaletteType { 1432 PALETTE_GRAY(0), // The function uses a palette that has a gradual 1433 // gray-level variation from black to white. 1434 PALETTE_BINARY(1), // The function uses a palette of 16 cycles of 16 1435 // different colors that is useful with binary images. 1436 PALETTE_GRADIENT(2), // The function uses a palette that has a gradation 1437 // from red to white with a prominent range of light 1438 // blue in the upper value range. 1439 PALETTE_RAINBOW(3), // The function uses a palette that has a gradation from 1440 // blue to red with a prominent range of greens in the 1441 // middle value range. 1442 PALETTE_TEMPERATURE(4), // The function uses a palette that has a gradation 1443 // from light brown to dark brown. 1444 PALETTE_USER(5), // The function uses a palette defined by the user. 1445 ; 1446 private final int value; 1447 1448 private PaletteType(int value) { 1449 this.value = value; 1450 } 1451 1452 public static PaletteType fromValue(int val) { 1453 try { 1454 return values()[val]; 1455 } catch (ArrayIndexOutOfBoundsException e) { 1456 return null; 1457 } 1458 } 1459 1460 public int getValue() { 1461 return value; 1462 } 1463 } 1464 1465 public static enum ColorSensitivity { 1466 SENSITIVITY_LOW(0), // Instructs the algorithm to divide the hue plane into 1467 // a low number of sectors, allowing for simple color 1468 // analysis. 1469 SENSITIVITY_MED(1), // Instructs the algorithm to divide the hue plane into 1470 // a medium number of sectors, allowing for color 1471 // analysis that balances sensitivity and complexity. 1472 SENSITIVITY_HIGH(2), // Instructs the algorithm to divide the hue plane into 1473 // a high number of sectors, allowing for complex, 1474 // sensitive color analysis. 1475 ; 1476 private final int value; 1477 1478 private ColorSensitivity(int value) { 1479 this.value = value; 1480 } 1481 1482 public static ColorSensitivity fromValue(int val) { 1483 try { 1484 return values()[val]; 1485 } catch (ArrayIndexOutOfBoundsException e) { 1486 return null; 1487 } 1488 } 1489 1490 public int getValue() { 1491 return value; 1492 } 1493 } 1494 1495 public static enum ColorMode { 1496 RGB(0), // The function operates in the RGB (Red, Blue, Green) color space. 1497 HSL(1), // The function operates in the HSL (Hue, Saturation, Luminance) 1498 // color space. 1499 HSV(2), // The function operates in the HSV (Hue, Saturation, Value) color 1500 // space. 1501 HSI(3), // The function operates in the HSI (Hue, Saturation, Intensity) 1502 // color space. 1503 CIE(4), // The function operates in the CIE L*a*b* color space. 1504 CIEXYZ(5), // The function operates in the CIE XYZ color space. 1505 ; 1506 private final int value; 1507 1508 private ColorMode(int value) { 1509 this.value = value; 1510 } 1511 1512 public static ColorMode fromValue(int val) { 1513 try { 1514 return values()[val]; 1515 } catch (ArrayIndexOutOfBoundsException e) { 1516 return null; 1517 } 1518 } 1519 1520 public int getValue() { 1521 return value; 1522 } 1523 } 1524 1525 public static enum DetectionMode { 1526 DETECT_PEAKS(0), // The function detects peaks. 1527 DETECT_VALLEYS(1), // The function detects valleys. 1528 ; 1529 private final int value; 1530 1531 private DetectionMode(int value) { 1532 this.value = value; 1533 } 1534 1535 public static DetectionMode fromValue(int val) { 1536 try { 1537 return values()[val]; 1538 } catch (ArrayIndexOutOfBoundsException e) { 1539 return null; 1540 } 1541 } 1542 1543 public int getValue() { 1544 return value; 1545 } 1546 } 1547 1548 public static enum CalibrationUnit { 1549 UNDEFINED(0), // The image does not have a defined unit of measurement. 1550 ANGSTROM(1), // The unit of measure for the image is angstroms. 1551 MICROMETER(2), // The unit of measure for the image is micrometers. 1552 MILLIMETER(3), // The unit of measure for the image is millimeters. 1553 CENTIMETER(4), // The unit of measure for the image is centimeters. 1554 METER(5), // The unit of measure for the image is meters. 1555 KILOMETER(6), // The unit of measure for the image is kilometers. 1556 MICROINCH(7), // The unit of measure for the image is microinches. 1557 INCH(8), // The unit of measure for the image is inches. 1558 FOOT(9), // The unit of measure for the image is feet. 1559 NAUTICMILE(10), // The unit of measure for the image is nautical miles. 1560 GROUNDMILE(11), // The unit of measure for the image is ground miles. 1561 STEP(12), // The unit of measure for the image is steps. 1562 ; 1563 private final int value; 1564 1565 private CalibrationUnit(int value) { 1566 this.value = value; 1567 } 1568 1569 public static CalibrationUnit fromValue(int val) { 1570 try { 1571 return values()[val]; 1572 } catch (ArrayIndexOutOfBoundsException e) { 1573 return null; 1574 } 1575 } 1576 1577 public int getValue() { 1578 return value; 1579 } 1580 } 1581 1582 public static enum ConcentricRakeDirection { 1583 COUNTER_CLOCKWISE(0), // The function searches the search area in a 1584 // counter-clockwise direction. 1585 CLOCKWISE(1), // The function searches the search area in a clockwise 1586 // direction. 1587 ; 1588 private final int value; 1589 1590 private ConcentricRakeDirection(int value) { 1591 this.value = value; 1592 } 1593 1594 public static ConcentricRakeDirection fromValue(int val) { 1595 try { 1596 return values()[val]; 1597 } catch (ArrayIndexOutOfBoundsException e) { 1598 return null; 1599 } 1600 } 1601 1602 public int getValue() { 1603 return value; 1604 } 1605 } 1606 1607 public static enum CalibrationMode { 1608 PERSPECTIVE(0), // Functions correct for distortion caused by the camera's 1609 // perspective. 1610 NONLINEAR(1), // Functions correct for distortion caused by the camera's 1611 // lens. 1612 SIMPLE_CALIBRATION(2), // Functions do not correct for distortion. 1613 CORRECTED_IMAGE(3), // The image is already corrected. 1614 ; 1615 private final int value; 1616 1617 private CalibrationMode(int value) { 1618 this.value = value; 1619 } 1620 1621 public static CalibrationMode fromValue(int val) { 1622 try { 1623 return values()[val]; 1624 } catch (ArrayIndexOutOfBoundsException e) { 1625 return null; 1626 } 1627 } 1628 1629 public int getValue() { 1630 return value; 1631 } 1632 } 1633 1634 public static enum BrowserLocation { 1635 INSERT_FIRST_FREE(0), // Inserts the thumbnail in the first available cell. 1636 INSERT_END(1), // Inserts the thumbnail after the last occupied cell. 1637 ; 1638 private final int value; 1639 1640 private BrowserLocation(int value) { 1641 this.value = value; 1642 } 1643 1644 public static BrowserLocation fromValue(int val) { 1645 try { 1646 return values()[val]; 1647 } catch (ArrayIndexOutOfBoundsException e) { 1648 return null; 1649 } 1650 } 1651 1652 public int getValue() { 1653 return value; 1654 } 1655 } 1656 1657 public static enum BrowserFrameStyle { 1658 RAISED_FRAME(0), // Each thumbnail has a raised frame. 1659 BEVELLED_FRAME(1), // Each thumbnail has a beveled frame. 1660 OUTLINE_FRAME(2), // Each thumbnail has an outlined frame. 1661 HIDDEN_FRAME(3), // Each thumbnail has a hidden frame. 1662 STEP_FRAME(4), // Each thumbnail has a stepped frame. 1663 RAISED_OUTLINE_FRAME(5), // Each thumbnail has a raised, outlined frame. 1664 ; 1665 private final int value; 1666 1667 private BrowserFrameStyle(int value) { 1668 this.value = value; 1669 } 1670 1671 public static BrowserFrameStyle fromValue(int val) { 1672 try { 1673 return values()[val]; 1674 } catch (ArrayIndexOutOfBoundsException e) { 1675 return null; 1676 } 1677 } 1678 1679 public int getValue() { 1680 return value; 1681 } 1682 } 1683 1684 public static enum BorderMethod { 1685 BORDER_MIRROR(0), // Symmetrically copies pixel values from the image into 1686 // the border. 1687 BORDER_COPY(1), // Copies the value of the pixel closest to the edge of the 1688 // image into the border. 1689 BORDER_CLEAR(2), // Sets all pixels in the border to 0. 1690 ; 1691 private final int value; 1692 1693 private BorderMethod(int value) { 1694 this.value = value; 1695 } 1696 1697 public static BorderMethod fromValue(int val) { 1698 try { 1699 return values()[val]; 1700 } catch (ArrayIndexOutOfBoundsException e) { 1701 return null; 1702 } 1703 } 1704 1705 public int getValue() { 1706 return value; 1707 } 1708 } 1709 1710 public static enum BarcodeType { 1711 INVALID(-1), // The barcode is not of a type known by NI Vision. 1712 CODABAR(1), // The barcode is of type Codabar. 1713 CODE39(2), // The barcode is of type Code 39. 1714 CODE93(4), // The barcode is of type Code 93. 1715 CODE128(8), // The barcode is of type Code 128. 1716 EAN8(16), // The barcode is of type EAN 8. 1717 EAN13(32), // The barcode is of type EAN 13. 1718 I2_OF_5(64), // The barcode is of type Code 25. 1719 MSI(128), // The barcode is of type MSI code. 1720 UPCA(256), // The barcode is of type UPC A. 1721 PHARMACODE(512), // The barcode is of type Pharmacode. 1722 RSS_LIMITED(1024), // The barcode is of type RSS Limited. 1723 ; 1724 private final int value; 1725 1726 private BarcodeType(int value) { 1727 this.value = value; 1728 } 1729 1730 public static BarcodeType fromValue(int val) { 1731 for (BarcodeType v : values()) { 1732 if (v.value == val) 1733 return v; 1734 } 1735 return null; 1736 } 1737 1738 public int getValue() { 1739 return value; 1740 } 1741 } 1742 1743 public static enum AxisOrientation { 1744 DIRECT(0), // The y-axis direction corresponds to the y-axis direction of 1745 // the Cartesian coordinate system. 1746 INDIRECT(1), // The y-axis direction corresponds to the y-axis direction of 1747 // an image. 1748 ; 1749 private final int value; 1750 1751 private AxisOrientation(int value) { 1752 this.value = value; 1753 } 1754 1755 public static AxisOrientation fromValue(int val) { 1756 try { 1757 return values()[val]; 1758 } catch (ArrayIndexOutOfBoundsException e) { 1759 return null; 1760 } 1761 } 1762 1763 public int getValue() { 1764 return value; 1765 } 1766 } 1767 1768 public static enum ColorIgnoreMode { 1769 IGNORE_NONE(0), // Specifies that the function does not ignore any pixels. 1770 IGNORE_BLACK(1), // Specifies that the function ignores black pixels. 1771 IGNORE_WHITE(2), // Specifies that the function ignores white pixels. 1772 IGNORE_BLACK_AND_WHITE(3), // Specifies that the function ignores black 1773 // pixels and white pixels. 1774 ; 1775 private final int value; 1776 1777 private ColorIgnoreMode(int value) { 1778 this.value = value; 1779 } 1780 1781 public static ColorIgnoreMode fromValue(int val) { 1782 try { 1783 return values()[val]; 1784 } catch (ArrayIndexOutOfBoundsException e) { 1785 return null; 1786 } 1787 } 1788 1789 public int getValue() { 1790 return value; 1791 } 1792 } 1793 1794 public static enum LevelType { 1795 ABSOLUTE(0), // The function evaluates the threshold and hysteresis values 1796 // as absolute values. 1797 RELATIVE(1), // The function evaluates the threshold and hysteresis values 1798 // relative to the dynamic range of the given path. 1799 ; 1800 private final int value; 1801 1802 private LevelType(int value) { 1803 this.value = value; 1804 } 1805 1806 public static LevelType fromValue(int val) { 1807 try { 1808 return values()[val]; 1809 } catch (ArrayIndexOutOfBoundsException e) { 1810 return null; 1811 } 1812 } 1813 1814 public int getValue() { 1815 return value; 1816 } 1817 } 1818 1819 public static enum MatchingMode { 1820 MATCH_SHIFT_INVARIANT(1), // Searches for occurrences of the template image 1821 // anywhere in the searchRect, assuming that the 1822 // pattern is not rotated more than plus or minus 1823 // 4 degrees. 1824 MATCH_ROTATION_INVARIANT(2), // Searches for occurrences of the pattern in 1825 // the image with no restriction on the 1826 // rotation of the pattern. 1827 ; 1828 private final int value; 1829 1830 private MatchingMode(int value) { 1831 this.value = value; 1832 } 1833 1834 public static MatchingMode fromValue(int val) { 1835 for (MatchingMode v : values()) { 1836 if (v.value == val) 1837 return v; 1838 } 1839 return null; 1840 } 1841 1842 public int getValue() { 1843 return value; 1844 } 1845 } 1846 1847 public static enum MappingMethod { 1848 FULL_DYNAMIC(0), // (Obsolete) When the image bit depth is 0, the function 1849 // maps the full dynamic range of the 16-bit image to an 1850 // 8-bit scale. 1851 DOWNSHIFT(1), // (Obsolete) When the image bit depth is 0, the function 1852 // shifts the 16-bit image pixels to the right the number of 1853 // times specified by the shiftCount element of the 1854 // DisplayMapping structure. 1855 RANGE(2), // (Obsolete) When the image bit depth is 0, the function maps the 1856 // pixel values in the range specified by the minimumValue and 1857 // maximumValue elements of the DisplayMapping structure to an 1858 // 8-bit scale. 1859 C90_PCT_DYNAMIC(3), // (Obsolete) When the image bit depth to 0, the 1860 // function maps the dynamic range containing the middle 1861 // 90 percent of the cumulated histogram of the image to 1862 // an 8-bit (256 grayscale values) scale. 1863 PERCENT_RANGE(4), // (Obsolete) When the image bit depth is 0, the function 1864 // maps the pixel values in the relative percentage range 1865 // (0 to 100) of the cumulated histogram specified by 1866 // minimumValue and maximumValue to an 8-bit scale. 1867 DEFAULT_MAPPING(10), // If the bit depth is 0, the function maps the 16-bit 1868 // image to 8 bits by following the 1869 // IMAQ_FULL_DYNAMIC_ALWAYS behavior; otherwise, the 1870 // function shifts the image data to the right 1871 // according to the IMAQ_MOST_SIGNIFICANT behavior. 1872 MOST_SIGNIFICANT(11), // The function shifts the 16-bit image pixels to the 1873 // right until the 8 most significant bits of the 1874 // image data are remaining. 1875 FULL_DYNAMIC_ALWAYS(12), // The function maps the full dynamic range of the 1876 // 16-bit image to an 8-bit scale. 1877 DOWNSHIFT_ALWAYS(13), // The function shifts the 16-bit image pixels to the 1878 // right the number of times specified by the 1879 // shiftCount element of the DisplayMapping structure. 1880 RANGE_ALWAYS(14), // The function maps the pixel values in the range 1881 // specified by the minimumValue and maximumValue elements 1882 // of the DisplayMapping structure to an 8-bit scale. 1883 C90_PCT_DYNAMIC_ALWAYS(15), // The function maps the dynamic range 1884 // containing the middle 90 percent of the 1885 // cumulated histogram of the image to an 8-bit 1886 // (256 grayscale values) scale. 1887 PERCENT_RANGE_ALWAYS(16), // The function maps the pixel values in the 1888 // relative percentage range (0 to 100) of the 1889 // cumulated histogram specified by minimumValue 1890 // and maximumValue to an 8-bit scale. 1891 ; 1892 private final int value; 1893 1894 private MappingMethod(int value) { 1895 this.value = value; 1896 } 1897 1898 public static MappingMethod fromValue(int val) { 1899 for (MappingMethod v : values()) { 1900 if (v.value == val) 1901 return v; 1902 } 1903 return null; 1904 } 1905 1906 public int getValue() { 1907 return value; 1908 } 1909 } 1910 1911 public static enum ComparisonFunction { 1912 CLEAR_LESS(0), // The comparison is true if the source pixel value is less 1913 // than the comparison image pixel value. 1914 CLEAR_LESS_OR_EQUAL(1), // The comparison is true if the source pixel value 1915 // is less than or equal to the comparison image 1916 // pixel value. 1917 CLEAR_EQUAL(2), // The comparison is true if the source pixel value is equal 1918 // to the comparison image pixel value. 1919 CLEAR_GREATER_OR_EQUAL(3), // The comparison is true if the source pixel 1920 // value is greater than or equal to the 1921 // comparison image pixel value. 1922 CLEAR_GREATER(4), // The comparison is true if the source pixel value is 1923 // greater than the comparison image pixel value. 1924 ; 1925 private final int value; 1926 1927 private ComparisonFunction(int value) { 1928 this.value = value; 1929 } 1930 1931 public static ComparisonFunction fromValue(int val) { 1932 try { 1933 return values()[val]; 1934 } catch (ArrayIndexOutOfBoundsException e) { 1935 return null; 1936 } 1937 } 1938 1939 public int getValue() { 1940 return value; 1941 } 1942 } 1943 1944 public static enum LineGaugeMethod { 1945 EDGE_TO_EDGE(0), // Measures from the first edge on the line to the last 1946 // edge on the line. 1947 EDGE_TO_POINT(1), // Measures from the first edge on the line to the end 1948 // point of the line. 1949 POINT_TO_EDGE(2), // Measures from the start point of the line to the first 1950 // edge on the line. 1951 POINT_TO_POINT(3), // Measures from the start point of the line to the end 1952 // point of the line. 1953 ; 1954 private final int value; 1955 1956 private LineGaugeMethod(int value) { 1957 this.value = value; 1958 } 1959 1960 public static LineGaugeMethod fromValue(int val) { 1961 try { 1962 return values()[val]; 1963 } catch (ArrayIndexOutOfBoundsException e) { 1964 return null; 1965 } 1966 } 1967 1968 public int getValue() { 1969 return value; 1970 } 1971 } 1972 1973 public static enum Direction3D { 1974 C3D_NW(0), // The viewing angle for the 3D image is from the northwest. 1975 C3D_SW(1), // The viewing angle for the 3D image is from the southwest. 1976 C3D_SE(2), // The viewing angle for the 3D image is from the southeast. 1977 C3D_NE(3), // The viewing angle for the 3D image is from the northeast. 1978 ; 1979 private final int value; 1980 1981 private Direction3D(int value) { 1982 this.value = value; 1983 } 1984 1985 public static Direction3D fromValue(int val) { 1986 try { 1987 return values()[val]; 1988 } catch (ArrayIndexOutOfBoundsException e) { 1989 return null; 1990 } 1991 } 1992 1993 public int getValue() { 1994 return value; 1995 } 1996 } 1997 1998 public static enum LearningMode { 1999 LEARN_ALL(0), // The function extracts information for shift- and 2000 // rotation-invariant matching. 2001 LEARN_SHIFT_INFORMATION(1), // The function extracts information for 2002 // shift-invariant matching. 2003 LEARN_ROTATION_INFORMATION(2), // The function extracts information for 2004 // rotation-invariant matching. 2005 ; 2006 private final int value; 2007 2008 private LearningMode(int value) { 2009 this.value = value; 2010 } 2011 2012 public static LearningMode fromValue(int val) { 2013 try { 2014 return values()[val]; 2015 } catch (ArrayIndexOutOfBoundsException e) { 2016 return null; 2017 } 2018 } 2019 2020 public int getValue() { 2021 return value; 2022 } 2023 } 2024 2025 public static enum KernelFamily { 2026 GRADIENT_FAMILY(0), // The kernel is in the gradient family. 2027 LAPLACIAN_FAMILY(1), // The kernel is in the Laplacian family. 2028 SMOOTHING_FAMILY(2), // The kernel is in the smoothing family. 2029 GAUSSIAN_FAMILY(3), // The kernel is in the Gaussian family. 2030 ; 2031 private final int value; 2032 2033 private KernelFamily(int value) { 2034 this.value = value; 2035 } 2036 2037 public static KernelFamily fromValue(int val) { 2038 try { 2039 return values()[val]; 2040 } catch (ArrayIndexOutOfBoundsException e) { 2041 return null; 2042 } 2043 } 2044 2045 public int getValue() { 2046 return value; 2047 } 2048 } 2049 2050 public static enum InterpolationMethod { 2051 ZERO_ORDER(0), // The function uses an interpolation method that 2052 // interpolates new pixel values using the nearest valid 2053 // neighboring pixel. 2054 BILINEAR(1), // The function uses an interpolation method that interpolates 2055 // new pixel values using a bidirectional average of the 2056 // neighboring pixels. 2057 QUADRATIC(2), // The function uses an interpolation method that interpolates 2058 // new pixel values using a quadratic approximating 2059 // polynomial. 2060 CUBIC_SPLINE(3), // The function uses an interpolation method that 2061 // interpolates new pixel values by fitting them to a cubic 2062 // spline curve, where the curve is based on known pixel 2063 // values from the image. 2064 BILINEAR_FIXED(4), // The function uses an interpolation method that 2065 // interpolates new pixel values using a bidirectional 2066 // average of the neighboring pixels. 2067 ; 2068 private final int value; 2069 2070 private InterpolationMethod(int value) { 2071 this.value = value; 2072 } 2073 2074 public static InterpolationMethod fromValue(int val) { 2075 try { 2076 return values()[val]; 2077 } catch (ArrayIndexOutOfBoundsException e) { 2078 return null; 2079 } 2080 } 2081 2082 public int getValue() { 2083 return value; 2084 } 2085 } 2086 2087 public static enum ImageType { 2088 IMAGE_U8(0), // The image type is 8-bit unsigned integer grayscale. 2089 IMAGE_U16(7), // The image type is 16-bit unsigned integer grayscale. 2090 IMAGE_I16(1), // The image type is 16-bit signed integer grayscale. 2091 IMAGE_SGL(2), // The image type is 32-bit floating-point grayscale. 2092 IMAGE_COMPLEX(3), // The image type is complex. 2093 IMAGE_RGB(4), // The image type is RGB color. 2094 IMAGE_HSL(5), // The image type is HSL color. 2095 IMAGE_RGB_U64(6), // The image type is 64-bit unsigned RGB color. 2096 ; 2097 private final int value; 2098 2099 private ImageType(int value) { 2100 this.value = value; 2101 } 2102 2103 public static ImageType fromValue(int val) { 2104 for (ImageType v : values()) { 2105 if (v.value == val) 2106 return v; 2107 } 2108 return null; 2109 } 2110 2111 public int getValue() { 2112 return value; 2113 } 2114 } 2115 2116 public static enum ImageFeatureMode { 2117 COLOR_AND_SHAPE_FEATURES(0), // Instructs the function to use the color and 2118 // the shape features of the color pattern. 2119 COLOR_FEATURES(1), // Instructs the function to use the color features of 2120 // the color pattern. 2121 SHAPE_FEATURES(2), // Instructs the function to use the shape features of 2122 // the color pattern. 2123 ; 2124 private final int value; 2125 2126 private ImageFeatureMode(int value) { 2127 this.value = value; 2128 } 2129 2130 public static ImageFeatureMode fromValue(int val) { 2131 try { 2132 return values()[val]; 2133 } catch (ArrayIndexOutOfBoundsException e) { 2134 return null; 2135 } 2136 } 2137 2138 public int getValue() { 2139 return value; 2140 } 2141 } 2142 2143 public static enum FontColor { 2144 WHITE(0), // Draws text in white. 2145 BLACK(1), // Draws text in black. 2146 INVERT(2), // Inverts the text pixels. 2147 BLACK_ON_WHITE(3), // Draws text in black with a white background. 2148 WHITE_ON_BLACK(4), // Draws text in white with a black background. 2149 ; 2150 private final int value; 2151 2152 private FontColor(int value) { 2153 this.value = value; 2154 } 2155 2156 public static FontColor fromValue(int val) { 2157 try { 2158 return values()[val]; 2159 } catch (ArrayIndexOutOfBoundsException e) { 2160 return null; 2161 } 2162 } 2163 2164 public int getValue() { 2165 return value; 2166 } 2167 } 2168 2169 public static enum FlipAxis { 2170 HORIZONTAL_AXIS(0), // Flips the image over the central horizontal axis. 2171 VERTICAL_AXIS(1), // Flips the image over the central vertical axis. 2172 CENTER_AXIS(2), // Flips the image over both the central vertical and 2173 // horizontal axes. 2174 DIAG_L_TO_R_AXIS(3), // Flips the image over an axis from the upper left 2175 // corner to lower right corner. 2176 DIAG_R_TO_L_AXIS(4), // Flips the image over an axis from the upper right 2177 // corner to lower left corner. 2178 ; 2179 private final int value; 2180 2181 private FlipAxis(int value) { 2182 this.value = value; 2183 } 2184 2185 public static FlipAxis fromValue(int val) { 2186 try { 2187 return values()[val]; 2188 } catch (ArrayIndexOutOfBoundsException e) { 2189 return null; 2190 } 2191 } 2192 2193 public int getValue() { 2194 return value; 2195 } 2196 } 2197 2198 public static enum EdgeProcess { 2199 FIRST(0), // The function looks for the first edge. 2200 FIRST_AND_LAST(1), // The function looks for the first and last edge. 2201 ALL(2), // The function looks for all edges. 2202 BEST(3), // The function looks for the best edge. 2203 ; 2204 private final int value; 2205 2206 private EdgeProcess(int value) { 2207 this.value = value; 2208 } 2209 2210 public static EdgeProcess fromValue(int val) { 2211 try { 2212 return values()[val]; 2213 } catch (ArrayIndexOutOfBoundsException e) { 2214 return null; 2215 } 2216 } 2217 2218 public int getValue() { 2219 return value; 2220 } 2221 } 2222 2223 public static enum DrawMode { 2224 DRAW_VALUE(0), // Draws the boundary of the object with the specified pixel 2225 // value. 2226 DRAW_INVERT(2), // Inverts the pixel values of the boundary of the object. 2227 PAINT_VALUE(1), // Fills the object with the given pixel value. 2228 PAINT_INVERT(3), // Inverts the pixel values of the object. 2229 HIGHLIGHT_VALUE(4), // The function fills the object by highlighting the 2230 // enclosed pixels with the color of the object. 2231 ; 2232 private final int value; 2233 2234 private DrawMode(int value) { 2235 this.value = value; 2236 } 2237 2238 public static DrawMode fromValue(int val) { 2239 for (DrawMode v : values()) { 2240 if (v.value == val) 2241 return v; 2242 } 2243 return null; 2244 } 2245 2246 public int getValue() { 2247 return value; 2248 } 2249 } 2250 2251 public static enum NearestNeighborMetric { 2252 METRIC_MAXIMUM(0), // The maximum metric. 2253 METRIC_SUM(1), // The sum metric. 2254 METRIC_EUCLIDEAN(2), // The Euclidean metric. 2255 ; 2256 private final int value; 2257 2258 private NearestNeighborMetric(int value) { 2259 this.value = value; 2260 } 2261 2262 public static NearestNeighborMetric fromValue(int val) { 2263 try { 2264 return values()[val]; 2265 } catch (ArrayIndexOutOfBoundsException e) { 2266 return null; 2267 } 2268 } 2269 2270 public int getValue() { 2271 return value; 2272 } 2273 } 2274 2275 public static enum ReadResolution { 2276 LOW_RESOLUTION(0), // Configures NI Vision to use low resolution during the 2277 // read process. 2278 MEDIUM_RESOLUTION(1), // Configures NI Vision to use medium resolution 2279 // during the read process. 2280 HIGH_RESOLUTION(2), // Configures NI Vision to use high resolution during 2281 // the read process. 2282 ; 2283 private final int value; 2284 2285 private ReadResolution(int value) { 2286 this.value = value; 2287 } 2288 2289 public static ReadResolution fromValue(int val) { 2290 try { 2291 return values()[val]; 2292 } catch (ArrayIndexOutOfBoundsException e) { 2293 return null; 2294 } 2295 } 2296 2297 public int getValue() { 2298 return value; 2299 } 2300 } 2301 2302 public static enum ThresholdMode { 2303 FIXED_RANGE(0), // Performs thresholding using the values you provide in the 2304 // lowThreshold and highThreshold elements of 2305 // OCRProcessingOptions. 2306 COMPUTED_UNIFORM(1), // Calculates a single threshold value for the entire 2307 // ROI. 2308 COMPUTED_LINEAR(2), // Calculates a value on the left side of the ROI, 2309 // calculates a value on the right side of the ROI, and 2310 // linearly fills the middle values from left to right. 2311 COMPUTED_NONLINEAR(3), // Divides the ROI into the number of blocks 2312 // specified by the blockCount element of 2313 // OCRProcessingOptions and calculates a threshold 2314 // value for each block. 2315 ; 2316 private final int value; 2317 2318 private ThresholdMode(int value) { 2319 this.value = value; 2320 } 2321 2322 public static ThresholdMode fromValue(int val) { 2323 try { 2324 return values()[val]; 2325 } catch (ArrayIndexOutOfBoundsException e) { 2326 return null; 2327 } 2328 } 2329 2330 public int getValue() { 2331 return value; 2332 } 2333 } 2334 2335 public static enum ReadStrategy { 2336 READ_AGGRESSIVE(0), // Configures NI Vision to perform fewer checks when 2337 // analyzing objects to determine if they match trained 2338 // characters. 2339 READ_CONSERVATIVE(1), // Configures NI Vision to perform more checks to 2340 // determine if an object matches a trained character. 2341 ; 2342 private final int value; 2343 2344 private ReadStrategy(int value) { 2345 this.value = value; 2346 } 2347 2348 public static ReadStrategy fromValue(int val) { 2349 try { 2350 return values()[val]; 2351 } catch (ArrayIndexOutOfBoundsException e) { 2352 return null; 2353 } 2354 } 2355 2356 public int getValue() { 2357 return value; 2358 } 2359 } 2360 2361 public static enum MeasurementType { 2362 MT_CENTER_OF_MASS_X(0), // X-coordinate of the point representing the 2363 // average position of the total particle mass, 2364 // assuming every point in the particle has a 2365 // constant density. 2366 MT_CENTER_OF_MASS_Y(1), // Y-coordinate of the point representing the 2367 // average position of the total particle mass, 2368 // assuming every point in the particle has a 2369 // constant density. 2370 MT_FIRST_PIXEL_X(2), // X-coordinate of the highest, leftmost particle 2371 // pixel. 2372 MT_FIRST_PIXEL_Y(3), // Y-coordinate of the highest, leftmost particle 2373 // pixel. 2374 MT_BOUNDING_RECT_LEFT(4), // X-coordinate of the leftmost particle point. 2375 MT_BOUNDING_RECT_TOP(5), // Y-coordinate of highest particle point. 2376 MT_BOUNDING_RECT_RIGHT(6), // X-coordinate of the rightmost particle point. 2377 MT_BOUNDING_RECT_BOTTOM(7), // Y-coordinate of the lowest particle point. 2378 MT_MAX_FERET_DIAMETER_START_X(8), // X-coordinate of the start of the line 2379 // segment connecting the two perimeter 2380 // points that are the furthest apart. 2381 MT_MAX_FERET_DIAMETER_START_Y(9), // Y-coordinate of the start of the line 2382 // segment connecting the two perimeter 2383 // points that are the furthest apart. 2384 MT_MAX_FERET_DIAMETER_END_X(10), // X-coordinate of the end of the line 2385 // segment connecting the two perimeter 2386 // points that are the furthest apart. 2387 MT_MAX_FERET_DIAMETER_END_Y(11), // Y-coordinate of the end of the line 2388 // segment connecting the two perimeter 2389 // points that are the furthest apart. 2390 MT_MAX_HORIZ_SEGMENT_LENGTH_LEFT(12), // X-coordinate of the leftmost pixel 2391 // in the longest row of contiguous 2392 // pixels in the particle. 2393 MT_MAX_HORIZ_SEGMENT_LENGTH_RIGHT(13), // X-coordinate of the rightmost 2394 // pixel in the longest row of 2395 // contiguous pixels in the particle. 2396 MT_MAX_HORIZ_SEGMENT_LENGTH_ROW(14), // Y-coordinate of all of the pixels in 2397 // the longest row of contiguous pixels 2398 // in the particle. 2399 MT_BOUNDING_RECT_WIDTH(16), // Distance between the x-coordinate of the 2400 // leftmost particle point and the x-coordinate 2401 // of the rightmost particle point. 2402 MT_BOUNDING_RECT_HEIGHT(17), // Distance between the y-coordinate of highest 2403 // particle point and the y-coordinate of the 2404 // lowest particle point. 2405 MT_BOUNDING_RECT_DIAGONAL(18), // Distance between opposite corners of the 2406 // bounding rectangle. 2407 MT_PERIMETER(19), // Length of the outer boundary of the particle. 2408 MT_CONVEX_HULL_PERIMETER(20), // Perimeter of the smallest convex polygon 2409 // containing all points in the particle. 2410 MT_HOLES_PERIMETER(21), // Sum of the perimeters of each hole in the 2411 // particle. 2412 MT_MAX_FERET_DIAMETER(22), // Distance between the start and end of the line 2413 // segment connecting the two perimeter points 2414 // that are the furthest apart. 2415 MT_EQUIVALENT_ELLIPSE_MAJOR_AXIS(23), // Length of the major axis of the 2416 // ellipse with the same perimeter and 2417 // area as the particle. 2418 MT_EQUIVALENT_ELLIPSE_MINOR_AXIS(24), // Length of the minor axis of the 2419 // ellipse with the same perimeter and 2420 // area as the particle. 2421 MT_EQUIVALENT_ELLIPSE_MINOR_AXIS_FERET(25), // Length of the minor axis of 2422 // the ellipse with the same 2423 // area as the particle, and 2424 // Major Axis equal in length to 2425 // the Max Feret Diameter. 2426 MT_EQUIVALENT_RECT_LONG_SIDE(26), // Longest side of the rectangle with the 2427 // same perimeter and area as the 2428 // particle. 2429 MT_EQUIVALENT_RECT_SHORT_SIDE(27), // Shortest side of the rectangle with 2430 // the same perimeter and area as the 2431 // particle. 2432 MT_EQUIVALENT_RECT_DIAGONAL(28), // Distance between opposite corners of the 2433 // rectangle with the same perimeter and 2434 // area as the particle. 2435 MT_EQUIVALENT_RECT_SHORT_SIDE_FERET(29), // Shortest side of the rectangle 2436 // with the same area as the 2437 // particle, and longest side equal 2438 // in length to the Max Feret 2439 // Diameter. 2440 MT_AVERAGE_HORIZ_SEGMENT_LENGTH(30), // Average length of a horizontal 2441 // segment in the particle. 2442 MT_AVERAGE_VERT_SEGMENT_LENGTH(31), // Average length of a vertical segment 2443 // in the particle. 2444 MT_HYDRAULIC_RADIUS(32), // The particle area divided by the particle 2445 // perimeter. 2446 MT_WADDEL_DISK_DIAMETER(33), // Diameter of a disk with the same area as the 2447 // particle. 2448 MT_AREA(35), // Area of the particle. 2449 MT_HOLES_AREA(36), // Sum of the areas of each hole in the particle. 2450 MT_PARTICLE_AND_HOLES_AREA(37), // Area of a particle that completely covers 2451 // the image. 2452 MT_CONVEX_HULL_AREA(38), // Area of the smallest convex polygon containing 2453 // all points in the particle. 2454 MT_IMAGE_AREA(39), // Area of the image. 2455 MT_NUMBER_OF_HOLES(41), // Number of holes in the particle. 2456 MT_NUMBER_OF_HORIZ_SEGMENTS(42), // Number of horizontal segments in the 2457 // particle. 2458 MT_NUMBER_OF_VERT_SEGMENTS(43), // Number of vertical segments in the 2459 // particle. 2460 MT_ORIENTATION(45), // The angle of the line that passes through the 2461 // particle Center of Mass about which the particle has 2462 // the lowest moment of inertia. 2463 MT_MAX_FERET_DIAMETER_ORIENTATION(46), // The angle of the line segment 2464 // connecting the two perimeter 2465 // points that are the furthest 2466 // apart. 2467 MT_AREA_BY_IMAGE_AREA(48), // Percentage of the particle Area covering the 2468 // Image Area. 2469 MT_AREA_BY_PARTICLE_AND_HOLES_AREA(49), // Percentage of the particle Area 2470 // in relation to its Particle and 2471 // Holes Area. 2472 MT_RATIO_OF_EQUIVALENT_ELLIPSE_AXES(50), // Equivalent Ellipse Major Axis 2473 // divided by Equivalent Ellipse 2474 // Minor Axis. 2475 MT_RATIO_OF_EQUIVALENT_RECT_SIDES(51), // Equivalent Rect Long Side divided 2476 // by Equivalent Rect Short Side. 2477 MT_ELONGATION_FACTOR(53), // Max Feret Diameter divided by Equivalent Rect 2478 // Short Side (Feret). 2479 MT_COMPACTNESS_FACTOR(54), // Area divided by the product of Bounding Rect 2480 // Width and Bounding Rect Height. 2481 MT_HEYWOOD_CIRCULARITY_FACTOR(55), // Perimeter divided by the circumference 2482 // of a circle with the same area. 2483 MT_TYPE_FACTOR(56), // Factor relating area to moment of inertia. 2484 MT_SUM_X(58), // The sum of all x-coordinates in the particle. 2485 MT_SUM_Y(59), // The sum of all y-coordinates in the particle. 2486 MT_SUM_XX(60), // The sum of all x-coordinates squared in the particle. 2487 MT_SUM_XY(61), // The sum of all x-coordinates times y-coordinates in the 2488 // particle. 2489 MT_SUM_YY(62), // The sum of all y-coordinates squared in the particle. 2490 MT_SUM_XXX(63), // The sum of all x-coordinates cubed in the particle. 2491 MT_SUM_XXY(64), // The sum of all x-coordinates squared times y-coordinates 2492 // in the particle. 2493 MT_SUM_XYY(65), // The sum of all x-coordinates times y-coordinates squared 2494 // in the particle. 2495 MT_SUM_YYY(66), // The sum of all y-coordinates cubed in the particle. 2496 MT_MOMENT_OF_INERTIA_XX(68), // The moment of inertia in the x-direction 2497 // twice. 2498 MT_MOMENT_OF_INERTIA_XY(69), // The moment of inertia in the x and y 2499 // directions. 2500 MT_MOMENT_OF_INERTIA_YY(70), // The moment of inertia in the y-direction 2501 // twice. 2502 MT_MOMENT_OF_INERTIA_XXX(71), // The moment of inertia in the x-direction 2503 // three times. 2504 MT_MOMENT_OF_INERTIA_XXY(72), // The moment of inertia in the x-direction 2505 // twice and the y-direction once. 2506 MT_MOMENT_OF_INERTIA_XYY(73), // The moment of inertia in the x-direction 2507 // once and the y-direction twice. 2508 MT_MOMENT_OF_INERTIA_YYY(74), // The moment of inertia in the y-direction 2509 // three times. 2510 MT_NORM_MOMENT_OF_INERTIA_XX(75), // The normalized moment of inertia in the 2511 // x-direction twice. 2512 MT_NORM_MOMENT_OF_INERTIA_XY(76), // The normalized moment of inertia in the 2513 // x- and y-directions. 2514 MT_NORM_MOMENT_OF_INERTIA_YY(77), // The normalized moment of inertia in the 2515 // y-direction twice. 2516 MT_NORM_MOMENT_OF_INERTIA_XXX(78), // The normalized moment of inertia in 2517 // the x-direction three times. 2518 MT_NORM_MOMENT_OF_INERTIA_XXY(79), // The normalized moment of inertia in 2519 // the x-direction twice and the 2520 // y-direction once. 2521 MT_NORM_MOMENT_OF_INERTIA_XYY(80), // The normalized moment of inertia in 2522 // the x-direction once and the 2523 // y-direction twice. 2524 MT_NORM_MOMENT_OF_INERTIA_YYY(81), // The normalized moment of inertia in 2525 // the y-direction three times. 2526 MT_HU_MOMENT_1(82), // The first Hu moment. 2527 MT_HU_MOMENT_2(83), // The second Hu moment. 2528 MT_HU_MOMENT_3(84), // The third Hu moment. 2529 MT_HU_MOMENT_4(85), // The fourth Hu moment. 2530 MT_HU_MOMENT_5(86), // The fifth Hu moment. 2531 MT_HU_MOMENT_6(87), // The sixth Hu moment. 2532 MT_HU_MOMENT_7(88), // The seventh Hu moment. 2533 ; 2534 private final int value; 2535 2536 private MeasurementType(int value) { 2537 this.value = value; 2538 } 2539 2540 public static MeasurementType fromValue(int val) { 2541 for (MeasurementType v : values()) { 2542 if (v.value == val) 2543 return v; 2544 } 2545 return null; 2546 } 2547 2548 public int getValue() { 2549 return value; 2550 } 2551 } 2552 2553 public static enum GeometricMatchingMode { 2554 GEOMETRIC_MATCH_SHIFT_INVARIANT(0), // Searches for occurrences of the 2555 // pattern in the image, assuming that 2556 // the pattern is not rotated more than 2557 // plus or minus 5 degrees. 2558 GEOMETRIC_MATCH_ROTATION_INVARIANT(1), // Searches for occurrences of the 2559 // pattern in the image with reduced 2560 // restriction on the rotation of the 2561 // pattern. 2562 GEOMETRIC_MATCH_SCALE_INVARIANT(2), // Searches for occurrences of the 2563 // pattern in the image with reduced 2564 // restriction on the size of the 2565 // pattern. 2566 GEOMETRIC_MATCH_OCCLUSION_INVARIANT(4), // Searches for occurrences of the 2567 // pattern in the image, allowing 2568 // for a specified percentage of the 2569 // pattern to be occluded. 2570 ; 2571 private final int value; 2572 2573 private GeometricMatchingMode(int value) { 2574 this.value = value; 2575 } 2576 2577 public static GeometricMatchingMode fromValue(int val) { 2578 for (GeometricMatchingMode v : values()) { 2579 if (v.value == val) 2580 return v; 2581 } 2582 return null; 2583 } 2584 2585 public int getValue() { 2586 return value; 2587 } 2588 } 2589 2590 public static enum ButtonLabel { 2591 BUTTON_OK(0), // The label "OK". 2592 BUTTON_SAVE(1), // The label "Save". 2593 BUTTON_SELECT(2), // The label "Select". 2594 BUTTON_LOAD(3), // The label "Load". 2595 ; 2596 private final int value; 2597 2598 private ButtonLabel(int value) { 2599 this.value = value; 2600 } 2601 2602 public static ButtonLabel fromValue(int val) { 2603 try { 2604 return values()[val]; 2605 } catch (ArrayIndexOutOfBoundsException e) { 2606 return null; 2607 } 2608 } 2609 2610 public int getValue() { 2611 return value; 2612 } 2613 } 2614 2615 public static enum NearestNeighborMethod { 2616 MINIMUM_MEAN_DISTANCE(0), // The minimum mean distance method. 2617 K_NEAREST_NEIGHBOR(1), // The k-nearest neighbor method. 2618 NEAREST_PROTOTYPE(2), // The nearest prototype method. 2619 ; 2620 private final int value; 2621 2622 private NearestNeighborMethod(int value) { 2623 this.value = value; 2624 } 2625 2626 public static NearestNeighborMethod fromValue(int val) { 2627 try { 2628 return values()[val]; 2629 } catch (ArrayIndexOutOfBoundsException e) { 2630 return null; 2631 } 2632 } 2633 2634 public int getValue() { 2635 return value; 2636 } 2637 } 2638 2639 public static enum QRMirrorMode { 2640 QR_MIRROR_MODE_AUTO_DETECT(-2), // The function should determine if the QR 2641 // code is mirrored. 2642 QR_MIRROR_MODE_MIRRORED(1), // The function should expect the QR code to 2643 // appear mirrored. 2644 QR_MIRROR_MODE_NORMAL(0), // The function should expect the QR code to 2645 // appear normal. 2646 ; 2647 private final int value; 2648 2649 private QRMirrorMode(int value) { 2650 this.value = value; 2651 } 2652 2653 public static QRMirrorMode fromValue(int val) { 2654 for (QRMirrorMode v : values()) { 2655 if (v.value == val) 2656 return v; 2657 } 2658 return null; 2659 } 2660 2661 public int getValue() { 2662 return value; 2663 } 2664 } 2665 2666 public static enum ColumnProcessingMode { 2667 AVERAGE_COLUMNS(0), // Averages the data extracted for edge detection. 2668 MEDIAN_COLUMNS(1), // Takes the median of the data extracted for edge 2669 // detection. 2670 ; 2671 private final int value; 2672 2673 private ColumnProcessingMode(int value) { 2674 this.value = value; 2675 } 2676 2677 public static ColumnProcessingMode fromValue(int val) { 2678 try { 2679 return values()[val]; 2680 } catch (ArrayIndexOutOfBoundsException e) { 2681 return null; 2682 } 2683 } 2684 2685 public int getValue() { 2686 return value; 2687 } 2688 } 2689 2690 public static enum FindReferenceDirection { 2691 LEFT_TO_RIGHT_DIRECT(0), // Searches from the left side of the search area 2692 // to the right side of the search area for a 2693 // direct axis. 2694 LEFT_TO_RIGHT_INDIRECT(1), // Searches from the left side of the search area 2695 // to the right side of the search area for an 2696 // indirect axis. 2697 TOP_TO_BOTTOM_DIRECT(2), // Searches from the top of the search area to the 2698 // bottom of the search area for a direct axis. 2699 TOP_TO_BOTTOM_INDIRECT(3), // Searches from the top of the search area to 2700 // the bottom of the search area for an indirect 2701 // axis. 2702 RIGHT_TO_LEFT_DIRECT(4), // Searches from the right side of the search area 2703 // to the left side of the search area for a direct 2704 // axis. 2705 RIGHT_TO_LEFT_INDIRECT(5), // Searches from the right side of the search 2706 // area to the left side of the search area for 2707 // an indirect axis. 2708 BOTTOM_TO_TOP_DIRECT(6), // Searches from the bottom of the search area to 2709 // the top of the search area for a direct axis. 2710 BOTTOM_TO_TOP_INDIRECT(7), // Searches from the bottom of the search area to 2711 // the top of the search area for an indirect 2712 // axis. 2713 ; 2714 private final int value; 2715 2716 private FindReferenceDirection(int value) { 2717 this.value = value; 2718 } 2719 2720 public static FindReferenceDirection fromValue(int val) { 2721 try { 2722 return values()[val]; 2723 } catch (ArrayIndexOutOfBoundsException e) { 2724 return null; 2725 } 2726 } 2727 2728 public int getValue() { 2729 return value; 2730 } 2731 } 2732 2733 public static enum MulticoreOperation { 2734 GET_CORES(0), // The number of processor cores NI Vision is currently using. 2735 SET_CORES(1), // The number of processor cores for NI Vision to use. 2736 USE_MAX_AVAILABLE(2), // Use the maximum number of available processor 2737 // cores. 2738 ; 2739 private final int value; 2740 2741 private MulticoreOperation(int value) { 2742 this.value = value; 2743 } 2744 2745 public static MulticoreOperation fromValue(int val) { 2746 try { 2747 return values()[val]; 2748 } catch (ArrayIndexOutOfBoundsException e) { 2749 return null; 2750 } 2751 } 2752 2753 public int getValue() { 2754 return value; 2755 } 2756 } 2757 2758 public static enum GroupBehavior { 2759 GROUP_CLEAR(0), // Sets the behavior of the overlay group to clear the 2760 // current settings when an image is transformed. 2761 GROUP_KEEP(1), // Sets the behavior of the overlay group to keep the current 2762 // settings when an image is transformed. 2763 GROUP_TRANSFORM(2), // Sets the behavior of the overlay group to transform 2764 // with the image. 2765 ; 2766 private final int value; 2767 2768 private GroupBehavior(int value) { 2769 this.value = value; 2770 } 2771 2772 public static GroupBehavior fromValue(int val) { 2773 try { 2774 return values()[val]; 2775 } catch (ArrayIndexOutOfBoundsException e) { 2776 return null; 2777 } 2778 } 2779 2780 public int getValue() { 2781 return value; 2782 } 2783 } 2784 2785 public static enum QRDimensions { 2786 QR_DIMENSIONS_AUTO_DETECT(0), // The function will automatically determine 2787 // the dimensions of the QR code. 2788 QR_DIMENSIONS_11x11(11), // Specifies the dimensions of the QR code as 11 x 2789 // 11. 2790 QR_DIMENSIONS_13x13(13), // Specifies the dimensions of the QR code as 13 x 2791 // 13. 2792 QR_DIMENSIONS_15x15(15), // Specifies the dimensions of the QR code as 15 x 2793 // 15. 2794 QR_DIMENSIONS_17x17(17), // Specifies the dimensions of the QR code as 17 x 2795 // 17. 2796 QR_DIMENSIONS_21x21(21), // Specifies the dimensions of the QR code as 21 x 2797 // 21. 2798 QR_DIMENSIONS_25x25(25), // Specifies the dimensions of the QR code as 25 x 2799 // 25. 2800 QR_DIMENSIONS_29x29(29), // Specifies the dimensions of the QR code as 29 x 2801 // 29. 2802 QR_DIMENSIONS_33x33(33), // Specifies the dimensions of the QR code as 33 x 2803 // 33. 2804 QR_DIMENSIONS_37x37(37), // Specifies the dimensions of the QR code as 37 x 2805 // 37. 2806 QR_DIMENSIONS_41x41(41), // Specifies the dimensions of the QR code as 41 x 2807 // 41. 2808 QR_DIMENSIONS_45x45(45), // Specifies the dimensions of the QR code as 45 x 2809 // 45. 2810 QR_DIMENSIONS_49x49(49), // Specifies the dimensions of the QR code as 49 x 2811 // 49. 2812 QR_DIMENSIONS_53x53(53), // Specifies the dimensions of the QR code as 53 x 2813 // 53. 2814 QR_DIMENSIONS_57x57(57), // Specifies the dimensions of the QR code as 57 x 2815 // 57. 2816 QR_DIMENSIONS_61x61(61), // Specifies the dimensions of the QR code as 61 x 2817 // 61. 2818 QR_DIMENSIONS_65x65(65), // Specifies the dimensions of the QR code as 65 x 2819 // 65. 2820 QR_DIMENSIONS_69x69(69), // Specifies the dimensions of the QR code as 69 x 2821 // 69. 2822 QR_DIMENSIONS_73x73(73), // Specifies the dimensions of the QR code as 73 x 2823 // 73. 2824 QR_DIMENSIONS_77x77(77), // Specifies the dimensions of the QR code as 77 x 2825 // 77. 2826 QR_DIMENSIONS_81x81(81), // Specifies the dimensions of the QR code as 81 x 2827 // 81. 2828 QR_DIMENSIONS_85x85(85), // Specifies the dimensions of the QR code as 85 x 2829 // 85. 2830 QR_DIMENSIONS_89x89(89), // Specifies the dimensions of the QR code as 89 x 2831 // 89. 2832 QR_DIMENSIONS_93x93(93), // Specifies the dimensions of the QR code as 93 x 2833 // 93. 2834 QR_DIMENSIONS_97x97(97), // Specifies the dimensions of the QR code as 97 x 2835 // 97. 2836 QR_DIMENSIONS_101x101(101), // Specifies the dimensions of the QR code as 2837 // 101 x 101. 2838 QR_DIMENSIONS_105x105(105), // Specifies the dimensions of the QR code as 2839 // 105 x 105. 2840 QR_DIMENSIONS_109x109(109), // Specifies the dimensions of the QR code as 2841 // 109 x 109. 2842 QR_DIMENSIONS_113x113(113), // Specifies the dimensions of the QR code as 2843 // 113 x 113. 2844 QR_DIMENSIONS_117x117(117), // Specifies the dimensions of the QR code as 2845 // 117 x 117. 2846 QR_DIMENSIONS_121x121(121), // Specifies the dimensions of the QR code as 2847 // 121 x 121. 2848 QR_DIMENSIONS_125x125(125), // Specifies the dimensions of the QR code as 2849 // 125 x 125. 2850 QR_DIMENSIONS_129x129(129), // Specifies the dimensions of the QR code as 2851 // 129 x 129. 2852 QR_DIMENSIONS_133x133(133), // Specifies the dimensions of the QR code as 2853 // 133 x 133. 2854 QR_DIMENSIONS_137x137(137), // Specifies the dimensions of the QR code as 2855 // 137 x 137. 2856 QR_DIMENSIONS_141x141(141), // Specifies the dimensions of the QR code as 2857 // 141 x 141. 2858 QR_DIMENSIONS_145x145(145), // Specifies the dimensions of the QR code as 2859 // 145 x 145. 2860 QR_DIMENSIONS_149x149(149), // Specifies the dimensions of the QR code as 2861 // 149 x 149. 2862 QR_DIMENSIONS_153x153(153), // Specifies the dimensions of the QR code as 2863 // 153 x 153. 2864 QR_DIMENSIONS_157x157(157), // Specifies the dimensions of the QR code as 2865 // 157 x 1537. 2866 QR_DIMENSIONS_161x161(161), // Specifies the dimensions of the QR code as 2867 // 161 x 161. 2868 QR_DIMENSIONS_165x165(165), // Specifies the dimensions of the QR code as 2869 // 165 x 165. 2870 QR_DIMENSIONS_169x169(169), // Specifies the dimensions of the QR code as 2871 // 169 x 169. 2872 QR_DIMENSIONS_173x173(173), // Specifies the dimensions of the QR code as 2873 // 173 x 173. 2874 QR_DIMENSIONS_177x177(177), // Specifies the dimensions of the QR code as 2875 // 177 x 177. 2876 ; 2877 private final int value; 2878 2879 private QRDimensions(int value) { 2880 this.value = value; 2881 } 2882 2883 public static QRDimensions fromValue(int val) { 2884 for (QRDimensions v : values()) { 2885 if (v.value == val) 2886 return v; 2887 } 2888 return null; 2889 } 2890 2891 public int getValue() { 2892 return value; 2893 } 2894 } 2895 2896 public static enum QRCellFilterMode { 2897 QR_CELL_FILTER_MODE_AUTO_DETECT(-2), // The function will try all filter 2898 // modes and uses the one that decodes 2899 // the QR code within the fewest 2900 // iterations and utilizing the least 2901 // amount of error correction. 2902 QR_CELL_FILTER_MODE_AVERAGE(0), // The function sets the pixel value for the 2903 // cell to the average of the sampled 2904 // pixels. 2905 QR_CELL_FILTER_MODE_MEDIAN(1), // The function sets the pixel value for the 2906 // cell to the median of the sampled pixels. 2907 QR_CELL_FILTER_MODE_CENTRAL_AVERAGE(2), // The function sets the pixel value 2908 // for the cell to the average of 2909 // the pixels in the center of the 2910 // cell sample. 2911 QR_CELL_FILTER_MODE_HIGH_AVERAGE(3), // The function sets the pixel value 2912 // for the cell to the average value of 2913 // the half of the sampled pixels with 2914 // the highest pixel values. 2915 QR_CELL_FILTER_MODE_LOW_AVERAGE(4), // The function sets the pixel value for 2916 // the cell to the average value of the 2917 // half of the sampled pixels with the 2918 // lowest pixel values. 2919 QR_CELL_FILTER_MODE_VERY_HIGH_AVERAGE(5), // The function sets the pixel 2920 // value for the cell to the 2921 // average value of the ninth of 2922 // the sampled pixels with the 2923 // highest pixel values. 2924 QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE(6), // The function sets the pixel 2925 // value for the cell to the 2926 // average value of the ninth of 2927 // the sampled pixels with the 2928 // lowest pixel values. 2929 QR_CELL_FILTER_MODE_ALL(8), // The function tries each filter mode, starting 2930 // with IMAQ_QR_CELL_FILTER_MODE_AVERAGE and 2931 // ending with 2932 // IMAQ_QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE, 2933 // stopping once a filter mode decodes 2934 // correctly. 2935 ; 2936 private final int value; 2937 2938 private QRCellFilterMode(int value) { 2939 this.value = value; 2940 } 2941 2942 public static QRCellFilterMode fromValue(int val) { 2943 for (QRCellFilterMode v : values()) { 2944 if (v.value == val) 2945 return v; 2946 } 2947 return null; 2948 } 2949 2950 public int getValue() { 2951 return value; 2952 } 2953 } 2954 2955 public static enum RoundingMode { 2956 ROUNDING_MODE_OPTIMIZE(0), // Rounds the result of a division using the best 2957 // available method. 2958 ROUNDING_MODE_TRUNCATE(1), // Truncates the result of a division. 2959 ; 2960 private final int value; 2961 2962 private RoundingMode(int value) { 2963 this.value = value; 2964 } 2965 2966 public static RoundingMode fromValue(int val) { 2967 try { 2968 return values()[val]; 2969 } catch (ArrayIndexOutOfBoundsException e) { 2970 return null; 2971 } 2972 } 2973 2974 public int getValue() { 2975 return value; 2976 } 2977 } 2978 2979 public static enum QRDemodulationMode { 2980 QR_DEMODULATION_MODE_AUTO_DETECT(-2), // The function will try each 2981 // demodulation mode and use the one 2982 // which decodes the QR code within 2983 // the fewest iterations and utilizing 2984 // the least amount of error 2985 // correction. 2986 QR_DEMODULATION_MODE_HISTOGRAM(0), // The function uses a histogram of all 2987 // of the QR cells to calculate a 2988 // threshold. 2989 QR_DEMODULATION_MODE_LOCAL_CONTRAST(1), // The function examines each of the 2990 // cell's neighbors to determine if 2991 // the cell is on or off. 2992 QR_DEMODULATION_MODE_COMBINED(2), // The function uses the histogram of the 2993 // QR code to calculate a threshold. 2994 QR_DEMODULATION_MODE_ALL(3), // The function tries 2995 // IMAQ_QR_DEMODULATION_MODE_HISTOGRAM, then 2996 // IMAQ_QR_DEMODULATION_MODE_LOCAL_CONTRAST and 2997 // then IMAQ_QR_DEMODULATION_MODE_COMBINED, 2998 // stopping once one mode is successful. 2999 ; 3000 private final int value; 3001 3002 private QRDemodulationMode(int value) { 3003 this.value = value; 3004 } 3005 3006 public static QRDemodulationMode fromValue(int val) { 3007 for (QRDemodulationMode v : values()) { 3008 if (v.value == val) 3009 return v; 3010 } 3011 return null; 3012 } 3013 3014 public int getValue() { 3015 return value; 3016 } 3017 } 3018 3019 public static enum ContrastMode { 3020 ORIGINAL_CONTRAST(0), // Instructs the geometric matching algorithm to find 3021 // matches with the same contrast as the template. 3022 REVERSED_CONTRAST(1), // Instructs the geometric matching algorithm to find 3023 // matches with the inverted contrast of the template. 3024 BOTH_CONTRASTS(2), // Instructs the geometric matching algorithm to find 3025 // matches with the same and inverted contrast of the 3026 // template. 3027 ; 3028 private final int value; 3029 3030 private ContrastMode(int value) { 3031 this.value = value; 3032 } 3033 3034 public static ContrastMode fromValue(int val) { 3035 try { 3036 return values()[val]; 3037 } catch (ArrayIndexOutOfBoundsException e) { 3038 return null; 3039 } 3040 } 3041 3042 public int getValue() { 3043 return value; 3044 } 3045 } 3046 3047 public static enum QRPolarities { 3048 QR_POLARITY_AUTO_DETECT(-2), // The function should determine the polarity 3049 // of the QR code. 3050 QR_POLARITY_BLACK_ON_WHITE(0), // The function should search for a QR code 3051 // with dark data on a bright background. 3052 QR_POLARITY_WHITE_ON_BLACK(1), // The function should search for a QR code 3053 // with bright data on a dark background. 3054 ; 3055 private final int value; 3056 3057 private QRPolarities(int value) { 3058 this.value = value; 3059 } 3060 3061 public static QRPolarities fromValue(int val) { 3062 for (QRPolarities v : values()) { 3063 if (v.value == val) 3064 return v; 3065 } 3066 return null; 3067 } 3068 3069 public int getValue() { 3070 return value; 3071 } 3072 } 3073 3074 public static enum QRRotationMode { 3075 QR_ROTATION_MODE_UNLIMITED(0), // The function allows for unlimited 3076 // rotation. 3077 QR_ROTATION_MODE_0_DEGREES(1), // The function allows for ??? 5 degrees of 3078 // rotation. 3079 QR_ROTATION_MODE_90_DEGREES(2), // The function allows for between 85 and 95 3080 // degrees of rotation. 3081 QR_ROTATION_MODE_180_DEGREES(3), // The function allows for between 175 and 3082 // 185 degrees of rotation. 3083 QR_ROTATION_MODE_270_DEGREES(4), // The function allows for between 265 and 3084 // 275 degrees of rotation. 3085 ; 3086 private final int value; 3087 3088 private QRRotationMode(int value) { 3089 this.value = value; 3090 } 3091 3092 public static QRRotationMode fromValue(int val) { 3093 try { 3094 return values()[val]; 3095 } catch (ArrayIndexOutOfBoundsException e) { 3096 return null; 3097 } 3098 } 3099 3100 public int getValue() { 3101 return value; 3102 } 3103 } 3104 3105 public static enum QRGradingMode { 3106 QR_NO_GRADING(0), // The function does not make any preparatory 3107 // calculations. 3108 ; 3109 private final int value; 3110 3111 private QRGradingMode(int value) { 3112 this.value = value; 3113 } 3114 3115 public static QRGradingMode fromValue(int val) { 3116 try { 3117 return values()[val]; 3118 } catch (ArrayIndexOutOfBoundsException e) { 3119 return null; 3120 } 3121 } 3122 3123 public int getValue() { 3124 return value; 3125 } 3126 } 3127 3128 public static enum StraightEdgeSearchMode { 3129 USE_FIRST_RAKE_EDGES(0), // Fits a straight edge on the first points 3130 // detected using a rake. 3131 USE_BEST_RAKE_EDGES(1), // Fits a straight edge on the best points detected 3132 // using a rake. 3133 USE_BEST_HOUGH_LINE(2), // Finds the strongest straight edge using all 3134 // points detected on a rake. 3135 USE_FIRST_PROJECTION_EDGE(3), // Uses the location of the first projected 3136 // edge as the straight edge. 3137 USE_BEST_PROJECTION_EDGE(4), // Finds the strongest projected edge location 3138 // to determine the straight edge. 3139 ; 3140 private final int value; 3141 3142 private StraightEdgeSearchMode(int value) { 3143 this.value = value; 3144 } 3145 3146 public static StraightEdgeSearchMode fromValue(int val) { 3147 try { 3148 return values()[val]; 3149 } catch (ArrayIndexOutOfBoundsException e) { 3150 return null; 3151 } 3152 } 3153 3154 public int getValue() { 3155 return value; 3156 } 3157 } 3158 3159 public static enum SearchDirection { 3160 SEARCH_DIRECTION_LEFT_TO_RIGHT(0), // Searches from the left side of the 3161 // search area to the right side of the 3162 // search area. 3163 SEARCH_DIRECTION_RIGHT_TO_LEFT(1), // Searches from the right side of the 3164 // search area to the left side of the 3165 // search area. 3166 SEARCH_DIRECTION_TOP_TO_BOTTOM(2), // Searches from the top side of the 3167 // search area to the bottom side of the 3168 // search area. 3169 SEARCH_DIRECTION_BOTTOM_TO_TOP(3), // Searches from the bottom side of the 3170 // search area to the top side of the 3171 // search area. 3172 ; 3173 private final int value; 3174 3175 private SearchDirection(int value) { 3176 this.value = value; 3177 } 3178 3179 public static SearchDirection fromValue(int val) { 3180 try { 3181 return values()[val]; 3182 } catch (ArrayIndexOutOfBoundsException e) { 3183 return null; 3184 } 3185 } 3186 3187 public int getValue() { 3188 return value; 3189 } 3190 } 3191 3192 public static enum QRStreamMode { 3193 QR_MODE_NUMERIC(0), // Specifies that the data was encoded using numeric 3194 // mode. 3195 QR_MODE_ALPHANUMERIC(1), // Specifies that the data was encoded using 3196 // alpha-numeric mode. 3197 QR_MODE_RAW_BYTE(2), // Specifies that the data was not encoded but is only 3198 // raw binary bytes, or encoded in JIS-8. 3199 QR_MODE_EAN128_TOKEN(3), // Specifies that the data has a special meaning 3200 // represented by the application ID. 3201 QR_MODE_EAN128_DATA(4), // Specifies that the data has a special meaning 3202 // represented by the application ID. 3203 QR_MODE_ECI(5), // Specifies that the data was meant to be read using the 3204 // language represented in the language ID. 3205 QR_MODE_KANJI(6), // Specifies that the data was encoded in Shift-JIS16 3206 // Japanese. 3207 ; 3208 private final int value; 3209 3210 private QRStreamMode(int value) { 3211 this.value = value; 3212 } 3213 3214 public static QRStreamMode fromValue(int val) { 3215 try { 3216 return values()[val]; 3217 } catch (ArrayIndexOutOfBoundsException e) { 3218 return null; 3219 } 3220 } 3221 3222 public int getValue() { 3223 return value; 3224 } 3225 } 3226 3227 public static enum ParticleClassifierType { 3228 PARTICLE_LARGEST(0), // Use only the largest particle in the image. 3229 PARTICLE_ALL(1), // Use all particles in the image. 3230 ; 3231 private final int value; 3232 3233 private ParticleClassifierType(int value) { 3234 this.value = value; 3235 } 3236 3237 public static ParticleClassifierType fromValue(int val) { 3238 try { 3239 return values()[val]; 3240 } catch (ArrayIndexOutOfBoundsException e) { 3241 return null; 3242 } 3243 } 3244 3245 public int getValue() { 3246 return value; 3247 } 3248 } 3249 3250 public static enum QRCellSampleSize { 3251 QR_CELL_SAMPLE_SIZE_AUTO_DETECT(-2), // The function will try each sample 3252 // size and use the one which decodes 3253 // the QR code within the fewest 3254 // iterations and utilizing the least 3255 // amount of error correction. 3256 QR_CELL_SAMPLE_SIZE1X1(1), // The function will use a 1x1 sized sample from 3257 // each cell. 3258 QR_CELL_SAMPLE_SIZE2X2(2), // The function will use a 2x2 sized sample from 3259 // each cell. 3260 QR_CELL_SAMPLE_SIZE3X3(3), // The function will use a 3x3 sized sample from 3261 // each cell. 3262 QR_CELL_SAMPLE_SIZE4X4(4), // The function will use a 4x4 sized sample from 3263 // each cell. 3264 QR_CELL_SAMPLE_SIZE5X5(5), // The function will use a 5x5 sized sample from 3265 // each cell. 3266 QR_CELL_SAMPLE_SIZE6X6(6), // The function will use a 6x6 sized sample from 3267 // each cell. 3268 QR_CELL_SAMPLE_SIZE7X7(7), // The function will use a 7x7 sized sample from 3269 // each cell. 3270 ; 3271 private final int value; 3272 3273 private QRCellSampleSize(int value) { 3274 this.value = value; 3275 } 3276 3277 public static QRCellSampleSize fromValue(int val) { 3278 for (QRCellSampleSize v : values()) { 3279 if (v.value == val) 3280 return v; 3281 } 3282 return null; 3283 } 3284 3285 public int getValue() { 3286 return value; 3287 } 3288 } 3289 3290 public static enum RakeProcessType { 3291 GET_FIRST_EDGES(0), GET_FIRST_AND_LAST_EDGES(1), GET_ALL_EDGES(2), GET_BEST_EDGES(3), ; 3292 private final int value; 3293 3294 private RakeProcessType(int value) { 3295 this.value = value; 3296 } 3297 3298 public static RakeProcessType fromValue(int val) { 3299 try { 3300 return values()[val]; 3301 } catch (ArrayIndexOutOfBoundsException e) { 3302 return null; 3303 } 3304 } 3305 3306 public int getValue() { 3307 return value; 3308 } 3309 } 3310 3311 public static enum GeometricSetupDataItem { 3312 CURVE_EXTRACTION_MODE(0), // Specifies how the function identifies curves in 3313 // the image. 3314 CURVE_EDGE_THRSHOLD(1), // Specifies the minimum contrast an edge pixel must 3315 // have for it to be considered part of a curve. 3316 CURVE_EDGE_FILTER(2), // Specifies the width of the edge filter that the 3317 // function uses to identify curves in the image. 3318 MINIMUM_CURVE_LENGTH(3), // Specifies the length, in pixels, of the smallest 3319 // curve that you want the function to identify. 3320 CURVE_ROW_SEARCH_STEP_SIZE(4), // Specifies the distance, in the y 3321 // direction, between the image rows that the 3322 // algorithm inspects for curve seed points. 3323 CURVE_COL_SEARCH_STEP_SIZE(5), // Specifies the distance, in the x 3324 // direction, between the image columns that 3325 // the algorithm inspects for curve seed 3326 // points. 3327 CURVE_MAX_END_POINT_GAP(6), // Specifies the maximum gap, in pixels, between 3328 // the endpoints of a curve that the function 3329 // identifies as a closed curve. 3330 EXTRACT_CLOSED_CURVES(7), // Specifies whether to identify only closed 3331 // curves in the image. 3332 ENABLE_SUBPIXEL_CURVE_EXTRACTION(8), // The function ignores this option. 3333 ENABLE_CORRELATION_SCORE(9), // Specifies that the function should calculate 3334 // the Correlation Score and return it for each 3335 // match result. 3336 ENABLE_SUBPIXEL_ACCURACY(10), // Determines whether to return the match 3337 // results with subpixel accuracy. 3338 SUBPIXEL_ITERATIONS(11), // Specifies the maximum number of incremental 3339 // improvements used to refine matches using 3340 // subpixel information. 3341 SUBPIXEL_TOLERANCE(12), // Specifies the maximum amount of change, in 3342 // pixels, between consecutive incremental 3343 // improvements in the match position before the 3344 // function stops refining the match position. 3345 INITIAL_MATCH_LIST_LENGTH(13), // Specifies the maximum size of the match 3346 // list. 3347 ENABLE_TARGET_TEMPLATE_CURVESCORE(14), // Specifies whether the function 3348 // should calculate the match curve 3349 // to template curve score and return 3350 // it for each match result. 3351 MINIMUM_MATCH_SEPARATION_DISTANCE(15), // Specifies the minimum separation 3352 // distance, in pixels, between the 3353 // origins of two matches that have 3354 // unique positions. 3355 MINIMUM_MATCH_SEPARATION_ANGLE(16), // Specifies the minimum angular 3356 // difference, in degrees, between two 3357 // matches that have unique angles. 3358 MINIMUM_MATCH_SEPARATION_SCALE(17), // Specifies the minimum difference in 3359 // scale, expressed as a percentage, 3360 // between two matches that have unique 3361 // scales. 3362 MAXIMUM_MATCH_OVERLAP(18), // Specifies whether you want the algorithm to 3363 // spend less time accurately estimating the 3364 // location of a match. 3365 ENABLE_COARSE_RESULT(19), // Specifies whether you want the algorithm to 3366 // spend less time accurately estimating the 3367 // location of a match. 3368 ENABLE_CALIBRATION_SUPPORT(20), // Specifies whether or not the algorithm 3369 // treat the inspection image as a 3370 // calibrated image. 3371 ENABLE_CONTRAST_REVERSAL(21), // Specifies the contrast of the matches to 3372 // search for. 3373 SEARCH_STRATEGY(22), // Specifies the aggressiveness of the strategy used to 3374 // find matches in the image. 3375 REFINEMENT_MATCH_FACTOR(23), // Specifies the factor applied to the number 3376 // of matches requested to determine how many 3377 // matches are refined in the pyramid stage. 3378 SUBPIXEL_MATCH_FACTOR(24), // Specifies the factor applied to the number for 3379 // matches requested to determine how many 3380 // matches are used for the final (subpixel) 3381 // stage. 3382 MAX_REFINEMENT_ITERATIONS(25), // Specifies maximum refinement iteration. 3383 ; 3384 private final int value; 3385 3386 private GeometricSetupDataItem(int value) { 3387 this.value = value; 3388 } 3389 3390 public static GeometricSetupDataItem fromValue(int val) { 3391 try { 3392 return values()[val]; 3393 } catch (ArrayIndexOutOfBoundsException e) { 3394 return null; 3395 } 3396 } 3397 3398 public int getValue() { 3399 return value; 3400 } 3401 } 3402 3403 public static enum DistortionModel { 3404 POLYNOMIAL_MODEL(0), // Polynomial model. 3405 DIVISION_MODEL(1), // Division Model. 3406 NO_DISTORTION_MODEL(-1), // Not a distortion model. 3407 ; 3408 private final int value; 3409 3410 private DistortionModel(int value) { 3411 this.value = value; 3412 } 3413 3414 public static DistortionModel fromValue(int val) { 3415 for (DistortionModel v : values()) { 3416 if (v.value == val) 3417 return v; 3418 } 3419 return null; 3420 } 3421 3422 public int getValue() { 3423 return value; 3424 } 3425 } 3426 3427 public static enum CalibrationThumbnailType { 3428 CAMARA_MODEL_TYPE(0), // Camara model thumbnail type. 3429 PERSPECTIVE_TYPE(1), // Perspective thumbnail type. 3430 MICRO_PLANE_TYPE(2), // Micro Plane thumbnail type. 3431 ; 3432 private final int value; 3433 3434 private CalibrationThumbnailType(int value) { 3435 this.value = value; 3436 } 3437 3438 public static CalibrationThumbnailType fromValue(int val) { 3439 try { 3440 return values()[val]; 3441 } catch (ArrayIndexOutOfBoundsException e) { 3442 return null; 3443 } 3444 } 3445 3446 public int getValue() { 3447 return value; 3448 } 3449 } 3450 3451 public static enum SettingType { 3452 ROTATION_ANGLE_RANGE(0), // Set a range for this option to specify the 3453 // angles at which you expect the Function to find 3454 // template matches in the inspection image. 3455 SCALE_RANGE(1), // Set a range for this option to specify the sizes at which 3456 // you expect the Function to find template matches in the 3457 // inspection image. 3458 OCCLUSION_RANGE(2), // Set a range for this option to specify the amount of 3459 // occlusion you expect for a match in the inspection 3460 // image. 3461 ; 3462 private final int value; 3463 3464 private SettingType(int value) { 3465 this.value = value; 3466 } 3467 3468 public static SettingType fromValue(int val) { 3469 try { 3470 return values()[val]; 3471 } catch (ArrayIndexOutOfBoundsException e) { 3472 return null; 3473 } 3474 } 3475 3476 public int getValue() { 3477 return value; 3478 } 3479 } 3480 3481 public static enum SegmentationDistanceLevel { 3482 SEGMENTATION_LEVEL_CONSERVATIVE(0), // Uses extensive criteria to determine 3483 // the Maximum Distance. 3484 SEGMENTATION_LEVEL_AGGRESSIVE(1), // Uses few criteria to determine the 3485 // Maximum Distance. 3486 ; 3487 private final int value; 3488 3489 private SegmentationDistanceLevel(int value) { 3490 this.value = value; 3491 } 3492 3493 public static SegmentationDistanceLevel fromValue(int val) { 3494 try { 3495 return values()[val]; 3496 } catch (ArrayIndexOutOfBoundsException e) { 3497 return null; 3498 } 3499 } 3500 3501 public int getValue() { 3502 return value; 3503 } 3504 } 3505 3506 public static enum ExtractContourSelection { 3507 CLOSEST(0), // Selects the curve closest to the ROI. 3508 LONGEST(1), // Selects the longest curve. 3509 STRONGEST(2), // Selects the curve with the highest edge strength averaged 3510 // from each point on the curve. 3511 ; 3512 private final int value; 3513 3514 private ExtractContourSelection(int value) { 3515 this.value = value; 3516 } 3517 3518 public static ExtractContourSelection fromValue(int val) { 3519 try { 3520 return values()[val]; 3521 } catch (ArrayIndexOutOfBoundsException e) { 3522 return null; 3523 } 3524 } 3525 3526 public int getValue() { 3527 return value; 3528 } 3529 } 3530 3531 public static enum FindTransformMode { 3532 FIND_REFERENCE(0), // Update both parts of the coordinate system. 3533 UPDATE_TRANSFORM(1), // Update only the new reference system. 3534 ; 3535 private final int value; 3536 3537 private FindTransformMode(int value) { 3538 this.value = value; 3539 } 3540 3541 public static FindTransformMode fromValue(int val) { 3542 try { 3543 return values()[val]; 3544 } catch (ArrayIndexOutOfBoundsException e) { 3545 return null; 3546 } 3547 } 3548 3549 public int getValue() { 3550 return value; 3551 } 3552 } 3553 3554 public static enum ExtractContourDirection { 3555 RECT_LEFT_RIGHT(0), // Searches the ROI from left to right. 3556 RECT_RIGHT_LEFT(1), // Searches the ROI from right to left. 3557 RECT_TOP_BOTTOM(2), // Searches the ROI from top to bottom. 3558 RECT_BOTTOM_TOP(3), // Searches the ROI from bottom to top. 3559 ANNULUS_INNER_OUTER(4), // Searches the ROI from the inner radius to the 3560 // outer radius. 3561 ANNULUS_OUTER_INNER(5), // Searches the ROI from the outer radius to the 3562 // inner radius. 3563 ANNULUS_START_STOP(6), // Searches the ROI from start angle to end angle. 3564 ANNULUS_STOP_START(7), // Searches the ROI from end angle to start angle. 3565 ; 3566 private final int value; 3567 3568 private ExtractContourDirection(int value) { 3569 this.value = value; 3570 } 3571 3572 public static ExtractContourDirection fromValue(int val) { 3573 try { 3574 return values()[val]; 3575 } catch (ArrayIndexOutOfBoundsException e) { 3576 return null; 3577 } 3578 } 3579 3580 public int getValue() { 3581 return value; 3582 } 3583 } 3584 3585 public static enum EdgePolaritySearchMode { 3586 SEARCH_FOR_ALL_EDGES(0), // Searches for all edges. 3587 SEARCH_FOR_RISING_EDGES(1), // Searches for rising edges only. 3588 SEARCH_FOR_FALLING_EDGES(2), // Searches for falling edges only. 3589 ; 3590 private final int value; 3591 3592 private EdgePolaritySearchMode(int value) { 3593 this.value = value; 3594 } 3595 3596 public static EdgePolaritySearchMode fromValue(int val) { 3597 try { 3598 return values()[val]; 3599 } catch (ArrayIndexOutOfBoundsException e) { 3600 return null; 3601 } 3602 } 3603 3604 public int getValue() { 3605 return value; 3606 } 3607 } 3608 3609 public static enum Connectivity { 3610 FOUR_CONNECTED(0), // Morphological reconstruction is performed in 3611 // connectivity mode 4. 3612 EIGHT_CONNECTED(1), // Morphological reconstruction is performed in 3613 // connectivity mode 8. 3614 ; 3615 private final int value; 3616 3617 private Connectivity(int value) { 3618 this.value = value; 3619 } 3620 3621 public static Connectivity fromValue(int val) { 3622 try { 3623 return values()[val]; 3624 } catch (ArrayIndexOutOfBoundsException e) { 3625 return null; 3626 } 3627 } 3628 3629 public int getValue() { 3630 return value; 3631 } 3632 } 3633 3634 public static enum MorphologyReconstructOperation { 3635 DILATE_RECONSTRUCT(0), // Performs Reconstruction by dilation. 3636 ERODE_RECONSTRUCT(1), // Performs Reconstruction by erosion. 3637 ; 3638 private final int value; 3639 3640 private MorphologyReconstructOperation(int value) { 3641 this.value = value; 3642 } 3643 3644 public static MorphologyReconstructOperation fromValue(int val) { 3645 try { 3646 return values()[val]; 3647 } catch (ArrayIndexOutOfBoundsException e) { 3648 return null; 3649 } 3650 } 3651 3652 public int getValue() { 3653 return value; 3654 } 3655 } 3656 3657 public static enum WaveletType { 3658 DB02(0), DB03(1), DB04(2), // Specifies the Wavelet Type as DB02. 3659 DB05(3), DB06(4), DB07(5), DB08(6), DB09(7), DB10(8), DB11(9), DB12(10), DB13(11), DB14(12), HAAR( 3660 13), BIOR1_3(14), BIOR1_5(15), BIOR2_2(16), BIOR2_4(17), BIOR2_6(18), BIOR2_8(19), BIOR3_1( 3661 20), BIOR3_3(21), BIOR3_5(22), BIOR3_7(23), BIOR3_9(24), BIOR4_4(25), COIF1(26), COIF2(27), COIF3( 3662 28), COIF4(29), COIF5(30), SYM2(31), SYM3(32), SYM4(33), SYM5(34), SYM6(35), SYM7(36), SYM8( 3663 37), BIOR5_5(38), BIOR6_8(39), ; 3664 private final int value; 3665 3666 private WaveletType(int value) { 3667 this.value = value; 3668 } 3669 3670 public static WaveletType fromValue(int val) { 3671 try { 3672 return values()[val]; 3673 } catch (ArrayIndexOutOfBoundsException e) { 3674 return null; 3675 } 3676 } 3677 3678 public int getValue() { 3679 return value; 3680 } 3681 } 3682 3683 public static enum ParticleClassifierThresholdType { 3684 THRESHOLD_MANUAL(0), // The classifier performs a manual threshold on the 3685 // image during preprocessing. 3686 THRESHOLD_AUTO(1), // The classifier performs an auto threshold on the image 3687 // during preprocessing. 3688 THRESHOLD_LOCAL(2), // The classifier performs a local threshold on the 3689 // image during preprocessing. 3690 ; 3691 private final int value; 3692 3693 private ParticleClassifierThresholdType(int value) { 3694 this.value = value; 3695 } 3696 3697 public static ParticleClassifierThresholdType fromValue(int val) { 3698 try { 3699 return values()[val]; 3700 } catch (ArrayIndexOutOfBoundsException e) { 3701 return null; 3702 } 3703 } 3704 3705 public int getValue() { 3706 return value; 3707 } 3708 } 3709 3710 public static enum MeasureParticlesCalibrationMode { 3711 CALIBRATION_MODE_PIXEL(0), // The function takes only pixel measurements on 3712 // the particles in the image. 3713 CALIBRATION_MODE_CALIBRATED(1), // The function takes only calibrated 3714 // measurements on the particles in the 3715 // image. 3716 CALIBRATION_MODE_BOTH(2), // The function takes both pixel and calibrated 3717 // measurements on the particles in the image. 3718 ; 3719 private final int value; 3720 3721 private MeasureParticlesCalibrationMode(int value) { 3722 this.value = value; 3723 } 3724 3725 public static MeasureParticlesCalibrationMode fromValue(int val) { 3726 try { 3727 return values()[val]; 3728 } catch (ArrayIndexOutOfBoundsException e) { 3729 return null; 3730 } 3731 } 3732 3733 public int getValue() { 3734 return value; 3735 } 3736 } 3737 3738 public static enum GeometricMatchingSearchStrategy { 3739 GEOMETRIC_MATCHING_CONSERVATIVE(0), // Instructs the pattern matching 3740 // algorithm to use the largest possible 3741 // amount of information from the image 3742 // at the expense of slowing down the 3743 // speed of the algorithm. 3744 GEOMETRIC_MATCHING_BALANCED(1), // Instructs the pattern matching algorithm 3745 // to balance the amount of information from 3746 // the image it uses with the speed of the 3747 // algorithm. 3748 GEOMETRIC_MATCHING_AGGRESSIVE(2), // Instructs the pattern matching 3749 // algorithm to use a lower amount of 3750 // information from the image, which 3751 // allows the algorithm to run quickly but 3752 // at the expense of accuracy. 3753 ; 3754 private final int value; 3755 3756 private GeometricMatchingSearchStrategy(int value) { 3757 this.value = value; 3758 } 3759 3760 public static GeometricMatchingSearchStrategy fromValue(int val) { 3761 try { 3762 return values()[val]; 3763 } catch (ArrayIndexOutOfBoundsException e) { 3764 return null; 3765 } 3766 } 3767 3768 public int getValue() { 3769 return value; 3770 } 3771 } 3772 3773 public static enum ColorClassificationResolution { 3774 CLASSIFIER_LOW_RESOLUTION(0), // Low resolution version of the color 3775 // classifier. 3776 CLASSIFIER_MEDIUM_RESOLUTION(1), // Medium resolution version of the color 3777 // classifier. 3778 CLASSIFIER_HIGH_RESOLUTION(2), // High resolution version of the color 3779 // classifier. 3780 ; 3781 private final int value; 3782 3783 private ColorClassificationResolution(int value) { 3784 this.value = value; 3785 } 3786 3787 public static ColorClassificationResolution fromValue(int val) { 3788 try { 3789 return values()[val]; 3790 } catch (ArrayIndexOutOfBoundsException e) { 3791 return null; 3792 } 3793 } 3794 3795 public int getValue() { 3796 return value; 3797 } 3798 } 3799 3800 public static enum ConnectionConstraintType { 3801 DISTANCE_CONSTRAINT(0), // Specifies the distance, in pixels, within which 3802 // the end points of two curves must lie in order to 3803 // be considered part of a contour. 3804 ANGLE_CONSTRAINT(1), // Specifies the range, in degrees, within which the 3805 // difference between the angle of two curves, measured 3806 // at the end points, must lie in order for the two 3807 // curves to be considered part of a contour. 3808 CONNECTIVITY_CONSTRAINT(2), // Specifies the distance, in pixels, within 3809 // which a line extended from the end point of a 3810 // curve must pass the end point of another 3811 // curve in order for the two curves to be 3812 // considered part of a contour. 3813 GRADIENT_CONSTRAINT(3), // Specifies the range, in degrees, within which the 3814 // gradient angles of two curves, measured at the 3815 // end points, must lie in order for the two curves 3816 // to be considered part of a contour. 3817 NUM_CONNECTION_CONSTRAINT_TYPES(4), // . 3818 ; 3819 private final int value; 3820 3821 private ConnectionConstraintType(int value) { 3822 this.value = value; 3823 } 3824 3825 public static ConnectionConstraintType fromValue(int val) { 3826 try { 3827 return values()[val]; 3828 } catch (ArrayIndexOutOfBoundsException e) { 3829 return null; 3830 } 3831 } 3832 3833 public int getValue() { 3834 return value; 3835 } 3836 } 3837 3838 public static enum Barcode2DContrast { 3839 ALL_BARCODE_2D_CONTRASTS(0), // The function searches for barcodes of each 3840 // contrast type. 3841 BLACK_ON_WHITE_BARCODE_2D(1), // The function searches for 2D barcodes 3842 // containing black data on a white 3843 // background. 3844 WHITE_ON_BLACK_BARCODE_2D(2), // The function searches for 2D barcodes 3845 // containing white data on a black 3846 // background. 3847 ; 3848 private final int value; 3849 3850 private Barcode2DContrast(int value) { 3851 this.value = value; 3852 } 3853 3854 public static Barcode2DContrast fromValue(int val) { 3855 try { 3856 return values()[val]; 3857 } catch (ArrayIndexOutOfBoundsException e) { 3858 return null; 3859 } 3860 } 3861 3862 public int getValue() { 3863 return value; 3864 } 3865 } 3866 3867 public static enum QRModelType { 3868 QR_MODELTYPE_AUTO_DETECT(0), // Specifies that the function will auto-detect 3869 // the type of QR code. 3870 QR_MODELTYPE_MICRO(1), // Specifies the QR code is of a micro type. 3871 QR_MODELTYPE_MODEL1(2), // Specifies the QR code is of a model1 type. 3872 QR_MODELTYPE_MODEL2(3), // Specifies the QR code is of a model2 type. 3873 ; 3874 private final int value; 3875 3876 private QRModelType(int value) { 3877 this.value = value; 3878 } 3879 3880 public static QRModelType fromValue(int val) { 3881 try { 3882 return values()[val]; 3883 } catch (ArrayIndexOutOfBoundsException e) { 3884 return null; 3885 } 3886 } 3887 3888 public int getValue() { 3889 return value; 3890 } 3891 } 3892 3893 public static enum WindowBackgroundFillStyle { 3894 FILL_STYLE_SOLID(0), // Fill the display window with a solid color. 3895 FILL_STYLE_HATCH(2), // Fill the display window with a pattern defined by 3896 // WindowBackgroundHatchStyle. 3897 FILL_STYLE_DEFAULT(3), // Fill the display window with the NI Vision default 3898 // pattern. 3899 ; 3900 private final int value; 3901 3902 private WindowBackgroundFillStyle(int value) { 3903 this.value = value; 3904 } 3905 3906 public static WindowBackgroundFillStyle fromValue(int val) { 3907 for (WindowBackgroundFillStyle v : values()) { 3908 if (v.value == val) 3909 return v; 3910 } 3911 return null; 3912 } 3913 3914 public int getValue() { 3915 return value; 3916 } 3917 } 3918 3919 public static enum ExtractionMode { 3920 NORMAL_IMAGE(0), // Specifies that the function makes no assumptions about 3921 // the uniformity of objects in the image or the image 3922 // background. 3923 UNIFORM_REGIONS(1), // Specifies that the function assumes that either the 3924 // objects in the image or the image background consists 3925 // of uniform pixel values. 3926 ; 3927 private final int value; 3928 3929 private ExtractionMode(int value) { 3930 this.value = value; 3931 } 3932 3933 public static ExtractionMode fromValue(int val) { 3934 try { 3935 return values()[val]; 3936 } catch (ArrayIndexOutOfBoundsException e) { 3937 return null; 3938 } 3939 } 3940 3941 public int getValue() { 3942 return value; 3943 } 3944 } 3945 3946 public static enum EdgeFilterSize { 3947 FINE(0), // Specifies that the function uses a fine (narrow) edge filter. 3948 NORMAL(1), // Specifies that the function uses a normal edge filter. 3949 CONTOUR_TRACING(2), // Sets the Edge Filter Size to contour tracing, which 3950 // provides the best results for contour extraction but 3951 // increases the time required to process the image. 3952 ; 3953 private final int value; 3954 3955 private EdgeFilterSize(int value) { 3956 this.value = value; 3957 } 3958 3959 public static EdgeFilterSize fromValue(int val) { 3960 try { 3961 return values()[val]; 3962 } catch (ArrayIndexOutOfBoundsException e) { 3963 return null; 3964 } 3965 } 3966 3967 public int getValue() { 3968 return value; 3969 } 3970 } 3971 3972 public static enum Barcode2DSearchMode { 3973 SEARCH_MULTIPLE(0), // The function searches for multiple 2D barcodes. 3974 SEARCH_SINGLE_CONSERVATIVE(1), // The function searches for 2D barcodes 3975 // using the same searching algorithm as 3976 // IMAQ_SEARCH_MULTIPLE but stops searching 3977 // after locating one valid barcode. 3978 SEARCH_SINGLE_AGGRESSIVE(2), // The function searches for a single 2D 3979 // barcode using a method that assumes the 3980 // barcode occupies a majority of the search 3981 // region. 3982 ; 3983 private final int value; 3984 3985 private Barcode2DSearchMode(int value) { 3986 this.value = value; 3987 } 3988 3989 public static Barcode2DSearchMode fromValue(int val) { 3990 try { 3991 return values()[val]; 3992 } catch (ArrayIndexOutOfBoundsException e) { 3993 return null; 3994 } 3995 } 3996 3997 public int getValue() { 3998 return value; 3999 } 4000 } 4001 4002 public static enum DataMatrixSubtype { 4003 ALL_DATA_MATRIX_SUBTYPES(0), // The function searches for Data Matrix 4004 // barcodes of all subtypes. 4005 DATA_MATRIX_SUBTYPES_ECC_000_ECC_140(1), // The function searches for Data 4006 // Matrix barcodes of subtypes ECC 4007 // 000, ECC 050, ECC 080, ECC 100 4008 // and ECC 140. 4009 DATA_MATRIX_SUBTYPE_ECC_200(2), // The function searches for Data Matrix ECC 4010 // 200 barcodes. 4011 ; 4012 private final int value; 4013 4014 private DataMatrixSubtype(int value) { 4015 this.value = value; 4016 } 4017 4018 public static DataMatrixSubtype fromValue(int val) { 4019 try { 4020 return values()[val]; 4021 } catch (ArrayIndexOutOfBoundsException e) { 4022 return null; 4023 } 4024 } 4025 4026 public int getValue() { 4027 return value; 4028 } 4029 } 4030 4031 public static enum FeatureType { 4032 NOT_FOUND_FEATURE(0), // Specifies the feature is not found. 4033 CIRCLE_FEATURE(1), // Specifies the feature is a circle. 4034 ELLIPSE_FEATURE(2), // Specifies the feature is an ellipse. 4035 CONST_CURVE_FEATURE(3), // Specifies the features is a constant curve. 4036 RECTANGLE_FEATURE(4), // Specifies the feature is a rectangle. 4037 LEG_FEATURE(5), // Specifies the feature is a leg. 4038 CORNER_FEATURE(6), // Specifies the feature is a corner. 4039 PARALLEL_LINE_PAIR_FEATURE(7), // Specifies the feature is a parallel line 4040 // pair. 4041 PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE(8), // Specifies the feature is a pair 4042 // of parallel line pairs. 4043 LINE_FEATURE(9), // Specifies the feature is a line. 4044 CLOSED_CURVE_FEATURE(10), // Specifies the feature is a closed curve. 4045 ; 4046 private final int value; 4047 4048 private FeatureType(int value) { 4049 this.value = value; 4050 } 4051 4052 public static FeatureType fromValue(int val) { 4053 try { 4054 return values()[val]; 4055 } catch (ArrayIndexOutOfBoundsException e) { 4056 return null; 4057 } 4058 } 4059 4060 public int getValue() { 4061 return value; 4062 } 4063 } 4064 4065 public static enum Barcode2DCellShape { 4066 SQUARE_CELLS(0), // The function uses an algorithm for decoding the 2D 4067 // barcode that works with square data cells. 4068 ROUND_CELLS(1), // The function uses an algorithm for decoding the 2D 4069 // barcode that works with round data cells. 4070 ; 4071 private final int value; 4072 4073 private Barcode2DCellShape(int value) { 4074 this.value = value; 4075 } 4076 4077 public static Barcode2DCellShape fromValue(int val) { 4078 try { 4079 return values()[val]; 4080 } catch (ArrayIndexOutOfBoundsException e) { 4081 return null; 4082 } 4083 } 4084 4085 public int getValue() { 4086 return value; 4087 } 4088 } 4089 4090 public static enum LocalThresholdMethod { 4091 NIBLACK(0), // The function computes thresholds for each pixel based on its 4092 // local statistics using the Niblack local thresholding 4093 // algorithm. 4094 BACKGROUND_CORRECTION(1), // The function performs background correction 4095 // first to eliminate non-uniform lighting 4096 // effects, then performs thresholding using the 4097 // Otsu thresholding algorithm. 4098 ; 4099 private final int value; 4100 4101 private LocalThresholdMethod(int value) { 4102 this.value = value; 4103 } 4104 4105 public static LocalThresholdMethod fromValue(int val) { 4106 try { 4107 return values()[val]; 4108 } catch (ArrayIndexOutOfBoundsException e) { 4109 return null; 4110 } 4111 } 4112 4113 public int getValue() { 4114 return value; 4115 } 4116 } 4117 4118 public static enum Barcode2DType { 4119 PDF417(0), // The 2D barcode is of type PDF417. 4120 DATA_MATRIX_ECC_000(1), // The 2D barcode is of type Data Matrix ECC 000. 4121 DATA_MATRIX_ECC_050(2), // The 2D barcode is of type Data Matrix ECC 050. 4122 DATA_MATRIX_ECC_080(3), // The 2D barcode is of type Data Matrix ECC 080. 4123 DATA_MATRIX_ECC_100(4), // The 2D barcode is of type Data Matrix ECC 100. 4124 DATA_MATRIX_ECC_140(5), // The 2D barcode is of type Data Matrix ECC 140. 4125 DATA_MATRIX_ECC_200(6), // The 2D barcode is of type Data Matrix ECC 200. 4126 ; 4127 private final int value; 4128 4129 private Barcode2DType(int value) { 4130 this.value = value; 4131 } 4132 4133 public static Barcode2DType fromValue(int val) { 4134 try { 4135 return values()[val]; 4136 } catch (ArrayIndexOutOfBoundsException e) { 4137 return null; 4138 } 4139 } 4140 4141 public int getValue() { 4142 return value; 4143 } 4144 } 4145 4146 public static enum ClassifierEngineType { 4147 ENGINE_NONE(0), // No engine has been set on this classifier session. 4148 ENGINE_NEAREST_NEIGHBOR(1), // Nearest neighbor engine. 4149 ENGINE_SUPPORT_VECTOR_MACHINE(2), ; 4150 private final int value; 4151 4152 private ClassifierEngineType(int value) { 4153 this.value = value; 4154 } 4155 4156 public static ClassifierEngineType fromValue(int val) { 4157 try { 4158 return values()[val]; 4159 } catch (ArrayIndexOutOfBoundsException e) { 4160 return null; 4161 } 4162 } 4163 4164 public int getValue() { 4165 return value; 4166 } 4167 } 4168 4169 public static enum ClassifierType { 4170 CLASSIFIER_CUSTOM(0), // The classifier session classifies vectors of 4171 // doubles. 4172 CLASSIFIER_PARTICLE(1), // The classifier session classifies particles in 4173 // binary images. 4174 CLASSIFIER_COLOR(2), // The classifier session classifies an image based on 4175 // its color. 4176 CLASSIFIER_TEXTURE(3), // The classifier session classifies an image based 4177 // on its texture. 4178 ; 4179 private final int value; 4180 4181 private ClassifierType(int value) { 4182 this.value = value; 4183 } 4184 4185 public static ClassifierType fromValue(int val) { 4186 try { 4187 return values()[val]; 4188 } catch (ArrayIndexOutOfBoundsException e) { 4189 return null; 4190 } 4191 } 4192 4193 public int getValue() { 4194 return value; 4195 } 4196 } 4197 4198 public static enum ParticleType { 4199 PARTICLE_BRIGHT(0), // Bright particles. 4200 PARTICLE_DARK(1), // Dark particles. 4201 ; 4202 private final int value; 4203 4204 private ParticleType(int value) { 4205 this.value = value; 4206 } 4207 4208 public static ParticleType fromValue(int val) { 4209 try { 4210 return values()[val]; 4211 } catch (ArrayIndexOutOfBoundsException e) { 4212 return null; 4213 } 4214 } 4215 4216 public int getValue() { 4217 return value; 4218 } 4219 } 4220 4221 public static enum VisionInfoType2 { 4222 VISIONINFO_CALIBRATION(0x01), // Used to indicate interaction with the 4223 // Calibration information in an image. 4224 VISIONINFO_OVERLAY(0x02), // Used to indicate interaction with the Overlay 4225 // information in an image. 4226 VISIONINFO_GRAYTEMPLATE(0x04), // Used to indicate interaction with the 4227 // grayscale template information in an 4228 // image. 4229 VISIONINFO_COLORTEMPLATE(0x08), // Used to indicate interaction with the 4230 // color template information in an image. 4231 VISIONINFO_GEOMETRICTEMPLATE(0x10), // Used to indicate interaction with the 4232 // geometric template information in an 4233 // image. 4234 VISIONINFO_CUSTOMDATA(0x20), // Used to indicate interaction with the binary 4235 // or text Custom Data in an image. 4236 VISIONINFO_GOLDENTEMPLATE(0x40), // Used to indicate interaction with the 4237 // golden template information in an image. 4238 VISIONINFO_GEOMETRICTEMPLATE2(0x80), // Used to indicate interaction with 4239 // the geometric template 2 information 4240 // in an image. 4241 VISIONINFO_ALL(0xFFFFFFFF), // Removes, checks for, or indicates the 4242 // presence of all types of extra information in 4243 // an image. 4244 ; 4245 private final int value; 4246 4247 private VisionInfoType2(int value) { 4248 this.value = value; 4249 } 4250 4251 public static VisionInfoType2 fromValue(int val) { 4252 for (VisionInfoType2 v : values()) { 4253 if (v.value == val) 4254 return v; 4255 } 4256 return null; 4257 } 4258 4259 public int getValue() { 4260 return value; 4261 } 4262 } 4263 4264 public static enum ReadClassifierFileMode { 4265 CLASSIFIER_READ_ALL(0), // Read all information from the classifier file. 4266 CLASSIFIER_READ_SAMPLES(1), // Read only the samples from the classifier 4267 // file. 4268 CLASSIFIER_READ_PROPERTIES(2), // Read only the properties from the 4269 // classifier file. 4270 ; 4271 private final int value; 4272 4273 private ReadClassifierFileMode(int value) { 4274 this.value = value; 4275 } 4276 4277 public static ReadClassifierFileMode fromValue(int val) { 4278 try { 4279 return values()[val]; 4280 } catch (ArrayIndexOutOfBoundsException e) { 4281 return null; 4282 } 4283 } 4284 4285 public int getValue() { 4286 return value; 4287 } 4288 } 4289 4290 public static enum WriteClassifierFileMode { 4291 CLASSIFIER_WRITE_ALL(0), // Writes all information to the classifier file. 4292 CLASSIFIER_WRITE_CLASSIFY_ONLY(1), // Write only the information needed to 4293 // classify to the classifier file. 4294 ; 4295 private final int value; 4296 4297 private WriteClassifierFileMode(int value) { 4298 this.value = value; 4299 } 4300 4301 public static WriteClassifierFileMode fromValue(int val) { 4302 try { 4303 return values()[val]; 4304 } catch (ArrayIndexOutOfBoundsException e) { 4305 return null; 4306 } 4307 } 4308 4309 public int getValue() { 4310 return value; 4311 } 4312 } 4313 4314 public static enum Barcode2DShape { 4315 SQUARE_BARCODE_2D(0), // The function searches for square 2D barcodes. 4316 RECTANGULAR_BARCODE_2D(1), // The function searches for rectangular 2D 4317 // barcodes. 4318 ; 4319 private final int value; 4320 4321 private Barcode2DShape(int value) { 4322 this.value = value; 4323 } 4324 4325 public static Barcode2DShape fromValue(int val) { 4326 try { 4327 return values()[val]; 4328 } catch (ArrayIndexOutOfBoundsException e) { 4329 return null; 4330 } 4331 } 4332 4333 public int getValue() { 4334 return value; 4335 } 4336 } 4337 4338 public static enum DataMatrixRotationMode { 4339 UNLIMITED_ROTATION(0), // The function allows for unlimited rotation. 4340 C0_DEGREES(1), // The function allows for between -5 and 5 degrees of 4341 // rotation. 4342 C90_DEGREES(2), // The function allows for between 85 and 95 degrees of 4343 // rotation. 4344 C180_DEGREES(3), // The function allows for between 175 and 185 degrees of 4345 // rotation. 4346 C270_DEGREES(4), // The function allows for between 265 and 275 degrees of 4347 // rotation. 4348 ; 4349 private final int value; 4350 4351 private DataMatrixRotationMode(int value) { 4352 this.value = value; 4353 } 4354 4355 public static DataMatrixRotationMode fromValue(int val) { 4356 try { 4357 return values()[val]; 4358 } catch (ArrayIndexOutOfBoundsException e) { 4359 return null; 4360 } 4361 } 4362 4363 public int getValue() { 4364 return value; 4365 } 4366 } 4367 4368 public static enum AIMGrade { 4369 AIM_GRADE_F(0), // The Data Matrix barcode received a grade of F. 4370 AIM_GRADE_D(1), // The Data Matrix barcode received a grade of D. 4371 AIM_GRADE_C(2), // The Data Matrix barcode received a grade of C. 4372 AIM_GRADE_B(3), // The Data Matrix barcode received a grade of B. 4373 AIM_GRADE_A(4), // The Data Matrix barcode received a grade of A. 4374 ; 4375 private final int value; 4376 4377 private AIMGrade(int value) { 4378 this.value = value; 4379 } 4380 4381 public static AIMGrade fromValue(int val) { 4382 try { 4383 return values()[val]; 4384 } catch (ArrayIndexOutOfBoundsException e) { 4385 return null; 4386 } 4387 } 4388 4389 public int getValue() { 4390 return value; 4391 } 4392 } 4393 4394 public static enum DataMatrixCellFillMode { 4395 AUTO_DETECT_CELL_FILL_MODE(-2), // Sets the function to determine the Data 4396 // Matrix barcode cell fill percentage 4397 // automatically. 4398 LOW_FILL(0), // Sets the function to read Data Matrix barcodes with a cell 4399 // fill percentage of less than 30 percent. 4400 NORMAL_FILL(1), // Sets the function to read Data Matrix barcodes with a 4401 // cell fill percentage greater than or equal to 30 percent. 4402 ; 4403 private final int value; 4404 4405 private DataMatrixCellFillMode(int value) { 4406 this.value = value; 4407 } 4408 4409 public static DataMatrixCellFillMode fromValue(int val) { 4410 for (DataMatrixCellFillMode v : values()) { 4411 if (v.value == val) 4412 return v; 4413 } 4414 return null; 4415 } 4416 4417 public int getValue() { 4418 return value; 4419 } 4420 } 4421 4422 public static enum DataMatrixDemodulationMode { 4423 AUTO_DETECT_DEMODULATION_MODE(-2), // The function will try each 4424 // demodulation mode and use the one 4425 // which decodes the Data Matrix barcode 4426 // within the fewest iterations and 4427 // utilizing the least amount of error 4428 // correction. 4429 HISTOGRAM(0), // The function uses a histogram of all of the Data Matrix 4430 // cells to calculate a threshold. 4431 LOCAL_CONTRAST(1), // The function examines each of the cell's neighbors to 4432 // determine if the cell is on or off. 4433 COMBINED(2), // The function uses the histogram of the Data Matrix barcode 4434 // to calculate a threshold. 4435 ALL_DEMODULATION_MODES(3), // The function tries IMAQ_HISTOGRAM, then 4436 // IMAQ_LOCAL_CONTRAST and then IMAQ_COMBINATION, 4437 // stopping once one mode is successful. 4438 ; 4439 private final int value; 4440 4441 private DataMatrixDemodulationMode(int value) { 4442 this.value = value; 4443 } 4444 4445 public static DataMatrixDemodulationMode fromValue(int val) { 4446 for (DataMatrixDemodulationMode v : values()) { 4447 if (v.value == val) 4448 return v; 4449 } 4450 return null; 4451 } 4452 4453 public int getValue() { 4454 return value; 4455 } 4456 } 4457 4458 public static enum DataMatrixECC { 4459 AUTO_DETECT_ECC(-2), // Sets the function to determine the Data Matrix 4460 // barcode ECC automatically. 4461 ECC_000(0), // Sets the function to read Data Matrix barcodes of ECC 000 4462 // only. 4463 ECC_050(50), // Sets the function to read Data Matrix barcodes of ECC 050 4464 // only. 4465 ECC_080(80), // Sets the function to read Data Matrix barcodes of ECC 080 4466 // only. 4467 ECC_100(100), // Sets the function to read Data Matrix barcodes of ECC 100 4468 // only. 4469 ECC_140(140), // Sets the function to read Data Matrix barcodes of ECC 140 4470 // only. 4471 ECC_000_140(190), // Sets the function to read Data Matrix barcodes of ECC 4472 // 000, ECC 050, ECC 080, ECC 100, and ECC 140 only. 4473 ECC_200(200), // Sets the function to read Data Matrix barcodes of ECC 200 4474 // only. 4475 ; 4476 private final int value; 4477 4478 private DataMatrixECC(int value) { 4479 this.value = value; 4480 } 4481 4482 public static DataMatrixECC fromValue(int val) { 4483 for (DataMatrixECC v : values()) { 4484 if (v.value == val) 4485 return v; 4486 } 4487 return null; 4488 } 4489 4490 public int getValue() { 4491 return value; 4492 } 4493 } 4494 4495 public static enum DataMatrixPolarity { 4496 AUTO_DETECT_POLARITY(-2), // Sets the function to determine the Data Matrix 4497 // barcode polarity automatically. 4498 BLACK_DATA_ON_WHITE_BACKGROUND(0), // Sets the function to read Data Matrix 4499 // barcodes with dark data on a bright 4500 // background. 4501 WHITE_DATA_ON_BLACK_BACKGROUND(1), // Sets the function to read Data Matrix 4502 // barcodes with bright data on a dark 4503 // background. 4504 ; 4505 private final int value; 4506 4507 private DataMatrixPolarity(int value) { 4508 this.value = value; 4509 } 4510 4511 public static DataMatrixPolarity fromValue(int val) { 4512 for (DataMatrixPolarity v : values()) { 4513 if (v.value == val) 4514 return v; 4515 } 4516 return null; 4517 } 4518 4519 public int getValue() { 4520 return value; 4521 } 4522 } 4523 4524 public static enum DataMatrixCellFilterMode { 4525 AUTO_DETECT_CELL_FILTER_MODE(-2), // The function will try all filter modes 4526 // and uses the one that decodes the Data 4527 // Matrix barcode within the fewest 4528 // iterations and utilizing the least 4529 // amount of error correction. 4530 AVERAGE_FILTER(0), // The function sets the pixel value for the cell to the 4531 // average of the sampled pixels. 4532 MEDIAN_FILTER(1), // The function sets the pixel value for the cell to the 4533 // median of the sampled pixels. 4534 CENTRAL_AVERAGE_FILTER(2), // The function sets the pixel value for the cell 4535 // to the average of the pixels in the center of 4536 // the cell sample. 4537 HIGH_AVERAGE_FILTER(3), // The function sets the pixel value for the cell to 4538 // the average value of the half of the sampled 4539 // pixels with the highest pixel values. 4540 LOW_AVERAGE_FILTER(4), // The function sets the pixel value for the cell to 4541 // the average value of the half of the sampled 4542 // pixels with the lowest pixel values. 4543 VERY_HIGH_AVERAGE_FILTER(5), // The function sets the pixel value for the 4544 // cell to the average value of the ninth of 4545 // the sampled pixels with the highest pixel 4546 // values. 4547 VERY_LOW_AVERAGE_FILTER(6), // The function sets the pixel value for the 4548 // cell to the average value of the ninth of the 4549 // sampled pixels with the lowest pixel values. 4550 ALL_CELL_FILTERS(8), // The function tries each filter mode, starting with 4551 // IMAQ_AVERAGE_FILTER and ending with 4552 // IMAQ_VERY_LOW_AVERAGE_FILTER, stopping once a filter 4553 // mode decodes correctly. 4554 ; 4555 private final int value; 4556 4557 private DataMatrixCellFilterMode(int value) { 4558 this.value = value; 4559 } 4560 4561 public static DataMatrixCellFilterMode fromValue(int val) { 4562 for (DataMatrixCellFilterMode v : values()) { 4563 if (v.value == val) 4564 return v; 4565 } 4566 return null; 4567 } 4568 4569 public int getValue() { 4570 return value; 4571 } 4572 } 4573 4574 public static enum WindowBackgroundHatchStyle { 4575 HATCH_STYLE_HORIZONTAL(0), // The background of the display window will be 4576 // horizontal bars. 4577 HATCH_STYLE_VERTICAL(1), // The background of the display window will be 4578 // vertical bars. 4579 HATCH_STYLE_FORWARD_DIAGONAL(2), // The background of the display window 4580 // will be diagonal bars. 4581 HATCH_STYLE_BACKWARD_DIAGONAL(3), // The background of the display window 4582 // will be diagonal bars. 4583 HATCH_STYLE_CROSS(4), // The background of the display window will be 4584 // intersecting horizontal and vertical bars. 4585 HATCH_STYLE_CROSS_HATCH(5), // The background of the display window will be 4586 // intersecting forward and backward diagonal 4587 // bars. 4588 ; 4589 private final int value; 4590 4591 private WindowBackgroundHatchStyle(int value) { 4592 this.value = value; 4593 } 4594 4595 public static WindowBackgroundHatchStyle fromValue(int val) { 4596 try { 4597 return values()[val]; 4598 } catch (ArrayIndexOutOfBoundsException e) { 4599 return null; 4600 } 4601 } 4602 4603 public int getValue() { 4604 return value; 4605 } 4606 } 4607 4608 public static enum DataMatrixMirrorMode { 4609 AUTO_DETECT_MIRROR(-2), // Specifies that the function should determine if 4610 // the Data Matrix barcode is mirrored. 4611 APPEARS_NORMAL(0), // Specifies that the function should expect the Data 4612 // Matrix barcode to appear normal. 4613 APPEARS_MIRRORED(1), // Specifies that the function should expect the Data 4614 // Matrix barcode to appear mirrored. 4615 ; 4616 private final int value; 4617 4618 private DataMatrixMirrorMode(int value) { 4619 this.value = value; 4620 } 4621 4622 public static DataMatrixMirrorMode fromValue(int val) { 4623 for (DataMatrixMirrorMode v : values()) { 4624 if (v.value == val) 4625 return v; 4626 } 4627 return null; 4628 } 4629 4630 public int getValue() { 4631 return value; 4632 } 4633 } 4634 4635 public static enum CalibrationMode2 { 4636 PERSPECTIVE_MODE(0), // Functions correct for distortion caused by the 4637 // camera's perspective. 4638 MICROPLANE_MODE(1), // Functions correct for distortion caused by the 4639 // camera's lens. 4640 SIMPLE_CALIBRATION_MODE(2), // Functions do not correct for distortion. 4641 CORRECTED_IMAGE_MODE(3), // The image is already corrected. 4642 NO_CALIBRATION_MODE(4), // Image with No calibration. 4643 ; 4644 private final int value; 4645 4646 private CalibrationMode2(int value) { 4647 this.value = value; 4648 } 4649 4650 public static CalibrationMode2 fromValue(int val) { 4651 try { 4652 return values()[val]; 4653 } catch (ArrayIndexOutOfBoundsException e) { 4654 return null; 4655 } 4656 } 4657 4658 public int getValue() { 4659 return value; 4660 } 4661 } 4662 4663 public static enum DataMatrixGradingMode { 4664 NO_GRADING(0), // The function does not make any preparatory calculations. 4665 PREPARE_FOR_AIM(1), // The function prepares the image for grading using the 4666 // AIM Print Quality metrics. 4667 ; 4668 private final int value; 4669 4670 private DataMatrixGradingMode(int value) { 4671 this.value = value; 4672 } 4673 4674 public static DataMatrixGradingMode fromValue(int val) { 4675 try { 4676 return values()[val]; 4677 } catch (ArrayIndexOutOfBoundsException e) { 4678 return null; 4679 } 4680 } 4681 4682 public int getValue() { 4683 return value; 4684 } 4685 } 4686 4687 public static enum WaveletTransformMode { 4688 WAVELET_TRANSFORM_INTEGER(0), // Uses a 5-3 reversible integer transform. 4689 WAVELET_TRANSFORM_FLOATING_POINT(1), // Performs a 9-7 irreversible 4690 // floating-point transform. 4691 ; 4692 private final int value; 4693 4694 private WaveletTransformMode(int value) { 4695 this.value = value; 4696 } 4697 4698 public static WaveletTransformMode fromValue(int val) { 4699 try { 4700 return values()[val]; 4701 } catch (ArrayIndexOutOfBoundsException e) { 4702 return null; 4703 } 4704 } 4705 4706 public int getValue() { 4707 return value; 4708 } 4709 } 4710 4711 public static enum NormalizationMethod { 4712 NORMALIZATION_NONE(0), // No normalization. 4713 NORMALIZATION_HISTOGRAM_MATCHING(1), // Adjust image so its histogram is 4714 // similar to the golden template's 4715 // histogram. 4716 NORMALIZATION_AVERAGE_MATCHING(2), // Adjust image so its mean pixel value 4717 // equals the golden template's mean 4718 // pixel value. 4719 ; 4720 private final int value; 4721 4722 private NormalizationMethod(int value) { 4723 this.value = value; 4724 } 4725 4726 public static NormalizationMethod fromValue(int val) { 4727 try { 4728 return values()[val]; 4729 } catch (ArrayIndexOutOfBoundsException e) { 4730 return null; 4731 } 4732 } 4733 4734 public int getValue() { 4735 return value; 4736 } 4737 } 4738 4739 public static enum RegistrationMethod { 4740 REGISTRATION_NONE(0), // No registration. 4741 REGISTRATION_PERSPECTIVE(1), // Adjust image to correct for minor variations 4742 // in alignment or perspective. 4743 ; 4744 private final int value; 4745 4746 private RegistrationMethod(int value) { 4747 this.value = value; 4748 } 4749 4750 public static RegistrationMethod fromValue(int val) { 4751 try { 4752 return values()[val]; 4753 } catch (ArrayIndexOutOfBoundsException e) { 4754 return null; 4755 } 4756 } 4757 4758 public int getValue() { 4759 return value; 4760 } 4761 } 4762 4763 public static enum LinearAveragesMode { 4764 COLUMN_AVERAGES(1), // Specifies that the function calculates the mean pixel 4765 // value of each column. 4766 ROW_AVERAGES(2), // Specifies that the function calculates the mean pixel 4767 // value of each row. 4768 RISING_DIAGONAL_AVERAGES(4), // Specifies that the function calculates the 4769 // mean pixel value of each diagonal running 4770 // from the lower left to the upper right of 4771 // the inspected area of the image. 4772 FALLING_DIAGONAL_AVERAGES(8), // Specifies that the function calculates the 4773 // mean pixel value of each diagonal running 4774 // from the upper left to the lower right of 4775 // the inspected area of the image. 4776 ALL_LINEAR_AVERAGES(15), // Specifies that the function calculates all four 4777 // linear mean pixel values. 4778 ; 4779 private final int value; 4780 4781 private LinearAveragesMode(int value) { 4782 this.value = value; 4783 } 4784 4785 public static LinearAveragesMode fromValue(int val) { 4786 for (LinearAveragesMode v : values()) { 4787 if (v.value == val) 4788 return v; 4789 } 4790 return null; 4791 } 4792 4793 public int getValue() { 4794 return value; 4795 } 4796 } 4797 4798 public static enum CompressionType { 4799 COMPRESSION_NONE(0), // Specifies that the function should not compress the 4800 // image. 4801 COMPRESSION_JPEG(1), // Specifies that the function should use lossy JPEG 4802 // compression on the image. 4803 COMPRESSION_PACKED_BINARY(2), // Specifies that the function should use 4804 // lossless binary packing on the image. 4805 ; 4806 private final int value; 4807 4808 private CompressionType(int value) { 4809 this.value = value; 4810 } 4811 4812 public static CompressionType fromValue(int val) { 4813 try { 4814 return values()[val]; 4815 } catch (ArrayIndexOutOfBoundsException e) { 4816 return null; 4817 } 4818 } 4819 4820 public int getValue() { 4821 return value; 4822 } 4823 } 4824 4825 public static enum FlattenType { 4826 FLATTEN_IMAGE(0), // Flattens just the image data. 4827 FLATTEN_IMAGE_AND_VISION_INFO(1), // Flattens the image data and any Vision 4828 // information associated with the image. 4829 ; 4830 private final int value; 4831 4832 private FlattenType(int value) { 4833 this.value = value; 4834 } 4835 4836 public static FlattenType fromValue(int val) { 4837 try { 4838 return values()[val]; 4839 } catch (ArrayIndexOutOfBoundsException e) { 4840 return null; 4841 } 4842 } 4843 4844 public int getValue() { 4845 return value; 4846 } 4847 } 4848 4849 public static enum DataMatrixCellSampleSize { 4850 AUTO_DETECT_CELL_SAMPLE_SIZE(-2), // The function will try each sample size 4851 // and use the one which decodes the Data 4852 // Matrix barcode within the fewest 4853 // iterations and utilizing the least 4854 // amount of error correction. 4855 C1x1(1), // The function will use a 1x1 sized sample from each cell. 4856 C2x2(2), // The function will use a 2x2 sized sample from each cell. 4857 C3x3(3), // The function will use a 3x3 sized sample from each cell. 4858 C4x4(4), // The function will use a 4x4 sized sample from each cell. 4859 C5x5(5), // The function will use a 5x5 sized sample from each cell. 4860 C6x6(6), // The function will use a 6x6 sized sample from each cell. 4861 C7x7(7), // The function will use a 7x7 sized sample from each cell. 4862 ; 4863 private final int value; 4864 4865 private DataMatrixCellSampleSize(int value) { 4866 this.value = value; 4867 } 4868 4869 public static DataMatrixCellSampleSize fromValue(int val) { 4870 for (DataMatrixCellSampleSize v : values()) { 4871 if (v.value == val) 4872 return v; 4873 } 4874 return null; 4875 } 4876 4877 public int getValue() { 4878 return value; 4879 } 4880 } 4881 4882 /** 4883 * Forward Declare Data Structures 4884 */ 4885 4886 /** 4887 * Data Structures 4888 */ 4889 4890 public static class DivisionModel extends DisposedStruct { 4891 public float kappa; // The learned kappa coefficient of division model. 4892 4893 private void init() { 4894 4895 } 4896 4897 public DivisionModel() { 4898 super(4); 4899 init(); 4900 } 4901 4902 public DivisionModel(double kappa) { 4903 super(4); 4904 this.kappa = (float) kappa; 4905 } 4906 4907 protected DivisionModel(ByteBuffer backing, int offset) { 4908 super(backing, offset, 4); 4909 init(); 4910 } 4911 4912 protected DivisionModel(long nativeObj, boolean owned) { 4913 super(nativeObj, owned, 4); 4914 init(); 4915 } 4916 4917 protected void setBuffer(ByteBuffer backing, int offset) { 4918 super.setBuffer(backing, offset, 4); 4919 } 4920 4921 public void read() { 4922 kappa = backing.getFloat(0); 4923 } 4924 4925 public void write() { 4926 backing.putFloat(0, kappa); 4927 } 4928 4929 public int size() { 4930 return 4; 4931 } 4932 } 4933 4934 public static class FocalLength extends DisposedStruct { 4935 public float fx; // Focal length in X direction. 4936 public float fy; // Focal length in Y direction. 4937 4938 private void init() { 4939 4940 } 4941 4942 public FocalLength() { 4943 super(8); 4944 init(); 4945 } 4946 4947 public FocalLength(double fx, double fy) { 4948 super(8); 4949 this.fx = (float) fx; 4950 this.fy = (float) fy; 4951 } 4952 4953 protected FocalLength(ByteBuffer backing, int offset) { 4954 super(backing, offset, 8); 4955 init(); 4956 } 4957 4958 protected FocalLength(long nativeObj, boolean owned) { 4959 super(nativeObj, owned, 8); 4960 init(); 4961 } 4962 4963 protected void setBuffer(ByteBuffer backing, int offset) { 4964 super.setBuffer(backing, offset, 8); 4965 } 4966 4967 public void read() { 4968 fx = backing.getFloat(0); 4969 fy = backing.getFloat(4); 4970 } 4971 4972 public void write() { 4973 backing.putFloat(0, fx); 4974 backing.putFloat(4, fy); 4975 } 4976 4977 public int size() { 4978 return 8; 4979 } 4980 } 4981 4982 public static class PolyModel extends DisposedStruct { 4983 public float[] kCoeffs; // The learned radial coefficients of polynomial 4984 // model. 4985 public float p1; // The P1(learned tangential coefficients of polynomial 4986 // model). 4987 public float p2; // The P2(learned tangential coefficients of polynomial 4988 // model). 4989 private ByteBuffer kCoeffs_buf; 4990 4991 private void init() { 4992 kCoeffs = new float[0]; 4993 } 4994 4995 public PolyModel() { 4996 super(16); 4997 init(); 4998 } 4999 5000 public PolyModel(float[] kCoeffs, double p1, double p2) { 5001 super(16); 5002 this.kCoeffs = kCoeffs; 5003 this.p1 = (float) p1; 5004 this.p2 = (float) p2; 5005 } 5006 5007 protected PolyModel(ByteBuffer backing, int offset) { 5008 super(backing, offset, 16); 5009 init(); 5010 } 5011 5012 protected PolyModel(long nativeObj, boolean owned) { 5013 super(nativeObj, owned, 16); 5014 init(); 5015 } 5016 5017 protected void setBuffer(ByteBuffer backing, int offset) { 5018 super.setBuffer(backing, offset, 16); 5019 } 5020 5021 public void read() { 5022 int kCoeffs_numKCoeffs = backing.getInt(4); 5023 long kCoeffs_addr = getPointer(backing, 0); 5024 kCoeffs = new float[kCoeffs_numKCoeffs]; 5025 if (kCoeffs_numKCoeffs > 0 && kCoeffs_addr != 0) { 5026 newDirectByteBuffer(kCoeffs_addr, kCoeffs_numKCoeffs * 4).asFloatBuffer().get(kCoeffs); 5027 } 5028 p1 = backing.getFloat(8); 5029 p2 = backing.getFloat(12); 5030 } 5031 5032 public void write() { 5033 kCoeffs_buf = ByteBuffer.allocateDirect(kCoeffs.length * 4).order(ByteOrder.nativeOrder()); 5034 kCoeffs_buf.asFloatBuffer().put(kCoeffs).rewind(); 5035 backing.putInt(4, kCoeffs.length); 5036 putPointer(backing, 0, kCoeffs_buf); 5037 backing.putFloat(8, p1); 5038 backing.putFloat(12, p2); 5039 } 5040 5041 public int size() { 5042 return 16; 5043 } 5044 } 5045 5046 public static class DistortionModelParams extends DisposedStruct { 5047 public DistortionModel distortionModel; // Type of learned distortion model. 5048 public PolyModel polyModel; // The learned coefficients of polynomial model. 5049 public DivisionModel divisionModel; // The learned coefficient of division 5050 // model. 5051 5052 private void init() { 5053 polyModel = new PolyModel(backing, 4); 5054 divisionModel = new DivisionModel(backing, 20); 5055 } 5056 5057 public DistortionModelParams() { 5058 super(24); 5059 init(); 5060 } 5061 5062 public DistortionModelParams(DistortionModel distortionModel, PolyModel polyModel, 5063 DivisionModel divisionModel) { 5064 super(24); 5065 this.distortionModel = distortionModel; 5066 this.polyModel = polyModel; 5067 this.divisionModel = divisionModel; 5068 } 5069 5070 protected DistortionModelParams(ByteBuffer backing, int offset) { 5071 super(backing, offset, 24); 5072 init(); 5073 } 5074 5075 protected DistortionModelParams(long nativeObj, boolean owned) { 5076 super(nativeObj, owned, 24); 5077 init(); 5078 } 5079 5080 protected void setBuffer(ByteBuffer backing, int offset) { 5081 super.setBuffer(backing, offset, 24); 5082 } 5083 5084 public void read() { 5085 distortionModel = DistortionModel.fromValue(backing.getInt(0)); 5086 polyModel.read(); 5087 divisionModel.read(); 5088 } 5089 5090 public void write() { 5091 if (distortionModel != null) 5092 backing.putInt(0, distortionModel.getValue()); 5093 polyModel.write(); 5094 divisionModel.write(); 5095 } 5096 5097 public int size() { 5098 return 24; 5099 } 5100 } 5101 5102 public static class PointFloat extends DisposedStruct { 5103 public float x; // The x-coordinate of the point. 5104 public float y; // The y-coordinate of the point. 5105 5106 private void init() { 5107 5108 } 5109 5110 public PointFloat() { 5111 super(8); 5112 init(); 5113 } 5114 5115 public PointFloat(double x, double y) { 5116 super(8); 5117 this.x = (float) x; 5118 this.y = (float) y; 5119 } 5120 5121 protected PointFloat(ByteBuffer backing, int offset) { 5122 super(backing, offset, 8); 5123 init(); 5124 } 5125 5126 protected PointFloat(long nativeObj, boolean owned) { 5127 super(nativeObj, owned, 8); 5128 init(); 5129 } 5130 5131 protected void setBuffer(ByteBuffer backing, int offset) { 5132 super.setBuffer(backing, offset, 8); 5133 } 5134 5135 public void read() { 5136 x = backing.getFloat(0); 5137 y = backing.getFloat(4); 5138 } 5139 5140 public void write() { 5141 backing.putFloat(0, x); 5142 backing.putFloat(4, y); 5143 } 5144 5145 public int size() { 5146 return 8; 5147 } 5148 } 5149 5150 public static class InternalParameters extends DisposedStruct { 5151 public byte isInsufficientData; 5152 public FocalLength focalLength; 5153 public PointFloat opticalCenter; 5154 5155 private void init() { 5156 focalLength = new FocalLength(backing, 4); 5157 opticalCenter = new PointFloat(backing, 12); 5158 } 5159 5160 public InternalParameters() { 5161 super(20); 5162 init(); 5163 } 5164 5165 public InternalParameters(byte isInsufficientData, FocalLength focalLength, 5166 PointFloat opticalCenter) { 5167 super(20); 5168 this.isInsufficientData = isInsufficientData; 5169 this.focalLength = focalLength; 5170 this.opticalCenter = opticalCenter; 5171 } 5172 5173 protected InternalParameters(ByteBuffer backing, int offset) { 5174 super(backing, offset, 20); 5175 init(); 5176 } 5177 5178 protected InternalParameters(long nativeObj, boolean owned) { 5179 super(nativeObj, owned, 20); 5180 init(); 5181 } 5182 5183 protected void setBuffer(ByteBuffer backing, int offset) { 5184 super.setBuffer(backing, offset, 20); 5185 } 5186 5187 public void read() { 5188 isInsufficientData = backing.get(0); 5189 focalLength.read(); 5190 opticalCenter.read(); 5191 } 5192 5193 public void write() { 5194 backing.put(0, isInsufficientData); 5195 focalLength.write(); 5196 opticalCenter.write(); 5197 } 5198 5199 public int size() { 5200 return 20; 5201 } 5202 } 5203 5204 public static class MaxGridSize extends DisposedStruct { 5205 public int xMax; // Maximum x limit for the grid size. 5206 public int yMax; // Maximum y limit for the grid size. 5207 5208 private void init() { 5209 5210 } 5211 5212 public MaxGridSize() { 5213 super(8); 5214 init(); 5215 } 5216 5217 public MaxGridSize(int xMax, int yMax) { 5218 super(8); 5219 this.xMax = xMax; 5220 this.yMax = yMax; 5221 } 5222 5223 protected MaxGridSize(ByteBuffer backing, int offset) { 5224 super(backing, offset, 8); 5225 init(); 5226 } 5227 5228 protected MaxGridSize(long nativeObj, boolean owned) { 5229 super(nativeObj, owned, 8); 5230 init(); 5231 } 5232 5233 protected void setBuffer(ByteBuffer backing, int offset) { 5234 super.setBuffer(backing, offset, 8); 5235 } 5236 5237 public void read() { 5238 xMax = backing.getInt(0); 5239 yMax = backing.getInt(4); 5240 } 5241 5242 public void write() { 5243 backing.putInt(0, xMax); 5244 backing.putInt(4, yMax); 5245 } 5246 5247 public int size() { 5248 return 8; 5249 } 5250 } 5251 5252 public static class ImageSize extends DisposedStruct { 5253 public int xRes; // X resolution of the image. 5254 public int yRes; // Y resolution of the image. 5255 5256 private void init() { 5257 5258 } 5259 5260 public ImageSize() { 5261 super(8); 5262 init(); 5263 } 5264 5265 public ImageSize(int xRes, int yRes) { 5266 super(8); 5267 this.xRes = xRes; 5268 this.yRes = yRes; 5269 } 5270 5271 protected ImageSize(ByteBuffer backing, int offset) { 5272 super(backing, offset, 8); 5273 init(); 5274 } 5275 5276 protected ImageSize(long nativeObj, boolean owned) { 5277 super(nativeObj, owned, 8); 5278 init(); 5279 } 5280 5281 protected void setBuffer(ByteBuffer backing, int offset) { 5282 super.setBuffer(backing, offset, 8); 5283 } 5284 5285 public void read() { 5286 xRes = backing.getInt(0); 5287 yRes = backing.getInt(4); 5288 } 5289 5290 public void write() { 5291 backing.putInt(0, xRes); 5292 backing.putInt(4, yRes); 5293 } 5294 5295 public int size() { 5296 return 8; 5297 } 5298 } 5299 5300 public static class CalibrationReferencePoints extends DisposedStruct { 5301 public PointDouble[] pixelCoords; // Specifies the coordinates of the pixel 5302 // reference points. 5303 public PointDouble[] realCoords; // Specifies the measuring unit associated 5304 // with the image. 5305 public CalibrationUnit units; // Specifies the units of X Step and Y Step. 5306 public ImageSize imageSize; // Specifies the size of calibration template 5307 // image. 5308 private ByteBuffer pixelCoords_buf; 5309 private ByteBuffer realCoords_buf; 5310 5311 private void init() { 5312 pixelCoords = new PointDouble[0]; 5313 realCoords = new PointDouble[0]; 5314 imageSize = new ImageSize(backing, 20); 5315 } 5316 5317 public CalibrationReferencePoints() { 5318 super(28); 5319 init(); 5320 } 5321 5322 public CalibrationReferencePoints(PointDouble[] pixelCoords, PointDouble[] realCoords, 5323 CalibrationUnit units, ImageSize imageSize) { 5324 super(28); 5325 this.pixelCoords = pixelCoords; 5326 this.realCoords = realCoords; 5327 this.units = units; 5328 this.imageSize = imageSize; 5329 } 5330 5331 protected CalibrationReferencePoints(ByteBuffer backing, int offset) { 5332 super(backing, offset, 28); 5333 init(); 5334 } 5335 5336 protected CalibrationReferencePoints(long nativeObj, boolean owned) { 5337 super(nativeObj, owned, 28); 5338 init(); 5339 } 5340 5341 protected void setBuffer(ByteBuffer backing, int offset) { 5342 super.setBuffer(backing, offset, 28); 5343 } 5344 5345 public void read() { 5346 int pixelCoords_numPixelCoords = backing.getInt(4); 5347 long pixelCoords_addr = getPointer(backing, 0); 5348 pixelCoords = new PointDouble[pixelCoords_numPixelCoords]; 5349 if (pixelCoords_numPixelCoords > 0 && pixelCoords_addr != 0) { 5350 ByteBuffer bb = newDirectByteBuffer(pixelCoords_addr, pixelCoords_numPixelCoords * 16); 5351 for (int i = 0, off = 0; i < pixelCoords_numPixelCoords; i++, off += 16) { 5352 pixelCoords[i] = new PointDouble(bb, off); 5353 pixelCoords[i].read(); 5354 } 5355 } 5356 int realCoords_numRealCoords = backing.getInt(12); 5357 long realCoords_addr = getPointer(backing, 8); 5358 realCoords = new PointDouble[realCoords_numRealCoords]; 5359 if (realCoords_numRealCoords > 0 && realCoords_addr != 0) { 5360 ByteBuffer bb = newDirectByteBuffer(realCoords_addr, realCoords_numRealCoords * 16); 5361 for (int i = 0, off = 0; i < realCoords_numRealCoords; i++, off += 16) { 5362 realCoords[i] = new PointDouble(bb, off); 5363 realCoords[i].read(); 5364 } 5365 } 5366 units = CalibrationUnit.fromValue(backing.getInt(16)); 5367 imageSize.read(); 5368 } 5369 5370 public void write() { 5371 pixelCoords_buf = 5372 ByteBuffer.allocateDirect(pixelCoords.length * 16).order(ByteOrder.nativeOrder()); 5373 for (int i = 0, off = 0; i < pixelCoords.length; i++, off += 16) { 5374 pixelCoords[i].setBuffer(pixelCoords_buf, off); 5375 pixelCoords[i].write(); 5376 } 5377 backing.putInt(4, pixelCoords.length); 5378 putPointer(backing, 0, pixelCoords_buf); 5379 realCoords_buf = 5380 ByteBuffer.allocateDirect(realCoords.length * 16).order(ByteOrder.nativeOrder()); 5381 for (int i = 0, off = 0; i < realCoords.length; i++, off += 16) { 5382 realCoords[i].setBuffer(realCoords_buf, off); 5383 realCoords[i].write(); 5384 } 5385 backing.putInt(12, realCoords.length); 5386 putPointer(backing, 8, realCoords_buf); 5387 if (units != null) 5388 backing.putInt(16, units.getValue()); 5389 imageSize.write(); 5390 } 5391 5392 public int size() { 5393 return 28; 5394 } 5395 } 5396 5397 public static class GetCameraParametersReport extends DisposedStruct { 5398 public int projectionMatrixRows; // Number of rows in projection matrix. 5399 public int projectionMatrixCols; // Number of columns in projection matrix. 5400 public DistortionModelParams distortion; // Distortion model Coefficients. 5401 public InternalParameters internalParams; // The learned internal paramters 5402 // of camera model such as focal 5403 // length and optical center. 5404 5405 private void init() { 5406 distortion = new DistortionModelParams(backing, 12); 5407 internalParams = new InternalParameters(backing, 36); 5408 } 5409 5410 public GetCameraParametersReport() { 5411 super(56); 5412 init(); 5413 } 5414 5415 public GetCameraParametersReport(int projectionMatrixRows, int projectionMatrixCols, 5416 DistortionModelParams distortion, InternalParameters internalParams) { 5417 super(56); 5418 this.projectionMatrixRows = projectionMatrixRows; 5419 this.projectionMatrixCols = projectionMatrixCols; 5420 this.distortion = distortion; 5421 this.internalParams = internalParams; 5422 } 5423 5424 protected GetCameraParametersReport(ByteBuffer backing, int offset) { 5425 super(backing, offset, 56); 5426 init(); 5427 } 5428 5429 protected GetCameraParametersReport(long nativeObj, boolean owned) { 5430 super(nativeObj, owned, 56); 5431 init(); 5432 } 5433 5434 protected void setBuffer(ByteBuffer backing, int offset) { 5435 super.setBuffer(backing, offset, 56); 5436 } 5437 5438 public void read() { 5439 projectionMatrixRows = backing.getInt(4); 5440 projectionMatrixCols = backing.getInt(8); 5441 distortion.read(); 5442 internalParams.read(); 5443 } 5444 5445 public void write() { 5446 backing.putInt(4, projectionMatrixRows); 5447 backing.putInt(8, projectionMatrixCols); 5448 distortion.write(); 5449 internalParams.write(); 5450 } 5451 5452 public int size() { 5453 return 56; 5454 } 5455 } 5456 5457 public static class CalibrationAxisInfo extends DisposedStruct { 5458 public PointFloat center; // The origin of the reference coordinate system, 5459 // expressed in pixel units. 5460 public float rotationAngle; // The angle of the x-axis of the real-world 5461 // coordinate system, in relation to the 5462 // horizontal. 5463 public AxisOrientation axisDirection; // Specifies the direction of the 5464 // calibraiton axis which is either 5465 // Direct or Indirect. 5466 5467 private void init() { 5468 center = new PointFloat(backing, 0); 5469 } 5470 5471 public CalibrationAxisInfo() { 5472 super(16); 5473 init(); 5474 } 5475 5476 public CalibrationAxisInfo(PointFloat center, double rotationAngle, 5477 AxisOrientation axisDirection) { 5478 super(16); 5479 this.center = center; 5480 this.rotationAngle = (float) rotationAngle; 5481 this.axisDirection = axisDirection; 5482 } 5483 5484 protected CalibrationAxisInfo(ByteBuffer backing, int offset) { 5485 super(backing, offset, 16); 5486 init(); 5487 } 5488 5489 protected CalibrationAxisInfo(long nativeObj, boolean owned) { 5490 super(nativeObj, owned, 16); 5491 init(); 5492 } 5493 5494 protected void setBuffer(ByteBuffer backing, int offset) { 5495 super.setBuffer(backing, offset, 16); 5496 } 5497 5498 public void read() { 5499 center.read(); 5500 rotationAngle = backing.getFloat(8); 5501 axisDirection = AxisOrientation.fromValue(backing.getInt(12)); 5502 } 5503 5504 public void write() { 5505 center.write(); 5506 backing.putFloat(8, rotationAngle); 5507 if (axisDirection != null) 5508 backing.putInt(12, axisDirection.getValue()); 5509 } 5510 5511 public int size() { 5512 return 16; 5513 } 5514 } 5515 5516 public static class CalibrationLearnSetupInfo extends DisposedStruct { 5517 public CalibrationMode2 calibrationMethod; // Type of calibration method 5518 // used. 5519 public DistortionModel distortionModel; // Type of learned distortion model. 5520 public ScalingMethod scaleMode; // The aspect scaling to use when correcting 5521 // an image. 5522 public CalibrationROI roiMode; // The ROI to use when correcting an image. 5523 public byte learnCorrectionTable; // Set this input to true value if you 5524 // want the correction table to be 5525 // determined and stored. 5526 5527 private void init() { 5528 5529 } 5530 5531 public CalibrationLearnSetupInfo() { 5532 super(20); 5533 init(); 5534 } 5535 5536 public CalibrationLearnSetupInfo(CalibrationMode2 calibrationMethod, 5537 DistortionModel distortionModel, ScalingMethod scaleMode, CalibrationROI roiMode, 5538 byte learnCorrectionTable) { 5539 super(20); 5540 this.calibrationMethod = calibrationMethod; 5541 this.distortionModel = distortionModel; 5542 this.scaleMode = scaleMode; 5543 this.roiMode = roiMode; 5544 this.learnCorrectionTable = learnCorrectionTable; 5545 } 5546 5547 protected CalibrationLearnSetupInfo(ByteBuffer backing, int offset) { 5548 super(backing, offset, 20); 5549 init(); 5550 } 5551 5552 protected CalibrationLearnSetupInfo(long nativeObj, boolean owned) { 5553 super(nativeObj, owned, 20); 5554 init(); 5555 } 5556 5557 protected void setBuffer(ByteBuffer backing, int offset) { 5558 super.setBuffer(backing, offset, 20); 5559 } 5560 5561 public void read() { 5562 calibrationMethod = CalibrationMode2.fromValue(backing.getInt(0)); 5563 distortionModel = DistortionModel.fromValue(backing.getInt(4)); 5564 scaleMode = ScalingMethod.fromValue(backing.getInt(8)); 5565 roiMode = CalibrationROI.fromValue(backing.getInt(12)); 5566 learnCorrectionTable = backing.get(16); 5567 } 5568 5569 public void write() { 5570 if (calibrationMethod != null) 5571 backing.putInt(0, calibrationMethod.getValue()); 5572 if (distortionModel != null) 5573 backing.putInt(4, distortionModel.getValue()); 5574 if (scaleMode != null) 5575 backing.putInt(8, scaleMode.getValue()); 5576 if (roiMode != null) 5577 backing.putInt(12, roiMode.getValue()); 5578 backing.put(16, learnCorrectionTable); 5579 } 5580 5581 public int size() { 5582 return 20; 5583 } 5584 } 5585 5586 public static class GridDescriptor extends DisposedStruct { 5587 public float xStep; // The distance in the x direction between two adjacent 5588 // pixels in units specified by unit. 5589 public float yStep; // The distance in the y direction between two adjacent 5590 // pixels in units specified by unit. 5591 public CalibrationUnit unit; // The unit of measure for the image. 5592 5593 private void init() { 5594 5595 } 5596 5597 public GridDescriptor() { 5598 super(12); 5599 init(); 5600 } 5601 5602 public GridDescriptor(double xStep, double yStep, CalibrationUnit unit) { 5603 super(12); 5604 this.xStep = (float) xStep; 5605 this.yStep = (float) yStep; 5606 this.unit = unit; 5607 } 5608 5609 protected GridDescriptor(ByteBuffer backing, int offset) { 5610 super(backing, offset, 12); 5611 init(); 5612 } 5613 5614 protected GridDescriptor(long nativeObj, boolean owned) { 5615 super(nativeObj, owned, 12); 5616 init(); 5617 } 5618 5619 protected void setBuffer(ByteBuffer backing, int offset) { 5620 super.setBuffer(backing, offset, 12); 5621 } 5622 5623 public void read() { 5624 xStep = backing.getFloat(0); 5625 yStep = backing.getFloat(4); 5626 unit = CalibrationUnit.fromValue(backing.getInt(8)); 5627 } 5628 5629 public void write() { 5630 backing.putFloat(0, xStep); 5631 backing.putFloat(4, yStep); 5632 if (unit != null) 5633 backing.putInt(8, unit.getValue()); 5634 } 5635 5636 public int size() { 5637 return 12; 5638 } 5639 } 5640 5641 public static class ErrorStatistics extends DisposedStruct { 5642 public double mean; // Mean error statistics value. 5643 public double maximum; // Maximum value of error. 5644 public double standardDeviation; // The standard deviation error statistiscs 5645 // value. 5646 public double distortion; // The distortion error statistics value. 5647 5648 private void init() { 5649 5650 } 5651 5652 public ErrorStatistics() { 5653 super(32); 5654 init(); 5655 } 5656 5657 public ErrorStatistics(double mean, double maximum, double standardDeviation, double distortion) { 5658 super(32); 5659 this.mean = mean; 5660 this.maximum = maximum; 5661 this.standardDeviation = standardDeviation; 5662 this.distortion = distortion; 5663 } 5664 5665 protected ErrorStatistics(ByteBuffer backing, int offset) { 5666 super(backing, offset, 32); 5667 init(); 5668 } 5669 5670 protected ErrorStatistics(long nativeObj, boolean owned) { 5671 super(nativeObj, owned, 32); 5672 init(); 5673 } 5674 5675 protected void setBuffer(ByteBuffer backing, int offset) { 5676 super.setBuffer(backing, offset, 32); 5677 } 5678 5679 public void read() { 5680 mean = backing.getDouble(0); 5681 maximum = backing.getDouble(8); 5682 standardDeviation = backing.getDouble(16); 5683 distortion = backing.getDouble(24); 5684 } 5685 5686 public void write() { 5687 backing.putDouble(0, mean); 5688 backing.putDouble(8, maximum); 5689 backing.putDouble(16, standardDeviation); 5690 backing.putDouble(24, distortion); 5691 } 5692 5693 public int size() { 5694 return 32; 5695 } 5696 } 5697 5698 public static class GetCalibrationInfoReport extends DisposedStruct { 5699 public ROI userRoi; // Specifies the ROI the user provided when learning the 5700 // calibration. 5701 public ROI calibrationRoi; // Specifies the ROI that corresponds to the 5702 // region of the image where the calibration 5703 // information is accurate. 5704 public CalibrationAxisInfo axisInfo; // Reference Coordinate System for the 5705 // real-world coordinates. 5706 public CalibrationLearnSetupInfo learnSetupInfo; // Calibration learn setup 5707 // information. 5708 public GridDescriptor gridDescriptor; // Specifies scaling constants used to 5709 // calibrate the image. 5710 public int errorMapRows; // Number of rows in error map. 5711 public int errorMapCols; // Number of Columns in error map. 5712 public ErrorStatistics errorStatistics; // Error statistics of the 5713 // calibration. 5714 5715 private void init() { 5716 axisInfo = new CalibrationAxisInfo(backing, 8); 5717 learnSetupInfo = new CalibrationLearnSetupInfo(backing, 24); 5718 gridDescriptor = new GridDescriptor(backing, 44); 5719 errorStatistics = new ErrorStatistics(backing, 72); 5720 } 5721 5722 public GetCalibrationInfoReport() { 5723 super(104); 5724 init(); 5725 } 5726 5727 public GetCalibrationInfoReport(ROI userRoi, ROI calibrationRoi, CalibrationAxisInfo axisInfo, 5728 CalibrationLearnSetupInfo learnSetupInfo, GridDescriptor gridDescriptor, int errorMapRows, 5729 int errorMapCols, ErrorStatistics errorStatistics) { 5730 super(104); 5731 this.userRoi = userRoi; 5732 this.calibrationRoi = calibrationRoi; 5733 this.axisInfo = axisInfo; 5734 this.learnSetupInfo = learnSetupInfo; 5735 this.gridDescriptor = gridDescriptor; 5736 this.errorMapRows = errorMapRows; 5737 this.errorMapCols = errorMapCols; 5738 this.errorStatistics = errorStatistics; 5739 } 5740 5741 protected GetCalibrationInfoReport(ByteBuffer backing, int offset) { 5742 super(backing, offset, 104); 5743 init(); 5744 } 5745 5746 protected GetCalibrationInfoReport(long nativeObj, boolean owned) { 5747 super(nativeObj, owned, 104); 5748 init(); 5749 } 5750 5751 protected void setBuffer(ByteBuffer backing, int offset) { 5752 super.setBuffer(backing, offset, 104); 5753 } 5754 5755 public void read() { 5756 long userRoi_addr = getPointer(backing, 0); 5757 if (userRoi_addr == 0) 5758 userRoi = null; 5759 else 5760 userRoi = new ROI(userRoi_addr, false); 5761 long calibrationRoi_addr = getPointer(backing, 4); 5762 if (calibrationRoi_addr == 0) 5763 calibrationRoi = null; 5764 else 5765 calibrationRoi = new ROI(calibrationRoi_addr, false); 5766 axisInfo.read(); 5767 learnSetupInfo.read(); 5768 gridDescriptor.read(); 5769 errorMapRows = backing.getInt(60); 5770 errorMapCols = backing.getInt(64); 5771 errorStatistics.read(); 5772 } 5773 5774 public void write() { 5775 putPointer(backing, 0, userRoi); 5776 putPointer(backing, 4, calibrationRoi); 5777 axisInfo.write(); 5778 learnSetupInfo.write(); 5779 gridDescriptor.write(); 5780 backing.putInt(60, errorMapRows); 5781 backing.putInt(64, errorMapCols); 5782 errorStatistics.write(); 5783 } 5784 5785 public int size() { 5786 return 104; 5787 } 5788 } 5789 5790 public static class EdgePolarity extends DisposedStruct { 5791 public EdgePolaritySearchMode start; 5792 public EdgePolaritySearchMode end; 5793 5794 private void init() { 5795 5796 } 5797 5798 public EdgePolarity() { 5799 super(8); 5800 init(); 5801 } 5802 5803 public EdgePolarity(EdgePolaritySearchMode start, EdgePolaritySearchMode end) { 5804 super(8); 5805 this.start = start; 5806 this.end = end; 5807 } 5808 5809 protected EdgePolarity(ByteBuffer backing, int offset) { 5810 super(backing, offset, 8); 5811 init(); 5812 } 5813 5814 protected EdgePolarity(long nativeObj, boolean owned) { 5815 super(nativeObj, owned, 8); 5816 init(); 5817 } 5818 5819 protected void setBuffer(ByteBuffer backing, int offset) { 5820 super.setBuffer(backing, offset, 8); 5821 } 5822 5823 public void read() { 5824 start = EdgePolaritySearchMode.fromValue(backing.getInt(0)); 5825 end = EdgePolaritySearchMode.fromValue(backing.getInt(4)); 5826 } 5827 5828 public void write() { 5829 if (start != null) 5830 backing.putInt(0, start.getValue()); 5831 if (end != null) 5832 backing.putInt(4, end.getValue()); 5833 } 5834 5835 public int size() { 5836 return 8; 5837 } 5838 } 5839 5840 public static class ClampSettings extends DisposedStruct { 5841 public double angleRange; // Specifies the angle range. 5842 public EdgePolarity edgePolarity; // Specifies the edge polarity. 5843 5844 private void init() { 5845 edgePolarity = new EdgePolarity(backing, 8); 5846 } 5847 5848 public ClampSettings() { 5849 super(16); 5850 init(); 5851 } 5852 5853 public ClampSettings(double angleRange, EdgePolarity edgePolarity) { 5854 super(16); 5855 this.angleRange = angleRange; 5856 this.edgePolarity = edgePolarity; 5857 } 5858 5859 protected ClampSettings(ByteBuffer backing, int offset) { 5860 super(backing, offset, 16); 5861 init(); 5862 } 5863 5864 protected ClampSettings(long nativeObj, boolean owned) { 5865 super(nativeObj, owned, 16); 5866 init(); 5867 } 5868 5869 protected void setBuffer(ByteBuffer backing, int offset) { 5870 super.setBuffer(backing, offset, 16); 5871 } 5872 5873 public void read() { 5874 angleRange = backing.getDouble(0); 5875 edgePolarity.read(); 5876 } 5877 5878 public void write() { 5879 backing.putDouble(0, angleRange); 5880 edgePolarity.write(); 5881 } 5882 5883 public int size() { 5884 return 16; 5885 } 5886 } 5887 5888 public static class PointDouble extends DisposedStruct { 5889 public double x; // The x-coordinate of the point. 5890 public double y; // The y-coordinate of the point. 5891 5892 private void init() { 5893 5894 } 5895 5896 public PointDouble() { 5897 super(16); 5898 init(); 5899 } 5900 5901 public PointDouble(double x, double y) { 5902 super(16); 5903 this.x = x; 5904 this.y = y; 5905 } 5906 5907 protected PointDouble(ByteBuffer backing, int offset) { 5908 super(backing, offset, 16); 5909 init(); 5910 } 5911 5912 protected PointDouble(long nativeObj, boolean owned) { 5913 super(nativeObj, owned, 16); 5914 init(); 5915 } 5916 5917 protected void setBuffer(ByteBuffer backing, int offset) { 5918 super.setBuffer(backing, offset, 16); 5919 } 5920 5921 public void read() { 5922 x = backing.getDouble(0); 5923 y = backing.getDouble(8); 5924 } 5925 5926 public void write() { 5927 backing.putDouble(0, x); 5928 backing.putDouble(8, y); 5929 } 5930 5931 public int size() { 5932 return 16; 5933 } 5934 } 5935 5936 public static class PointDoublePair extends DisposedStruct { 5937 public PointDouble start; // The Start co-ordinate of the pair. 5938 public PointDouble end; // The End co-ordinate of the pair. 5939 5940 private void init() { 5941 start = new PointDouble(backing, 0); 5942 end = new PointDouble(backing, 16); 5943 } 5944 5945 public PointDoublePair() { 5946 super(32); 5947 init(); 5948 } 5949 5950 public PointDoublePair(PointDouble start, PointDouble end) { 5951 super(32); 5952 this.start = start; 5953 this.end = end; 5954 } 5955 5956 protected PointDoublePair(ByteBuffer backing, int offset) { 5957 super(backing, offset, 32); 5958 init(); 5959 } 5960 5961 protected PointDoublePair(long nativeObj, boolean owned) { 5962 super(nativeObj, owned, 32); 5963 init(); 5964 } 5965 5966 protected void setBuffer(ByteBuffer backing, int offset) { 5967 super.setBuffer(backing, offset, 32); 5968 } 5969 5970 public void read() { 5971 start.read(); 5972 end.read(); 5973 } 5974 5975 public void write() { 5976 start.write(); 5977 end.write(); 5978 } 5979 5980 public int size() { 5981 return 32; 5982 } 5983 } 5984 5985 public static class ClampResults extends DisposedStruct { 5986 public double distancePix; // Defines the Pixel world distance. 5987 public double distanceRealWorld; // Defines the real world distance. 5988 public double angleAbs; // Defines the absolute angle. 5989 public double angleRelative; // Defines the relative angle. 5990 5991 private void init() { 5992 5993 } 5994 5995 public ClampResults() { 5996 super(32); 5997 init(); 5998 } 5999 6000 public ClampResults(double distancePix, double distanceRealWorld, double angleAbs, 6001 double angleRelative) { 6002 super(32); 6003 this.distancePix = distancePix; 6004 this.distanceRealWorld = distanceRealWorld; 6005 this.angleAbs = angleAbs; 6006 this.angleRelative = angleRelative; 6007 } 6008 6009 protected ClampResults(ByteBuffer backing, int offset) { 6010 super(backing, offset, 32); 6011 init(); 6012 } 6013 6014 protected ClampResults(long nativeObj, boolean owned) { 6015 super(nativeObj, owned, 32); 6016 init(); 6017 } 6018 6019 protected void setBuffer(ByteBuffer backing, int offset) { 6020 super.setBuffer(backing, offset, 32); 6021 } 6022 6023 public void read() { 6024 distancePix = backing.getDouble(0); 6025 distanceRealWorld = backing.getDouble(8); 6026 angleAbs = backing.getDouble(16); 6027 angleRelative = backing.getDouble(24); 6028 } 6029 6030 public void write() { 6031 backing.putDouble(0, distancePix); 6032 backing.putDouble(8, distanceRealWorld); 6033 backing.putDouble(16, angleAbs); 6034 backing.putDouble(24, angleRelative); 6035 } 6036 6037 public int size() { 6038 return 32; 6039 } 6040 } 6041 6042 public static class ClampPoints extends DisposedStruct { 6043 public PointDoublePair pixel; // Specifies the pixel world point pair for 6044 // clamp. 6045 public PointDoublePair realWorld; // Specifies the real world point pair for 6046 // clamp. 6047 6048 private void init() { 6049 pixel = new PointDoublePair(backing, 0); 6050 realWorld = new PointDoublePair(backing, 32); 6051 } 6052 6053 public ClampPoints() { 6054 super(64); 6055 init(); 6056 } 6057 6058 public ClampPoints(PointDoublePair pixel, PointDoublePair realWorld) { 6059 super(64); 6060 this.pixel = pixel; 6061 this.realWorld = realWorld; 6062 } 6063 6064 protected ClampPoints(ByteBuffer backing, int offset) { 6065 super(backing, offset, 64); 6066 init(); 6067 } 6068 6069 protected ClampPoints(long nativeObj, boolean owned) { 6070 super(nativeObj, owned, 64); 6071 init(); 6072 } 6073 6074 protected void setBuffer(ByteBuffer backing, int offset) { 6075 super.setBuffer(backing, offset, 64); 6076 } 6077 6078 public void read() { 6079 pixel.read(); 6080 realWorld.read(); 6081 } 6082 6083 public void write() { 6084 pixel.write(); 6085 realWorld.write(); 6086 } 6087 6088 public int size() { 6089 return 64; 6090 } 6091 } 6092 6093 public static class RGBValue extends DisposedStruct { 6094 public short B; // The blue value of the color. 6095 public short G; // The green value of the color. 6096 public short R; // The red value of the color. 6097 public short alpha; // The alpha value of the color, which represents extra 6098 // information about a color image, such as gamma 6099 // correction. 6100 6101 private void init() { 6102 6103 } 6104 6105 public RGBValue() { 6106 super(4); 6107 init(); 6108 } 6109 6110 public RGBValue(int B, int G, int R, int alpha) { 6111 super(4); 6112 this.B = (short) B; 6113 this.G = (short) G; 6114 this.R = (short) R; 6115 this.alpha = (short) alpha; 6116 } 6117 6118 protected RGBValue(ByteBuffer backing, int offset) { 6119 super(backing, offset, 4); 6120 init(); 6121 } 6122 6123 protected RGBValue(long nativeObj, boolean owned) { 6124 super(nativeObj, owned, 4); 6125 init(); 6126 } 6127 6128 protected void setBuffer(ByteBuffer backing, int offset) { 6129 super.setBuffer(backing, offset, 4); 6130 } 6131 6132 public void read() { 6133 B = (short) (backing.get(0) & 0xff); 6134 G = (short) (backing.get(1) & 0xff); 6135 R = (short) (backing.get(2) & 0xff); 6136 alpha = (short) (backing.get(3) & 0xff); 6137 } 6138 6139 public void write() { 6140 backing.put(0, (byte) (B & 0xff)); 6141 backing.put(1, (byte) (G & 0xff)); 6142 backing.put(2, (byte) (R & 0xff)); 6143 backing.put(3, (byte) (alpha & 0xff)); 6144 } 6145 6146 public int size() { 6147 return 4; 6148 } 6149 } 6150 6151 public static class ClampOverlaySettings extends DisposedStruct { 6152 public int showSearchArea; // If TRUE, the function overlays the search area 6153 // on the image. 6154 public int showCurves; // If TRUE, the function overlays the curves on the 6155 // image. 6156 public int showClampLocation; // If TRUE, the function overlays the clamp 6157 // location on the image. 6158 public int showResult; // If TRUE, the function overlays the hit lines to 6159 // the object and the edge used to generate the hit 6160 // line on the result image. 6161 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 6162 // overlay the search area. 6163 public RGBValue curvesColor; // Specifies the RGB color value to use to 6164 // overlay the curves. 6165 public RGBValue clampLocationsColor; // Specifies the RGB color value to use 6166 // to overlay the clamp locations. 6167 public RGBValue resultColor; // Specifies the RGB color value to use to 6168 // overlay the results. 6169 public String overlayGroupName; // Specifies the group overlay name for the 6170 // step overlays. 6171 private ByteBuffer overlayGroupName_buf; 6172 6173 private void init() { 6174 searchAreaColor = new RGBValue(backing, 16); 6175 curvesColor = new RGBValue(backing, 20); 6176 clampLocationsColor = new RGBValue(backing, 24); 6177 resultColor = new RGBValue(backing, 28); 6178 } 6179 6180 public ClampOverlaySettings() { 6181 super(36); 6182 init(); 6183 } 6184 6185 public ClampOverlaySettings(int showSearchArea, int showCurves, int showClampLocation, 6186 int showResult, RGBValue searchAreaColor, RGBValue curvesColor, 6187 RGBValue clampLocationsColor, RGBValue resultColor, String overlayGroupName) { 6188 super(36); 6189 this.showSearchArea = showSearchArea; 6190 this.showCurves = showCurves; 6191 this.showClampLocation = showClampLocation; 6192 this.showResult = showResult; 6193 this.searchAreaColor = searchAreaColor; 6194 this.curvesColor = curvesColor; 6195 this.clampLocationsColor = clampLocationsColor; 6196 this.resultColor = resultColor; 6197 this.overlayGroupName = overlayGroupName; 6198 } 6199 6200 protected ClampOverlaySettings(ByteBuffer backing, int offset) { 6201 super(backing, offset, 36); 6202 init(); 6203 } 6204 6205 protected ClampOverlaySettings(long nativeObj, boolean owned) { 6206 super(nativeObj, owned, 36); 6207 init(); 6208 } 6209 6210 protected void setBuffer(ByteBuffer backing, int offset) { 6211 super.setBuffer(backing, offset, 36); 6212 } 6213 6214 public void read() { 6215 showSearchArea = backing.getInt(0); 6216 showCurves = backing.getInt(4); 6217 showClampLocation = backing.getInt(8); 6218 showResult = backing.getInt(12); 6219 searchAreaColor.read(); 6220 curvesColor.read(); 6221 clampLocationsColor.read(); 6222 resultColor.read(); 6223 long overlayGroupName_addr = getPointer(backing, 32); 6224 if (overlayGroupName_addr == 0) 6225 overlayGroupName = null; 6226 else { 6227 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 6228 while (bb.get() != 0) { 6229 } 6230 byte[] bytes = new byte[bb.position() - 1]; 6231 getBytes(bb, bytes, 0, bytes.length); 6232 try { 6233 overlayGroupName = new String(bytes, "UTF-8"); 6234 } catch (UnsupportedEncodingException e) { 6235 overlayGroupName = ""; 6236 } 6237 } 6238 6239 } 6240 6241 public void write() { 6242 backing.putInt(0, showSearchArea); 6243 backing.putInt(4, showCurves); 6244 backing.putInt(8, showClampLocation); 6245 backing.putInt(12, showResult); 6246 searchAreaColor.write(); 6247 curvesColor.write(); 6248 clampLocationsColor.write(); 6249 resultColor.write(); 6250 if (overlayGroupName != null) { 6251 byte[] overlayGroupName_bytes; 6252 try { 6253 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 6254 } catch (UnsupportedEncodingException e) { 6255 overlayGroupName_bytes = new byte[0]; 6256 } 6257 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 6258 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 6259 .put(overlayGroupName_bytes.length, (byte) 0); 6260 } 6261 putPointer(backing, 32, overlayGroupName == null ? 0 6262 : getByteBufferAddress(overlayGroupName_buf)); 6263 } 6264 6265 public int size() { 6266 return 36; 6267 } 6268 } 6269 6270 public static class ClampMax2Report extends DisposedStruct { 6271 public ClampResults clampResults; // Specifies the Clamp results information 6272 // returned by the function. 6273 public ClampPoints clampPoints; // Specifies the clamp points information 6274 // returned by the function. 6275 public int calibrationValid; // Specifies if the calibration information is 6276 // valid or not. 6277 6278 private void init() { 6279 clampResults = new ClampResults(backing, 0); 6280 clampPoints = new ClampPoints(backing, 32); 6281 } 6282 6283 public ClampMax2Report() { 6284 super(104); 6285 init(); 6286 } 6287 6288 public ClampMax2Report(ClampResults clampResults, ClampPoints clampPoints, int calibrationValid) { 6289 super(104); 6290 this.clampResults = clampResults; 6291 this.clampPoints = clampPoints; 6292 this.calibrationValid = calibrationValid; 6293 } 6294 6295 protected ClampMax2Report(ByteBuffer backing, int offset) { 6296 super(backing, offset, 104); 6297 init(); 6298 } 6299 6300 protected ClampMax2Report(long nativeObj, boolean owned) { 6301 super(nativeObj, owned, 104); 6302 init(); 6303 } 6304 6305 protected void setBuffer(ByteBuffer backing, int offset) { 6306 super.setBuffer(backing, offset, 104); 6307 } 6308 6309 public void read() { 6310 clampResults.read(); 6311 clampPoints.read(); 6312 calibrationValid = backing.getInt(96); 6313 } 6314 6315 public void write() { 6316 clampResults.write(); 6317 clampPoints.write(); 6318 backing.putInt(96, calibrationValid); 6319 } 6320 6321 public int size() { 6322 return 104; 6323 } 6324 } 6325 6326 public static class ContourFitSplineReport extends DisposedStruct { 6327 public PointDouble[] points; // It returns the points of the best-fit 6328 // B-spline curve. 6329 private ByteBuffer points_buf; 6330 6331 private void init() { 6332 points = new PointDouble[0]; 6333 } 6334 6335 public ContourFitSplineReport() { 6336 super(8); 6337 init(); 6338 } 6339 6340 public ContourFitSplineReport(PointDouble[] points) { 6341 super(8); 6342 this.points = points; 6343 } 6344 6345 protected ContourFitSplineReport(ByteBuffer backing, int offset) { 6346 super(backing, offset, 8); 6347 init(); 6348 } 6349 6350 protected ContourFitSplineReport(long nativeObj, boolean owned) { 6351 super(nativeObj, owned, 8); 6352 init(); 6353 } 6354 6355 protected void setBuffer(ByteBuffer backing, int offset) { 6356 super.setBuffer(backing, offset, 8); 6357 } 6358 6359 public void read() { 6360 int points_numberOfPoints = backing.getInt(4); 6361 long points_addr = getPointer(backing, 0); 6362 points = new PointDouble[points_numberOfPoints]; 6363 if (points_numberOfPoints > 0 && points_addr != 0) { 6364 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numberOfPoints * 16); 6365 for (int i = 0, off = 0; i < points_numberOfPoints; i++, off += 16) { 6366 points[i] = new PointDouble(bb, off); 6367 points[i].read(); 6368 } 6369 } 6370 } 6371 6372 public void write() { 6373 points_buf = ByteBuffer.allocateDirect(points.length * 16).order(ByteOrder.nativeOrder()); 6374 for (int i = 0, off = 0; i < points.length; i++, off += 16) { 6375 points[i].setBuffer(points_buf, off); 6376 points[i].write(); 6377 } 6378 backing.putInt(4, points.length); 6379 putPointer(backing, 0, points_buf); 6380 } 6381 6382 public int size() { 6383 return 8; 6384 } 6385 } 6386 6387 public static class LineFloat extends DisposedStruct { 6388 public PointFloat start; // The coordinate location of the start of the 6389 // line. 6390 public PointFloat end; // The coordinate location of the end of the line. 6391 6392 private void init() { 6393 start = new PointFloat(backing, 0); 6394 end = new PointFloat(backing, 8); 6395 } 6396 6397 public LineFloat() { 6398 super(16); 6399 init(); 6400 } 6401 6402 public LineFloat(PointFloat start, PointFloat end) { 6403 super(16); 6404 this.start = start; 6405 this.end = end; 6406 } 6407 6408 protected LineFloat(ByteBuffer backing, int offset) { 6409 super(backing, offset, 16); 6410 init(); 6411 } 6412 6413 protected LineFloat(long nativeObj, boolean owned) { 6414 super(nativeObj, owned, 16); 6415 init(); 6416 } 6417 6418 protected void setBuffer(ByteBuffer backing, int offset) { 6419 super.setBuffer(backing, offset, 16); 6420 } 6421 6422 public void read() { 6423 start.read(); 6424 end.read(); 6425 } 6426 6427 public void write() { 6428 start.write(); 6429 end.write(); 6430 } 6431 6432 public int size() { 6433 return 16; 6434 } 6435 } 6436 6437 public static class LineEquation extends DisposedStruct { 6438 public double a; // The a coefficient of the line equation. 6439 public double b; // The b coefficient of the line equation. 6440 public double c; // The c coefficient of the line equation. 6441 6442 private void init() { 6443 6444 } 6445 6446 public LineEquation() { 6447 super(24); 6448 init(); 6449 } 6450 6451 public LineEquation(double a, double b, double c) { 6452 super(24); 6453 this.a = a; 6454 this.b = b; 6455 this.c = c; 6456 } 6457 6458 protected LineEquation(ByteBuffer backing, int offset) { 6459 super(backing, offset, 24); 6460 init(); 6461 } 6462 6463 protected LineEquation(long nativeObj, boolean owned) { 6464 super(nativeObj, owned, 24); 6465 init(); 6466 } 6467 6468 protected void setBuffer(ByteBuffer backing, int offset) { 6469 super.setBuffer(backing, offset, 24); 6470 } 6471 6472 public void read() { 6473 a = backing.getDouble(0); 6474 b = backing.getDouble(8); 6475 c = backing.getDouble(16); 6476 } 6477 6478 public void write() { 6479 backing.putDouble(0, a); 6480 backing.putDouble(8, b); 6481 backing.putDouble(16, c); 6482 } 6483 6484 public int size() { 6485 return 24; 6486 } 6487 } 6488 6489 public static class ContourFitLineReport extends DisposedStruct { 6490 public LineFloat lineSegment; // Line Segment represents the intersection of 6491 // the line equation and the contour. 6492 public LineEquation lineEquation; // Line Equation is a structure of three 6493 // coefficients A, B, and C of the 6494 // equation in the normal form (Ax + By + 6495 // C=0) of the best fit line. 6496 6497 private void init() { 6498 lineSegment = new LineFloat(backing, 0); 6499 lineEquation = new LineEquation(backing, 16); 6500 } 6501 6502 public ContourFitLineReport() { 6503 super(40); 6504 init(); 6505 } 6506 6507 public ContourFitLineReport(LineFloat lineSegment, LineEquation lineEquation) { 6508 super(40); 6509 this.lineSegment = lineSegment; 6510 this.lineEquation = lineEquation; 6511 } 6512 6513 protected ContourFitLineReport(ByteBuffer backing, int offset) { 6514 super(backing, offset, 40); 6515 init(); 6516 } 6517 6518 protected ContourFitLineReport(long nativeObj, boolean owned) { 6519 super(nativeObj, owned, 40); 6520 init(); 6521 } 6522 6523 protected void setBuffer(ByteBuffer backing, int offset) { 6524 super.setBuffer(backing, offset, 40); 6525 } 6526 6527 public void read() { 6528 lineSegment.read(); 6529 lineEquation.read(); 6530 } 6531 6532 public void write() { 6533 lineSegment.write(); 6534 lineEquation.write(); 6535 } 6536 6537 public int size() { 6538 return 40; 6539 } 6540 } 6541 6542 public static class ContourFitPolynomialReport extends DisposedStruct { 6543 public PointDouble[] bestFit; // It returns the points of the best-fit 6544 // polynomial. 6545 public double[] polynomialCoefficients; // Polynomial Coefficients returns 6546 // the coefficients of the 6547 // polynomial equation. 6548 private ByteBuffer bestFit_buf; 6549 private ByteBuffer polynomialCoefficients_buf; 6550 6551 private void init() { 6552 bestFit = new PointDouble[0]; 6553 polynomialCoefficients = new double[0]; 6554 } 6555 6556 public ContourFitPolynomialReport() { 6557 super(16); 6558 init(); 6559 } 6560 6561 public ContourFitPolynomialReport(PointDouble[] bestFit, double[] polynomialCoefficients) { 6562 super(16); 6563 this.bestFit = bestFit; 6564 this.polynomialCoefficients = polynomialCoefficients; 6565 } 6566 6567 protected ContourFitPolynomialReport(ByteBuffer backing, int offset) { 6568 super(backing, offset, 16); 6569 init(); 6570 } 6571 6572 protected ContourFitPolynomialReport(long nativeObj, boolean owned) { 6573 super(nativeObj, owned, 16); 6574 init(); 6575 } 6576 6577 protected void setBuffer(ByteBuffer backing, int offset) { 6578 super.setBuffer(backing, offset, 16); 6579 } 6580 6581 public void read() { 6582 int bestFit_numberOfPoints = backing.getInt(4); 6583 long bestFit_addr = getPointer(backing, 0); 6584 bestFit = new PointDouble[bestFit_numberOfPoints]; 6585 if (bestFit_numberOfPoints > 0 && bestFit_addr != 0) { 6586 ByteBuffer bb = newDirectByteBuffer(bestFit_addr, bestFit_numberOfPoints * 16); 6587 for (int i = 0, off = 0; i < bestFit_numberOfPoints; i++, off += 16) { 6588 bestFit[i] = new PointDouble(bb, off); 6589 bestFit[i].read(); 6590 } 6591 } 6592 int polynomialCoefficients_numberOfCoefficients = backing.getInt(12); 6593 long polynomialCoefficients_addr = getPointer(backing, 8); 6594 polynomialCoefficients = new double[polynomialCoefficients_numberOfCoefficients]; 6595 if (polynomialCoefficients_numberOfCoefficients > 0 && polynomialCoefficients_addr != 0) { 6596 newDirectByteBuffer(polynomialCoefficients_addr, 6597 polynomialCoefficients_numberOfCoefficients * 8).asDoubleBuffer().get( 6598 polynomialCoefficients); 6599 } 6600 } 6601 6602 public void write() { 6603 bestFit_buf = ByteBuffer.allocateDirect(bestFit.length * 16).order(ByteOrder.nativeOrder()); 6604 for (int i = 0, off = 0; i < bestFit.length; i++, off += 16) { 6605 bestFit[i].setBuffer(bestFit_buf, off); 6606 bestFit[i].write(); 6607 } 6608 backing.putInt(4, bestFit.length); 6609 putPointer(backing, 0, bestFit_buf); 6610 polynomialCoefficients_buf = 6611 ByteBuffer.allocateDirect(polynomialCoefficients.length * 8).order( 6612 ByteOrder.nativeOrder()); 6613 polynomialCoefficients_buf.asDoubleBuffer().put(polynomialCoefficients).rewind(); 6614 backing.putInt(12, polynomialCoefficients.length); 6615 putPointer(backing, 8, polynomialCoefficients_buf); 6616 } 6617 6618 public int size() { 6619 return 16; 6620 } 6621 } 6622 6623 public static class PartialCircle extends DisposedStruct { 6624 public PointFloat center; // Center of the circle. 6625 public double radius; // Radius of the circle. 6626 public double startAngle; // Start angle of the fitted structure. 6627 public double endAngle; // End angle of the fitted structure. 6628 6629 private void init() { 6630 center = new PointFloat(backing, 0); 6631 } 6632 6633 public PartialCircle() { 6634 super(32); 6635 init(); 6636 } 6637 6638 public PartialCircle(PointFloat center, double radius, double startAngle, double endAngle) { 6639 super(32); 6640 this.center = center; 6641 this.radius = radius; 6642 this.startAngle = startAngle; 6643 this.endAngle = endAngle; 6644 } 6645 6646 protected PartialCircle(ByteBuffer backing, int offset) { 6647 super(backing, offset, 32); 6648 init(); 6649 } 6650 6651 protected PartialCircle(long nativeObj, boolean owned) { 6652 super(nativeObj, owned, 32); 6653 init(); 6654 } 6655 6656 protected void setBuffer(ByteBuffer backing, int offset) { 6657 super.setBuffer(backing, offset, 32); 6658 } 6659 6660 public void read() { 6661 center.read(); 6662 radius = backing.getDouble(8); 6663 startAngle = backing.getDouble(16); 6664 endAngle = backing.getDouble(24); 6665 } 6666 6667 public void write() { 6668 center.write(); 6669 backing.putDouble(8, radius); 6670 backing.putDouble(16, startAngle); 6671 backing.putDouble(24, endAngle); 6672 } 6673 6674 public int size() { 6675 return 32; 6676 } 6677 } 6678 6679 public static class PartialEllipse extends DisposedStruct { 6680 public PointFloat center; // Center of the Ellipse. 6681 public double angle; // Angle of the ellipse. 6682 public double majorRadius; // The length of the semi-major axis of the 6683 // ellipse. 6684 public double minorRadius; // The length of the semi-minor axis of the 6685 // ellipse. 6686 public double startAngle; // Start angle of the fitted structure. 6687 public double endAngle; // End angle of the fitted structure. 6688 6689 private void init() { 6690 center = new PointFloat(backing, 0); 6691 } 6692 6693 public PartialEllipse() { 6694 super(48); 6695 init(); 6696 } 6697 6698 public PartialEllipse(PointFloat center, double angle, double majorRadius, double minorRadius, 6699 double startAngle, double endAngle) { 6700 super(48); 6701 this.center = center; 6702 this.angle = angle; 6703 this.majorRadius = majorRadius; 6704 this.minorRadius = minorRadius; 6705 this.startAngle = startAngle; 6706 this.endAngle = endAngle; 6707 } 6708 6709 protected PartialEllipse(ByteBuffer backing, int offset) { 6710 super(backing, offset, 48); 6711 init(); 6712 } 6713 6714 protected PartialEllipse(long nativeObj, boolean owned) { 6715 super(nativeObj, owned, 48); 6716 init(); 6717 } 6718 6719 protected void setBuffer(ByteBuffer backing, int offset) { 6720 super.setBuffer(backing, offset, 48); 6721 } 6722 6723 public void read() { 6724 center.read(); 6725 angle = backing.getDouble(8); 6726 majorRadius = backing.getDouble(16); 6727 minorRadius = backing.getDouble(24); 6728 startAngle = backing.getDouble(32); 6729 endAngle = backing.getDouble(40); 6730 } 6731 6732 public void write() { 6733 center.write(); 6734 backing.putDouble(8, angle); 6735 backing.putDouble(16, majorRadius); 6736 backing.putDouble(24, minorRadius); 6737 backing.putDouble(32, startAngle); 6738 backing.putDouble(40, endAngle); 6739 } 6740 6741 public int size() { 6742 return 48; 6743 } 6744 } 6745 6746 public static class SetupMatchPatternData extends DisposedStruct { 6747 public byte[] matchSetupData; // String containing the match setup data. 6748 private ByteBuffer matchSetupData_buf; 6749 6750 private void init() { 6751 matchSetupData = new byte[0]; 6752 } 6753 6754 public SetupMatchPatternData() { 6755 super(8); 6756 init(); 6757 } 6758 6759 public SetupMatchPatternData(byte[] matchSetupData) { 6760 super(8); 6761 this.matchSetupData = matchSetupData; 6762 } 6763 6764 protected SetupMatchPatternData(ByteBuffer backing, int offset) { 6765 super(backing, offset, 8); 6766 init(); 6767 } 6768 6769 protected SetupMatchPatternData(long nativeObj, boolean owned) { 6770 super(nativeObj, owned, 8); 6771 init(); 6772 } 6773 6774 protected void setBuffer(ByteBuffer backing, int offset) { 6775 super.setBuffer(backing, offset, 8); 6776 } 6777 6778 public void read() { 6779 int matchSetupData_numMatchSetupData = backing.getInt(4); 6780 long matchSetupData_addr = getPointer(backing, 0); 6781 matchSetupData = new byte[matchSetupData_numMatchSetupData]; 6782 if (matchSetupData_numMatchSetupData > 0 && matchSetupData_addr != 0) { 6783 getBytes(newDirectByteBuffer(matchSetupData_addr, matchSetupData_numMatchSetupData), 6784 matchSetupData, 0, matchSetupData_numMatchSetupData); 6785 } 6786 } 6787 6788 public void write() { 6789 matchSetupData_buf = ByteBuffer.allocateDirect(matchSetupData.length); 6790 putBytes(matchSetupData_buf, matchSetupData, 0, matchSetupData.length); 6791 backing.putInt(4, matchSetupData.length); 6792 putPointer(backing, 0, matchSetupData_buf); 6793 } 6794 6795 public int size() { 6796 return 8; 6797 } 6798 } 6799 6800 public static class RangeSettingDouble extends DisposedStruct { 6801 public SettingType settingType; // Match Constraints specifies the match 6802 // option whose values you want to constrain 6803 // by the given range. 6804 public double min; // Min is the minimum value of the range for a given 6805 // Match Constraint. 6806 public double max; // Max is the maximum value of the range for a given 6807 // Match Constraint. 6808 6809 private void init() { 6810 6811 } 6812 6813 public RangeSettingDouble() { 6814 super(24); 6815 init(); 6816 } 6817 6818 public RangeSettingDouble(SettingType settingType, double min, double max) { 6819 super(24); 6820 this.settingType = settingType; 6821 this.min = min; 6822 this.max = max; 6823 } 6824 6825 protected RangeSettingDouble(ByteBuffer backing, int offset) { 6826 super(backing, offset, 24); 6827 init(); 6828 } 6829 6830 protected RangeSettingDouble(long nativeObj, boolean owned) { 6831 super(nativeObj, owned, 24); 6832 init(); 6833 } 6834 6835 protected void setBuffer(ByteBuffer backing, int offset) { 6836 super.setBuffer(backing, offset, 24); 6837 } 6838 6839 public void read() { 6840 settingType = SettingType.fromValue(backing.getInt(0)); 6841 min = backing.getDouble(8); 6842 max = backing.getDouble(16); 6843 } 6844 6845 public void write() { 6846 if (settingType != null) 6847 backing.putInt(0, settingType.getValue()); 6848 backing.putDouble(8, min); 6849 backing.putDouble(16, max); 6850 } 6851 6852 public int size() { 6853 return 24; 6854 } 6855 } 6856 6857 public static class GeometricAdvancedSetupDataOption extends DisposedStruct { 6858 public GeometricSetupDataItem type; // It determines the option you want to 6859 // use during the matching phase. 6860 public double value; // Value is the value for the option you want to use 6861 // during the matching phase. 6862 6863 private void init() { 6864 6865 } 6866 6867 public GeometricAdvancedSetupDataOption() { 6868 super(16); 6869 init(); 6870 } 6871 6872 public GeometricAdvancedSetupDataOption(GeometricSetupDataItem type, double value) { 6873 super(16); 6874 this.type = type; 6875 this.value = value; 6876 } 6877 6878 protected GeometricAdvancedSetupDataOption(ByteBuffer backing, int offset) { 6879 super(backing, offset, 16); 6880 init(); 6881 } 6882 6883 protected GeometricAdvancedSetupDataOption(long nativeObj, boolean owned) { 6884 super(nativeObj, owned, 16); 6885 init(); 6886 } 6887 6888 protected void setBuffer(ByteBuffer backing, int offset) { 6889 super.setBuffer(backing, offset, 16); 6890 } 6891 6892 public void read() { 6893 type = GeometricSetupDataItem.fromValue(backing.getInt(0)); 6894 value = backing.getDouble(8); 6895 } 6896 6897 public void write() { 6898 if (type != null) 6899 backing.putInt(0, type.getValue()); 6900 backing.putDouble(8, value); 6901 } 6902 6903 public int size() { 6904 return 16; 6905 } 6906 } 6907 6908 public static class ContourInfoReport extends DisposedStruct { 6909 public PointDouble[] pointsPixel; // Points (pixel) specifies the location 6910 // of every point detected on the curve, 6911 // in pixels. 6912 public PointDouble[] pointsReal; // Points (real) specifies the location of 6913 // every point detected on the curve, in 6914 // calibrated units. 6915 public double[] curvaturePixel; // Curvature Pixel displays the curvature 6916 // profile for the selected contour, in 6917 // pixels. 6918 public double[] curvatureReal; // Curvature Real displays the curvature 6919 // profile for the selected contour, in 6920 // calibrated units. 6921 public double length; // Length (pixel) specifies the length, in pixels, of 6922 // the curves in the image. 6923 public double lengthReal; // Length (real) specifies the length, in 6924 // calibrated units, of the curves within the 6925 // curvature range. 6926 public int hasEquation; // Has Equation specifies whether the contour has a 6927 // fitted equation. 6928 private ByteBuffer pointsPixel_buf; 6929 private ByteBuffer pointsReal_buf; 6930 private ByteBuffer curvaturePixel_buf; 6931 private ByteBuffer curvatureReal_buf; 6932 6933 private void init() { 6934 pointsPixel = new PointDouble[0]; 6935 pointsReal = new PointDouble[0]; 6936 curvaturePixel = new double[0]; 6937 curvatureReal = new double[0]; 6938 } 6939 6940 public ContourInfoReport() { 6941 super(56); 6942 init(); 6943 } 6944 6945 public ContourInfoReport(PointDouble[] pointsPixel, PointDouble[] pointsReal, 6946 double[] curvaturePixel, double[] curvatureReal, double length, double lengthReal, 6947 int hasEquation) { 6948 super(56); 6949 this.pointsPixel = pointsPixel; 6950 this.pointsReal = pointsReal; 6951 this.curvaturePixel = curvaturePixel; 6952 this.curvatureReal = curvatureReal; 6953 this.length = length; 6954 this.lengthReal = lengthReal; 6955 this.hasEquation = hasEquation; 6956 } 6957 6958 protected ContourInfoReport(ByteBuffer backing, int offset) { 6959 super(backing, offset, 56); 6960 init(); 6961 } 6962 6963 protected ContourInfoReport(long nativeObj, boolean owned) { 6964 super(nativeObj, owned, 56); 6965 init(); 6966 } 6967 6968 protected void setBuffer(ByteBuffer backing, int offset) { 6969 super.setBuffer(backing, offset, 56); 6970 } 6971 6972 public void read() { 6973 int pointsPixel_numPointsPixel = backing.getInt(4); 6974 long pointsPixel_addr = getPointer(backing, 0); 6975 pointsPixel = new PointDouble[pointsPixel_numPointsPixel]; 6976 if (pointsPixel_numPointsPixel > 0 && pointsPixel_addr != 0) { 6977 ByteBuffer bb = newDirectByteBuffer(pointsPixel_addr, pointsPixel_numPointsPixel * 16); 6978 for (int i = 0, off = 0; i < pointsPixel_numPointsPixel; i++, off += 16) { 6979 pointsPixel[i] = new PointDouble(bb, off); 6980 pointsPixel[i].read(); 6981 } 6982 } 6983 int pointsReal_numPointsReal = backing.getInt(12); 6984 long pointsReal_addr = getPointer(backing, 8); 6985 pointsReal = new PointDouble[pointsReal_numPointsReal]; 6986 if (pointsReal_numPointsReal > 0 && pointsReal_addr != 0) { 6987 ByteBuffer bb = newDirectByteBuffer(pointsReal_addr, pointsReal_numPointsReal * 16); 6988 for (int i = 0, off = 0; i < pointsReal_numPointsReal; i++, off += 16) { 6989 pointsReal[i] = new PointDouble(bb, off); 6990 pointsReal[i].read(); 6991 } 6992 } 6993 int curvaturePixel_numCurvaturePixel = backing.getInt(20); 6994 long curvaturePixel_addr = getPointer(backing, 16); 6995 curvaturePixel = new double[curvaturePixel_numCurvaturePixel]; 6996 if (curvaturePixel_numCurvaturePixel > 0 && curvaturePixel_addr != 0) { 6997 newDirectByteBuffer(curvaturePixel_addr, curvaturePixel_numCurvaturePixel * 8) 6998 .asDoubleBuffer().get(curvaturePixel); 6999 } 7000 int curvatureReal_numCurvatureReal = backing.getInt(28); 7001 long curvatureReal_addr = getPointer(backing, 24); 7002 curvatureReal = new double[curvatureReal_numCurvatureReal]; 7003 if (curvatureReal_numCurvatureReal > 0 && curvatureReal_addr != 0) { 7004 newDirectByteBuffer(curvatureReal_addr, curvatureReal_numCurvatureReal * 8) 7005 .asDoubleBuffer().get(curvatureReal); 7006 } 7007 length = backing.getDouble(32); 7008 lengthReal = backing.getDouble(40); 7009 hasEquation = backing.getInt(48); 7010 } 7011 7012 public void write() { 7013 pointsPixel_buf = 7014 ByteBuffer.allocateDirect(pointsPixel.length * 16).order(ByteOrder.nativeOrder()); 7015 for (int i = 0, off = 0; i < pointsPixel.length; i++, off += 16) { 7016 pointsPixel[i].setBuffer(pointsPixel_buf, off); 7017 pointsPixel[i].write(); 7018 } 7019 backing.putInt(4, pointsPixel.length); 7020 putPointer(backing, 0, pointsPixel_buf); 7021 pointsReal_buf = 7022 ByteBuffer.allocateDirect(pointsReal.length * 16).order(ByteOrder.nativeOrder()); 7023 for (int i = 0, off = 0; i < pointsReal.length; i++, off += 16) { 7024 pointsReal[i].setBuffer(pointsReal_buf, off); 7025 pointsReal[i].write(); 7026 } 7027 backing.putInt(12, pointsReal.length); 7028 putPointer(backing, 8, pointsReal_buf); 7029 curvaturePixel_buf = 7030 ByteBuffer.allocateDirect(curvaturePixel.length * 8).order(ByteOrder.nativeOrder()); 7031 curvaturePixel_buf.asDoubleBuffer().put(curvaturePixel).rewind(); 7032 backing.putInt(20, curvaturePixel.length); 7033 putPointer(backing, 16, curvaturePixel_buf); 7034 curvatureReal_buf = 7035 ByteBuffer.allocateDirect(curvatureReal.length * 8).order(ByteOrder.nativeOrder()); 7036 curvatureReal_buf.asDoubleBuffer().put(curvatureReal).rewind(); 7037 backing.putInt(28, curvatureReal.length); 7038 putPointer(backing, 24, curvatureReal_buf); 7039 backing.putDouble(32, length); 7040 backing.putDouble(40, lengthReal); 7041 backing.putInt(48, hasEquation); 7042 } 7043 7044 public int size() { 7045 return 56; 7046 } 7047 } 7048 7049 public static class ROILabel extends DisposedStruct { 7050 public String className; // Specifies the classname you want to segment. 7051 public int label; // Label is the label number associated with the Class 7052 // Name. 7053 private ByteBuffer className_buf; 7054 7055 private void init() { 7056 7057 } 7058 7059 public ROILabel() { 7060 super(8); 7061 init(); 7062 } 7063 7064 public ROILabel(String className, int label) { 7065 super(8); 7066 this.className = className; 7067 this.label = label; 7068 } 7069 7070 protected ROILabel(ByteBuffer backing, int offset) { 7071 super(backing, offset, 8); 7072 init(); 7073 } 7074 7075 protected ROILabel(long nativeObj, boolean owned) { 7076 super(nativeObj, owned, 8); 7077 init(); 7078 } 7079 7080 protected void setBuffer(ByteBuffer backing, int offset) { 7081 super.setBuffer(backing, offset, 8); 7082 } 7083 7084 public void read() { 7085 long className_addr = getPointer(backing, 0); 7086 if (className_addr == 0) 7087 className = null; 7088 else { 7089 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 7090 while (bb.get() != 0) { 7091 } 7092 byte[] bytes = new byte[bb.position() - 1]; 7093 getBytes(bb, bytes, 0, bytes.length); 7094 try { 7095 className = new String(bytes, "UTF-8"); 7096 } catch (UnsupportedEncodingException e) { 7097 className = ""; 7098 } 7099 } 7100 7101 label = backing.getInt(4); 7102 } 7103 7104 public void write() { 7105 if (className != null) { 7106 byte[] className_bytes; 7107 try { 7108 className_bytes = className.getBytes("UTF-8"); 7109 } catch (UnsupportedEncodingException e) { 7110 className_bytes = new byte[0]; 7111 } 7112 className_buf = ByteBuffer.allocateDirect(className_bytes.length + 1); 7113 putBytes(className_buf, className_bytes, 0, className_bytes.length).put( 7114 className_bytes.length, (byte) 0); 7115 } 7116 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 7117 backing.putInt(4, label); 7118 } 7119 7120 public int size() { 7121 return 8; 7122 } 7123 } 7124 7125 public static class SupervisedColorSegmentationReport extends DisposedStruct { 7126 public ROILabel[] labelOut; // The Roi labels array. 7127 private ByteBuffer labelOut_buf; 7128 7129 private void init() { 7130 labelOut = new ROILabel[0]; 7131 } 7132 7133 public SupervisedColorSegmentationReport() { 7134 super(8); 7135 init(); 7136 } 7137 7138 public SupervisedColorSegmentationReport(ROILabel[] labelOut) { 7139 super(8); 7140 this.labelOut = labelOut; 7141 } 7142 7143 protected SupervisedColorSegmentationReport(ByteBuffer backing, int offset) { 7144 super(backing, offset, 8); 7145 init(); 7146 } 7147 7148 protected SupervisedColorSegmentationReport(long nativeObj, boolean owned) { 7149 super(nativeObj, owned, 8); 7150 init(); 7151 } 7152 7153 protected void setBuffer(ByteBuffer backing, int offset) { 7154 super.setBuffer(backing, offset, 8); 7155 } 7156 7157 public void read() { 7158 int labelOut_numLabelOut = backing.getInt(4); 7159 long labelOut_addr = getPointer(backing, 0); 7160 labelOut = new ROILabel[labelOut_numLabelOut]; 7161 if (labelOut_numLabelOut > 0 && labelOut_addr != 0) { 7162 ByteBuffer bb = newDirectByteBuffer(labelOut_addr, labelOut_numLabelOut * 8); 7163 for (int i = 0, off = 0; i < labelOut_numLabelOut; i++, off += 8) { 7164 labelOut[i] = new ROILabel(bb, off); 7165 labelOut[i].read(); 7166 } 7167 } 7168 } 7169 7170 public void write() { 7171 labelOut_buf = ByteBuffer.allocateDirect(labelOut.length * 8).order(ByteOrder.nativeOrder()); 7172 for (int i = 0, off = 0; i < labelOut.length; i++, off += 8) { 7173 labelOut[i].setBuffer(labelOut_buf, off); 7174 labelOut[i].write(); 7175 } 7176 backing.putInt(4, labelOut.length); 7177 putPointer(backing, 0, labelOut_buf); 7178 } 7179 7180 public int size() { 7181 return 8; 7182 } 7183 } 7184 7185 public static class LabelToROIReport extends DisposedStruct { 7186 public ROI[] roiArray; // Array of ROIs. 7187 public int[] labelsOutArray; // Array of labels. 7188 public int[] isTooManyVectorsArray; // isTooManyVectorsArray array. 7189 private ByteBuffer roiArray_buf; 7190 private ByteBuffer labelsOutArray_buf; 7191 private ByteBuffer isTooManyVectorsArray_buf; 7192 7193 private void init() { 7194 roiArray = new ROI[0]; 7195 labelsOutArray = new int[0]; 7196 isTooManyVectorsArray = new int[0]; 7197 } 7198 7199 public LabelToROIReport() { 7200 super(24); 7201 init(); 7202 } 7203 7204 public LabelToROIReport(ROI[] roiArray, int[] labelsOutArray, int[] isTooManyVectorsArray) { 7205 super(24); 7206 this.roiArray = roiArray; 7207 this.labelsOutArray = labelsOutArray; 7208 this.isTooManyVectorsArray = isTooManyVectorsArray; 7209 } 7210 7211 protected LabelToROIReport(ByteBuffer backing, int offset) { 7212 super(backing, offset, 24); 7213 init(); 7214 } 7215 7216 protected LabelToROIReport(long nativeObj, boolean owned) { 7217 super(nativeObj, owned, 24); 7218 init(); 7219 } 7220 7221 protected void setBuffer(ByteBuffer backing, int offset) { 7222 super.setBuffer(backing, offset, 24); 7223 } 7224 7225 public void read() { 7226 int roiArray_numOfROIs = backing.getInt(4); 7227 long roiArray_addr = getPointer(backing, 0); 7228 roiArray = new ROI[roiArray_numOfROIs]; 7229 if (roiArray_numOfROIs > 0 && roiArray_addr != 0) { 7230 ByteBuffer bb = newDirectByteBuffer(roiArray_addr, roiArray_numOfROIs * 4); 7231 for (int i = 0, off = 0; i < roiArray_numOfROIs; i++, off += 4) { 7232 roiArray[i] = new ROI(getPointer(bb, off), false); 7233 } 7234 } 7235 int labelsOutArray_numOfLabels = backing.getInt(12); 7236 long labelsOutArray_addr = getPointer(backing, 8); 7237 labelsOutArray = new int[labelsOutArray_numOfLabels]; 7238 if (labelsOutArray_numOfLabels > 0 && labelsOutArray_addr != 0) { 7239 newDirectByteBuffer(labelsOutArray_addr, labelsOutArray_numOfLabels * 4).asIntBuffer().get( 7240 labelsOutArray); 7241 } 7242 int isTooManyVectorsArray_isTooManyVectorsArraySize = backing.getInt(20); 7243 long isTooManyVectorsArray_addr = getPointer(backing, 16); 7244 isTooManyVectorsArray = new int[isTooManyVectorsArray_isTooManyVectorsArraySize]; 7245 if (isTooManyVectorsArray_isTooManyVectorsArraySize > 0 && isTooManyVectorsArray_addr != 0) { 7246 newDirectByteBuffer(isTooManyVectorsArray_addr, 7247 isTooManyVectorsArray_isTooManyVectorsArraySize * 4).asIntBuffer().get( 7248 isTooManyVectorsArray); 7249 } 7250 } 7251 7252 public void write() { 7253 roiArray_buf = ByteBuffer.allocateDirect(roiArray.length * 4).order(ByteOrder.nativeOrder()); 7254 for (int i = 0, off = 0; i < roiArray.length; i++, off += 4) { 7255 putPointer(roiArray_buf, off, roiArray[i]); 7256 } 7257 backing.putInt(4, roiArray.length); 7258 putPointer(backing, 0, roiArray_buf); 7259 labelsOutArray_buf = 7260 ByteBuffer.allocateDirect(labelsOutArray.length * 4).order(ByteOrder.nativeOrder()); 7261 labelsOutArray_buf.asIntBuffer().put(labelsOutArray).rewind(); 7262 backing.putInt(12, labelsOutArray.length); 7263 putPointer(backing, 8, labelsOutArray_buf); 7264 isTooManyVectorsArray_buf = 7265 ByteBuffer.allocateDirect(isTooManyVectorsArray.length * 4) 7266 .order(ByteOrder.nativeOrder()); 7267 isTooManyVectorsArray_buf.asIntBuffer().put(isTooManyVectorsArray).rewind(); 7268 backing.putInt(20, isTooManyVectorsArray.length); 7269 putPointer(backing, 16, isTooManyVectorsArray_buf); 7270 } 7271 7272 public int size() { 7273 return 24; 7274 } 7275 } 7276 7277 public static class ColorSegmenationOptions extends DisposedStruct { 7278 public int windowX; // X is the window size in x direction. 7279 public int windowY; // Y is the window size in y direction. 7280 public int stepSize; // Step Size is the distance between two windows. 7281 public int minParticleArea; // Min Particle Area is the minimum number of 7282 // allowed pixels. 7283 public int maxParticleArea; // Max Particle Area is the maximum number of 7284 // allowed pixels. 7285 public short isFineSegment; // When enabled, the step processes the boundary 7286 // pixels of each segmentation cluster using a 7287 // step size of 1. 7288 7289 private void init() { 7290 7291 } 7292 7293 public ColorSegmenationOptions() { 7294 super(24); 7295 init(); 7296 } 7297 7298 public ColorSegmenationOptions(int windowX, int windowY, int stepSize, int minParticleArea, 7299 int maxParticleArea, int isFineSegment) { 7300 super(24); 7301 this.windowX = windowX; 7302 this.windowY = windowY; 7303 this.stepSize = stepSize; 7304 this.minParticleArea = minParticleArea; 7305 this.maxParticleArea = maxParticleArea; 7306 this.isFineSegment = (short) isFineSegment; 7307 } 7308 7309 protected ColorSegmenationOptions(ByteBuffer backing, int offset) { 7310 super(backing, offset, 24); 7311 init(); 7312 } 7313 7314 protected ColorSegmenationOptions(long nativeObj, boolean owned) { 7315 super(nativeObj, owned, 24); 7316 init(); 7317 } 7318 7319 protected void setBuffer(ByteBuffer backing, int offset) { 7320 super.setBuffer(backing, offset, 24); 7321 } 7322 7323 public void read() { 7324 windowX = backing.getInt(0); 7325 windowY = backing.getInt(4); 7326 stepSize = backing.getInt(8); 7327 minParticleArea = backing.getInt(12); 7328 maxParticleArea = backing.getInt(16); 7329 isFineSegment = backing.getShort(20); 7330 } 7331 7332 public void write() { 7333 backing.putInt(0, windowX); 7334 backing.putInt(4, windowY); 7335 backing.putInt(8, stepSize); 7336 backing.putInt(12, minParticleArea); 7337 backing.putInt(16, maxParticleArea); 7338 backing.putShort(20, isFineSegment); 7339 } 7340 7341 public int size() { 7342 return 24; 7343 } 7344 } 7345 7346 public static class ClassifiedCurve extends DisposedStruct { 7347 public double length; // Specifies the length, in pixels, of the curves 7348 // within the curvature range. 7349 public double lengthReal; // specifies the length, in calibrated units, of 7350 // the curves within the curvature range. 7351 public double maxCurvature; // specifies the maximum curvature, in pixels, 7352 // for the selected curvature range. 7353 public double maxCurvatureReal; // specifies the maximum curvature, in 7354 // calibrated units, for the selected 7355 // curvature range. 7356 public int label; // specifies the class to which the the sample belongs. 7357 public PointDouble[] curvePoints; // Curve Points is a point-coordinate 7358 // cluster that defines the points of the 7359 // curve. 7360 private ByteBuffer curvePoints_buf; 7361 7362 private void init() { 7363 curvePoints = new PointDouble[0]; 7364 } 7365 7366 public ClassifiedCurve() { 7367 super(48); 7368 init(); 7369 } 7370 7371 public ClassifiedCurve(double length, double lengthReal, double maxCurvature, 7372 double maxCurvatureReal, int label, PointDouble[] curvePoints) { 7373 super(48); 7374 this.length = length; 7375 this.lengthReal = lengthReal; 7376 this.maxCurvature = maxCurvature; 7377 this.maxCurvatureReal = maxCurvatureReal; 7378 this.label = label; 7379 this.curvePoints = curvePoints; 7380 } 7381 7382 protected ClassifiedCurve(ByteBuffer backing, int offset) { 7383 super(backing, offset, 48); 7384 init(); 7385 } 7386 7387 protected ClassifiedCurve(long nativeObj, boolean owned) { 7388 super(nativeObj, owned, 48); 7389 init(); 7390 } 7391 7392 protected void setBuffer(ByteBuffer backing, int offset) { 7393 super.setBuffer(backing, offset, 48); 7394 } 7395 7396 public void read() { 7397 length = backing.getDouble(0); 7398 lengthReal = backing.getDouble(8); 7399 maxCurvature = backing.getDouble(16); 7400 maxCurvatureReal = backing.getDouble(24); 7401 label = backing.getInt(32); 7402 int curvePoints_numCurvePoints = backing.getInt(40); 7403 long curvePoints_addr = getPointer(backing, 36); 7404 curvePoints = new PointDouble[curvePoints_numCurvePoints]; 7405 if (curvePoints_numCurvePoints > 0 && curvePoints_addr != 0) { 7406 ByteBuffer bb = newDirectByteBuffer(curvePoints_addr, curvePoints_numCurvePoints * 16); 7407 for (int i = 0, off = 0; i < curvePoints_numCurvePoints; i++, off += 16) { 7408 curvePoints[i] = new PointDouble(bb, off); 7409 curvePoints[i].read(); 7410 } 7411 } 7412 } 7413 7414 public void write() { 7415 backing.putDouble(0, length); 7416 backing.putDouble(8, lengthReal); 7417 backing.putDouble(16, maxCurvature); 7418 backing.putDouble(24, maxCurvatureReal); 7419 backing.putInt(32, label); 7420 curvePoints_buf = 7421 ByteBuffer.allocateDirect(curvePoints.length * 16).order(ByteOrder.nativeOrder()); 7422 for (int i = 0, off = 0; i < curvePoints.length; i++, off += 16) { 7423 curvePoints[i].setBuffer(curvePoints_buf, off); 7424 curvePoints[i].write(); 7425 } 7426 backing.putInt(40, curvePoints.length); 7427 putPointer(backing, 36, curvePoints_buf); 7428 } 7429 7430 public int size() { 7431 return 48; 7432 } 7433 } 7434 7435 public static class RangeDouble extends DisposedStruct { 7436 public double minValue; // The minimum value of the range. 7437 public double maxValue; // The maximum value of the range. 7438 7439 private void init() { 7440 7441 } 7442 7443 public RangeDouble() { 7444 super(16); 7445 init(); 7446 } 7447 7448 public RangeDouble(double minValue, double maxValue) { 7449 super(16); 7450 this.minValue = minValue; 7451 this.maxValue = maxValue; 7452 } 7453 7454 protected RangeDouble(ByteBuffer backing, int offset) { 7455 super(backing, offset, 16); 7456 init(); 7457 } 7458 7459 protected RangeDouble(long nativeObj, boolean owned) { 7460 super(nativeObj, owned, 16); 7461 init(); 7462 } 7463 7464 protected void setBuffer(ByteBuffer backing, int offset) { 7465 super.setBuffer(backing, offset, 16); 7466 } 7467 7468 public void read() { 7469 minValue = backing.getDouble(0); 7470 maxValue = backing.getDouble(8); 7471 } 7472 7473 public void write() { 7474 backing.putDouble(0, minValue); 7475 backing.putDouble(8, maxValue); 7476 } 7477 7478 public int size() { 7479 return 16; 7480 } 7481 } 7482 7483 public static class RangeLabel extends DisposedStruct { 7484 public RangeDouble range; // Specifies the range of curvature values. 7485 public int label; // Class Label specifies the class to which the the sample 7486 // belongs. 7487 7488 private void init() { 7489 range = new RangeDouble(backing, 0); 7490 } 7491 7492 public RangeLabel() { 7493 super(24); 7494 init(); 7495 } 7496 7497 public RangeLabel(RangeDouble range, int label) { 7498 super(24); 7499 this.range = range; 7500 this.label = label; 7501 } 7502 7503 protected RangeLabel(ByteBuffer backing, int offset) { 7504 super(backing, offset, 24); 7505 init(); 7506 } 7507 7508 protected RangeLabel(long nativeObj, boolean owned) { 7509 super(nativeObj, owned, 24); 7510 init(); 7511 } 7512 7513 protected void setBuffer(ByteBuffer backing, int offset) { 7514 super.setBuffer(backing, offset, 24); 7515 } 7516 7517 public void read() { 7518 range.read(); 7519 label = backing.getInt(16); 7520 } 7521 7522 public void write() { 7523 range.write(); 7524 backing.putInt(16, label); 7525 } 7526 7527 public int size() { 7528 return 24; 7529 } 7530 } 7531 7532 public static class CurvatureAnalysisReport extends DisposedStruct { 7533 public ClassifiedCurve[] curves; 7534 private ByteBuffer curves_buf; 7535 7536 private void init() { 7537 curves = new ClassifiedCurve[0]; 7538 } 7539 7540 public CurvatureAnalysisReport() { 7541 super(8); 7542 init(); 7543 } 7544 7545 public CurvatureAnalysisReport(ClassifiedCurve[] curves) { 7546 super(8); 7547 this.curves = curves; 7548 } 7549 7550 protected CurvatureAnalysisReport(ByteBuffer backing, int offset) { 7551 super(backing, offset, 8); 7552 init(); 7553 } 7554 7555 protected CurvatureAnalysisReport(long nativeObj, boolean owned) { 7556 super(nativeObj, owned, 8); 7557 init(); 7558 } 7559 7560 protected void setBuffer(ByteBuffer backing, int offset) { 7561 super.setBuffer(backing, offset, 8); 7562 } 7563 7564 public void read() { 7565 int curves_numCurves = backing.getInt(4); 7566 long curves_addr = getPointer(backing, 0); 7567 curves = new ClassifiedCurve[curves_numCurves]; 7568 if (curves_numCurves > 0 && curves_addr != 0) { 7569 ByteBuffer bb = newDirectByteBuffer(curves_addr, curves_numCurves * 48); 7570 for (int i = 0, off = 0; i < curves_numCurves; i++, off += 48) { 7571 curves[i] = new ClassifiedCurve(bb, off); 7572 curves[i].read(); 7573 } 7574 } 7575 } 7576 7577 public void write() { 7578 curves_buf = ByteBuffer.allocateDirect(curves.length * 48).order(ByteOrder.nativeOrder()); 7579 for (int i = 0, off = 0; i < curves.length; i++, off += 48) { 7580 curves[i].setBuffer(curves_buf, off); 7581 curves[i].write(); 7582 } 7583 backing.putInt(4, curves.length); 7584 putPointer(backing, 0, curves_buf); 7585 } 7586 7587 public int size() { 7588 return 8; 7589 } 7590 } 7591 7592 public static class Disparity extends DisposedStruct { 7593 public PointDouble current; // Current is a array of points that defines the 7594 // target contour. 7595 public PointDouble reference; // reference is a array of points that defines 7596 // the template contour. 7597 public double distance; // Specifies the distance, in pixels, between the 7598 // template contour point and the target contour 7599 // point. 7600 7601 private void init() { 7602 current = new PointDouble(backing, 0); 7603 reference = new PointDouble(backing, 16); 7604 } 7605 7606 public Disparity() { 7607 super(40); 7608 init(); 7609 } 7610 7611 public Disparity(PointDouble current, PointDouble reference, double distance) { 7612 super(40); 7613 this.current = current; 7614 this.reference = reference; 7615 this.distance = distance; 7616 } 7617 7618 protected Disparity(ByteBuffer backing, int offset) { 7619 super(backing, offset, 40); 7620 init(); 7621 } 7622 7623 protected Disparity(long nativeObj, boolean owned) { 7624 super(nativeObj, owned, 40); 7625 init(); 7626 } 7627 7628 protected void setBuffer(ByteBuffer backing, int offset) { 7629 super.setBuffer(backing, offset, 40); 7630 } 7631 7632 public void read() { 7633 current.read(); 7634 reference.read(); 7635 distance = backing.getDouble(32); 7636 } 7637 7638 public void write() { 7639 current.write(); 7640 reference.write(); 7641 backing.putDouble(32, distance); 7642 } 7643 7644 public int size() { 7645 return 40; 7646 } 7647 } 7648 7649 public static class ComputeDistancesReport extends DisposedStruct { 7650 public Disparity[] distances; // Distances is an array containing the 7651 // computed distances. 7652 public Disparity[] distancesReal; // Distances Real is an array containing 7653 // the computed distances in calibrated 7654 // units. 7655 private ByteBuffer distances_buf; 7656 private ByteBuffer distancesReal_buf; 7657 7658 private void init() { 7659 distances = new Disparity[0]; 7660 distancesReal = new Disparity[0]; 7661 } 7662 7663 public ComputeDistancesReport() { 7664 super(16); 7665 init(); 7666 } 7667 7668 public ComputeDistancesReport(Disparity[] distances, Disparity[] distancesReal) { 7669 super(16); 7670 this.distances = distances; 7671 this.distancesReal = distancesReal; 7672 } 7673 7674 protected ComputeDistancesReport(ByteBuffer backing, int offset) { 7675 super(backing, offset, 16); 7676 init(); 7677 } 7678 7679 protected ComputeDistancesReport(long nativeObj, boolean owned) { 7680 super(nativeObj, owned, 16); 7681 init(); 7682 } 7683 7684 protected void setBuffer(ByteBuffer backing, int offset) { 7685 super.setBuffer(backing, offset, 16); 7686 } 7687 7688 public void read() { 7689 int distances_numDistances = backing.getInt(4); 7690 long distances_addr = getPointer(backing, 0); 7691 distances = new Disparity[distances_numDistances]; 7692 if (distances_numDistances > 0 && distances_addr != 0) { 7693 ByteBuffer bb = newDirectByteBuffer(distances_addr, distances_numDistances * 40); 7694 for (int i = 0, off = 0; i < distances_numDistances; i++, off += 40) { 7695 distances[i] = new Disparity(bb, off); 7696 distances[i].read(); 7697 } 7698 } 7699 int distancesReal_numDistancesReal = backing.getInt(12); 7700 long distancesReal_addr = getPointer(backing, 8); 7701 distancesReal = new Disparity[distancesReal_numDistancesReal]; 7702 if (distancesReal_numDistancesReal > 0 && distancesReal_addr != 0) { 7703 ByteBuffer bb = 7704 newDirectByteBuffer(distancesReal_addr, distancesReal_numDistancesReal * 40); 7705 for (int i = 0, off = 0; i < distancesReal_numDistancesReal; i++, off += 40) { 7706 distancesReal[i] = new Disparity(bb, off); 7707 distancesReal[i].read(); 7708 } 7709 } 7710 } 7711 7712 public void write() { 7713 distances_buf = 7714 ByteBuffer.allocateDirect(distances.length * 40).order(ByteOrder.nativeOrder()); 7715 for (int i = 0, off = 0; i < distances.length; i++, off += 40) { 7716 distances[i].setBuffer(distances_buf, off); 7717 distances[i].write(); 7718 } 7719 backing.putInt(4, distances.length); 7720 putPointer(backing, 0, distances_buf); 7721 distancesReal_buf = 7722 ByteBuffer.allocateDirect(distancesReal.length * 40).order(ByteOrder.nativeOrder()); 7723 for (int i = 0, off = 0; i < distancesReal.length; i++, off += 40) { 7724 distancesReal[i].setBuffer(distancesReal_buf, off); 7725 distancesReal[i].write(); 7726 } 7727 backing.putInt(12, distancesReal.length); 7728 putPointer(backing, 8, distancesReal_buf); 7729 } 7730 7731 public int size() { 7732 return 16; 7733 } 7734 } 7735 7736 public static class MatchMode extends DisposedStruct { 7737 public int rotation; // Rotation When enabled, the Function searches for 7738 // occurrences of the template in the inspection image, 7739 // allowing for template matches to be rotated. 7740 public int scale; // Rotation When enabled, the Function searches for 7741 // occurrences of the template in the inspection image, 7742 // allowing for template matches to be rotated. 7743 public int occlusion; // Occlusion specifies whether or not to search for 7744 // occluded versions of the shape. 7745 7746 private void init() { 7747 7748 } 7749 7750 public MatchMode() { 7751 super(12); 7752 init(); 7753 } 7754 7755 public MatchMode(int rotation, int scale, int occlusion) { 7756 super(12); 7757 this.rotation = rotation; 7758 this.scale = scale; 7759 this.occlusion = occlusion; 7760 } 7761 7762 protected MatchMode(ByteBuffer backing, int offset) { 7763 super(backing, offset, 12); 7764 init(); 7765 } 7766 7767 protected MatchMode(long nativeObj, boolean owned) { 7768 super(nativeObj, owned, 12); 7769 init(); 7770 } 7771 7772 protected void setBuffer(ByteBuffer backing, int offset) { 7773 super.setBuffer(backing, offset, 12); 7774 } 7775 7776 public void read() { 7777 rotation = backing.getInt(0); 7778 scale = backing.getInt(4); 7779 occlusion = backing.getInt(8); 7780 } 7781 7782 public void write() { 7783 backing.putInt(0, rotation); 7784 backing.putInt(4, scale); 7785 backing.putInt(8, occlusion); 7786 } 7787 7788 public int size() { 7789 return 12; 7790 } 7791 } 7792 7793 public static class ClassifiedDisparity extends DisposedStruct { 7794 public double length; // Length (pixel) specifies the length, in pixels, of 7795 // the curves within the curvature range. 7796 public double lengthReal; // Length (real) specifies the length, in 7797 // calibrated units, of the curves within the 7798 // curvature range. 7799 public double maxDistance; // Maximum Distance (pixel) specifies the maximum 7800 // distance, in pixels, between points along the 7801 // selected contour and the template contour. 7802 public double maxDistanceReal; // Maximum Distance (real) specifies the 7803 // maximum distance, in calibrated units, 7804 // between points along the selected contour 7805 // and the template contour. 7806 public int label; // Class Label specifies the class to which the the sample 7807 // belongs. 7808 public PointDouble[] templateSubsection; // Template subsection points is an 7809 // array of points that defines the 7810 // boundary of the template. 7811 public PointDouble[] targetSubsection; // Current Points(Target subsection 7812 // points) is an array of points that 7813 // defines the boundary of the 7814 // target. 7815 private ByteBuffer templateSubsection_buf; 7816 private ByteBuffer targetSubsection_buf; 7817 7818 private void init() { 7819 templateSubsection = new PointDouble[0]; 7820 targetSubsection = new PointDouble[0]; 7821 } 7822 7823 public ClassifiedDisparity() { 7824 super(56); 7825 init(); 7826 } 7827 7828 public ClassifiedDisparity(double length, double lengthReal, double maxDistance, 7829 double maxDistanceReal, int label, PointDouble[] templateSubsection, 7830 PointDouble[] targetSubsection) { 7831 super(56); 7832 this.length = length; 7833 this.lengthReal = lengthReal; 7834 this.maxDistance = maxDistance; 7835 this.maxDistanceReal = maxDistanceReal; 7836 this.label = label; 7837 this.templateSubsection = templateSubsection; 7838 this.targetSubsection = targetSubsection; 7839 } 7840 7841 protected ClassifiedDisparity(ByteBuffer backing, int offset) { 7842 super(backing, offset, 56); 7843 init(); 7844 } 7845 7846 protected ClassifiedDisparity(long nativeObj, boolean owned) { 7847 super(nativeObj, owned, 56); 7848 init(); 7849 } 7850 7851 protected void setBuffer(ByteBuffer backing, int offset) { 7852 super.setBuffer(backing, offset, 56); 7853 } 7854 7855 public void read() { 7856 length = backing.getDouble(0); 7857 lengthReal = backing.getDouble(8); 7858 maxDistance = backing.getDouble(16); 7859 maxDistanceReal = backing.getDouble(24); 7860 label = backing.getInt(32); 7861 int templateSubsection_numTemplateSubsection = backing.getInt(40); 7862 long templateSubsection_addr = getPointer(backing, 36); 7863 templateSubsection = new PointDouble[templateSubsection_numTemplateSubsection]; 7864 if (templateSubsection_numTemplateSubsection > 0 && templateSubsection_addr != 0) { 7865 ByteBuffer bb = 7866 newDirectByteBuffer(templateSubsection_addr, 7867 templateSubsection_numTemplateSubsection * 16); 7868 for (int i = 0, off = 0; i < templateSubsection_numTemplateSubsection; i++, off += 16) { 7869 templateSubsection[i] = new PointDouble(bb, off); 7870 templateSubsection[i].read(); 7871 } 7872 } 7873 int targetSubsection_numTargetSubsection = backing.getInt(48); 7874 long targetSubsection_addr = getPointer(backing, 44); 7875 targetSubsection = new PointDouble[targetSubsection_numTargetSubsection]; 7876 if (targetSubsection_numTargetSubsection > 0 && targetSubsection_addr != 0) { 7877 ByteBuffer bb = 7878 newDirectByteBuffer(targetSubsection_addr, targetSubsection_numTargetSubsection * 16); 7879 for (int i = 0, off = 0; i < targetSubsection_numTargetSubsection; i++, off += 16) { 7880 targetSubsection[i] = new PointDouble(bb, off); 7881 targetSubsection[i].read(); 7882 } 7883 } 7884 } 7885 7886 public void write() { 7887 backing.putDouble(0, length); 7888 backing.putDouble(8, lengthReal); 7889 backing.putDouble(16, maxDistance); 7890 backing.putDouble(24, maxDistanceReal); 7891 backing.putInt(32, label); 7892 templateSubsection_buf = 7893 ByteBuffer.allocateDirect(templateSubsection.length * 16).order(ByteOrder.nativeOrder()); 7894 for (int i = 0, off = 0; i < templateSubsection.length; i++, off += 16) { 7895 templateSubsection[i].setBuffer(templateSubsection_buf, off); 7896 templateSubsection[i].write(); 7897 } 7898 backing.putInt(40, templateSubsection.length); 7899 putPointer(backing, 36, templateSubsection_buf); 7900 targetSubsection_buf = 7901 ByteBuffer.allocateDirect(targetSubsection.length * 16).order(ByteOrder.nativeOrder()); 7902 for (int i = 0, off = 0; i < targetSubsection.length; i++, off += 16) { 7903 targetSubsection[i].setBuffer(targetSubsection_buf, off); 7904 targetSubsection[i].write(); 7905 } 7906 backing.putInt(48, targetSubsection.length); 7907 putPointer(backing, 44, targetSubsection_buf); 7908 } 7909 7910 public int size() { 7911 return 56; 7912 } 7913 } 7914 7915 public static class ClassifyDistancesReport extends DisposedStruct { 7916 public ClassifiedDisparity[] classifiedDistances; // Disparity array 7917 // containing the 7918 // classified distances. 7919 private ByteBuffer classifiedDistances_buf; 7920 7921 private void init() { 7922 classifiedDistances = new ClassifiedDisparity[0]; 7923 } 7924 7925 public ClassifyDistancesReport() { 7926 super(8); 7927 init(); 7928 } 7929 7930 public ClassifyDistancesReport(ClassifiedDisparity[] classifiedDistances) { 7931 super(8); 7932 this.classifiedDistances = classifiedDistances; 7933 } 7934 7935 protected ClassifyDistancesReport(ByteBuffer backing, int offset) { 7936 super(backing, offset, 8); 7937 init(); 7938 } 7939 7940 protected ClassifyDistancesReport(long nativeObj, boolean owned) { 7941 super(nativeObj, owned, 8); 7942 init(); 7943 } 7944 7945 protected void setBuffer(ByteBuffer backing, int offset) { 7946 super.setBuffer(backing, offset, 8); 7947 } 7948 7949 public void read() { 7950 int classifiedDistances_numClassifiedDistances = backing.getInt(4); 7951 long classifiedDistances_addr = getPointer(backing, 0); 7952 classifiedDistances = new ClassifiedDisparity[classifiedDistances_numClassifiedDistances]; 7953 if (classifiedDistances_numClassifiedDistances > 0 && classifiedDistances_addr != 0) { 7954 ByteBuffer bb = 7955 newDirectByteBuffer(classifiedDistances_addr, 7956 classifiedDistances_numClassifiedDistances * 56); 7957 for (int i = 0, off = 0; i < classifiedDistances_numClassifiedDistances; i++, off += 56) { 7958 classifiedDistances[i] = new ClassifiedDisparity(bb, off); 7959 classifiedDistances[i].read(); 7960 } 7961 } 7962 } 7963 7964 public void write() { 7965 classifiedDistances_buf = 7966 ByteBuffer.allocateDirect(classifiedDistances.length * 56).order(ByteOrder.nativeOrder()); 7967 for (int i = 0, off = 0; i < classifiedDistances.length; i++, off += 56) { 7968 classifiedDistances[i].setBuffer(classifiedDistances_buf, off); 7969 classifiedDistances[i].write(); 7970 } 7971 backing.putInt(4, classifiedDistances.length); 7972 putPointer(backing, 0, classifiedDistances_buf); 7973 } 7974 7975 public int size() { 7976 return 8; 7977 } 7978 } 7979 7980 public static class ContourComputeCurvatureReport extends DisposedStruct { 7981 public double[] curvaturePixel; // Curvature Pixel displays the curvature 7982 // profile for the selected contour, in 7983 // pixels. 7984 public double[] curvatureReal; // Curvature Real displays the curvature 7985 // profile for the selected contour, in 7986 // calibrated units. 7987 private ByteBuffer curvaturePixel_buf; 7988 private ByteBuffer curvatureReal_buf; 7989 7990 private void init() { 7991 curvaturePixel = new double[0]; 7992 curvatureReal = new double[0]; 7993 } 7994 7995 public ContourComputeCurvatureReport() { 7996 super(16); 7997 init(); 7998 } 7999 8000 public ContourComputeCurvatureReport(double[] curvaturePixel, double[] curvatureReal) { 8001 super(16); 8002 this.curvaturePixel = curvaturePixel; 8003 this.curvatureReal = curvatureReal; 8004 } 8005 8006 protected ContourComputeCurvatureReport(ByteBuffer backing, int offset) { 8007 super(backing, offset, 16); 8008 init(); 8009 } 8010 8011 protected ContourComputeCurvatureReport(long nativeObj, boolean owned) { 8012 super(nativeObj, owned, 16); 8013 init(); 8014 } 8015 8016 protected void setBuffer(ByteBuffer backing, int offset) { 8017 super.setBuffer(backing, offset, 16); 8018 } 8019 8020 public void read() { 8021 int curvaturePixel_numCurvaturePixel = backing.getInt(4); 8022 long curvaturePixel_addr = getPointer(backing, 0); 8023 curvaturePixel = new double[curvaturePixel_numCurvaturePixel]; 8024 if (curvaturePixel_numCurvaturePixel > 0 && curvaturePixel_addr != 0) { 8025 newDirectByteBuffer(curvaturePixel_addr, curvaturePixel_numCurvaturePixel * 8) 8026 .asDoubleBuffer().get(curvaturePixel); 8027 } 8028 int curvatureReal_numCurvatureReal = backing.getInt(12); 8029 long curvatureReal_addr = getPointer(backing, 8); 8030 curvatureReal = new double[curvatureReal_numCurvatureReal]; 8031 if (curvatureReal_numCurvatureReal > 0 && curvatureReal_addr != 0) { 8032 newDirectByteBuffer(curvatureReal_addr, curvatureReal_numCurvatureReal * 8) 8033 .asDoubleBuffer().get(curvatureReal); 8034 } 8035 } 8036 8037 public void write() { 8038 curvaturePixel_buf = 8039 ByteBuffer.allocateDirect(curvaturePixel.length * 8).order(ByteOrder.nativeOrder()); 8040 curvaturePixel_buf.asDoubleBuffer().put(curvaturePixel).rewind(); 8041 backing.putInt(4, curvaturePixel.length); 8042 putPointer(backing, 0, curvaturePixel_buf); 8043 curvatureReal_buf = 8044 ByteBuffer.allocateDirect(curvatureReal.length * 8).order(ByteOrder.nativeOrder()); 8045 curvatureReal_buf.asDoubleBuffer().put(curvatureReal).rewind(); 8046 backing.putInt(12, curvatureReal.length); 8047 putPointer(backing, 8, curvatureReal_buf); 8048 } 8049 8050 public int size() { 8051 return 16; 8052 } 8053 } 8054 8055 public static class ContourOverlaySettings extends DisposedStruct { 8056 public int overlay; // Overlay specifies whether to display the overlay on 8057 // the image. 8058 public RGBValue color; // Color is the color of the overlay. 8059 public int width; // Width specifies the width of the overlay in pixels. 8060 public int maintainWidth; // Maintain Width? specifies whether you want the 8061 // overlay measured in screen pixels or image 8062 // pixels. 8063 8064 private void init() { 8065 color = new RGBValue(backing, 4); 8066 } 8067 8068 public ContourOverlaySettings() { 8069 super(16); 8070 init(); 8071 } 8072 8073 public ContourOverlaySettings(int overlay, RGBValue color, int width, int maintainWidth) { 8074 super(16); 8075 this.overlay = overlay; 8076 this.color = color; 8077 this.width = width; 8078 this.maintainWidth = maintainWidth; 8079 } 8080 8081 protected ContourOverlaySettings(ByteBuffer backing, int offset) { 8082 super(backing, offset, 16); 8083 init(); 8084 } 8085 8086 protected ContourOverlaySettings(long nativeObj, boolean owned) { 8087 super(nativeObj, owned, 16); 8088 init(); 8089 } 8090 8091 protected void setBuffer(ByteBuffer backing, int offset) { 8092 super.setBuffer(backing, offset, 16); 8093 } 8094 8095 public void read() { 8096 overlay = backing.getInt(0); 8097 color.read(); 8098 width = backing.getInt(8); 8099 maintainWidth = backing.getInt(12); 8100 } 8101 8102 public void write() { 8103 backing.putInt(0, overlay); 8104 color.write(); 8105 backing.putInt(8, width); 8106 backing.putInt(12, maintainWidth); 8107 } 8108 8109 public int size() { 8110 return 16; 8111 } 8112 } 8113 8114 public static class CurveParameters extends DisposedStruct { 8115 public ExtractionMode extractionMode; // Specifies the method the function 8116 // uses to identify curves in the 8117 // image. 8118 public int threshold; // Specifies the minimum contrast a seed point must 8119 // have in order to begin a curve. 8120 public EdgeFilterSize filterSize; // Specifies the width of the edge filter 8121 // the function uses to identify curves in 8122 // the image. 8123 public int minLength; // Specifies the length, in pixels, of the smallest 8124 // curve the function will extract. 8125 public int searchStep; // Search Step Size specifies the distance, in the y 8126 // direction, between the image rows that the 8127 // algorithm inspects for curve seed points. 8128 public int maxEndPointGap; // Specifies the maximum gap, in pixels, between 8129 // the endpoints of a curve that the function 8130 // identifies as a closed curve. 8131 public int subpixel; // Subpixel specifies whether to detect curve points 8132 // with subpixel accuracy. 8133 8134 private void init() { 8135 8136 } 8137 8138 public CurveParameters() { 8139 super(28); 8140 init(); 8141 } 8142 8143 public CurveParameters(ExtractionMode extractionMode, int threshold, EdgeFilterSize filterSize, 8144 int minLength, int searchStep, int maxEndPointGap, int subpixel) { 8145 super(28); 8146 this.extractionMode = extractionMode; 8147 this.threshold = threshold; 8148 this.filterSize = filterSize; 8149 this.minLength = minLength; 8150 this.searchStep = searchStep; 8151 this.maxEndPointGap = maxEndPointGap; 8152 this.subpixel = subpixel; 8153 } 8154 8155 protected CurveParameters(ByteBuffer backing, int offset) { 8156 super(backing, offset, 28); 8157 init(); 8158 } 8159 8160 protected CurveParameters(long nativeObj, boolean owned) { 8161 super(nativeObj, owned, 28); 8162 init(); 8163 } 8164 8165 protected void setBuffer(ByteBuffer backing, int offset) { 8166 super.setBuffer(backing, offset, 28); 8167 } 8168 8169 public void read() { 8170 extractionMode = ExtractionMode.fromValue(backing.getInt(0)); 8171 threshold = backing.getInt(4); 8172 filterSize = EdgeFilterSize.fromValue(backing.getInt(8)); 8173 minLength = backing.getInt(12); 8174 searchStep = backing.getInt(16); 8175 maxEndPointGap = backing.getInt(20); 8176 subpixel = backing.getInt(24); 8177 } 8178 8179 public void write() { 8180 if (extractionMode != null) 8181 backing.putInt(0, extractionMode.getValue()); 8182 backing.putInt(4, threshold); 8183 if (filterSize != null) 8184 backing.putInt(8, filterSize.getValue()); 8185 backing.putInt(12, minLength); 8186 backing.putInt(16, searchStep); 8187 backing.putInt(20, maxEndPointGap); 8188 backing.putInt(24, subpixel); 8189 } 8190 8191 public int size() { 8192 return 28; 8193 } 8194 } 8195 8196 public static class ExtractContourReport extends DisposedStruct { 8197 public PointDouble[] contourPoints; // Contour Points specifies every point 8198 // found on the contour. 8199 public PointDouble[] sourcePoints; // Source Image Points specifies every 8200 // point found on the contour in the 8201 // source image. 8202 private ByteBuffer contourPoints_buf; 8203 private ByteBuffer sourcePoints_buf; 8204 8205 private void init() { 8206 contourPoints = new PointDouble[0]; 8207 sourcePoints = new PointDouble[0]; 8208 } 8209 8210 public ExtractContourReport() { 8211 super(16); 8212 init(); 8213 } 8214 8215 public ExtractContourReport(PointDouble[] contourPoints, PointDouble[] sourcePoints) { 8216 super(16); 8217 this.contourPoints = contourPoints; 8218 this.sourcePoints = sourcePoints; 8219 } 8220 8221 protected ExtractContourReport(ByteBuffer backing, int offset) { 8222 super(backing, offset, 16); 8223 init(); 8224 } 8225 8226 protected ExtractContourReport(long nativeObj, boolean owned) { 8227 super(nativeObj, owned, 16); 8228 init(); 8229 } 8230 8231 protected void setBuffer(ByteBuffer backing, int offset) { 8232 super.setBuffer(backing, offset, 16); 8233 } 8234 8235 public void read() { 8236 int contourPoints_numContourPoints = backing.getInt(4); 8237 long contourPoints_addr = getPointer(backing, 0); 8238 contourPoints = new PointDouble[contourPoints_numContourPoints]; 8239 if (contourPoints_numContourPoints > 0 && contourPoints_addr != 0) { 8240 ByteBuffer bb = 8241 newDirectByteBuffer(contourPoints_addr, contourPoints_numContourPoints * 16); 8242 for (int i = 0, off = 0; i < contourPoints_numContourPoints; i++, off += 16) { 8243 contourPoints[i] = new PointDouble(bb, off); 8244 contourPoints[i].read(); 8245 } 8246 } 8247 int sourcePoints_numSourcePoints = backing.getInt(12); 8248 long sourcePoints_addr = getPointer(backing, 8); 8249 sourcePoints = new PointDouble[sourcePoints_numSourcePoints]; 8250 if (sourcePoints_numSourcePoints > 0 && sourcePoints_addr != 0) { 8251 ByteBuffer bb = newDirectByteBuffer(sourcePoints_addr, sourcePoints_numSourcePoints * 16); 8252 for (int i = 0, off = 0; i < sourcePoints_numSourcePoints; i++, off += 16) { 8253 sourcePoints[i] = new PointDouble(bb, off); 8254 sourcePoints[i].read(); 8255 } 8256 } 8257 } 8258 8259 public void write() { 8260 contourPoints_buf = 8261 ByteBuffer.allocateDirect(contourPoints.length * 16).order(ByteOrder.nativeOrder()); 8262 for (int i = 0, off = 0; i < contourPoints.length; i++, off += 16) { 8263 contourPoints[i].setBuffer(contourPoints_buf, off); 8264 contourPoints[i].write(); 8265 } 8266 backing.putInt(4, contourPoints.length); 8267 putPointer(backing, 0, contourPoints_buf); 8268 sourcePoints_buf = 8269 ByteBuffer.allocateDirect(sourcePoints.length * 16).order(ByteOrder.nativeOrder()); 8270 for (int i = 0, off = 0; i < sourcePoints.length; i++, off += 16) { 8271 sourcePoints[i].setBuffer(sourcePoints_buf, off); 8272 sourcePoints[i].write(); 8273 } 8274 backing.putInt(12, sourcePoints.length); 8275 putPointer(backing, 8, sourcePoints_buf); 8276 } 8277 8278 public int size() { 8279 return 16; 8280 } 8281 } 8282 8283 public static class ConnectionConstraint extends DisposedStruct { 8284 public ConnectionConstraintType constraintType; // Constraint Type specifies 8285 // what criteria to use to 8286 // consider two curves part 8287 // of a contour. 8288 public RangeDouble range; // Specifies range for a given Match Constraint. 8289 8290 private void init() { 8291 range = new RangeDouble(backing, 8); 8292 } 8293 8294 public ConnectionConstraint() { 8295 super(24); 8296 init(); 8297 } 8298 8299 public ConnectionConstraint(ConnectionConstraintType constraintType, RangeDouble range) { 8300 super(24); 8301 this.constraintType = constraintType; 8302 this.range = range; 8303 } 8304 8305 protected ConnectionConstraint(ByteBuffer backing, int offset) { 8306 super(backing, offset, 24); 8307 init(); 8308 } 8309 8310 protected ConnectionConstraint(long nativeObj, boolean owned) { 8311 super(nativeObj, owned, 24); 8312 init(); 8313 } 8314 8315 protected void setBuffer(ByteBuffer backing, int offset) { 8316 super.setBuffer(backing, offset, 24); 8317 } 8318 8319 public void read() { 8320 constraintType = ConnectionConstraintType.fromValue(backing.getInt(0)); 8321 range.read(); 8322 } 8323 8324 public void write() { 8325 if (constraintType != null) 8326 backing.putInt(0, constraintType.getValue()); 8327 range.write(); 8328 } 8329 8330 public int size() { 8331 return 24; 8332 } 8333 } 8334 8335 public static class ExtractTextureFeaturesReport extends DisposedStruct { 8336 public int[] waveletBands; // The array having all the Wavelet Banks used 8337 // for extraction. 8338 public int textureFeaturesRows; // Number of Rows in the Texture Features 8339 // array. 8340 public int textureFeaturesCols; // Number of Cols in Texture Features array. 8341 private ByteBuffer waveletBands_buf; 8342 8343 private void init() { 8344 waveletBands = new int[0]; 8345 } 8346 8347 public ExtractTextureFeaturesReport() { 8348 super(20); 8349 init(); 8350 } 8351 8352 public ExtractTextureFeaturesReport(int[] waveletBands, int textureFeaturesRows, 8353 int textureFeaturesCols) { 8354 super(20); 8355 this.waveletBands = waveletBands; 8356 this.textureFeaturesRows = textureFeaturesRows; 8357 this.textureFeaturesCols = textureFeaturesCols; 8358 } 8359 8360 protected ExtractTextureFeaturesReport(ByteBuffer backing, int offset) { 8361 super(backing, offset, 20); 8362 init(); 8363 } 8364 8365 protected ExtractTextureFeaturesReport(long nativeObj, boolean owned) { 8366 super(nativeObj, owned, 20); 8367 init(); 8368 } 8369 8370 protected void setBuffer(ByteBuffer backing, int offset) { 8371 super.setBuffer(backing, offset, 20); 8372 } 8373 8374 public void read() { 8375 int waveletBands_numWaveletBands = backing.getInt(4); 8376 long waveletBands_addr = getPointer(backing, 0); 8377 waveletBands = new int[waveletBands_numWaveletBands]; 8378 if (waveletBands_numWaveletBands > 0 && waveletBands_addr != 0) { 8379 newDirectByteBuffer(waveletBands_addr, waveletBands_numWaveletBands * 4).asIntBuffer().get( 8380 waveletBands); 8381 } 8382 textureFeaturesRows = backing.getInt(12); 8383 textureFeaturesCols = backing.getInt(16); 8384 } 8385 8386 public void write() { 8387 waveletBands_buf = 8388 ByteBuffer.allocateDirect(waveletBands.length * 4).order(ByteOrder.nativeOrder()); 8389 waveletBands_buf.asIntBuffer().put(waveletBands).rewind(); 8390 backing.putInt(4, waveletBands.length); 8391 putPointer(backing, 0, waveletBands_buf); 8392 backing.putInt(12, textureFeaturesRows); 8393 backing.putInt(16, textureFeaturesCols); 8394 } 8395 8396 public int size() { 8397 return 20; 8398 } 8399 } 8400 8401 public static class WaveletBandsReport extends DisposedStruct { 8402 public float LHLBand; // 2-D array for LHL Band. 8403 public int rows; // Number of Rows for each of the 2-D arrays. 8404 public int cols; // Number of Columns for each of the 2-D arrays. 8405 8406 private void init() { 8407 8408 } 8409 8410 public WaveletBandsReport() { 8411 super(40); 8412 init(); 8413 } 8414 8415 public WaveletBandsReport(double LHLBand, int rows, int cols) { 8416 super(40); 8417 this.LHLBand = (float) LHLBand; 8418 this.rows = rows; 8419 this.cols = cols; 8420 } 8421 8422 protected WaveletBandsReport(ByteBuffer backing, int offset) { 8423 super(backing, offset, 40); 8424 init(); 8425 } 8426 8427 protected WaveletBandsReport(long nativeObj, boolean owned) { 8428 super(nativeObj, owned, 40); 8429 init(); 8430 } 8431 8432 protected void setBuffer(ByteBuffer backing, int offset) { 8433 super.setBuffer(backing, offset, 40); 8434 } 8435 8436 public void read() { 8437 LHLBand = backing.getFloat(24); 8438 rows = backing.getInt(32); 8439 cols = backing.getInt(36); 8440 } 8441 8442 public void write() { 8443 backing.putFloat(24, LHLBand); 8444 backing.putInt(32, rows); 8445 backing.putInt(36, cols); 8446 } 8447 8448 public int size() { 8449 return 40; 8450 } 8451 } 8452 8453 public static class CircleFitOptions extends DisposedStruct { 8454 public int maxRadius; // Specifies the acceptable distance, in pixels, that 8455 // a point determined to belong to the circle can be 8456 // from the perimeter of the circle. 8457 public double stepSize; // Step Size is the angle, in degrees, between each 8458 // radial line in the annular region. 8459 public RakeProcessType processType; // Method used to process the data 8460 // extracted for edge detection. 8461 8462 private void init() { 8463 8464 } 8465 8466 public CircleFitOptions() { 8467 super(24); 8468 init(); 8469 } 8470 8471 public CircleFitOptions(int maxRadius, double stepSize, RakeProcessType processType) { 8472 super(24); 8473 this.maxRadius = maxRadius; 8474 this.stepSize = stepSize; 8475 this.processType = processType; 8476 } 8477 8478 protected CircleFitOptions(ByteBuffer backing, int offset) { 8479 super(backing, offset, 24); 8480 init(); 8481 } 8482 8483 protected CircleFitOptions(long nativeObj, boolean owned) { 8484 super(nativeObj, owned, 24); 8485 init(); 8486 } 8487 8488 protected void setBuffer(ByteBuffer backing, int offset) { 8489 super.setBuffer(backing, offset, 24); 8490 } 8491 8492 public void read() { 8493 maxRadius = backing.getInt(0); 8494 stepSize = backing.getDouble(8); 8495 processType = RakeProcessType.fromValue(backing.getInt(16)); 8496 } 8497 8498 public void write() { 8499 backing.putInt(0, maxRadius); 8500 backing.putDouble(8, stepSize); 8501 if (processType != null) 8502 backing.putInt(16, processType.getValue()); 8503 } 8504 8505 public int size() { 8506 return 24; 8507 } 8508 } 8509 8510 public static class EdgeOptions2 extends DisposedStruct { 8511 public EdgePolaritySearchMode polarity; // Specifies the polarity of the 8512 // edges to be found. 8513 public int kernelSize; // Specifies the size of the edge detection kernel. 8514 public int width; // Specifies the number of pixels averaged perpendicular 8515 // to the search direction to compute the edge profile 8516 // strength at each point along the search ROI. 8517 public float minThreshold; // Specifies the minimum edge strength (gradient 8518 // magnitude) required for a detected edge. 8519 public InterpolationMethod interpolationType; // Specifies the interpolation 8520 // method used to locate the 8521 // edge position. 8522 public ColumnProcessingMode columnProcessingMode; // Specifies the method 8523 // used to find the 8524 // straight edge. 8525 8526 private void init() { 8527 8528 } 8529 8530 public EdgeOptions2() { 8531 super(24); 8532 init(); 8533 } 8534 8535 public EdgeOptions2(EdgePolaritySearchMode polarity, int kernelSize, int width, 8536 double minThreshold, InterpolationMethod interpolationType, 8537 ColumnProcessingMode columnProcessingMode) { 8538 super(24); 8539 this.polarity = polarity; 8540 this.kernelSize = kernelSize; 8541 this.width = width; 8542 this.minThreshold = (float) minThreshold; 8543 this.interpolationType = interpolationType; 8544 this.columnProcessingMode = columnProcessingMode; 8545 } 8546 8547 protected EdgeOptions2(ByteBuffer backing, int offset) { 8548 super(backing, offset, 24); 8549 init(); 8550 } 8551 8552 protected EdgeOptions2(long nativeObj, boolean owned) { 8553 super(nativeObj, owned, 24); 8554 init(); 8555 } 8556 8557 protected void setBuffer(ByteBuffer backing, int offset) { 8558 super.setBuffer(backing, offset, 24); 8559 } 8560 8561 public void read() { 8562 polarity = EdgePolaritySearchMode.fromValue(backing.getInt(0)); 8563 kernelSize = backing.getInt(4); 8564 width = backing.getInt(8); 8565 minThreshold = backing.getFloat(12); 8566 interpolationType = InterpolationMethod.fromValue(backing.getInt(16)); 8567 columnProcessingMode = ColumnProcessingMode.fromValue(backing.getInt(20)); 8568 } 8569 8570 public void write() { 8571 if (polarity != null) 8572 backing.putInt(0, polarity.getValue()); 8573 backing.putInt(4, kernelSize); 8574 backing.putInt(8, width); 8575 backing.putFloat(12, minThreshold); 8576 if (interpolationType != null) 8577 backing.putInt(16, interpolationType.getValue()); 8578 if (columnProcessingMode != null) 8579 backing.putInt(20, columnProcessingMode.getValue()); 8580 } 8581 8582 public int size() { 8583 return 24; 8584 } 8585 } 8586 8587 public static class FindCircularEdgeOptions extends DisposedStruct { 8588 public SpokeDirection direction; // Specifies the Spoke direction to search 8589 // in the ROI. 8590 public int showSearchArea; // If TRUE, the function overlays the search area 8591 // on the image. 8592 public int showSearchLines; // If TRUE, the function overlays the search 8593 // lines used to locate the edges on the image. 8594 public int showEdgesFound; // If TRUE, the function overlays the locations 8595 // of the edges found on the image. 8596 public int showResult; // If TRUE, the function overlays the hit lines to 8597 // the object and the edge used to generate the hit 8598 // line on the result image. 8599 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 8600 // overlay the search area. 8601 public RGBValue searchLinesColor; // Specifies the RGB color value to use to 8602 // overlay the search lines. 8603 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to 8604 // overlay the search edges. 8605 public RGBValue resultColor; // Specifies the RGB color value to use to 8606 // overlay the results. 8607 public String overlayGroupName; // Specifies the overlay group name to 8608 // assign to the overlays. 8609 public EdgeOptions2 edgeOptions; // Specifies the edge detection options 8610 // along a single search line. 8611 private ByteBuffer overlayGroupName_buf; 8612 8613 private void init() { 8614 searchAreaColor = new RGBValue(backing, 20); 8615 searchLinesColor = new RGBValue(backing, 24); 8616 searchEdgesColor = new RGBValue(backing, 28); 8617 resultColor = new RGBValue(backing, 32); 8618 edgeOptions = new EdgeOptions2(backing, 40); 8619 } 8620 8621 public FindCircularEdgeOptions() { 8622 super(64); 8623 init(); 8624 } 8625 8626 public FindCircularEdgeOptions(SpokeDirection direction, int showSearchArea, 8627 int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, 8628 RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, 8629 String overlayGroupName, EdgeOptions2 edgeOptions) { 8630 super(64); 8631 this.direction = direction; 8632 this.showSearchArea = showSearchArea; 8633 this.showSearchLines = showSearchLines; 8634 this.showEdgesFound = showEdgesFound; 8635 this.showResult = showResult; 8636 this.searchAreaColor = searchAreaColor; 8637 this.searchLinesColor = searchLinesColor; 8638 this.searchEdgesColor = searchEdgesColor; 8639 this.resultColor = resultColor; 8640 this.overlayGroupName = overlayGroupName; 8641 this.edgeOptions = edgeOptions; 8642 } 8643 8644 protected FindCircularEdgeOptions(ByteBuffer backing, int offset) { 8645 super(backing, offset, 64); 8646 init(); 8647 } 8648 8649 protected FindCircularEdgeOptions(long nativeObj, boolean owned) { 8650 super(nativeObj, owned, 64); 8651 init(); 8652 } 8653 8654 protected void setBuffer(ByteBuffer backing, int offset) { 8655 super.setBuffer(backing, offset, 64); 8656 } 8657 8658 public void read() { 8659 direction = SpokeDirection.fromValue(backing.getInt(0)); 8660 showSearchArea = backing.getInt(4); 8661 showSearchLines = backing.getInt(8); 8662 showEdgesFound = backing.getInt(12); 8663 showResult = backing.getInt(16); 8664 searchAreaColor.read(); 8665 searchLinesColor.read(); 8666 searchEdgesColor.read(); 8667 resultColor.read(); 8668 long overlayGroupName_addr = getPointer(backing, 36); 8669 if (overlayGroupName_addr == 0) 8670 overlayGroupName = null; 8671 else { 8672 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 8673 while (bb.get() != 0) { 8674 } 8675 byte[] bytes = new byte[bb.position() - 1]; 8676 getBytes(bb, bytes, 0, bytes.length); 8677 try { 8678 overlayGroupName = new String(bytes, "UTF-8"); 8679 } catch (UnsupportedEncodingException e) { 8680 overlayGroupName = ""; 8681 } 8682 } 8683 8684 edgeOptions.read(); 8685 } 8686 8687 public void write() { 8688 if (direction != null) 8689 backing.putInt(0, direction.getValue()); 8690 backing.putInt(4, showSearchArea); 8691 backing.putInt(8, showSearchLines); 8692 backing.putInt(12, showEdgesFound); 8693 backing.putInt(16, showResult); 8694 searchAreaColor.write(); 8695 searchLinesColor.write(); 8696 searchEdgesColor.write(); 8697 resultColor.write(); 8698 if (overlayGroupName != null) { 8699 byte[] overlayGroupName_bytes; 8700 try { 8701 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 8702 } catch (UnsupportedEncodingException e) { 8703 overlayGroupName_bytes = new byte[0]; 8704 } 8705 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 8706 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 8707 .put(overlayGroupName_bytes.length, (byte) 0); 8708 } 8709 putPointer(backing, 36, overlayGroupName == null ? 0 8710 : getByteBufferAddress(overlayGroupName_buf)); 8711 edgeOptions.write(); 8712 } 8713 8714 public int size() { 8715 return 64; 8716 } 8717 } 8718 8719 public static class FindConcentricEdgeOptions extends DisposedStruct { 8720 public ConcentricRakeDirection direction; // Specifies the Concentric Rake 8721 // direction. 8722 public int showSearchArea; // If TRUE, the function overlays the search area 8723 // on the image. 8724 public int showSearchLines; // If TRUE, the function overlays the search 8725 // lines used to locate the edges on the image. 8726 public int showEdgesFound; // If TRUE, the function overlays the locations 8727 // of the edges found on the image. 8728 public int showResult; // If TRUE, the function overlays the hit lines to 8729 // the object and the edge used to generate the hit 8730 // line on the result image. 8731 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 8732 // overlay the search area. 8733 public RGBValue searchLinesColor; // Specifies the RGB color value to use to 8734 // overlay the search lines. 8735 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to 8736 // overlay the search edges. 8737 public RGBValue resultColor; // Specifies the RGB color value to use to 8738 // overlay the results. 8739 public String overlayGroupName; // Specifies the overlay group name to 8740 // assign to the overlays. 8741 public EdgeOptions2 edgeOptions; // Specifies the edge detection options 8742 // along a single search line. 8743 private ByteBuffer overlayGroupName_buf; 8744 8745 private void init() { 8746 searchAreaColor = new RGBValue(backing, 20); 8747 searchLinesColor = new RGBValue(backing, 24); 8748 searchEdgesColor = new RGBValue(backing, 28); 8749 resultColor = new RGBValue(backing, 32); 8750 edgeOptions = new EdgeOptions2(backing, 40); 8751 } 8752 8753 public FindConcentricEdgeOptions() { 8754 super(64); 8755 init(); 8756 } 8757 8758 public FindConcentricEdgeOptions(ConcentricRakeDirection direction, int showSearchArea, 8759 int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, 8760 RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, 8761 String overlayGroupName, EdgeOptions2 edgeOptions) { 8762 super(64); 8763 this.direction = direction; 8764 this.showSearchArea = showSearchArea; 8765 this.showSearchLines = showSearchLines; 8766 this.showEdgesFound = showEdgesFound; 8767 this.showResult = showResult; 8768 this.searchAreaColor = searchAreaColor; 8769 this.searchLinesColor = searchLinesColor; 8770 this.searchEdgesColor = searchEdgesColor; 8771 this.resultColor = resultColor; 8772 this.overlayGroupName = overlayGroupName; 8773 this.edgeOptions = edgeOptions; 8774 } 8775 8776 protected FindConcentricEdgeOptions(ByteBuffer backing, int offset) { 8777 super(backing, offset, 64); 8778 init(); 8779 } 8780 8781 protected FindConcentricEdgeOptions(long nativeObj, boolean owned) { 8782 super(nativeObj, owned, 64); 8783 init(); 8784 } 8785 8786 protected void setBuffer(ByteBuffer backing, int offset) { 8787 super.setBuffer(backing, offset, 64); 8788 } 8789 8790 public void read() { 8791 direction = ConcentricRakeDirection.fromValue(backing.getInt(0)); 8792 showSearchArea = backing.getInt(4); 8793 showSearchLines = backing.getInt(8); 8794 showEdgesFound = backing.getInt(12); 8795 showResult = backing.getInt(16); 8796 searchAreaColor.read(); 8797 searchLinesColor.read(); 8798 searchEdgesColor.read(); 8799 resultColor.read(); 8800 long overlayGroupName_addr = getPointer(backing, 36); 8801 if (overlayGroupName_addr == 0) 8802 overlayGroupName = null; 8803 else { 8804 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 8805 while (bb.get() != 0) { 8806 } 8807 byte[] bytes = new byte[bb.position() - 1]; 8808 getBytes(bb, bytes, 0, bytes.length); 8809 try { 8810 overlayGroupName = new String(bytes, "UTF-8"); 8811 } catch (UnsupportedEncodingException e) { 8812 overlayGroupName = ""; 8813 } 8814 } 8815 8816 edgeOptions.read(); 8817 } 8818 8819 public void write() { 8820 if (direction != null) 8821 backing.putInt(0, direction.getValue()); 8822 backing.putInt(4, showSearchArea); 8823 backing.putInt(8, showSearchLines); 8824 backing.putInt(12, showEdgesFound); 8825 backing.putInt(16, showResult); 8826 searchAreaColor.write(); 8827 searchLinesColor.write(); 8828 searchEdgesColor.write(); 8829 resultColor.write(); 8830 if (overlayGroupName != null) { 8831 byte[] overlayGroupName_bytes; 8832 try { 8833 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 8834 } catch (UnsupportedEncodingException e) { 8835 overlayGroupName_bytes = new byte[0]; 8836 } 8837 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 8838 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 8839 .put(overlayGroupName_bytes.length, (byte) 0); 8840 } 8841 putPointer(backing, 36, overlayGroupName == null ? 0 8842 : getByteBufferAddress(overlayGroupName_buf)); 8843 edgeOptions.write(); 8844 } 8845 8846 public int size() { 8847 return 64; 8848 } 8849 } 8850 8851 public static class ConcentricEdgeFitOptions extends DisposedStruct { 8852 public int maxRadius; // Specifies the acceptable distance, in pixels, that 8853 // a point determined to belong to the circle can be 8854 // from the perimeter of the circle. 8855 public double stepSize; // The sampling factor that determines the gap 8856 // between the rake lines. 8857 public RakeProcessType processType; // Method used to process the data 8858 // extracted for edge detection. 8859 8860 private void init() { 8861 8862 } 8863 8864 public ConcentricEdgeFitOptions() { 8865 super(24); 8866 init(); 8867 } 8868 8869 public ConcentricEdgeFitOptions(int maxRadius, double stepSize, RakeProcessType processType) { 8870 super(24); 8871 this.maxRadius = maxRadius; 8872 this.stepSize = stepSize; 8873 this.processType = processType; 8874 } 8875 8876 protected ConcentricEdgeFitOptions(ByteBuffer backing, int offset) { 8877 super(backing, offset, 24); 8878 init(); 8879 } 8880 8881 protected ConcentricEdgeFitOptions(long nativeObj, boolean owned) { 8882 super(nativeObj, owned, 24); 8883 init(); 8884 } 8885 8886 protected void setBuffer(ByteBuffer backing, int offset) { 8887 super.setBuffer(backing, offset, 24); 8888 } 8889 8890 public void read() { 8891 maxRadius = backing.getInt(0); 8892 stepSize = backing.getDouble(8); 8893 processType = RakeProcessType.fromValue(backing.getInt(16)); 8894 } 8895 8896 public void write() { 8897 backing.putInt(0, maxRadius); 8898 backing.putDouble(8, stepSize); 8899 if (processType != null) 8900 backing.putInt(16, processType.getValue()); 8901 } 8902 8903 public int size() { 8904 return 24; 8905 } 8906 } 8907 8908 public static class FindConcentricEdgeReport extends DisposedStruct { 8909 public PointFloat startPt; // Pixel Coordinates for starting point of the 8910 // edge. 8911 public PointFloat endPt; // Pixel Coordinates for end point of the edge. 8912 public PointFloat startPtCalibrated; // Real world Coordinates for starting 8913 // point of the edge. 8914 public PointFloat endPtCalibrated; // Real world Coordinates for end point 8915 // of the edge. 8916 public double angle; // Angle of the edge found. 8917 public double angleCalibrated; // Calibrated angle of the edge found. 8918 public double straightness; // The straightness value of the detected 8919 // straight edge. 8920 public double avgStrength; // Average strength of the egde found. 8921 public double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge 8922 // found. 8923 public int lineFound; // If the edge is found or not. 8924 8925 private void init() { 8926 startPt = new PointFloat(backing, 0); 8927 endPt = new PointFloat(backing, 8); 8928 startPtCalibrated = new PointFloat(backing, 16); 8929 endPtCalibrated = new PointFloat(backing, 24); 8930 } 8931 8932 public FindConcentricEdgeReport() { 8933 super(80); 8934 init(); 8935 } 8936 8937 public FindConcentricEdgeReport(PointFloat startPt, PointFloat endPt, 8938 PointFloat startPtCalibrated, PointFloat endPtCalibrated, double angle, 8939 double angleCalibrated, double straightness, double avgStrength, double avgSNR, 8940 int lineFound) { 8941 super(80); 8942 this.startPt = startPt; 8943 this.endPt = endPt; 8944 this.startPtCalibrated = startPtCalibrated; 8945 this.endPtCalibrated = endPtCalibrated; 8946 this.angle = angle; 8947 this.angleCalibrated = angleCalibrated; 8948 this.straightness = straightness; 8949 this.avgStrength = avgStrength; 8950 this.avgSNR = avgSNR; 8951 this.lineFound = lineFound; 8952 } 8953 8954 protected FindConcentricEdgeReport(ByteBuffer backing, int offset) { 8955 super(backing, offset, 80); 8956 init(); 8957 } 8958 8959 protected FindConcentricEdgeReport(long nativeObj, boolean owned) { 8960 super(nativeObj, owned, 80); 8961 init(); 8962 } 8963 8964 protected void setBuffer(ByteBuffer backing, int offset) { 8965 super.setBuffer(backing, offset, 80); 8966 } 8967 8968 public void read() { 8969 startPt.read(); 8970 endPt.read(); 8971 startPtCalibrated.read(); 8972 endPtCalibrated.read(); 8973 angle = backing.getDouble(32); 8974 angleCalibrated = backing.getDouble(40); 8975 straightness = backing.getDouble(48); 8976 avgStrength = backing.getDouble(56); 8977 avgSNR = backing.getDouble(64); 8978 lineFound = backing.getInt(72); 8979 } 8980 8981 public void write() { 8982 startPt.write(); 8983 endPt.write(); 8984 startPtCalibrated.write(); 8985 endPtCalibrated.write(); 8986 backing.putDouble(32, angle); 8987 backing.putDouble(40, angleCalibrated); 8988 backing.putDouble(48, straightness); 8989 backing.putDouble(56, avgStrength); 8990 backing.putDouble(64, avgSNR); 8991 backing.putInt(72, lineFound); 8992 } 8993 8994 public int size() { 8995 return 80; 8996 } 8997 } 8998 8999 public static class FindCircularEdgeReport extends DisposedStruct { 9000 public PointFloat centerCalibrated; // Real world Coordinates of the Center. 9001 public double radiusCalibrated; // Real world radius of the Circular Edge 9002 // found. 9003 public PointFloat center; // Pixel Coordinates of the Center. 9004 public double radius; // Radius in pixels of the Circular Edge found. 9005 public double roundness; // The roundness of the calculated circular edge. 9006 public double avgStrength; // Average strength of the egde found. 9007 public double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge 9008 // found. 9009 public int circleFound; // If the circlular edge is found or not. 9010 9011 private void init() { 9012 centerCalibrated = new PointFloat(backing, 0); 9013 center = new PointFloat(backing, 16); 9014 } 9015 9016 public FindCircularEdgeReport() { 9017 super(64); 9018 init(); 9019 } 9020 9021 public FindCircularEdgeReport(PointFloat centerCalibrated, double radiusCalibrated, 9022 PointFloat center, double radius, double roundness, double avgStrength, double avgSNR, 9023 int circleFound) { 9024 super(64); 9025 this.centerCalibrated = centerCalibrated; 9026 this.radiusCalibrated = radiusCalibrated; 9027 this.center = center; 9028 this.radius = radius; 9029 this.roundness = roundness; 9030 this.avgStrength = avgStrength; 9031 this.avgSNR = avgSNR; 9032 this.circleFound = circleFound; 9033 } 9034 9035 protected FindCircularEdgeReport(ByteBuffer backing, int offset) { 9036 super(backing, offset, 64); 9037 init(); 9038 } 9039 9040 protected FindCircularEdgeReport(long nativeObj, boolean owned) { 9041 super(nativeObj, owned, 64); 9042 init(); 9043 } 9044 9045 protected void setBuffer(ByteBuffer backing, int offset) { 9046 super.setBuffer(backing, offset, 64); 9047 } 9048 9049 public void read() { 9050 centerCalibrated.read(); 9051 radiusCalibrated = backing.getDouble(8); 9052 center.read(); 9053 radius = backing.getDouble(24); 9054 roundness = backing.getDouble(32); 9055 avgStrength = backing.getDouble(40); 9056 avgSNR = backing.getDouble(48); 9057 circleFound = backing.getInt(56); 9058 } 9059 9060 public void write() { 9061 centerCalibrated.write(); 9062 backing.putDouble(8, radiusCalibrated); 9063 center.write(); 9064 backing.putDouble(24, radius); 9065 backing.putDouble(32, roundness); 9066 backing.putDouble(40, avgStrength); 9067 backing.putDouble(48, avgSNR); 9068 backing.putInt(56, circleFound); 9069 } 9070 9071 public int size() { 9072 return 64; 9073 } 9074 } 9075 9076 public static class WindowSize extends DisposedStruct { 9077 public int x; // Window lenght on X direction. 9078 public int y; // Window lenght on Y direction. 9079 public int stepSize; // Distance between windows. 9080 9081 private void init() { 9082 9083 } 9084 9085 public WindowSize() { 9086 super(12); 9087 init(); 9088 } 9089 9090 public WindowSize(int x, int y, int stepSize) { 9091 super(12); 9092 this.x = x; 9093 this.y = y; 9094 this.stepSize = stepSize; 9095 } 9096 9097 protected WindowSize(ByteBuffer backing, int offset) { 9098 super(backing, offset, 12); 9099 init(); 9100 } 9101 9102 protected WindowSize(long nativeObj, boolean owned) { 9103 super(nativeObj, owned, 12); 9104 init(); 9105 } 9106 9107 protected void setBuffer(ByteBuffer backing, int offset) { 9108 super.setBuffer(backing, offset, 12); 9109 } 9110 9111 public void read() { 9112 x = backing.getInt(0); 9113 y = backing.getInt(4); 9114 stepSize = backing.getInt(8); 9115 } 9116 9117 public void write() { 9118 backing.putInt(0, x); 9119 backing.putInt(4, y); 9120 backing.putInt(8, stepSize); 9121 } 9122 9123 public int size() { 9124 return 12; 9125 } 9126 } 9127 9128 public static class DisplacementVector extends DisposedStruct { 9129 public int x; // length on X direction. 9130 public int y; // length on Y direction. 9131 9132 private void init() { 9133 9134 } 9135 9136 public DisplacementVector() { 9137 super(8); 9138 init(); 9139 } 9140 9141 public DisplacementVector(int x, int y) { 9142 super(8); 9143 this.x = x; 9144 this.y = y; 9145 } 9146 9147 protected DisplacementVector(ByteBuffer backing, int offset) { 9148 super(backing, offset, 8); 9149 init(); 9150 } 9151 9152 protected DisplacementVector(long nativeObj, boolean owned) { 9153 super(nativeObj, owned, 8); 9154 init(); 9155 } 9156 9157 protected void setBuffer(ByteBuffer backing, int offset) { 9158 super.setBuffer(backing, offset, 8); 9159 } 9160 9161 public void read() { 9162 x = backing.getInt(0); 9163 y = backing.getInt(4); 9164 } 9165 9166 public void write() { 9167 backing.putInt(0, x); 9168 backing.putInt(4, y); 9169 } 9170 9171 public int size() { 9172 return 8; 9173 } 9174 } 9175 9176 public static class WaveletOptions extends DisposedStruct { 9177 public WaveletType typeOfWavelet; // Type of wavelet(db, bior. 9178 public float minEnergy; // Minimum Energy in the bands to consider for 9179 // texture defect detection. 9180 9181 private void init() { 9182 9183 } 9184 9185 public WaveletOptions() { 9186 super(8); 9187 init(); 9188 } 9189 9190 public WaveletOptions(WaveletType typeOfWavelet, double minEnergy) { 9191 super(8); 9192 this.typeOfWavelet = typeOfWavelet; 9193 this.minEnergy = (float) minEnergy; 9194 } 9195 9196 protected WaveletOptions(ByteBuffer backing, int offset) { 9197 super(backing, offset, 8); 9198 init(); 9199 } 9200 9201 protected WaveletOptions(long nativeObj, boolean owned) { 9202 super(nativeObj, owned, 8); 9203 init(); 9204 } 9205 9206 protected void setBuffer(ByteBuffer backing, int offset) { 9207 super.setBuffer(backing, offset, 8); 9208 } 9209 9210 public void read() { 9211 typeOfWavelet = WaveletType.fromValue(backing.getInt(0)); 9212 minEnergy = backing.getFloat(4); 9213 } 9214 9215 public void write() { 9216 if (typeOfWavelet != null) 9217 backing.putInt(0, typeOfWavelet.getValue()); 9218 backing.putFloat(4, minEnergy); 9219 } 9220 9221 public int size() { 9222 return 8; 9223 } 9224 } 9225 9226 public static class CooccurrenceOptions extends DisposedStruct { 9227 public int level; // Level/size of matrix. 9228 public DisplacementVector displacement; // Displacemnet between pixels to 9229 // accumulate the matrix. 9230 9231 private void init() { 9232 displacement = new DisplacementVector(backing, 4); 9233 } 9234 9235 public CooccurrenceOptions() { 9236 super(12); 9237 init(); 9238 } 9239 9240 public CooccurrenceOptions(int level, DisplacementVector displacement) { 9241 super(12); 9242 this.level = level; 9243 this.displacement = displacement; 9244 } 9245 9246 protected CooccurrenceOptions(ByteBuffer backing, int offset) { 9247 super(backing, offset, 12); 9248 init(); 9249 } 9250 9251 protected CooccurrenceOptions(long nativeObj, boolean owned) { 9252 super(nativeObj, owned, 12); 9253 init(); 9254 } 9255 9256 protected void setBuffer(ByteBuffer backing, int offset) { 9257 super.setBuffer(backing, offset, 12); 9258 } 9259 9260 public void read() { 9261 level = backing.getInt(0); 9262 displacement.read(); 9263 } 9264 9265 public void write() { 9266 backing.putInt(0, level); 9267 displacement.write(); 9268 } 9269 9270 public int size() { 9271 return 12; 9272 } 9273 } 9274 9275 public static class ParticleClassifierLocalThresholdOptions extends DisposedStruct { 9276 public LocalThresholdMethod method; // Specifies the local thresholding 9277 // method the function uses. 9278 public ParticleType particleType; // Specifies what kind of particles to 9279 // look for. 9280 public int windowWidth; // The width of the rectangular window around the 9281 // pixel on which the function performs the local 9282 // threshold. 9283 public int windowHeight; // The height of the rectangular window around the 9284 // pixel on which the function performs the local 9285 // threshold. 9286 public double deviationWeight; // Specifies the k constant used in the 9287 // Niblack local thresholding algorithm, 9288 // which determines the weight applied to the 9289 // variance calculation. 9290 9291 private void init() { 9292 9293 } 9294 9295 public ParticleClassifierLocalThresholdOptions() { 9296 super(24); 9297 init(); 9298 } 9299 9300 public ParticleClassifierLocalThresholdOptions(LocalThresholdMethod method, 9301 ParticleType particleType, int windowWidth, int windowHeight, double deviationWeight) { 9302 super(24); 9303 this.method = method; 9304 this.particleType = particleType; 9305 this.windowWidth = windowWidth; 9306 this.windowHeight = windowHeight; 9307 this.deviationWeight = deviationWeight; 9308 } 9309 9310 protected ParticleClassifierLocalThresholdOptions(ByteBuffer backing, int offset) { 9311 super(backing, offset, 24); 9312 init(); 9313 } 9314 9315 protected ParticleClassifierLocalThresholdOptions(long nativeObj, boolean owned) { 9316 super(nativeObj, owned, 24); 9317 init(); 9318 } 9319 9320 protected void setBuffer(ByteBuffer backing, int offset) { 9321 super.setBuffer(backing, offset, 24); 9322 } 9323 9324 public void read() { 9325 method = LocalThresholdMethod.fromValue(backing.getInt(0)); 9326 particleType = ParticleType.fromValue(backing.getInt(4)); 9327 windowWidth = backing.getInt(8); 9328 windowHeight = backing.getInt(12); 9329 deviationWeight = backing.getDouble(16); 9330 } 9331 9332 public void write() { 9333 if (method != null) 9334 backing.putInt(0, method.getValue()); 9335 if (particleType != null) 9336 backing.putInt(4, particleType.getValue()); 9337 backing.putInt(8, windowWidth); 9338 backing.putInt(12, windowHeight); 9339 backing.putDouble(16, deviationWeight); 9340 } 9341 9342 public int size() { 9343 return 24; 9344 } 9345 } 9346 9347 public static class RangeFloat extends DisposedStruct { 9348 public float minValue; // The minimum value of the range. 9349 public float maxValue; // The maximum value of the range. 9350 9351 private void init() { 9352 9353 } 9354 9355 public RangeFloat() { 9356 super(8); 9357 init(); 9358 } 9359 9360 public RangeFloat(double minValue, double maxValue) { 9361 super(8); 9362 this.minValue = (float) minValue; 9363 this.maxValue = (float) maxValue; 9364 } 9365 9366 protected RangeFloat(ByteBuffer backing, int offset) { 9367 super(backing, offset, 8); 9368 init(); 9369 } 9370 9371 protected RangeFloat(long nativeObj, boolean owned) { 9372 super(nativeObj, owned, 8); 9373 init(); 9374 } 9375 9376 protected void setBuffer(ByteBuffer backing, int offset) { 9377 super.setBuffer(backing, offset, 8); 9378 } 9379 9380 public void read() { 9381 minValue = backing.getFloat(0); 9382 maxValue = backing.getFloat(4); 9383 } 9384 9385 public void write() { 9386 backing.putFloat(0, minValue); 9387 backing.putFloat(4, maxValue); 9388 } 9389 9390 public int size() { 9391 return 8; 9392 } 9393 } 9394 9395 public static class ParticleClassifierAutoThresholdOptions extends DisposedStruct { 9396 public ThresholdMethod method; // The method for binary thresholding, which 9397 // specifies how to calculate the classes. 9398 public ParticleType particleType; // Specifies what kind of particles to 9399 // look for. 9400 public RangeFloat limits; // The limits on the automatic threshold range. 9401 9402 private void init() { 9403 limits = new RangeFloat(backing, 8); 9404 } 9405 9406 public ParticleClassifierAutoThresholdOptions() { 9407 super(16); 9408 init(); 9409 } 9410 9411 public ParticleClassifierAutoThresholdOptions(ThresholdMethod method, 9412 ParticleType particleType, RangeFloat limits) { 9413 super(16); 9414 this.method = method; 9415 this.particleType = particleType; 9416 this.limits = limits; 9417 } 9418 9419 protected ParticleClassifierAutoThresholdOptions(ByteBuffer backing, int offset) { 9420 super(backing, offset, 16); 9421 init(); 9422 } 9423 9424 protected ParticleClassifierAutoThresholdOptions(long nativeObj, boolean owned) { 9425 super(nativeObj, owned, 16); 9426 init(); 9427 } 9428 9429 protected void setBuffer(ByteBuffer backing, int offset) { 9430 super.setBuffer(backing, offset, 16); 9431 } 9432 9433 public void read() { 9434 method = ThresholdMethod.fromValue(backing.getInt(0)); 9435 particleType = ParticleType.fromValue(backing.getInt(4)); 9436 limits.read(); 9437 } 9438 9439 public void write() { 9440 if (method != null) 9441 backing.putInt(0, method.getValue()); 9442 if (particleType != null) 9443 backing.putInt(4, particleType.getValue()); 9444 limits.write(); 9445 } 9446 9447 public int size() { 9448 return 16; 9449 } 9450 } 9451 9452 public static class ParticleClassifierPreprocessingOptions2 extends DisposedStruct { 9453 public ParticleClassifierThresholdType thresholdType; // The type of 9454 // threshold to 9455 // perform on the 9456 // image. 9457 public RangeFloat manualThresholdRange; // The range of pixels to keep if 9458 // manually thresholding the image. 9459 public ParticleClassifierAutoThresholdOptions autoThresholdOptions; // The 9460 // options 9461 // used 9462 // to 9463 // auto 9464 // threshold 9465 // the 9466 // image. 9467 public ParticleClassifierLocalThresholdOptions localThresholdOptions; // The 9468 // options 9469 // used 9470 // to 9471 // local 9472 // threshold 9473 // the 9474 // image. 9475 public int rejectBorder; // Set this element to TRUE to reject border 9476 // particles. 9477 public int numErosions; // The number of erosions to perform. 9478 9479 private void init() { 9480 manualThresholdRange = new RangeFloat(backing, 4); 9481 autoThresholdOptions = new ParticleClassifierAutoThresholdOptions(backing, 12); 9482 localThresholdOptions = new ParticleClassifierLocalThresholdOptions(backing, 32); 9483 } 9484 9485 public ParticleClassifierPreprocessingOptions2() { 9486 super(64); 9487 init(); 9488 } 9489 9490 public ParticleClassifierPreprocessingOptions2(ParticleClassifierThresholdType thresholdType, 9491 RangeFloat manualThresholdRange, 9492 ParticleClassifierAutoThresholdOptions autoThresholdOptions, 9493 ParticleClassifierLocalThresholdOptions localThresholdOptions, int rejectBorder, 9494 int numErosions) { 9495 super(64); 9496 this.thresholdType = thresholdType; 9497 this.manualThresholdRange = manualThresholdRange; 9498 this.autoThresholdOptions = autoThresholdOptions; 9499 this.localThresholdOptions = localThresholdOptions; 9500 this.rejectBorder = rejectBorder; 9501 this.numErosions = numErosions; 9502 } 9503 9504 protected ParticleClassifierPreprocessingOptions2(ByteBuffer backing, int offset) { 9505 super(backing, offset, 64); 9506 init(); 9507 } 9508 9509 protected ParticleClassifierPreprocessingOptions2(long nativeObj, boolean owned) { 9510 super(nativeObj, owned, 64); 9511 init(); 9512 } 9513 9514 protected void setBuffer(ByteBuffer backing, int offset) { 9515 super.setBuffer(backing, offset, 64); 9516 } 9517 9518 public void read() { 9519 thresholdType = ParticleClassifierThresholdType.fromValue(backing.getInt(0)); 9520 manualThresholdRange.read(); 9521 autoThresholdOptions.read(); 9522 localThresholdOptions.read(); 9523 rejectBorder = backing.getInt(56); 9524 numErosions = backing.getInt(60); 9525 } 9526 9527 public void write() { 9528 if (thresholdType != null) 9529 backing.putInt(0, thresholdType.getValue()); 9530 manualThresholdRange.write(); 9531 autoThresholdOptions.write(); 9532 localThresholdOptions.write(); 9533 backing.putInt(56, rejectBorder); 9534 backing.putInt(60, numErosions); 9535 } 9536 9537 public int size() { 9538 return 64; 9539 } 9540 } 9541 9542 public static class MeasureParticlesReport extends DisposedStruct { 9543 public int numParticles; // The number of particles on which measurements 9544 // were taken. 9545 public int numMeasurements; // The number of measurements taken. 9546 9547 private void init() { 9548 9549 } 9550 9551 public MeasureParticlesReport() { 9552 super(16); 9553 init(); 9554 } 9555 9556 public MeasureParticlesReport(int numParticles, int numMeasurements) { 9557 super(16); 9558 this.numParticles = numParticles; 9559 this.numMeasurements = numMeasurements; 9560 } 9561 9562 protected MeasureParticlesReport(ByteBuffer backing, int offset) { 9563 super(backing, offset, 16); 9564 init(); 9565 } 9566 9567 protected MeasureParticlesReport(long nativeObj, boolean owned) { 9568 super(nativeObj, owned, 16); 9569 init(); 9570 } 9571 9572 protected void setBuffer(ByteBuffer backing, int offset) { 9573 super.setBuffer(backing, offset, 16); 9574 } 9575 9576 public void read() { 9577 numParticles = backing.getInt(8); 9578 numMeasurements = backing.getInt(12); 9579 } 9580 9581 public void write() { 9582 backing.putInt(8, numParticles); 9583 backing.putInt(12, numMeasurements); 9584 } 9585 9586 public int size() { 9587 return 16; 9588 } 9589 } 9590 9591 public static class GeometricPatternMatch3 extends DisposedStruct { 9592 public PointFloat position; // The location of the origin of the template in 9593 // the match. 9594 public float rotation; // The rotation of the match relative to the template 9595 // image, in degrees. 9596 public float scale; // The size of the match relative to the size of the 9597 // template image, expressed as a percentage. 9598 public float score; // The accuracy of the match. 9599 public PointFloat[] corner; // An array of four points describing the 9600 // rectangle surrounding the template image. 9601 public int inverse; // This element is TRUE if the match is an inverse of 9602 // the template image. 9603 public float occlusion; // The percentage of the match that is occluded. 9604 public float templateMatchCurveScore; // The accuracy of the match obtained 9605 // by comparing the template curves to 9606 // the curves in the match region. 9607 public float matchTemplateCurveScore; // The accuracy of the match obtained 9608 // by comparing the curves in the 9609 // match region to the template 9610 // curves. 9611 public float correlationScore; // The accuracy of the match obtained by 9612 // comparing the template image to the match 9613 // region using a correlation metric that 9614 // compares the two regions as a function of 9615 // their pixel values. 9616 public PointFloat calibratedPosition; // The location of the origin of the 9617 // template in the match. 9618 public float calibratedRotation; // The rotation of the match relative to 9619 // the template image, in degrees. 9620 public PointFloat[] calibratedCorner; // An array of four points describing 9621 // the rectangle surrounding the 9622 // template image. 9623 9624 private void init() { 9625 position = new PointFloat(backing, 0); 9626 corner = new PointFloat[4]; 9627 9628 for (int i = 0, off = 20; i < 4; i++, off += 8) 9629 corner[i] = new PointFloat(backing, off); 9630 calibratedPosition = new PointFloat(backing, 72); 9631 calibratedCorner = new PointFloat[4]; 9632 9633 for (int i = 0, off = 84; i < 4; i++, off += 8) 9634 calibratedCorner[i] = new PointFloat(backing, off); 9635 } 9636 9637 public GeometricPatternMatch3() { 9638 super(116); 9639 init(); 9640 } 9641 9642 public GeometricPatternMatch3(PointFloat position, double rotation, double scale, double score, 9643 PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, 9644 double matchTemplateCurveScore, double correlationScore, PointFloat calibratedPosition, 9645 double calibratedRotation, PointFloat[] calibratedCorner) { 9646 super(116); 9647 this.position = position; 9648 this.rotation = (float) rotation; 9649 this.scale = (float) scale; 9650 this.score = (float) score; 9651 this.corner = corner; 9652 this.inverse = inverse; 9653 this.occlusion = (float) occlusion; 9654 this.templateMatchCurveScore = (float) templateMatchCurveScore; 9655 this.matchTemplateCurveScore = (float) matchTemplateCurveScore; 9656 this.correlationScore = (float) correlationScore; 9657 this.calibratedPosition = calibratedPosition; 9658 this.calibratedRotation = (float) calibratedRotation; 9659 this.calibratedCorner = calibratedCorner; 9660 } 9661 9662 protected GeometricPatternMatch3(ByteBuffer backing, int offset) { 9663 super(backing, offset, 116); 9664 init(); 9665 } 9666 9667 protected GeometricPatternMatch3(long nativeObj, boolean owned) { 9668 super(nativeObj, owned, 116); 9669 init(); 9670 } 9671 9672 protected void setBuffer(ByteBuffer backing, int offset) { 9673 super.setBuffer(backing, offset, 116); 9674 } 9675 9676 public void read() { 9677 position.read(); 9678 rotation = backing.getFloat(8); 9679 scale = backing.getFloat(12); 9680 score = backing.getFloat(16); 9681 for (PointFloat it : corner) { 9682 it.read(); 9683 } 9684 inverse = backing.getInt(52); 9685 occlusion = backing.getFloat(56); 9686 templateMatchCurveScore = backing.getFloat(60); 9687 matchTemplateCurveScore = backing.getFloat(64); 9688 correlationScore = backing.getFloat(68); 9689 calibratedPosition.read(); 9690 calibratedRotation = backing.getFloat(80); 9691 for (PointFloat it : calibratedCorner) { 9692 it.read(); 9693 } 9694 } 9695 9696 public void write() { 9697 position.write(); 9698 backing.putFloat(8, rotation); 9699 backing.putFloat(12, scale); 9700 backing.putFloat(16, score); 9701 for (PointFloat it : corner) { 9702 it.write(); 9703 } 9704 backing.putInt(52, inverse); 9705 backing.putFloat(56, occlusion); 9706 backing.putFloat(60, templateMatchCurveScore); 9707 backing.putFloat(64, matchTemplateCurveScore); 9708 backing.putFloat(68, correlationScore); 9709 calibratedPosition.write(); 9710 backing.putFloat(80, calibratedRotation); 9711 for (PointFloat it : calibratedCorner) { 9712 it.write(); 9713 } 9714 } 9715 9716 public int size() { 9717 return 116; 9718 } 9719 } 9720 9721 public static class MatchGeometricPatternAdvancedOptions3 extends DisposedStruct { 9722 public int subpixelIterations; // Specifies the maximum number of 9723 // incremental improvements used to refine 9724 // matches with subpixel information. 9725 public double subpixelTolerance; // Specifies the maximum amount of change, 9726 // in pixels, between consecutive 9727 // incremental improvements in the match 9728 // position before the function stops 9729 // refining the match position. 9730 public int initialMatchListLength; // Specifies the maximum size of the 9731 // match list. 9732 public int targetTemplateCurveScore; // Set this element to TRUE to specify 9733 // that the function should calculate 9734 // the match curve to template curve 9735 // score and return it for each match 9736 // result. 9737 public int correlationScore; // Set this element to TRUE to specify that the 9738 // function should calculate the correlation 9739 // score and return it for each match result. 9740 public double minMatchSeparationDistance; // Specifies the minimum 9741 // separation distance, in pixels, 9742 // between the origins of two 9743 // matches that have unique 9744 // positions. 9745 public double minMatchSeparationAngle; // Specifies the minimum angular 9746 // difference, in degrees, between 9747 // two matches that have unique 9748 // angles. 9749 public double minMatchSeparationScale; // Specifies the minimum difference 9750 // in scale, expressed as a 9751 // percentage, between two matches 9752 // that have unique scales. 9753 public double maxMatchOverlap; // Specifies the maximum amount of overlap, 9754 // expressed as a percentage, allowed between 9755 // the bounding rectangles of two unique 9756 // matches. 9757 public int coarseResult; // Specifies whether you want the function to spend 9758 // less time accurately estimating the location of 9759 // a match. 9760 public int enableCalibrationSupport; // Set this element to TRUE to specify 9761 // the algorithm treat the inspection 9762 // image as a calibrated image. 9763 public ContrastMode enableContrastReversal; // Use this element to specify 9764 // the contrast of the matches 9765 // to search for in the image. 9766 public GeometricMatchingSearchStrategy matchStrategy; // Specifies the 9767 // aggressiveness of 9768 // the search 9769 // strategy. 9770 public int refineMatchFactor; // Specifies the factor that is applied to the 9771 // number of matches requested by the user to 9772 // determine the number of matches that are 9773 // refined at the initial matching stage. 9774 public int subpixelMatchFactor; // Specifies the factor that is applied to 9775 // the number of matches requested by the 9776 // user to determine the number of matches 9777 // that are evaluated at the final subpixel 9778 // matching stage. 9779 9780 private void init() { 9781 9782 } 9783 9784 public MatchGeometricPatternAdvancedOptions3() { 9785 super(88); 9786 init(); 9787 } 9788 9789 public MatchGeometricPatternAdvancedOptions3(int subpixelIterations, double subpixelTolerance, 9790 int initialMatchListLength, int targetTemplateCurveScore, int correlationScore, 9791 double minMatchSeparationDistance, double minMatchSeparationAngle, 9792 double minMatchSeparationScale, double maxMatchOverlap, int coarseResult, 9793 int enableCalibrationSupport, ContrastMode enableContrastReversal, 9794 GeometricMatchingSearchStrategy matchStrategy, int refineMatchFactor, 9795 int subpixelMatchFactor) { 9796 super(88); 9797 this.subpixelIterations = subpixelIterations; 9798 this.subpixelTolerance = subpixelTolerance; 9799 this.initialMatchListLength = initialMatchListLength; 9800 this.targetTemplateCurveScore = targetTemplateCurveScore; 9801 this.correlationScore = correlationScore; 9802 this.minMatchSeparationDistance = minMatchSeparationDistance; 9803 this.minMatchSeparationAngle = minMatchSeparationAngle; 9804 this.minMatchSeparationScale = minMatchSeparationScale; 9805 this.maxMatchOverlap = maxMatchOverlap; 9806 this.coarseResult = coarseResult; 9807 this.enableCalibrationSupport = enableCalibrationSupport; 9808 this.enableContrastReversal = enableContrastReversal; 9809 this.matchStrategy = matchStrategy; 9810 this.refineMatchFactor = refineMatchFactor; 9811 this.subpixelMatchFactor = subpixelMatchFactor; 9812 } 9813 9814 protected MatchGeometricPatternAdvancedOptions3(ByteBuffer backing, int offset) { 9815 super(backing, offset, 88); 9816 init(); 9817 } 9818 9819 protected MatchGeometricPatternAdvancedOptions3(long nativeObj, boolean owned) { 9820 super(nativeObj, owned, 88); 9821 init(); 9822 } 9823 9824 protected void setBuffer(ByteBuffer backing, int offset) { 9825 super.setBuffer(backing, offset, 88); 9826 } 9827 9828 public void read() { 9829 subpixelIterations = backing.getInt(0); 9830 subpixelTolerance = backing.getDouble(8); 9831 initialMatchListLength = backing.getInt(16); 9832 targetTemplateCurveScore = backing.getInt(20); 9833 correlationScore = backing.getInt(24); 9834 minMatchSeparationDistance = backing.getDouble(32); 9835 minMatchSeparationAngle = backing.getDouble(40); 9836 minMatchSeparationScale = backing.getDouble(48); 9837 maxMatchOverlap = backing.getDouble(56); 9838 coarseResult = backing.getInt(64); 9839 enableCalibrationSupport = backing.getInt(68); 9840 enableContrastReversal = ContrastMode.fromValue(backing.getInt(72)); 9841 matchStrategy = GeometricMatchingSearchStrategy.fromValue(backing.getInt(76)); 9842 refineMatchFactor = backing.getInt(80); 9843 subpixelMatchFactor = backing.getInt(84); 9844 } 9845 9846 public void write() { 9847 backing.putInt(0, subpixelIterations); 9848 backing.putDouble(8, subpixelTolerance); 9849 backing.putInt(16, initialMatchListLength); 9850 backing.putInt(20, targetTemplateCurveScore); 9851 backing.putInt(24, correlationScore); 9852 backing.putDouble(32, minMatchSeparationDistance); 9853 backing.putDouble(40, minMatchSeparationAngle); 9854 backing.putDouble(48, minMatchSeparationScale); 9855 backing.putDouble(56, maxMatchOverlap); 9856 backing.putInt(64, coarseResult); 9857 backing.putInt(68, enableCalibrationSupport); 9858 if (enableContrastReversal != null) 9859 backing.putInt(72, enableContrastReversal.getValue()); 9860 if (matchStrategy != null) 9861 backing.putInt(76, matchStrategy.getValue()); 9862 backing.putInt(80, refineMatchFactor); 9863 backing.putInt(84, subpixelMatchFactor); 9864 } 9865 9866 public int size() { 9867 return 88; 9868 } 9869 } 9870 9871 public static class ColorOptions extends DisposedStruct { 9872 public ColorClassificationResolution colorClassificationResolution; // Specifies 9873 // the 9874 // color 9875 // resolution 9876 // of 9877 // the 9878 // classifier. 9879 public int useLuminance; // Specifies if the luminance band is going to be 9880 // used in the feature vector. 9881 public ColorMode colorMode; // Specifies the color mode of the classifier. 9882 9883 private void init() { 9884 9885 } 9886 9887 public ColorOptions() { 9888 super(12); 9889 init(); 9890 } 9891 9892 public ColorOptions(ColorClassificationResolution colorClassificationResolution, 9893 int useLuminance, ColorMode colorMode) { 9894 super(12); 9895 this.colorClassificationResolution = colorClassificationResolution; 9896 this.useLuminance = useLuminance; 9897 this.colorMode = colorMode; 9898 } 9899 9900 protected ColorOptions(ByteBuffer backing, int offset) { 9901 super(backing, offset, 12); 9902 init(); 9903 } 9904 9905 protected ColorOptions(long nativeObj, boolean owned) { 9906 super(nativeObj, owned, 12); 9907 init(); 9908 } 9909 9910 protected void setBuffer(ByteBuffer backing, int offset) { 9911 super.setBuffer(backing, offset, 12); 9912 } 9913 9914 public void read() { 9915 colorClassificationResolution = ColorClassificationResolution.fromValue(backing.getInt(0)); 9916 useLuminance = backing.getInt(4); 9917 colorMode = ColorMode.fromValue(backing.getInt(8)); 9918 } 9919 9920 public void write() { 9921 if (colorClassificationResolution != null) 9922 backing.putInt(0, colorClassificationResolution.getValue()); 9923 backing.putInt(4, useLuminance); 9924 if (colorMode != null) 9925 backing.putInt(8, colorMode.getValue()); 9926 } 9927 9928 public int size() { 9929 return 12; 9930 } 9931 } 9932 9933 public static class SampleScore extends DisposedStruct { 9934 public String className; // The name of the class. 9935 public float distance; // The distance from the item to this class. 9936 public int index; // index of this sample. 9937 private ByteBuffer className_buf; 9938 9939 private void init() { 9940 9941 } 9942 9943 public SampleScore() { 9944 super(12); 9945 init(); 9946 } 9947 9948 public SampleScore(String className, double distance, int index) { 9949 super(12); 9950 this.className = className; 9951 this.distance = (float) distance; 9952 this.index = index; 9953 } 9954 9955 protected SampleScore(ByteBuffer backing, int offset) { 9956 super(backing, offset, 12); 9957 init(); 9958 } 9959 9960 protected SampleScore(long nativeObj, boolean owned) { 9961 super(nativeObj, owned, 12); 9962 init(); 9963 } 9964 9965 protected void setBuffer(ByteBuffer backing, int offset) { 9966 super.setBuffer(backing, offset, 12); 9967 } 9968 9969 public void read() { 9970 long className_addr = getPointer(backing, 0); 9971 if (className_addr == 0) 9972 className = null; 9973 else { 9974 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 9975 while (bb.get() != 0) { 9976 } 9977 byte[] bytes = new byte[bb.position() - 1]; 9978 getBytes(bb, bytes, 0, bytes.length); 9979 try { 9980 className = new String(bytes, "UTF-8"); 9981 } catch (UnsupportedEncodingException e) { 9982 className = ""; 9983 } 9984 } 9985 9986 distance = backing.getFloat(4); 9987 index = backing.getInt(8); 9988 } 9989 9990 public void write() { 9991 if (className != null) { 9992 byte[] className_bytes; 9993 try { 9994 className_bytes = className.getBytes("UTF-8"); 9995 } catch (UnsupportedEncodingException e) { 9996 className_bytes = new byte[0]; 9997 } 9998 className_buf = ByteBuffer.allocateDirect(className_bytes.length + 1); 9999 putBytes(className_buf, className_bytes, 0, className_bytes.length).put( 10000 className_bytes.length, (byte) 0); 10001 } 10002 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 10003 backing.putFloat(4, distance); 10004 backing.putInt(8, index); 10005 } 10006 10007 public int size() { 10008 return 12; 10009 } 10010 } 10011 10012 public static class ClassifierReportAdvanced extends DisposedStruct { 10013 public String bestClassName; // The name of the best class for the sample. 10014 public float classificationScore; // The similarity of the sample and the 10015 // two closest classes in the classifier. 10016 public float identificationScore; // The similarity of the sample and the 10017 // assigned class. 10018 public ClassScore[] allScores; // All classes and their scores. 10019 public SampleScore[] sampleScores; // All samples and their scores. 10020 private ByteBuffer bestClassName_buf; 10021 private ByteBuffer allScores_buf; 10022 private ByteBuffer sampleScores_buf; 10023 10024 private void init() { 10025 allScores = new ClassScore[0]; 10026 sampleScores = new SampleScore[0]; 10027 } 10028 10029 public ClassifierReportAdvanced() { 10030 super(28); 10031 init(); 10032 } 10033 10034 public ClassifierReportAdvanced(String bestClassName, double classificationScore, 10035 double identificationScore, ClassScore[] allScores, SampleScore[] sampleScores) { 10036 super(28); 10037 this.bestClassName = bestClassName; 10038 this.classificationScore = (float) classificationScore; 10039 this.identificationScore = (float) identificationScore; 10040 this.allScores = allScores; 10041 this.sampleScores = sampleScores; 10042 } 10043 10044 protected ClassifierReportAdvanced(ByteBuffer backing, int offset) { 10045 super(backing, offset, 28); 10046 init(); 10047 } 10048 10049 protected ClassifierReportAdvanced(long nativeObj, boolean owned) { 10050 super(nativeObj, owned, 28); 10051 init(); 10052 } 10053 10054 protected void setBuffer(ByteBuffer backing, int offset) { 10055 super.setBuffer(backing, offset, 28); 10056 } 10057 10058 public void read() { 10059 long bestClassName_addr = getPointer(backing, 0); 10060 if (bestClassName_addr == 0) 10061 bestClassName = null; 10062 else { 10063 ByteBuffer bb = newDirectByteBuffer(bestClassName_addr, 1000); // FIXME 10064 while (bb.get() != 0) { 10065 } 10066 byte[] bytes = new byte[bb.position() - 1]; 10067 getBytes(bb, bytes, 0, bytes.length); 10068 try { 10069 bestClassName = new String(bytes, "UTF-8"); 10070 } catch (UnsupportedEncodingException e) { 10071 bestClassName = ""; 10072 } 10073 } 10074 10075 classificationScore = backing.getFloat(4); 10076 identificationScore = backing.getFloat(8); 10077 int allScores_allScoresSize = backing.getInt(16); 10078 long allScores_addr = getPointer(backing, 12); 10079 allScores = new ClassScore[allScores_allScoresSize]; 10080 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 10081 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize * 8); 10082 for (int i = 0, off = 0; i < allScores_allScoresSize; i++, off += 8) { 10083 allScores[i] = new ClassScore(bb, off); 10084 allScores[i].read(); 10085 } 10086 } 10087 int sampleScores_sampleScoresSize = backing.getInt(24); 10088 long sampleScores_addr = getPointer(backing, 20); 10089 sampleScores = new SampleScore[sampleScores_sampleScoresSize]; 10090 if (sampleScores_sampleScoresSize > 0 && sampleScores_addr != 0) { 10091 ByteBuffer bb = newDirectByteBuffer(sampleScores_addr, sampleScores_sampleScoresSize * 12); 10092 for (int i = 0, off = 0; i < sampleScores_sampleScoresSize; i++, off += 12) { 10093 sampleScores[i] = new SampleScore(bb, off); 10094 sampleScores[i].read(); 10095 } 10096 } 10097 } 10098 10099 public void write() { 10100 if (bestClassName != null) { 10101 byte[] bestClassName_bytes; 10102 try { 10103 bestClassName_bytes = bestClassName.getBytes("UTF-8"); 10104 } catch (UnsupportedEncodingException e) { 10105 bestClassName_bytes = new byte[0]; 10106 } 10107 bestClassName_buf = ByteBuffer.allocateDirect(bestClassName_bytes.length + 1); 10108 putBytes(bestClassName_buf, bestClassName_bytes, 0, bestClassName_bytes.length).put( 10109 bestClassName_bytes.length, (byte) 0); 10110 } 10111 putPointer(backing, 0, bestClassName == null ? 0 : getByteBufferAddress(bestClassName_buf)); 10112 backing.putFloat(4, classificationScore); 10113 backing.putFloat(8, identificationScore); 10114 allScores_buf = 10115 ByteBuffer.allocateDirect(allScores.length * 8).order(ByteOrder.nativeOrder()); 10116 for (int i = 0, off = 0; i < allScores.length; i++, off += 8) { 10117 allScores[i].setBuffer(allScores_buf, off); 10118 allScores[i].write(); 10119 } 10120 backing.putInt(16, allScores.length); 10121 putPointer(backing, 12, allScores_buf); 10122 sampleScores_buf = 10123 ByteBuffer.allocateDirect(sampleScores.length * 12).order(ByteOrder.nativeOrder()); 10124 for (int i = 0, off = 0; i < sampleScores.length; i++, off += 12) { 10125 sampleScores[i].setBuffer(sampleScores_buf, off); 10126 sampleScores[i].write(); 10127 } 10128 backing.putInt(24, sampleScores.length); 10129 putPointer(backing, 20, sampleScores_buf); 10130 } 10131 10132 public int size() { 10133 return 28; 10134 } 10135 } 10136 10137 public static class LearnGeometricPatternAdvancedOptions2 extends DisposedStruct { 10138 public double minScaleFactor; // Specifies the minimum scale factor that the 10139 // template is learned for. 10140 public double maxScaleFactor; // Specifies the maximum scale factor the 10141 // template is learned for. 10142 public double minRotationAngleValue; // Specifies the minimum rotation angle 10143 // the template is learned for. 10144 public double maxRotationAngleValue; // Specifies the maximum rotation angle 10145 // the template is learned for. 10146 public int imageSamplingFactor; // Specifies the factor that is used to 10147 // subsample the template and the image for 10148 // the initial matching phase. 10149 10150 private void init() { 10151 10152 } 10153 10154 public LearnGeometricPatternAdvancedOptions2() { 10155 super(40); 10156 init(); 10157 } 10158 10159 public LearnGeometricPatternAdvancedOptions2(double minScaleFactor, double maxScaleFactor, 10160 double minRotationAngleValue, double maxRotationAngleValue, int imageSamplingFactor) { 10161 super(40); 10162 this.minScaleFactor = minScaleFactor; 10163 this.maxScaleFactor = maxScaleFactor; 10164 this.minRotationAngleValue = minRotationAngleValue; 10165 this.maxRotationAngleValue = maxRotationAngleValue; 10166 this.imageSamplingFactor = imageSamplingFactor; 10167 } 10168 10169 protected LearnGeometricPatternAdvancedOptions2(ByteBuffer backing, int offset) { 10170 super(backing, offset, 40); 10171 init(); 10172 } 10173 10174 protected LearnGeometricPatternAdvancedOptions2(long nativeObj, boolean owned) { 10175 super(nativeObj, owned, 40); 10176 init(); 10177 } 10178 10179 protected void setBuffer(ByteBuffer backing, int offset) { 10180 super.setBuffer(backing, offset, 40); 10181 } 10182 10183 public void read() { 10184 minScaleFactor = backing.getDouble(0); 10185 maxScaleFactor = backing.getDouble(8); 10186 minRotationAngleValue = backing.getDouble(16); 10187 maxRotationAngleValue = backing.getDouble(24); 10188 imageSamplingFactor = backing.getInt(32); 10189 } 10190 10191 public void write() { 10192 backing.putDouble(0, minScaleFactor); 10193 backing.putDouble(8, maxScaleFactor); 10194 backing.putDouble(16, minRotationAngleValue); 10195 backing.putDouble(24, maxRotationAngleValue); 10196 backing.putInt(32, imageSamplingFactor); 10197 } 10198 10199 public int size() { 10200 return 40; 10201 } 10202 } 10203 10204 public static class ParticleFilterOptions2 extends DisposedStruct { 10205 public int rejectMatches; // Set this parameter to TRUE to transfer only 10206 // those particles that do not meet all the 10207 // criteria. 10208 public int rejectBorder; // Set this element to TRUE to reject border 10209 // particles. 10210 public int fillHoles; // Set this element to TRUE to fill holes in 10211 // particles. 10212 public int connectivity8; // Set this parameter to TRUE to use 10213 // connectivity-8 to determine whether particles 10214 // are touching. 10215 10216 private void init() { 10217 10218 } 10219 10220 public ParticleFilterOptions2() { 10221 super(16); 10222 init(); 10223 } 10224 10225 public ParticleFilterOptions2(int rejectMatches, int rejectBorder, int fillHoles, 10226 int connectivity8) { 10227 super(16); 10228 this.rejectMatches = rejectMatches; 10229 this.rejectBorder = rejectBorder; 10230 this.fillHoles = fillHoles; 10231 this.connectivity8 = connectivity8; 10232 } 10233 10234 protected ParticleFilterOptions2(ByteBuffer backing, int offset) { 10235 super(backing, offset, 16); 10236 init(); 10237 } 10238 10239 protected ParticleFilterOptions2(long nativeObj, boolean owned) { 10240 super(nativeObj, owned, 16); 10241 init(); 10242 } 10243 10244 protected void setBuffer(ByteBuffer backing, int offset) { 10245 super.setBuffer(backing, offset, 16); 10246 } 10247 10248 public void read() { 10249 rejectMatches = backing.getInt(0); 10250 rejectBorder = backing.getInt(4); 10251 fillHoles = backing.getInt(8); 10252 connectivity8 = backing.getInt(12); 10253 } 10254 10255 public void write() { 10256 backing.putInt(0, rejectMatches); 10257 backing.putInt(4, rejectBorder); 10258 backing.putInt(8, fillHoles); 10259 backing.putInt(12, connectivity8); 10260 } 10261 10262 public int size() { 10263 return 16; 10264 } 10265 } 10266 10267 public static class FindEdgeOptions2 extends DisposedStruct { 10268 public RakeDirection direction; // The direction to search in the ROI. 10269 public int showSearchArea; // If TRUE, the function overlays the search area 10270 // on the image. 10271 public int showSearchLines; // If TRUE, the function overlays the search 10272 // lines used to locate the edges on the image. 10273 public int showEdgesFound; // If TRUE, the function overlays the locations 10274 // of the edges found on the image. 10275 public int showResult; // If TRUE, the function overlays the hit lines to 10276 // the object and the edge used to generate the hit 10277 // line on the result image. 10278 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 10279 // overlay the search area. 10280 public RGBValue searchLinesColor; // Specifies the RGB color value to use to 10281 // overlay the search lines. 10282 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to 10283 // overlay the search edges. 10284 public RGBValue resultColor; // Specifies the RGB color value to use to 10285 // overlay the results. 10286 public String overlayGroupName; // Specifies the overlay group name to 10287 // assign to the overlays. 10288 public EdgeOptions2 edgeOptions; // Specifies the edge detection options 10289 // along a single search line. 10290 private ByteBuffer overlayGroupName_buf; 10291 10292 private void init() { 10293 searchAreaColor = new RGBValue(backing, 20); 10294 searchLinesColor = new RGBValue(backing, 24); 10295 searchEdgesColor = new RGBValue(backing, 28); 10296 resultColor = new RGBValue(backing, 32); 10297 edgeOptions = new EdgeOptions2(backing, 40); 10298 } 10299 10300 public FindEdgeOptions2() { 10301 super(64); 10302 init(); 10303 } 10304 10305 public FindEdgeOptions2(RakeDirection direction, int showSearchArea, int showSearchLines, 10306 int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, 10307 RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, 10308 EdgeOptions2 edgeOptions) { 10309 super(64); 10310 this.direction = direction; 10311 this.showSearchArea = showSearchArea; 10312 this.showSearchLines = showSearchLines; 10313 this.showEdgesFound = showEdgesFound; 10314 this.showResult = showResult; 10315 this.searchAreaColor = searchAreaColor; 10316 this.searchLinesColor = searchLinesColor; 10317 this.searchEdgesColor = searchEdgesColor; 10318 this.resultColor = resultColor; 10319 this.overlayGroupName = overlayGroupName; 10320 this.edgeOptions = edgeOptions; 10321 } 10322 10323 protected FindEdgeOptions2(ByteBuffer backing, int offset) { 10324 super(backing, offset, 64); 10325 init(); 10326 } 10327 10328 protected FindEdgeOptions2(long nativeObj, boolean owned) { 10329 super(nativeObj, owned, 64); 10330 init(); 10331 } 10332 10333 protected void setBuffer(ByteBuffer backing, int offset) { 10334 super.setBuffer(backing, offset, 64); 10335 } 10336 10337 public void read() { 10338 direction = RakeDirection.fromValue(backing.getInt(0)); 10339 showSearchArea = backing.getInt(4); 10340 showSearchLines = backing.getInt(8); 10341 showEdgesFound = backing.getInt(12); 10342 showResult = backing.getInt(16); 10343 searchAreaColor.read(); 10344 searchLinesColor.read(); 10345 searchEdgesColor.read(); 10346 resultColor.read(); 10347 long overlayGroupName_addr = getPointer(backing, 36); 10348 if (overlayGroupName_addr == 0) 10349 overlayGroupName = null; 10350 else { 10351 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 10352 while (bb.get() != 0) { 10353 } 10354 byte[] bytes = new byte[bb.position() - 1]; 10355 getBytes(bb, bytes, 0, bytes.length); 10356 try { 10357 overlayGroupName = new String(bytes, "UTF-8"); 10358 } catch (UnsupportedEncodingException e) { 10359 overlayGroupName = ""; 10360 } 10361 } 10362 10363 edgeOptions.read(); 10364 } 10365 10366 public void write() { 10367 if (direction != null) 10368 backing.putInt(0, direction.getValue()); 10369 backing.putInt(4, showSearchArea); 10370 backing.putInt(8, showSearchLines); 10371 backing.putInt(12, showEdgesFound); 10372 backing.putInt(16, showResult); 10373 searchAreaColor.write(); 10374 searchLinesColor.write(); 10375 searchEdgesColor.write(); 10376 resultColor.write(); 10377 if (overlayGroupName != null) { 10378 byte[] overlayGroupName_bytes; 10379 try { 10380 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 10381 } catch (UnsupportedEncodingException e) { 10382 overlayGroupName_bytes = new byte[0]; 10383 } 10384 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 10385 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 10386 .put(overlayGroupName_bytes.length, (byte) 0); 10387 } 10388 putPointer(backing, 36, overlayGroupName == null ? 0 10389 : getByteBufferAddress(overlayGroupName_buf)); 10390 edgeOptions.write(); 10391 } 10392 10393 public int size() { 10394 return 64; 10395 } 10396 } 10397 10398 public static class FindEdgeReport extends DisposedStruct { 10399 public StraightEdge[] straightEdges; // An array of straight edges detected. 10400 private ByteBuffer straightEdges_buf; 10401 10402 private void init() { 10403 straightEdges = new StraightEdge[0]; 10404 } 10405 10406 public FindEdgeReport() { 10407 super(8); 10408 init(); 10409 } 10410 10411 public FindEdgeReport(StraightEdge[] straightEdges) { 10412 super(8); 10413 this.straightEdges = straightEdges; 10414 } 10415 10416 protected FindEdgeReport(ByteBuffer backing, int offset) { 10417 super(backing, offset, 8); 10418 init(); 10419 } 10420 10421 protected FindEdgeReport(long nativeObj, boolean owned) { 10422 super(nativeObj, owned, 8); 10423 init(); 10424 } 10425 10426 protected void setBuffer(ByteBuffer backing, int offset) { 10427 super.setBuffer(backing, offset, 8); 10428 } 10429 10430 public void read() { 10431 int straightEdges_numStraightEdges = backing.getInt(4); 10432 long straightEdges_addr = getPointer(backing, 0); 10433 straightEdges = new StraightEdge[straightEdges_numStraightEdges]; 10434 if (straightEdges_numStraightEdges > 0 && straightEdges_addr != 0) { 10435 ByteBuffer bb = 10436 newDirectByteBuffer(straightEdges_addr, straightEdges_numStraightEdges * 88); 10437 for (int i = 0, off = 0; i < straightEdges_numStraightEdges; i++, off += 88) { 10438 straightEdges[i] = new StraightEdge(bb, off); 10439 straightEdges[i].read(); 10440 } 10441 } 10442 } 10443 10444 public void write() { 10445 straightEdges_buf = 10446 ByteBuffer.allocateDirect(straightEdges.length * 88).order(ByteOrder.nativeOrder()); 10447 for (int i = 0, off = 0; i < straightEdges.length; i++, off += 88) { 10448 straightEdges[i].setBuffer(straightEdges_buf, off); 10449 straightEdges[i].write(); 10450 } 10451 backing.putInt(4, straightEdges.length); 10452 putPointer(backing, 0, straightEdges_buf); 10453 } 10454 10455 public int size() { 10456 return 8; 10457 } 10458 } 10459 10460 public static class FindTransformRectOptions2 extends DisposedStruct { 10461 public FindReferenceDirection direction; // Specifies the direction and 10462 // orientation in which the 10463 // function searches for the 10464 // primary axis. 10465 public int showSearchArea; // If TRUE, the function overlays the search area 10466 // on the image. 10467 public int showSearchLines; // If TRUE, the function overlays the search 10468 // lines used to locate the edges on the image. 10469 public int showEdgesFound; // If TRUE, the function overlays the locations 10470 // of the edges found on the image. 10471 public int showResult; // If TRUE, the function overlays the hit lines to 10472 // the object and the edge used to generate the hit 10473 // line on the result image. 10474 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 10475 // overlay the search area. 10476 public RGBValue searchLinesColor; // Specifies the RGB color value to use to 10477 // overlay the search lines. 10478 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to 10479 // overlay the search edges. 10480 public RGBValue resultColor; // Specifies the RGB color value to use to 10481 // overlay the results. 10482 public String overlayGroupName; // Specifies the overlay group name to 10483 // assign to the overlays. 10484 public EdgeOptions2 edgeOptions; // Specifies the edge detection options 10485 // along a single search line. 10486 private ByteBuffer overlayGroupName_buf; 10487 10488 private void init() { 10489 searchAreaColor = new RGBValue(backing, 20); 10490 searchLinesColor = new RGBValue(backing, 24); 10491 searchEdgesColor = new RGBValue(backing, 28); 10492 resultColor = new RGBValue(backing, 32); 10493 edgeOptions = new EdgeOptions2(backing, 40); 10494 } 10495 10496 public FindTransformRectOptions2() { 10497 super(64); 10498 init(); 10499 } 10500 10501 public FindTransformRectOptions2(FindReferenceDirection direction, int showSearchArea, 10502 int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, 10503 RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, 10504 String overlayGroupName, EdgeOptions2 edgeOptions) { 10505 super(64); 10506 this.direction = direction; 10507 this.showSearchArea = showSearchArea; 10508 this.showSearchLines = showSearchLines; 10509 this.showEdgesFound = showEdgesFound; 10510 this.showResult = showResult; 10511 this.searchAreaColor = searchAreaColor; 10512 this.searchLinesColor = searchLinesColor; 10513 this.searchEdgesColor = searchEdgesColor; 10514 this.resultColor = resultColor; 10515 this.overlayGroupName = overlayGroupName; 10516 this.edgeOptions = edgeOptions; 10517 } 10518 10519 protected FindTransformRectOptions2(ByteBuffer backing, int offset) { 10520 super(backing, offset, 64); 10521 init(); 10522 } 10523 10524 protected FindTransformRectOptions2(long nativeObj, boolean owned) { 10525 super(nativeObj, owned, 64); 10526 init(); 10527 } 10528 10529 protected void setBuffer(ByteBuffer backing, int offset) { 10530 super.setBuffer(backing, offset, 64); 10531 } 10532 10533 public void read() { 10534 direction = FindReferenceDirection.fromValue(backing.getInt(0)); 10535 showSearchArea = backing.getInt(4); 10536 showSearchLines = backing.getInt(8); 10537 showEdgesFound = backing.getInt(12); 10538 showResult = backing.getInt(16); 10539 searchAreaColor.read(); 10540 searchLinesColor.read(); 10541 searchEdgesColor.read(); 10542 resultColor.read(); 10543 long overlayGroupName_addr = getPointer(backing, 36); 10544 if (overlayGroupName_addr == 0) 10545 overlayGroupName = null; 10546 else { 10547 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 10548 while (bb.get() != 0) { 10549 } 10550 byte[] bytes = new byte[bb.position() - 1]; 10551 getBytes(bb, bytes, 0, bytes.length); 10552 try { 10553 overlayGroupName = new String(bytes, "UTF-8"); 10554 } catch (UnsupportedEncodingException e) { 10555 overlayGroupName = ""; 10556 } 10557 } 10558 10559 edgeOptions.read(); 10560 } 10561 10562 public void write() { 10563 if (direction != null) 10564 backing.putInt(0, direction.getValue()); 10565 backing.putInt(4, showSearchArea); 10566 backing.putInt(8, showSearchLines); 10567 backing.putInt(12, showEdgesFound); 10568 backing.putInt(16, showResult); 10569 searchAreaColor.write(); 10570 searchLinesColor.write(); 10571 searchEdgesColor.write(); 10572 resultColor.write(); 10573 if (overlayGroupName != null) { 10574 byte[] overlayGroupName_bytes; 10575 try { 10576 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 10577 } catch (UnsupportedEncodingException e) { 10578 overlayGroupName_bytes = new byte[0]; 10579 } 10580 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 10581 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 10582 .put(overlayGroupName_bytes.length, (byte) 0); 10583 } 10584 putPointer(backing, 36, overlayGroupName == null ? 0 10585 : getByteBufferAddress(overlayGroupName_buf)); 10586 edgeOptions.write(); 10587 } 10588 10589 public int size() { 10590 return 64; 10591 } 10592 } 10593 10594 public static class FindTransformRectsOptions2 extends DisposedStruct { 10595 public FindReferenceDirection direction; // Specifies the direction and 10596 // orientation in which the 10597 // function searches for the 10598 // primary axis. 10599 public int showSearchArea; // If TRUE, the function overlays the search area 10600 // on the image. 10601 public int showSearchLines; // If TRUE, the function overlays the search 10602 // lines used to locate the edges on the image. 10603 public int showEdgesFound; // If TRUE, the function overlays the locations 10604 // of the edges found on the image. 10605 public int showResult; // If TRUE, the function overlays the hit lines to 10606 // the object and the edge used to generate the hit 10607 // line on the result image. 10608 public RGBValue searchAreaColor; // Specifies the RGB color value to use to 10609 // overlay the search area. 10610 public RGBValue searchLinesColor; // Specifies the RGB color value to use to 10611 // overlay the search lines. 10612 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to 10613 // overlay the search edges. 10614 public RGBValue resultColor; // Specifies the RGB color value to use to 10615 // overlay the results. 10616 public String overlayGroupName; // Specifies the overlay group name to 10617 // assign to the overlays. 10618 public EdgeOptions2 primaryEdgeOptions; // Specifies the parameters used to 10619 // compute the edge gradient 10620 // information and detect the edges 10621 // for the primary ROI. 10622 public EdgeOptions2 secondaryEdgeOptions; // Specifies the parameters used 10623 // to compute the edge gradient 10624 // information and detect the 10625 // edges for the secondary ROI. 10626 private ByteBuffer overlayGroupName_buf; 10627 10628 private void init() { 10629 searchAreaColor = new RGBValue(backing, 20); 10630 searchLinesColor = new RGBValue(backing, 24); 10631 searchEdgesColor = new RGBValue(backing, 28); 10632 resultColor = new RGBValue(backing, 32); 10633 primaryEdgeOptions = new EdgeOptions2(backing, 40); 10634 secondaryEdgeOptions = new EdgeOptions2(backing, 64); 10635 } 10636 10637 public FindTransformRectsOptions2() { 10638 super(88); 10639 init(); 10640 } 10641 10642 public FindTransformRectsOptions2(FindReferenceDirection direction, int showSearchArea, 10643 int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, 10644 RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, 10645 String overlayGroupName, EdgeOptions2 primaryEdgeOptions, EdgeOptions2 secondaryEdgeOptions) { 10646 super(88); 10647 this.direction = direction; 10648 this.showSearchArea = showSearchArea; 10649 this.showSearchLines = showSearchLines; 10650 this.showEdgesFound = showEdgesFound; 10651 this.showResult = showResult; 10652 this.searchAreaColor = searchAreaColor; 10653 this.searchLinesColor = searchLinesColor; 10654 this.searchEdgesColor = searchEdgesColor; 10655 this.resultColor = resultColor; 10656 this.overlayGroupName = overlayGroupName; 10657 this.primaryEdgeOptions = primaryEdgeOptions; 10658 this.secondaryEdgeOptions = secondaryEdgeOptions; 10659 } 10660 10661 protected FindTransformRectsOptions2(ByteBuffer backing, int offset) { 10662 super(backing, offset, 88); 10663 init(); 10664 } 10665 10666 protected FindTransformRectsOptions2(long nativeObj, boolean owned) { 10667 super(nativeObj, owned, 88); 10668 init(); 10669 } 10670 10671 protected void setBuffer(ByteBuffer backing, int offset) { 10672 super.setBuffer(backing, offset, 88); 10673 } 10674 10675 public void read() { 10676 direction = FindReferenceDirection.fromValue(backing.getInt(0)); 10677 showSearchArea = backing.getInt(4); 10678 showSearchLines = backing.getInt(8); 10679 showEdgesFound = backing.getInt(12); 10680 showResult = backing.getInt(16); 10681 searchAreaColor.read(); 10682 searchLinesColor.read(); 10683 searchEdgesColor.read(); 10684 resultColor.read(); 10685 long overlayGroupName_addr = getPointer(backing, 36); 10686 if (overlayGroupName_addr == 0) 10687 overlayGroupName = null; 10688 else { 10689 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 10690 while (bb.get() != 0) { 10691 } 10692 byte[] bytes = new byte[bb.position() - 1]; 10693 getBytes(bb, bytes, 0, bytes.length); 10694 try { 10695 overlayGroupName = new String(bytes, "UTF-8"); 10696 } catch (UnsupportedEncodingException e) { 10697 overlayGroupName = ""; 10698 } 10699 } 10700 10701 primaryEdgeOptions.read(); 10702 secondaryEdgeOptions.read(); 10703 } 10704 10705 public void write() { 10706 if (direction != null) 10707 backing.putInt(0, direction.getValue()); 10708 backing.putInt(4, showSearchArea); 10709 backing.putInt(8, showSearchLines); 10710 backing.putInt(12, showEdgesFound); 10711 backing.putInt(16, showResult); 10712 searchAreaColor.write(); 10713 searchLinesColor.write(); 10714 searchEdgesColor.write(); 10715 resultColor.write(); 10716 if (overlayGroupName != null) { 10717 byte[] overlayGroupName_bytes; 10718 try { 10719 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 10720 } catch (UnsupportedEncodingException e) { 10721 overlayGroupName_bytes = new byte[0]; 10722 } 10723 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length + 1); 10724 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length) 10725 .put(overlayGroupName_bytes.length, (byte) 0); 10726 } 10727 putPointer(backing, 36, overlayGroupName == null ? 0 10728 : getByteBufferAddress(overlayGroupName_buf)); 10729 primaryEdgeOptions.write(); 10730 secondaryEdgeOptions.write(); 10731 } 10732 10733 public int size() { 10734 return 88; 10735 } 10736 } 10737 10738 public static class ReadTextReport3 extends DisposedStruct { 10739 public String readString; // The read string. 10740 public CharReport3[] characterReport; // An array of reports describing the 10741 // properties of each identified 10742 // character. 10743 public ROI roiBoundingCharacters; // An array specifying the coordinates of 10744 // the character bounding ROI. 10745 private ByteBuffer readString_buf; 10746 private ByteBuffer characterReport_buf; 10747 10748 private void init() { 10749 characterReport = new CharReport3[0]; 10750 } 10751 10752 public ReadTextReport3() { 10753 super(16); 10754 init(); 10755 } 10756 10757 public ReadTextReport3(String readString, CharReport3[] characterReport, 10758 ROI roiBoundingCharacters) { 10759 super(16); 10760 this.readString = readString; 10761 this.characterReport = characterReport; 10762 this.roiBoundingCharacters = roiBoundingCharacters; 10763 } 10764 10765 protected ReadTextReport3(ByteBuffer backing, int offset) { 10766 super(backing, offset, 16); 10767 init(); 10768 } 10769 10770 protected ReadTextReport3(long nativeObj, boolean owned) { 10771 super(nativeObj, owned, 16); 10772 init(); 10773 } 10774 10775 protected void setBuffer(ByteBuffer backing, int offset) { 10776 super.setBuffer(backing, offset, 16); 10777 } 10778 10779 public void read() { 10780 long readString_addr = getPointer(backing, 0); 10781 if (readString_addr == 0) 10782 readString = null; 10783 else { 10784 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 10785 while (bb.get() != 0) { 10786 } 10787 byte[] bytes = new byte[bb.position() - 1]; 10788 getBytes(bb, bytes, 0, bytes.length); 10789 try { 10790 readString = new String(bytes, "UTF-8"); 10791 } catch (UnsupportedEncodingException e) { 10792 readString = ""; 10793 } 10794 } 10795 10796 int characterReport_numCharacterReports = backing.getInt(8); 10797 long characterReport_addr = getPointer(backing, 4); 10798 characterReport = new CharReport3[characterReport_numCharacterReports]; 10799 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 10800 ByteBuffer bb = 10801 newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports * 44); 10802 for (int i = 0, off = 0; i < characterReport_numCharacterReports; i++, off += 44) { 10803 characterReport[i] = new CharReport3(bb, off); 10804 characterReport[i].read(); 10805 } 10806 } 10807 long roiBoundingCharacters_addr = getPointer(backing, 12); 10808 if (roiBoundingCharacters_addr == 0) 10809 roiBoundingCharacters = null; 10810 else 10811 roiBoundingCharacters = new ROI(roiBoundingCharacters_addr, false); 10812 } 10813 10814 public void write() { 10815 if (readString != null) { 10816 byte[] readString_bytes; 10817 try { 10818 readString_bytes = readString.getBytes("UTF-8"); 10819 } catch (UnsupportedEncodingException e) { 10820 readString_bytes = new byte[0]; 10821 } 10822 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length + 1); 10823 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put( 10824 readString_bytes.length, (byte) 0); 10825 } 10826 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 10827 characterReport_buf = 10828 ByteBuffer.allocateDirect(characterReport.length * 44).order(ByteOrder.nativeOrder()); 10829 for (int i = 0, off = 0; i < characterReport.length; i++, off += 44) { 10830 characterReport[i].setBuffer(characterReport_buf, off); 10831 characterReport[i].write(); 10832 } 10833 backing.putInt(8, characterReport.length); 10834 putPointer(backing, 4, characterReport_buf); 10835 putPointer(backing, 12, roiBoundingCharacters); 10836 } 10837 10838 public int size() { 10839 return 16; 10840 } 10841 } 10842 10843 public static class CharacterStatistics extends DisposedStruct { 10844 public int left; // The left offset of the character bounding rectangles in 10845 // the current ROI. 10846 public int top; // The top offset of the character bounding rectangles in 10847 // the current ROI. 10848 public int width; // The width of each of the characters you trained in the 10849 // current ROI. 10850 public int height; // The height of each trained character in the current 10851 // ROI. 10852 public int characterSize; // The size of the character in pixels. 10853 10854 private void init() { 10855 10856 } 10857 10858 public CharacterStatistics() { 10859 super(20); 10860 init(); 10861 } 10862 10863 public CharacterStatistics(int left, int top, int width, int height, int characterSize) { 10864 super(20); 10865 this.left = left; 10866 this.top = top; 10867 this.width = width; 10868 this.height = height; 10869 this.characterSize = characterSize; 10870 } 10871 10872 protected CharacterStatistics(ByteBuffer backing, int offset) { 10873 super(backing, offset, 20); 10874 init(); 10875 } 10876 10877 protected CharacterStatistics(long nativeObj, boolean owned) { 10878 super(nativeObj, owned, 20); 10879 init(); 10880 } 10881 10882 protected void setBuffer(ByteBuffer backing, int offset) { 10883 super.setBuffer(backing, offset, 20); 10884 } 10885 10886 public void read() { 10887 left = backing.getInt(0); 10888 top = backing.getInt(4); 10889 width = backing.getInt(8); 10890 height = backing.getInt(12); 10891 characterSize = backing.getInt(16); 10892 } 10893 10894 public void write() { 10895 backing.putInt(0, left); 10896 backing.putInt(4, top); 10897 backing.putInt(8, width); 10898 backing.putInt(12, height); 10899 backing.putInt(16, characterSize); 10900 } 10901 10902 public int size() { 10903 return 20; 10904 } 10905 } 10906 10907 public static class CharReport3 extends DisposedStruct { 10908 public String character; // The character value. 10909 public int classificationScore; // The degree to which the assigned 10910 // character class represents the object 10911 // better than the other character classes 10912 // in the character set. 10913 public int verificationScore; // The similarity of the character and the 10914 // reference character for the character 10915 // class. 10916 public int verified; // This element is TRUE if a reference character was 10917 // found for the character class and FALSE if a 10918 // reference character was not found. 10919 public int lowThreshold; // The minimum value of the threshold range used 10920 // for this character. 10921 public int highThreshold; // The maximum value of the threshold range used 10922 // for this character. 10923 public CharacterStatistics characterStats; // Describes the characters 10924 // segmented in the ROI. 10925 private ByteBuffer character_buf; 10926 10927 private void init() { 10928 characterStats = new CharacterStatistics(backing, 24); 10929 } 10930 10931 public CharReport3() { 10932 super(44); 10933 init(); 10934 } 10935 10936 public CharReport3(String character, int classificationScore, int verificationScore, 10937 int verified, int lowThreshold, int highThreshold, CharacterStatistics characterStats) { 10938 super(44); 10939 this.character = character; 10940 this.classificationScore = classificationScore; 10941 this.verificationScore = verificationScore; 10942 this.verified = verified; 10943 this.lowThreshold = lowThreshold; 10944 this.highThreshold = highThreshold; 10945 this.characterStats = characterStats; 10946 } 10947 10948 protected CharReport3(ByteBuffer backing, int offset) { 10949 super(backing, offset, 44); 10950 init(); 10951 } 10952 10953 protected CharReport3(long nativeObj, boolean owned) { 10954 super(nativeObj, owned, 44); 10955 init(); 10956 } 10957 10958 protected void setBuffer(ByteBuffer backing, int offset) { 10959 super.setBuffer(backing, offset, 44); 10960 } 10961 10962 public void read() { 10963 long character_addr = getPointer(backing, 0); 10964 if (character_addr == 0) 10965 character = null; 10966 else { 10967 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 10968 while (bb.get() != 0) { 10969 } 10970 byte[] bytes = new byte[bb.position() - 1]; 10971 getBytes(bb, bytes, 0, bytes.length); 10972 try { 10973 character = new String(bytes, "UTF-8"); 10974 } catch (UnsupportedEncodingException e) { 10975 character = ""; 10976 } 10977 } 10978 10979 classificationScore = backing.getInt(4); 10980 verificationScore = backing.getInt(8); 10981 verified = backing.getInt(12); 10982 lowThreshold = backing.getInt(16); 10983 highThreshold = backing.getInt(20); 10984 characterStats.read(); 10985 } 10986 10987 public void write() { 10988 if (character != null) { 10989 byte[] character_bytes; 10990 try { 10991 character_bytes = character.getBytes("UTF-8"); 10992 } catch (UnsupportedEncodingException e) { 10993 character_bytes = new byte[0]; 10994 } 10995 character_buf = ByteBuffer.allocateDirect(character_bytes.length + 1); 10996 putBytes(character_buf, character_bytes, 0, character_bytes.length).put( 10997 character_bytes.length, (byte) 0); 10998 } 10999 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 11000 backing.putInt(4, classificationScore); 11001 backing.putInt(8, verificationScore); 11002 backing.putInt(12, verified); 11003 backing.putInt(16, lowThreshold); 11004 backing.putInt(20, highThreshold); 11005 characterStats.write(); 11006 } 11007 11008 public int size() { 11009 return 44; 11010 } 11011 } 11012 11013 public static class ArcInfo2 extends DisposedStruct { 11014 public PointFloat center; // The center point of the arc. 11015 public double radius; // The radius of the arc. 11016 public double startAngle; // The starting angle of the arc, specified 11017 // counter-clockwise from the x-axis. 11018 public double endAngle; // The ending angle of the arc, specified 11019 // counter-clockwise from the x-axis. 11020 11021 private void init() { 11022 center = new PointFloat(backing, 0); 11023 } 11024 11025 public ArcInfo2() { 11026 super(32); 11027 init(); 11028 } 11029 11030 public ArcInfo2(PointFloat center, double radius, double startAngle, double endAngle) { 11031 super(32); 11032 this.center = center; 11033 this.radius = radius; 11034 this.startAngle = startAngle; 11035 this.endAngle = endAngle; 11036 } 11037 11038 protected ArcInfo2(ByteBuffer backing, int offset) { 11039 super(backing, offset, 32); 11040 init(); 11041 } 11042 11043 protected ArcInfo2(long nativeObj, boolean owned) { 11044 super(nativeObj, owned, 32); 11045 init(); 11046 } 11047 11048 protected void setBuffer(ByteBuffer backing, int offset) { 11049 super.setBuffer(backing, offset, 32); 11050 } 11051 11052 public void read() { 11053 center.read(); 11054 radius = backing.getDouble(8); 11055 startAngle = backing.getDouble(16); 11056 endAngle = backing.getDouble(24); 11057 } 11058 11059 public void write() { 11060 center.write(); 11061 backing.putDouble(8, radius); 11062 backing.putDouble(16, startAngle); 11063 backing.putDouble(24, endAngle); 11064 } 11065 11066 public int size() { 11067 return 32; 11068 } 11069 } 11070 11071 public static class EdgeReport2 extends DisposedStruct { 11072 public EdgeInfo[] edges; // An array of edges detected. 11073 public double[] gradientInfo; // An array that contains the calculated edge 11074 // strengths along the user-defined search 11075 // area. 11076 public int calibrationValid; // Indicates if the calibration data 11077 // corresponding to the location of the edges 11078 // is correct. 11079 private ByteBuffer edges_buf; 11080 private ByteBuffer gradientInfo_buf; 11081 11082 private void init() { 11083 edges = new EdgeInfo[0]; 11084 gradientInfo = new double[0]; 11085 } 11086 11087 public EdgeReport2() { 11088 super(20); 11089 init(); 11090 } 11091 11092 public EdgeReport2(EdgeInfo[] edges, double[] gradientInfo, int calibrationValid) { 11093 super(20); 11094 this.edges = edges; 11095 this.gradientInfo = gradientInfo; 11096 this.calibrationValid = calibrationValid; 11097 } 11098 11099 protected EdgeReport2(ByteBuffer backing, int offset) { 11100 super(backing, offset, 20); 11101 init(); 11102 } 11103 11104 protected EdgeReport2(long nativeObj, boolean owned) { 11105 super(nativeObj, owned, 20); 11106 init(); 11107 } 11108 11109 protected void setBuffer(ByteBuffer backing, int offset) { 11110 super.setBuffer(backing, offset, 20); 11111 } 11112 11113 public void read() { 11114 int edges_numEdges = backing.getInt(4); 11115 long edges_addr = getPointer(backing, 0); 11116 edges = new EdgeInfo[edges_numEdges]; 11117 if (edges_numEdges > 0 && edges_addr != 0) { 11118 ByteBuffer bb = newDirectByteBuffer(edges_addr, edges_numEdges * 56); 11119 for (int i = 0, off = 0; i < edges_numEdges; i++, off += 56) { 11120 edges[i] = new EdgeInfo(bb, off); 11121 edges[i].read(); 11122 } 11123 } 11124 int gradientInfo_numGradientInfo = backing.getInt(12); 11125 long gradientInfo_addr = getPointer(backing, 8); 11126 gradientInfo = new double[gradientInfo_numGradientInfo]; 11127 if (gradientInfo_numGradientInfo > 0 && gradientInfo_addr != 0) { 11128 newDirectByteBuffer(gradientInfo_addr, gradientInfo_numGradientInfo * 8).asDoubleBuffer() 11129 .get(gradientInfo); 11130 } 11131 calibrationValid = backing.getInt(16); 11132 } 11133 11134 public void write() { 11135 edges_buf = ByteBuffer.allocateDirect(edges.length * 56).order(ByteOrder.nativeOrder()); 11136 for (int i = 0, off = 0; i < edges.length; i++, off += 56) { 11137 edges[i].setBuffer(edges_buf, off); 11138 edges[i].write(); 11139 } 11140 backing.putInt(4, edges.length); 11141 putPointer(backing, 0, edges_buf); 11142 gradientInfo_buf = 11143 ByteBuffer.allocateDirect(gradientInfo.length * 8).order(ByteOrder.nativeOrder()); 11144 gradientInfo_buf.asDoubleBuffer().put(gradientInfo).rewind(); 11145 backing.putInt(12, gradientInfo.length); 11146 putPointer(backing, 8, gradientInfo_buf); 11147 backing.putInt(16, calibrationValid); 11148 } 11149 11150 public int size() { 11151 return 20; 11152 } 11153 } 11154 11155 public static class SearchArcInfo extends DisposedStruct { 11156 public ArcInfo2 arcCoordinates; // Describes the arc used for edge 11157 // detection. 11158 public EdgeReport2 edgeReport; // Describes the edges found in this search 11159 // line. 11160 11161 private void init() { 11162 arcCoordinates = new ArcInfo2(backing, 0); 11163 edgeReport = new EdgeReport2(backing, 32); 11164 } 11165 11166 public SearchArcInfo() { 11167 super(56); 11168 init(); 11169 } 11170 11171 public SearchArcInfo(ArcInfo2 arcCoordinates, EdgeReport2 edgeReport) { 11172 super(56); 11173 this.arcCoordinates = arcCoordinates; 11174 this.edgeReport = edgeReport; 11175 } 11176 11177 protected SearchArcInfo(ByteBuffer backing, int offset) { 11178 super(backing, offset, 56); 11179 init(); 11180 } 11181 11182 protected SearchArcInfo(long nativeObj, boolean owned) { 11183 super(nativeObj, owned, 56); 11184 init(); 11185 } 11186 11187 protected void setBuffer(ByteBuffer backing, int offset) { 11188 super.setBuffer(backing, offset, 56); 11189 } 11190 11191 public void read() { 11192 arcCoordinates.read(); 11193 edgeReport.read(); 11194 } 11195 11196 public void write() { 11197 arcCoordinates.write(); 11198 edgeReport.write(); 11199 } 11200 11201 public int size() { 11202 return 56; 11203 } 11204 } 11205 11206 public static class ConcentricRakeReport2 extends DisposedStruct { 11207 public EdgeInfo[] firstEdges; // The first edge point detected along each 11208 // search line in the ROI. 11209 public EdgeInfo[] lastEdges; // The last edge point detected along each 11210 // search line in the ROI. 11211 public SearchArcInfo[] searchArcs; // Contains the arcs used for edge 11212 // detection and the edge information for 11213 // each arc. 11214 private ByteBuffer firstEdges_buf; 11215 private ByteBuffer lastEdges_buf; 11216 private ByteBuffer searchArcs_buf; 11217 11218 private void init() { 11219 firstEdges = new EdgeInfo[0]; 11220 lastEdges = new EdgeInfo[0]; 11221 searchArcs = new SearchArcInfo[0]; 11222 } 11223 11224 public ConcentricRakeReport2() { 11225 super(24); 11226 init(); 11227 } 11228 11229 public ConcentricRakeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, 11230 SearchArcInfo[] searchArcs) { 11231 super(24); 11232 this.firstEdges = firstEdges; 11233 this.lastEdges = lastEdges; 11234 this.searchArcs = searchArcs; 11235 } 11236 11237 protected ConcentricRakeReport2(ByteBuffer backing, int offset) { 11238 super(backing, offset, 24); 11239 init(); 11240 } 11241 11242 protected ConcentricRakeReport2(long nativeObj, boolean owned) { 11243 super(nativeObj, owned, 24); 11244 init(); 11245 } 11246 11247 protected void setBuffer(ByteBuffer backing, int offset) { 11248 super.setBuffer(backing, offset, 24); 11249 } 11250 11251 public void read() { 11252 int firstEdges_numFirstEdges = backing.getInt(4); 11253 long firstEdges_addr = getPointer(backing, 0); 11254 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 11255 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 11256 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 56); 11257 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 56) { 11258 firstEdges[i] = new EdgeInfo(bb, off); 11259 firstEdges[i].read(); 11260 } 11261 } 11262 int lastEdges_numLastEdges = backing.getInt(12); 11263 long lastEdges_addr = getPointer(backing, 8); 11264 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 11265 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 11266 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 56); 11267 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 56) { 11268 lastEdges[i] = new EdgeInfo(bb, off); 11269 lastEdges[i].read(); 11270 } 11271 } 11272 int searchArcs_numSearchArcs = backing.getInt(20); 11273 long searchArcs_addr = getPointer(backing, 16); 11274 searchArcs = new SearchArcInfo[searchArcs_numSearchArcs]; 11275 if (searchArcs_numSearchArcs > 0 && searchArcs_addr != 0) { 11276 ByteBuffer bb = newDirectByteBuffer(searchArcs_addr, searchArcs_numSearchArcs * 56); 11277 for (int i = 0, off = 0; i < searchArcs_numSearchArcs; i++, off += 56) { 11278 searchArcs[i] = new SearchArcInfo(bb, off); 11279 searchArcs[i].read(); 11280 } 11281 } 11282 } 11283 11284 public void write() { 11285 firstEdges_buf = 11286 ByteBuffer.allocateDirect(firstEdges.length * 56).order(ByteOrder.nativeOrder()); 11287 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 56) { 11288 firstEdges[i].setBuffer(firstEdges_buf, off); 11289 firstEdges[i].write(); 11290 } 11291 backing.putInt(4, firstEdges.length); 11292 putPointer(backing, 0, firstEdges_buf); 11293 lastEdges_buf = 11294 ByteBuffer.allocateDirect(lastEdges.length * 56).order(ByteOrder.nativeOrder()); 11295 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 56) { 11296 lastEdges[i].setBuffer(lastEdges_buf, off); 11297 lastEdges[i].write(); 11298 } 11299 backing.putInt(12, lastEdges.length); 11300 putPointer(backing, 8, lastEdges_buf); 11301 searchArcs_buf = 11302 ByteBuffer.allocateDirect(searchArcs.length * 56).order(ByteOrder.nativeOrder()); 11303 for (int i = 0, off = 0; i < searchArcs.length; i++, off += 56) { 11304 searchArcs[i].setBuffer(searchArcs_buf, off); 11305 searchArcs[i].write(); 11306 } 11307 backing.putInt(20, searchArcs.length); 11308 putPointer(backing, 16, searchArcs_buf); 11309 } 11310 11311 public int size() { 11312 return 24; 11313 } 11314 } 11315 11316 public static class SpokeReport2 extends DisposedStruct { 11317 public EdgeInfo[] firstEdges; // The first edge point detected along each 11318 // search line in the ROI. 11319 public EdgeInfo[] lastEdges; // The last edge point detected along each 11320 // search line in the ROI. 11321 public SearchLineInfo[] searchLines; // The search lines used for edge 11322 // detection. 11323 private ByteBuffer firstEdges_buf; 11324 private ByteBuffer lastEdges_buf; 11325 private ByteBuffer searchLines_buf; 11326 11327 private void init() { 11328 firstEdges = new EdgeInfo[0]; 11329 lastEdges = new EdgeInfo[0]; 11330 searchLines = new SearchLineInfo[0]; 11331 } 11332 11333 public SpokeReport2() { 11334 super(24); 11335 init(); 11336 } 11337 11338 public SpokeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, SearchLineInfo[] searchLines) { 11339 super(24); 11340 this.firstEdges = firstEdges; 11341 this.lastEdges = lastEdges; 11342 this.searchLines = searchLines; 11343 } 11344 11345 protected SpokeReport2(ByteBuffer backing, int offset) { 11346 super(backing, offset, 24); 11347 init(); 11348 } 11349 11350 protected SpokeReport2(long nativeObj, boolean owned) { 11351 super(nativeObj, owned, 24); 11352 init(); 11353 } 11354 11355 protected void setBuffer(ByteBuffer backing, int offset) { 11356 super.setBuffer(backing, offset, 24); 11357 } 11358 11359 public void read() { 11360 int firstEdges_numFirstEdges = backing.getInt(4); 11361 long firstEdges_addr = getPointer(backing, 0); 11362 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 11363 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 11364 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 56); 11365 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 56) { 11366 firstEdges[i] = new EdgeInfo(bb, off); 11367 firstEdges[i].read(); 11368 } 11369 } 11370 int lastEdges_numLastEdges = backing.getInt(12); 11371 long lastEdges_addr = getPointer(backing, 8); 11372 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 11373 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 11374 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 56); 11375 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 56) { 11376 lastEdges[i] = new EdgeInfo(bb, off); 11377 lastEdges[i].read(); 11378 } 11379 } 11380 int searchLines_numSearchLines = backing.getInt(20); 11381 long searchLines_addr = getPointer(backing, 16); 11382 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 11383 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 11384 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines * 36); 11385 for (int i = 0, off = 0; i < searchLines_numSearchLines; i++, off += 36) { 11386 searchLines[i] = new SearchLineInfo(bb, off); 11387 searchLines[i].read(); 11388 } 11389 } 11390 } 11391 11392 public void write() { 11393 firstEdges_buf = 11394 ByteBuffer.allocateDirect(firstEdges.length * 56).order(ByteOrder.nativeOrder()); 11395 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 56) { 11396 firstEdges[i].setBuffer(firstEdges_buf, off); 11397 firstEdges[i].write(); 11398 } 11399 backing.putInt(4, firstEdges.length); 11400 putPointer(backing, 0, firstEdges_buf); 11401 lastEdges_buf = 11402 ByteBuffer.allocateDirect(lastEdges.length * 56).order(ByteOrder.nativeOrder()); 11403 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 56) { 11404 lastEdges[i].setBuffer(lastEdges_buf, off); 11405 lastEdges[i].write(); 11406 } 11407 backing.putInt(12, lastEdges.length); 11408 putPointer(backing, 8, lastEdges_buf); 11409 searchLines_buf = 11410 ByteBuffer.allocateDirect(searchLines.length * 36).order(ByteOrder.nativeOrder()); 11411 for (int i = 0, off = 0; i < searchLines.length; i++, off += 36) { 11412 searchLines[i].setBuffer(searchLines_buf, off); 11413 searchLines[i].write(); 11414 } 11415 backing.putInt(20, searchLines.length); 11416 putPointer(backing, 16, searchLines_buf); 11417 } 11418 11419 public int size() { 11420 return 24; 11421 } 11422 } 11423 11424 public static class EdgeInfo extends DisposedStruct { 11425 public PointFloat position; // The location of the edge in the image. 11426 public PointFloat calibratedPosition; // The position of the edge in the 11427 // image in real-world coordinates. 11428 public double distance; // The location of the edge from the first point 11429 // along the boundary of the input ROI. 11430 public double calibratedDistance; // The location of the edge from the first 11431 // point along the boundary of the input 11432 // ROI in real-world coordinates. 11433 public double magnitude; // The intensity contrast at the edge. 11434 public double noisePeak; // The strength of the noise associated with the 11435 // current edge. 11436 public int rising; // Indicates the polarity of the edge. 11437 11438 private void init() { 11439 position = new PointFloat(backing, 0); 11440 calibratedPosition = new PointFloat(backing, 8); 11441 } 11442 11443 public EdgeInfo() { 11444 super(56); 11445 init(); 11446 } 11447 11448 public EdgeInfo(PointFloat position, PointFloat calibratedPosition, double distance, 11449 double calibratedDistance, double magnitude, double noisePeak, int rising) { 11450 super(56); 11451 this.position = position; 11452 this.calibratedPosition = calibratedPosition; 11453 this.distance = distance; 11454 this.calibratedDistance = calibratedDistance; 11455 this.magnitude = magnitude; 11456 this.noisePeak = noisePeak; 11457 this.rising = rising; 11458 } 11459 11460 protected EdgeInfo(ByteBuffer backing, int offset) { 11461 super(backing, offset, 56); 11462 init(); 11463 } 11464 11465 protected EdgeInfo(long nativeObj, boolean owned) { 11466 super(nativeObj, owned, 56); 11467 init(); 11468 } 11469 11470 protected void setBuffer(ByteBuffer backing, int offset) { 11471 super.setBuffer(backing, offset, 56); 11472 } 11473 11474 public void read() { 11475 position.read(); 11476 calibratedPosition.read(); 11477 distance = backing.getDouble(16); 11478 calibratedDistance = backing.getDouble(24); 11479 magnitude = backing.getDouble(32); 11480 noisePeak = backing.getDouble(40); 11481 rising = backing.getInt(48); 11482 } 11483 11484 public void write() { 11485 position.write(); 11486 calibratedPosition.write(); 11487 backing.putDouble(16, distance); 11488 backing.putDouble(24, calibratedDistance); 11489 backing.putDouble(32, magnitude); 11490 backing.putDouble(40, noisePeak); 11491 backing.putInt(48, rising); 11492 } 11493 11494 public int size() { 11495 return 56; 11496 } 11497 } 11498 11499 public static class SearchLineInfo extends DisposedStruct { 11500 public LineFloat lineCoordinates; // The endpoints of the search line. 11501 public EdgeReport2 edgeReport; // Describes the edges found in this search 11502 // line. 11503 11504 private void init() { 11505 lineCoordinates = new LineFloat(backing, 0); 11506 edgeReport = new EdgeReport2(backing, 16); 11507 } 11508 11509 public SearchLineInfo() { 11510 super(36); 11511 init(); 11512 } 11513 11514 public SearchLineInfo(LineFloat lineCoordinates, EdgeReport2 edgeReport) { 11515 super(36); 11516 this.lineCoordinates = lineCoordinates; 11517 this.edgeReport = edgeReport; 11518 } 11519 11520 protected SearchLineInfo(ByteBuffer backing, int offset) { 11521 super(backing, offset, 36); 11522 init(); 11523 } 11524 11525 protected SearchLineInfo(long nativeObj, boolean owned) { 11526 super(nativeObj, owned, 36); 11527 init(); 11528 } 11529 11530 protected void setBuffer(ByteBuffer backing, int offset) { 11531 super.setBuffer(backing, offset, 36); 11532 } 11533 11534 public void read() { 11535 lineCoordinates.read(); 11536 edgeReport.read(); 11537 } 11538 11539 public void write() { 11540 lineCoordinates.write(); 11541 edgeReport.write(); 11542 } 11543 11544 public int size() { 11545 return 36; 11546 } 11547 } 11548 11549 public static class RakeReport2 extends DisposedStruct { 11550 public EdgeInfo[] firstEdges; // The first edge point detected along each 11551 // search line in the ROI. 11552 public EdgeInfo[] lastEdges; // The last edge point detected along each 11553 // search line in the ROI. 11554 public SearchLineInfo[] searchLines; // The search lines used for edge 11555 // detection. 11556 private ByteBuffer firstEdges_buf; 11557 private ByteBuffer lastEdges_buf; 11558 private ByteBuffer searchLines_buf; 11559 11560 private void init() { 11561 firstEdges = new EdgeInfo[0]; 11562 lastEdges = new EdgeInfo[0]; 11563 searchLines = new SearchLineInfo[0]; 11564 } 11565 11566 public RakeReport2() { 11567 super(24); 11568 init(); 11569 } 11570 11571 public RakeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, SearchLineInfo[] searchLines) { 11572 super(24); 11573 this.firstEdges = firstEdges; 11574 this.lastEdges = lastEdges; 11575 this.searchLines = searchLines; 11576 } 11577 11578 protected RakeReport2(ByteBuffer backing, int offset) { 11579 super(backing, offset, 24); 11580 init(); 11581 } 11582 11583 protected RakeReport2(long nativeObj, boolean owned) { 11584 super(nativeObj, owned, 24); 11585 init(); 11586 } 11587 11588 protected void setBuffer(ByteBuffer backing, int offset) { 11589 super.setBuffer(backing, offset, 24); 11590 } 11591 11592 public void read() { 11593 int firstEdges_numFirstEdges = backing.getInt(4); 11594 long firstEdges_addr = getPointer(backing, 0); 11595 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 11596 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 11597 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 56); 11598 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 56) { 11599 firstEdges[i] = new EdgeInfo(bb, off); 11600 firstEdges[i].read(); 11601 } 11602 } 11603 int lastEdges_numLastEdges = backing.getInt(12); 11604 long lastEdges_addr = getPointer(backing, 8); 11605 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 11606 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 11607 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 56); 11608 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 56) { 11609 lastEdges[i] = new EdgeInfo(bb, off); 11610 lastEdges[i].read(); 11611 } 11612 } 11613 int searchLines_numSearchLines = backing.getInt(20); 11614 long searchLines_addr = getPointer(backing, 16); 11615 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 11616 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 11617 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines * 36); 11618 for (int i = 0, off = 0; i < searchLines_numSearchLines; i++, off += 36) { 11619 searchLines[i] = new SearchLineInfo(bb, off); 11620 searchLines[i].read(); 11621 } 11622 } 11623 } 11624 11625 public void write() { 11626 firstEdges_buf = 11627 ByteBuffer.allocateDirect(firstEdges.length * 56).order(ByteOrder.nativeOrder()); 11628 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 56) { 11629 firstEdges[i].setBuffer(firstEdges_buf, off); 11630 firstEdges[i].write(); 11631 } 11632 backing.putInt(4, firstEdges.length); 11633 putPointer(backing, 0, firstEdges_buf); 11634 lastEdges_buf = 11635 ByteBuffer.allocateDirect(lastEdges.length * 56).order(ByteOrder.nativeOrder()); 11636 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 56) { 11637 lastEdges[i].setBuffer(lastEdges_buf, off); 11638 lastEdges[i].write(); 11639 } 11640 backing.putInt(12, lastEdges.length); 11641 putPointer(backing, 8, lastEdges_buf); 11642 searchLines_buf = 11643 ByteBuffer.allocateDirect(searchLines.length * 36).order(ByteOrder.nativeOrder()); 11644 for (int i = 0, off = 0; i < searchLines.length; i++, off += 36) { 11645 searchLines[i].setBuffer(searchLines_buf, off); 11646 searchLines[i].write(); 11647 } 11648 backing.putInt(20, searchLines.length); 11649 putPointer(backing, 16, searchLines_buf); 11650 } 11651 11652 public int size() { 11653 return 24; 11654 } 11655 } 11656 11657 public static class TransformBehaviors extends DisposedStruct { 11658 public GroupBehavior ShiftBehavior; // Specifies the behavior of an overlay 11659 // group when a shift operation is 11660 // applied to an image. 11661 public GroupBehavior ScaleBehavior; // Specifies the behavior of an overlay 11662 // group when a scale operation is 11663 // applied to an image. 11664 public GroupBehavior RotateBehavior; // Specifies the behavior of an overlay 11665 // group when a rotate operation is 11666 // applied to an image. 11667 public GroupBehavior SymmetryBehavior; // Specifies the behavior of an 11668 // overlay group when a symmetry 11669 // operation is applied to an image. 11670 11671 private void init() { 11672 11673 } 11674 11675 public TransformBehaviors() { 11676 super(16); 11677 init(); 11678 } 11679 11680 public TransformBehaviors(GroupBehavior ShiftBehavior, GroupBehavior ScaleBehavior, 11681 GroupBehavior RotateBehavior, GroupBehavior SymmetryBehavior) { 11682 super(16); 11683 this.ShiftBehavior = ShiftBehavior; 11684 this.ScaleBehavior = ScaleBehavior; 11685 this.RotateBehavior = RotateBehavior; 11686 this.SymmetryBehavior = SymmetryBehavior; 11687 } 11688 11689 protected TransformBehaviors(ByteBuffer backing, int offset) { 11690 super(backing, offset, 16); 11691 init(); 11692 } 11693 11694 protected TransformBehaviors(long nativeObj, boolean owned) { 11695 super(nativeObj, owned, 16); 11696 init(); 11697 } 11698 11699 protected void setBuffer(ByteBuffer backing, int offset) { 11700 super.setBuffer(backing, offset, 16); 11701 } 11702 11703 public void read() { 11704 ShiftBehavior = GroupBehavior.fromValue(backing.getInt(0)); 11705 ScaleBehavior = GroupBehavior.fromValue(backing.getInt(4)); 11706 RotateBehavior = GroupBehavior.fromValue(backing.getInt(8)); 11707 SymmetryBehavior = GroupBehavior.fromValue(backing.getInt(12)); 11708 } 11709 11710 public void write() { 11711 if (ShiftBehavior != null) 11712 backing.putInt(0, ShiftBehavior.getValue()); 11713 if (ScaleBehavior != null) 11714 backing.putInt(4, ScaleBehavior.getValue()); 11715 if (RotateBehavior != null) 11716 backing.putInt(8, RotateBehavior.getValue()); 11717 if (SymmetryBehavior != null) 11718 backing.putInt(12, SymmetryBehavior.getValue()); 11719 } 11720 11721 public int size() { 11722 return 16; 11723 } 11724 } 11725 11726 public static class QRCodeDataToken extends DisposedStruct { 11727 public QRStreamMode mode; // Specifies the stream mode or the format of the 11728 // data that is encoded in the QR code. 11729 public int modeData; // Indicates specifiers used by the user to postprocess 11730 // the data if it requires it. 11731 public byte[] data; // Shows the encoded data in the QR code. 11732 private ByteBuffer data_buf; 11733 11734 private void init() { 11735 data = new byte[0]; 11736 } 11737 11738 public QRCodeDataToken() { 11739 super(16); 11740 init(); 11741 } 11742 11743 public QRCodeDataToken(QRStreamMode mode, int modeData, byte[] data) { 11744 super(16); 11745 this.mode = mode; 11746 this.modeData = modeData; 11747 this.data = data; 11748 } 11749 11750 protected QRCodeDataToken(ByteBuffer backing, int offset) { 11751 super(backing, offset, 16); 11752 init(); 11753 } 11754 11755 protected QRCodeDataToken(long nativeObj, boolean owned) { 11756 super(nativeObj, owned, 16); 11757 init(); 11758 } 11759 11760 protected void setBuffer(ByteBuffer backing, int offset) { 11761 super.setBuffer(backing, offset, 16); 11762 } 11763 11764 public void read() { 11765 mode = QRStreamMode.fromValue(backing.getInt(0)); 11766 modeData = backing.getInt(4); 11767 int data_dataLength = backing.getInt(12); 11768 long data_addr = getPointer(backing, 8); 11769 data = new byte[data_dataLength]; 11770 if (data_dataLength > 0 && data_addr != 0) { 11771 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 11772 } 11773 } 11774 11775 public void write() { 11776 if (mode != null) 11777 backing.putInt(0, mode.getValue()); 11778 backing.putInt(4, modeData); 11779 data_buf = ByteBuffer.allocateDirect(data.length); 11780 putBytes(data_buf, data, 0, data.length); 11781 backing.putInt(12, data.length); 11782 putPointer(backing, 8, data_buf); 11783 } 11784 11785 public int size() { 11786 return 16; 11787 } 11788 } 11789 11790 public static class ParticleFilterOptions extends DisposedStruct { 11791 public int rejectMatches; // Set this parameter to TRUE to transfer only 11792 // those particles that do not meet all the 11793 // criteria. 11794 public int rejectBorder; // Set this element to TRUE to reject border 11795 // particles. 11796 public int connectivity8; // Set this parameter to TRUE to use 11797 // connectivity-8 to determine whether particles 11798 // are touching. 11799 11800 private void init() { 11801 11802 } 11803 11804 public ParticleFilterOptions() { 11805 super(12); 11806 init(); 11807 } 11808 11809 public ParticleFilterOptions(int rejectMatches, int rejectBorder, int connectivity8) { 11810 super(12); 11811 this.rejectMatches = rejectMatches; 11812 this.rejectBorder = rejectBorder; 11813 this.connectivity8 = connectivity8; 11814 } 11815 11816 protected ParticleFilterOptions(ByteBuffer backing, int offset) { 11817 super(backing, offset, 12); 11818 init(); 11819 } 11820 11821 protected ParticleFilterOptions(long nativeObj, boolean owned) { 11822 super(nativeObj, owned, 12); 11823 init(); 11824 } 11825 11826 protected void setBuffer(ByteBuffer backing, int offset) { 11827 super.setBuffer(backing, offset, 12); 11828 } 11829 11830 public void read() { 11831 rejectMatches = backing.getInt(0); 11832 rejectBorder = backing.getInt(4); 11833 connectivity8 = backing.getInt(8); 11834 } 11835 11836 public void write() { 11837 backing.putInt(0, rejectMatches); 11838 backing.putInt(4, rejectBorder); 11839 backing.putInt(8, connectivity8); 11840 } 11841 11842 public int size() { 11843 return 12; 11844 } 11845 } 11846 11847 public static class StraightEdgeReport2 extends DisposedStruct { 11848 public StraightEdge[] straightEdges; // Contains an array of found straight 11849 // edges. 11850 public SearchLineInfo[] searchLines; // Contains an array of all search 11851 // lines used in the detection. 11852 private ByteBuffer straightEdges_buf; 11853 private ByteBuffer searchLines_buf; 11854 11855 private void init() { 11856 straightEdges = new StraightEdge[0]; 11857 searchLines = new SearchLineInfo[0]; 11858 } 11859 11860 public StraightEdgeReport2() { 11861 super(16); 11862 init(); 11863 } 11864 11865 public StraightEdgeReport2(StraightEdge[] straightEdges, SearchLineInfo[] searchLines) { 11866 super(16); 11867 this.straightEdges = straightEdges; 11868 this.searchLines = searchLines; 11869 } 11870 11871 protected StraightEdgeReport2(ByteBuffer backing, int offset) { 11872 super(backing, offset, 16); 11873 init(); 11874 } 11875 11876 protected StraightEdgeReport2(long nativeObj, boolean owned) { 11877 super(nativeObj, owned, 16); 11878 init(); 11879 } 11880 11881 protected void setBuffer(ByteBuffer backing, int offset) { 11882 super.setBuffer(backing, offset, 16); 11883 } 11884 11885 public void read() { 11886 int straightEdges_numStraightEdges = backing.getInt(4); 11887 long straightEdges_addr = getPointer(backing, 0); 11888 straightEdges = new StraightEdge[straightEdges_numStraightEdges]; 11889 if (straightEdges_numStraightEdges > 0 && straightEdges_addr != 0) { 11890 ByteBuffer bb = 11891 newDirectByteBuffer(straightEdges_addr, straightEdges_numStraightEdges * 88); 11892 for (int i = 0, off = 0; i < straightEdges_numStraightEdges; i++, off += 88) { 11893 straightEdges[i] = new StraightEdge(bb, off); 11894 straightEdges[i].read(); 11895 } 11896 } 11897 int searchLines_numSearchLines = backing.getInt(12); 11898 long searchLines_addr = getPointer(backing, 8); 11899 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 11900 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 11901 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines * 36); 11902 for (int i = 0, off = 0; i < searchLines_numSearchLines; i++, off += 36) { 11903 searchLines[i] = new SearchLineInfo(bb, off); 11904 searchLines[i].read(); 11905 } 11906 } 11907 } 11908 11909 public void write() { 11910 straightEdges_buf = 11911 ByteBuffer.allocateDirect(straightEdges.length * 88).order(ByteOrder.nativeOrder()); 11912 for (int i = 0, off = 0; i < straightEdges.length; i++, off += 88) { 11913 straightEdges[i].setBuffer(straightEdges_buf, off); 11914 straightEdges[i].write(); 11915 } 11916 backing.putInt(4, straightEdges.length); 11917 putPointer(backing, 0, straightEdges_buf); 11918 searchLines_buf = 11919 ByteBuffer.allocateDirect(searchLines.length * 36).order(ByteOrder.nativeOrder()); 11920 for (int i = 0, off = 0; i < searchLines.length; i++, off += 36) { 11921 searchLines[i].setBuffer(searchLines_buf, off); 11922 searchLines[i].write(); 11923 } 11924 backing.putInt(12, searchLines.length); 11925 putPointer(backing, 8, searchLines_buf); 11926 } 11927 11928 public int size() { 11929 return 16; 11930 } 11931 } 11932 11933 public static class StraightEdgeOptions extends DisposedStruct { 11934 public int numLines; // Specifies the number of straight edges to find. 11935 public StraightEdgeSearchMode searchMode; // Specifies the method used to 11936 // find the straight edge. 11937 public double minScore; // Specifies the minimum score of a detected 11938 // straight edge. 11939 public double maxScore; // Specifies the maximum score of a detected edge. 11940 public double orientation; // Specifies the angle at which the straight edge 11941 // is expected to be found. 11942 public double angleRange; // Specifies the +/- range around the orientation 11943 // within which the straight edge is expected to 11944 // be found. 11945 public double angleTolerance; // Specifies the expected angular accuracy of 11946 // the straight edge. 11947 public int stepSize; // Specifies the gap in pixels between the search lines 11948 // used with the rake-based methods. 11949 public double minSignalToNoiseRatio; // Specifies the minimum signal to 11950 // noise ratio (SNR) of the edge points 11951 // used to fit the straight edge. 11952 public double minCoverage; // Specifies the minimum number of points as a 11953 // percentage of the number of search lines that 11954 // need to be included in the detected straight 11955 // edge. 11956 public int houghIterations; // Specifies the number of iterations used in 11957 // the Hough-based method. 11958 11959 private void init() { 11960 11961 } 11962 11963 public StraightEdgeOptions() { 11964 super(80); 11965 init(); 11966 } 11967 11968 public StraightEdgeOptions(int numLines, StraightEdgeSearchMode searchMode, double minScore, 11969 double maxScore, double orientation, double angleRange, double angleTolerance, 11970 int stepSize, double minSignalToNoiseRatio, double minCoverage, int houghIterations) { 11971 super(80); 11972 this.numLines = numLines; 11973 this.searchMode = searchMode; 11974 this.minScore = minScore; 11975 this.maxScore = maxScore; 11976 this.orientation = orientation; 11977 this.angleRange = angleRange; 11978 this.angleTolerance = angleTolerance; 11979 this.stepSize = stepSize; 11980 this.minSignalToNoiseRatio = minSignalToNoiseRatio; 11981 this.minCoverage = minCoverage; 11982 this.houghIterations = houghIterations; 11983 } 11984 11985 protected StraightEdgeOptions(ByteBuffer backing, int offset) { 11986 super(backing, offset, 80); 11987 init(); 11988 } 11989 11990 protected StraightEdgeOptions(long nativeObj, boolean owned) { 11991 super(nativeObj, owned, 80); 11992 init(); 11993 } 11994 11995 protected void setBuffer(ByteBuffer backing, int offset) { 11996 super.setBuffer(backing, offset, 80); 11997 } 11998 11999 public void read() { 12000 numLines = backing.getInt(0); 12001 searchMode = StraightEdgeSearchMode.fromValue(backing.getInt(4)); 12002 minScore = backing.getDouble(8); 12003 maxScore = backing.getDouble(16); 12004 orientation = backing.getDouble(24); 12005 angleRange = backing.getDouble(32); 12006 angleTolerance = backing.getDouble(40); 12007 stepSize = backing.getInt(48); 12008 minSignalToNoiseRatio = backing.getDouble(56); 12009 minCoverage = backing.getDouble(64); 12010 houghIterations = backing.getInt(72); 12011 } 12012 12013 public void write() { 12014 backing.putInt(0, numLines); 12015 if (searchMode != null) 12016 backing.putInt(4, searchMode.getValue()); 12017 backing.putDouble(8, minScore); 12018 backing.putDouble(16, maxScore); 12019 backing.putDouble(24, orientation); 12020 backing.putDouble(32, angleRange); 12021 backing.putDouble(40, angleTolerance); 12022 backing.putInt(48, stepSize); 12023 backing.putDouble(56, minSignalToNoiseRatio); 12024 backing.putDouble(64, minCoverage); 12025 backing.putInt(72, houghIterations); 12026 } 12027 12028 public int size() { 12029 return 80; 12030 } 12031 } 12032 12033 public static class StraightEdge extends DisposedStruct { 12034 public LineFloat straightEdgeCoordinates; // End points of the detected 12035 // straight edge in pixel 12036 // coordinates. 12037 public LineFloat calibratedStraightEdgeCoordinates; // End points of the 12038 // detected straight 12039 // edge in real-world 12040 // coordinates. 12041 public double angle; // Angle of the found edge using the pixel coordinates. 12042 public double calibratedAngle; // Angle of the found edge using the 12043 // real-world coordinates. 12044 public double score; // Describes the score of the detected edge. 12045 public double straightness; // The straightness value of the detected 12046 // straight edge. 12047 public double averageSignalToNoiseRatio; // Describes the average signal to 12048 // noise ratio (SNR) of the 12049 // detected edge. 12050 public int calibrationValid; // Indicates if the calibration data for the 12051 // straight edge is valid. 12052 public EdgeInfo[] usedEdges; // An array of edges that were used to 12053 // determine this straight line. 12054 private ByteBuffer usedEdges_buf; 12055 12056 private void init() { 12057 straightEdgeCoordinates = new LineFloat(backing, 0); 12058 calibratedStraightEdgeCoordinates = new LineFloat(backing, 16); 12059 usedEdges = new EdgeInfo[0]; 12060 } 12061 12062 public StraightEdge() { 12063 super(88); 12064 init(); 12065 } 12066 12067 public StraightEdge(LineFloat straightEdgeCoordinates, 12068 LineFloat calibratedStraightEdgeCoordinates, double angle, double calibratedAngle, 12069 double score, double straightness, double averageSignalToNoiseRatio, int calibrationValid, 12070 EdgeInfo[] usedEdges) { 12071 super(88); 12072 this.straightEdgeCoordinates = straightEdgeCoordinates; 12073 this.calibratedStraightEdgeCoordinates = calibratedStraightEdgeCoordinates; 12074 this.angle = angle; 12075 this.calibratedAngle = calibratedAngle; 12076 this.score = score; 12077 this.straightness = straightness; 12078 this.averageSignalToNoiseRatio = averageSignalToNoiseRatio; 12079 this.calibrationValid = calibrationValid; 12080 this.usedEdges = usedEdges; 12081 } 12082 12083 protected StraightEdge(ByteBuffer backing, int offset) { 12084 super(backing, offset, 88); 12085 init(); 12086 } 12087 12088 protected StraightEdge(long nativeObj, boolean owned) { 12089 super(nativeObj, owned, 88); 12090 init(); 12091 } 12092 12093 protected void setBuffer(ByteBuffer backing, int offset) { 12094 super.setBuffer(backing, offset, 88); 12095 } 12096 12097 public void read() { 12098 straightEdgeCoordinates.read(); 12099 calibratedStraightEdgeCoordinates.read(); 12100 angle = backing.getDouble(32); 12101 calibratedAngle = backing.getDouble(40); 12102 score = backing.getDouble(48); 12103 straightness = backing.getDouble(56); 12104 averageSignalToNoiseRatio = backing.getDouble(64); 12105 calibrationValid = backing.getInt(72); 12106 int usedEdges_numUsedEdges = backing.getInt(80); 12107 long usedEdges_addr = getPointer(backing, 76); 12108 usedEdges = new EdgeInfo[usedEdges_numUsedEdges]; 12109 if (usedEdges_numUsedEdges > 0 && usedEdges_addr != 0) { 12110 ByteBuffer bb = newDirectByteBuffer(usedEdges_addr, usedEdges_numUsedEdges * 56); 12111 for (int i = 0, off = 0; i < usedEdges_numUsedEdges; i++, off += 56) { 12112 usedEdges[i] = new EdgeInfo(bb, off); 12113 usedEdges[i].read(); 12114 } 12115 } 12116 } 12117 12118 public void write() { 12119 straightEdgeCoordinates.write(); 12120 calibratedStraightEdgeCoordinates.write(); 12121 backing.putDouble(32, angle); 12122 backing.putDouble(40, calibratedAngle); 12123 backing.putDouble(48, score); 12124 backing.putDouble(56, straightness); 12125 backing.putDouble(64, averageSignalToNoiseRatio); 12126 backing.putInt(72, calibrationValid); 12127 usedEdges_buf = 12128 ByteBuffer.allocateDirect(usedEdges.length * 56).order(ByteOrder.nativeOrder()); 12129 for (int i = 0, off = 0; i < usedEdges.length; i++, off += 56) { 12130 usedEdges[i].setBuffer(usedEdges_buf, off); 12131 usedEdges[i].write(); 12132 } 12133 backing.putInt(80, usedEdges.length); 12134 putPointer(backing, 76, usedEdges_buf); 12135 } 12136 12137 public int size() { 12138 return 88; 12139 } 12140 } 12141 12142 public static class QRCodeSearchOptions extends DisposedStruct { 12143 public QRRotationMode rotationMode; // Specifies the amount of QR code 12144 // rotation the function should allow 12145 // for. 12146 public int skipLocation; // If set to TRUE, specifies that the function 12147 // should assume that the QR code occupies the 12148 // entire image (or the entire search region). 12149 public int edgeThreshold; // The strength of the weakest edge the function 12150 // uses to find the coarse location of the QR code 12151 // in the image. 12152 public QRDemodulationMode demodulationMode; // The demodulation mode the 12153 // function uses to locate the 12154 // QR code. 12155 public QRCellSampleSize cellSampleSize; // The cell sample size the function 12156 // uses to locate the QR code. 12157 public QRCellFilterMode cellFilterMode; // The cell filter mode the function 12158 // uses to locate the QR code. 12159 public int skewDegreesAllowed; // Specifies the amount of skew in the QR 12160 // code the function should allow for. 12161 12162 private void init() { 12163 12164 } 12165 12166 public QRCodeSearchOptions() { 12167 super(48); 12168 init(); 12169 } 12170 12171 public QRCodeSearchOptions(QRRotationMode rotationMode, int skipLocation, int edgeThreshold, 12172 QRDemodulationMode demodulationMode, QRCellSampleSize cellSampleSize, 12173 QRCellFilterMode cellFilterMode, int skewDegreesAllowed) { 12174 super(48); 12175 this.rotationMode = rotationMode; 12176 this.skipLocation = skipLocation; 12177 this.edgeThreshold = edgeThreshold; 12178 this.demodulationMode = demodulationMode; 12179 this.cellSampleSize = cellSampleSize; 12180 this.cellFilterMode = cellFilterMode; 12181 this.skewDegreesAllowed = skewDegreesAllowed; 12182 } 12183 12184 protected QRCodeSearchOptions(ByteBuffer backing, int offset) { 12185 super(backing, offset, 48); 12186 init(); 12187 } 12188 12189 protected QRCodeSearchOptions(long nativeObj, boolean owned) { 12190 super(nativeObj, owned, 48); 12191 init(); 12192 } 12193 12194 protected void setBuffer(ByteBuffer backing, int offset) { 12195 super.setBuffer(backing, offset, 48); 12196 } 12197 12198 public void read() { 12199 rotationMode = QRRotationMode.fromValue(backing.getInt(0)); 12200 skipLocation = backing.getInt(4); 12201 edgeThreshold = backing.getInt(8); 12202 demodulationMode = QRDemodulationMode.fromValue(backing.getInt(16)); 12203 cellSampleSize = QRCellSampleSize.fromValue(backing.getInt(24)); 12204 cellFilterMode = QRCellFilterMode.fromValue(backing.getInt(32)); 12205 skewDegreesAllowed = backing.getInt(40); 12206 } 12207 12208 public void write() { 12209 if (rotationMode != null) 12210 backing.putInt(0, rotationMode.getValue()); 12211 backing.putInt(4, skipLocation); 12212 backing.putInt(8, edgeThreshold); 12213 if (demodulationMode != null) 12214 backing.putInt(16, demodulationMode.getValue()); 12215 if (cellSampleSize != null) 12216 backing.putInt(24, cellSampleSize.getValue()); 12217 if (cellFilterMode != null) 12218 backing.putInt(32, cellFilterMode.getValue()); 12219 backing.putInt(40, skewDegreesAllowed); 12220 } 12221 12222 public int size() { 12223 return 48; 12224 } 12225 } 12226 12227 public static class QRCodeSizeOptions extends DisposedStruct { 12228 public int minSize; // Specifies the minimum size (in pixels) of the QR code 12229 // in the image. 12230 public int maxSize; // Specifies the maximum size (in pixels) of the QR code 12231 // in the image. 12232 12233 private void init() { 12234 12235 } 12236 12237 public QRCodeSizeOptions() { 12238 super(8); 12239 init(); 12240 } 12241 12242 public QRCodeSizeOptions(int minSize, int maxSize) { 12243 super(8); 12244 this.minSize = minSize; 12245 this.maxSize = maxSize; 12246 } 12247 12248 protected QRCodeSizeOptions(ByteBuffer backing, int offset) { 12249 super(backing, offset, 8); 12250 init(); 12251 } 12252 12253 protected QRCodeSizeOptions(long nativeObj, boolean owned) { 12254 super(nativeObj, owned, 8); 12255 init(); 12256 } 12257 12258 protected void setBuffer(ByteBuffer backing, int offset) { 12259 super.setBuffer(backing, offset, 8); 12260 } 12261 12262 public void read() { 12263 minSize = backing.getInt(0); 12264 maxSize = backing.getInt(4); 12265 } 12266 12267 public void write() { 12268 backing.putInt(0, minSize); 12269 backing.putInt(4, maxSize); 12270 } 12271 12272 public int size() { 12273 return 8; 12274 } 12275 } 12276 12277 public static class QRCodeDescriptionOptions extends DisposedStruct { 12278 public QRDimensions dimensions; // The number of rows and columns that are 12279 // populated for the QR code, measured in 12280 // cells. 12281 public QRPolarities polarity; // The polarity of the QR code. 12282 public QRMirrorMode mirror; // This element is TRUE if the QR code appears 12283 // mirrored in the image and FALSE if the QR 12284 // code appears normally in the image. 12285 public QRModelType modelType; // This option allows you to specify the type 12286 // of QR code. 12287 12288 private void init() { 12289 12290 } 12291 12292 public QRCodeDescriptionOptions() { 12293 super(32); 12294 init(); 12295 } 12296 12297 public QRCodeDescriptionOptions(QRDimensions dimensions, QRPolarities polarity, 12298 QRMirrorMode mirror, QRModelType modelType) { 12299 super(32); 12300 this.dimensions = dimensions; 12301 this.polarity = polarity; 12302 this.mirror = mirror; 12303 this.modelType = modelType; 12304 } 12305 12306 protected QRCodeDescriptionOptions(ByteBuffer backing, int offset) { 12307 super(backing, offset, 32); 12308 init(); 12309 } 12310 12311 protected QRCodeDescriptionOptions(long nativeObj, boolean owned) { 12312 super(nativeObj, owned, 32); 12313 init(); 12314 } 12315 12316 protected void setBuffer(ByteBuffer backing, int offset) { 12317 super.setBuffer(backing, offset, 32); 12318 } 12319 12320 public void read() { 12321 dimensions = QRDimensions.fromValue(backing.getInt(0)); 12322 polarity = QRPolarities.fromValue(backing.getInt(8)); 12323 mirror = QRMirrorMode.fromValue(backing.getInt(16)); 12324 modelType = QRModelType.fromValue(backing.getInt(24)); 12325 } 12326 12327 public void write() { 12328 if (dimensions != null) 12329 backing.putInt(0, dimensions.getValue()); 12330 if (polarity != null) 12331 backing.putInt(8, polarity.getValue()); 12332 if (mirror != null) 12333 backing.putInt(16, mirror.getValue()); 12334 if (modelType != null) 12335 backing.putInt(24, modelType.getValue()); 12336 } 12337 12338 public int size() { 12339 return 32; 12340 } 12341 } 12342 12343 public static class QRCodeReport extends DisposedStruct { 12344 public int found; // This element is TRUE if the function located and 12345 // decoded a QR code and FALSE if the function failed to 12346 // locate and decode a QR code. 12347 public byte[] data; // The data encoded in the QR code. 12348 public PointFloat[] boundingBox; // An array of four points describing the 12349 // rectangle surrounding the QR code. 12350 public QRCodeDataToken[] tokenizedData; // Contains the data tokenized in 12351 // exactly the way it was encoded in 12352 // the code. 12353 public int numErrorsCorrected; // The number of errors the function 12354 // corrected when decoding the QR code. 12355 public int dimensions; // The number of rows and columns that are populated 12356 // for the QR code, measured in cells. 12357 public int version; // The version of the QR code. 12358 public QRModelType modelType; // This option allows you to specify what type 12359 // of QR code this is. 12360 public QRStreamMode streamMode; // The format of the data encoded in the 12361 // stream. 12362 public QRPolarities matrixPolarity; // The polarity of the QR code. 12363 public int mirrored; // This element is TRUE if the QR code appears mirrored 12364 // in the image and FALSE if the QR code appears 12365 // normally in the image. 12366 public int positionInAppendStream; // Indicates what position the QR code is 12367 // in with respect to the stream of data 12368 // in all codes. 12369 public int sizeOfAppendStream; // Specifies how many QR codes are part of a 12370 // larger array of codes. 12371 public int firstEAN128ApplicationID; // The first EAN-128 Application ID 12372 // encountered in the stream. 12373 public int firstECIDesignator; // The first Regional Language Designator 12374 // encountered in the stream. 12375 public int appendStreamIdentifier; // Specifies what stream the QR code is 12376 // in relation to when the code is part 12377 // of a larger array of codes. 12378 public int minimumEdgeStrength; // The strength of the weakest edge the 12379 // function used to find the coarse location 12380 // of the QR code in the image. 12381 public QRDemodulationMode demodulationMode; // The demodulation mode the 12382 // function used to locate the 12383 // QR code. 12384 public QRCellSampleSize cellSampleSize; // The cell sample size the function 12385 // used to locate the QR code. 12386 public QRCellFilterMode cellFilterMode; // The cell filter mode the function 12387 // used to locate the QR code. 12388 private ByteBuffer data_buf; 12389 private ByteBuffer tokenizedData_buf; 12390 12391 private void init() { 12392 data = new byte[0]; 12393 boundingBox = new PointFloat[4]; 12394 12395 for (int i = 0, off = 12; i < 4; i++, off += 8) 12396 boundingBox[i] = new PointFloat(backing, off); 12397 tokenizedData = new QRCodeDataToken[0]; 12398 } 12399 12400 public QRCodeReport() { 12401 super(136); 12402 init(); 12403 } 12404 12405 public QRCodeReport(int found, byte[] data, PointFloat[] boundingBox, 12406 QRCodeDataToken[] tokenizedData, int numErrorsCorrected, int dimensions, int version, 12407 QRModelType modelType, QRStreamMode streamMode, QRPolarities matrixPolarity, int mirrored, 12408 int positionInAppendStream, int sizeOfAppendStream, int firstEAN128ApplicationID, 12409 int firstECIDesignator, int appendStreamIdentifier, int minimumEdgeStrength, 12410 QRDemodulationMode demodulationMode, QRCellSampleSize cellSampleSize, 12411 QRCellFilterMode cellFilterMode) { 12412 super(136); 12413 this.found = found; 12414 this.data = data; 12415 this.boundingBox = boundingBox; 12416 this.tokenizedData = tokenizedData; 12417 this.numErrorsCorrected = numErrorsCorrected; 12418 this.dimensions = dimensions; 12419 this.version = version; 12420 this.modelType = modelType; 12421 this.streamMode = streamMode; 12422 this.matrixPolarity = matrixPolarity; 12423 this.mirrored = mirrored; 12424 this.positionInAppendStream = positionInAppendStream; 12425 this.sizeOfAppendStream = sizeOfAppendStream; 12426 this.firstEAN128ApplicationID = firstEAN128ApplicationID; 12427 this.firstECIDesignator = firstECIDesignator; 12428 this.appendStreamIdentifier = appendStreamIdentifier; 12429 this.minimumEdgeStrength = minimumEdgeStrength; 12430 this.demodulationMode = demodulationMode; 12431 this.cellSampleSize = cellSampleSize; 12432 this.cellFilterMode = cellFilterMode; 12433 } 12434 12435 protected QRCodeReport(ByteBuffer backing, int offset) { 12436 super(backing, offset, 136); 12437 init(); 12438 } 12439 12440 protected QRCodeReport(long nativeObj, boolean owned) { 12441 super(nativeObj, owned, 136); 12442 init(); 12443 } 12444 12445 protected void setBuffer(ByteBuffer backing, int offset) { 12446 super.setBuffer(backing, offset, 136); 12447 } 12448 12449 public void read() { 12450 found = backing.getInt(0); 12451 int data_dataLength = backing.getInt(8); 12452 long data_addr = getPointer(backing, 4); 12453 data = new byte[data_dataLength]; 12454 if (data_dataLength > 0 && data_addr != 0) { 12455 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 12456 } 12457 for (PointFloat it : boundingBox) { 12458 it.read(); 12459 } 12460 int tokenizedData_sizeOfTokenizedData = backing.getInt(48); 12461 long tokenizedData_addr = getPointer(backing, 44); 12462 tokenizedData = new QRCodeDataToken[tokenizedData_sizeOfTokenizedData]; 12463 if (tokenizedData_sizeOfTokenizedData > 0 && tokenizedData_addr != 0) { 12464 ByteBuffer bb = 12465 newDirectByteBuffer(tokenizedData_addr, tokenizedData_sizeOfTokenizedData * 16); 12466 for (int i = 0, off = 0; i < tokenizedData_sizeOfTokenizedData; i++, off += 16) { 12467 tokenizedData[i] = new QRCodeDataToken(bb, off); 12468 tokenizedData[i].read(); 12469 } 12470 } 12471 numErrorsCorrected = backing.getInt(52); 12472 dimensions = backing.getInt(56); 12473 version = backing.getInt(60); 12474 modelType = QRModelType.fromValue(backing.getInt(64)); 12475 streamMode = QRStreamMode.fromValue(backing.getInt(68)); 12476 matrixPolarity = QRPolarities.fromValue(backing.getInt(72)); 12477 mirrored = backing.getInt(80); 12478 positionInAppendStream = backing.getInt(84); 12479 sizeOfAppendStream = backing.getInt(88); 12480 firstEAN128ApplicationID = backing.getInt(92); 12481 firstECIDesignator = backing.getInt(96); 12482 appendStreamIdentifier = backing.getInt(100); 12483 minimumEdgeStrength = backing.getInt(104); 12484 demodulationMode = QRDemodulationMode.fromValue(backing.getInt(112)); 12485 cellSampleSize = QRCellSampleSize.fromValue(backing.getInt(120)); 12486 cellFilterMode = QRCellFilterMode.fromValue(backing.getInt(128)); 12487 } 12488 12489 public void write() { 12490 backing.putInt(0, found); 12491 data_buf = ByteBuffer.allocateDirect(data.length); 12492 putBytes(data_buf, data, 0, data.length); 12493 backing.putInt(8, data.length); 12494 putPointer(backing, 4, data_buf); 12495 for (PointFloat it : boundingBox) { 12496 it.write(); 12497 } 12498 tokenizedData_buf = 12499 ByteBuffer.allocateDirect(tokenizedData.length * 16).order(ByteOrder.nativeOrder()); 12500 for (int i = 0, off = 0; i < tokenizedData.length; i++, off += 16) { 12501 tokenizedData[i].setBuffer(tokenizedData_buf, off); 12502 tokenizedData[i].write(); 12503 } 12504 backing.putInt(48, tokenizedData.length); 12505 putPointer(backing, 44, tokenizedData_buf); 12506 backing.putInt(52, numErrorsCorrected); 12507 backing.putInt(56, dimensions); 12508 backing.putInt(60, version); 12509 if (modelType != null) 12510 backing.putInt(64, modelType.getValue()); 12511 if (streamMode != null) 12512 backing.putInt(68, streamMode.getValue()); 12513 if (matrixPolarity != null) 12514 backing.putInt(72, matrixPolarity.getValue()); 12515 backing.putInt(80, mirrored); 12516 backing.putInt(84, positionInAppendStream); 12517 backing.putInt(88, sizeOfAppendStream); 12518 backing.putInt(92, firstEAN128ApplicationID); 12519 backing.putInt(96, firstECIDesignator); 12520 backing.putInt(100, appendStreamIdentifier); 12521 backing.putInt(104, minimumEdgeStrength); 12522 if (demodulationMode != null) 12523 backing.putInt(112, demodulationMode.getValue()); 12524 if (cellSampleSize != null) 12525 backing.putInt(120, cellSampleSize.getValue()); 12526 if (cellFilterMode != null) 12527 backing.putInt(128, cellFilterMode.getValue()); 12528 } 12529 12530 public int size() { 12531 return 136; 12532 } 12533 } 12534 12535 public static class AIMGradeReport extends DisposedStruct { 12536 public AIMGrade overallGrade; // The overall letter grade, which is equal to 12537 // the lowest of the other five letter grades. 12538 public AIMGrade decodingGrade; // The letter grade assigned to a Data Matrix 12539 // barcode based on the success of the 12540 // function in decoding the Data Matrix 12541 // barcode. 12542 public AIMGrade symbolContrastGrade; // The letter grade assigned to a Data 12543 // Matrix barcode based on the symbol 12544 // contrast raw score. 12545 public float symbolContrast; // The symbol contrast raw score representing 12546 // the percentage difference between the mean 12547 // of the reflectance of the darkest 10 percent 12548 // and lightest 10 percent of the Data Matrix 12549 // barcode. 12550 public AIMGrade printGrowthGrade; // The print growth letter grade for the 12551 // Data Matrix barcode. 12552 public float printGrowth; // The print growth raw score for the barcode, 12553 // which is based on the extent to which dark or 12554 // light markings appropriately fill their module 12555 // boundaries. 12556 public AIMGrade axialNonuniformityGrade; // The axial nonuniformity grade 12557 // for the Data Matrix barcode. 12558 public float axialNonuniformity; // The axial nonuniformity raw score for 12559 // the barcode, which is based on how much 12560 // the sampling point spacing differs from 12561 // one axis to another. 12562 public AIMGrade unusedErrorCorrectionGrade; // The unused error correction 12563 // letter grade for the Data 12564 // Matrix barcode. 12565 public float unusedErrorCorrection; // The unused error correction raw score 12566 // for the Data Matrix barcode, which is 12567 // based on the extent to which regional 12568 // or spot damage in the Data Matrix 12569 // barcode has eroded the reading safety 12570 // margin provided by the error 12571 // correction. 12572 12573 private void init() { 12574 12575 } 12576 12577 public AIMGradeReport() { 12578 super(40); 12579 init(); 12580 } 12581 12582 public AIMGradeReport(AIMGrade overallGrade, AIMGrade decodingGrade, 12583 AIMGrade symbolContrastGrade, double symbolContrast, AIMGrade printGrowthGrade, 12584 double printGrowth, AIMGrade axialNonuniformityGrade, double axialNonuniformity, 12585 AIMGrade unusedErrorCorrectionGrade, double unusedErrorCorrection) { 12586 super(40); 12587 this.overallGrade = overallGrade; 12588 this.decodingGrade = decodingGrade; 12589 this.symbolContrastGrade = symbolContrastGrade; 12590 this.symbolContrast = (float) symbolContrast; 12591 this.printGrowthGrade = printGrowthGrade; 12592 this.printGrowth = (float) printGrowth; 12593 this.axialNonuniformityGrade = axialNonuniformityGrade; 12594 this.axialNonuniformity = (float) axialNonuniformity; 12595 this.unusedErrorCorrectionGrade = unusedErrorCorrectionGrade; 12596 this.unusedErrorCorrection = (float) unusedErrorCorrection; 12597 } 12598 12599 protected AIMGradeReport(ByteBuffer backing, int offset) { 12600 super(backing, offset, 40); 12601 init(); 12602 } 12603 12604 protected AIMGradeReport(long nativeObj, boolean owned) { 12605 super(nativeObj, owned, 40); 12606 init(); 12607 } 12608 12609 protected void setBuffer(ByteBuffer backing, int offset) { 12610 super.setBuffer(backing, offset, 40); 12611 } 12612 12613 public void read() { 12614 overallGrade = AIMGrade.fromValue(backing.getInt(0)); 12615 decodingGrade = AIMGrade.fromValue(backing.getInt(4)); 12616 symbolContrastGrade = AIMGrade.fromValue(backing.getInt(8)); 12617 symbolContrast = backing.getFloat(12); 12618 printGrowthGrade = AIMGrade.fromValue(backing.getInt(16)); 12619 printGrowth = backing.getFloat(20); 12620 axialNonuniformityGrade = AIMGrade.fromValue(backing.getInt(24)); 12621 axialNonuniformity = backing.getFloat(28); 12622 unusedErrorCorrectionGrade = AIMGrade.fromValue(backing.getInt(32)); 12623 unusedErrorCorrection = backing.getFloat(36); 12624 } 12625 12626 public void write() { 12627 if (overallGrade != null) 12628 backing.putInt(0, overallGrade.getValue()); 12629 if (decodingGrade != null) 12630 backing.putInt(4, decodingGrade.getValue()); 12631 if (symbolContrastGrade != null) 12632 backing.putInt(8, symbolContrastGrade.getValue()); 12633 backing.putFloat(12, symbolContrast); 12634 if (printGrowthGrade != null) 12635 backing.putInt(16, printGrowthGrade.getValue()); 12636 backing.putFloat(20, printGrowth); 12637 if (axialNonuniformityGrade != null) 12638 backing.putInt(24, axialNonuniformityGrade.getValue()); 12639 backing.putFloat(28, axialNonuniformity); 12640 if (unusedErrorCorrectionGrade != null) 12641 backing.putInt(32, unusedErrorCorrectionGrade.getValue()); 12642 backing.putFloat(36, unusedErrorCorrection); 12643 } 12644 12645 public int size() { 12646 return 40; 12647 } 12648 } 12649 12650 public static class DataMatrixSizeOptions extends DisposedStruct { 12651 public int minSize; // Specifies the minimum size (in pixels) of the Data 12652 // Matrix barcode in the image. 12653 public int maxSize; // Specifies the maximum size (in pixels) of the Data 12654 // Matrix barcode in the image. 12655 public int quietZoneWidth; // Specifies the expected minimum size of the 12656 // quiet zone, in pixels. 12657 12658 private void init() { 12659 12660 } 12661 12662 public DataMatrixSizeOptions() { 12663 super(12); 12664 init(); 12665 } 12666 12667 public DataMatrixSizeOptions(int minSize, int maxSize, int quietZoneWidth) { 12668 super(12); 12669 this.minSize = minSize; 12670 this.maxSize = maxSize; 12671 this.quietZoneWidth = quietZoneWidth; 12672 } 12673 12674 protected DataMatrixSizeOptions(ByteBuffer backing, int offset) { 12675 super(backing, offset, 12); 12676 init(); 12677 } 12678 12679 protected DataMatrixSizeOptions(long nativeObj, boolean owned) { 12680 super(nativeObj, owned, 12); 12681 init(); 12682 } 12683 12684 protected void setBuffer(ByteBuffer backing, int offset) { 12685 super.setBuffer(backing, offset, 12); 12686 } 12687 12688 public void read() { 12689 minSize = backing.getInt(0); 12690 maxSize = backing.getInt(4); 12691 quietZoneWidth = backing.getInt(8); 12692 } 12693 12694 public void write() { 12695 backing.putInt(0, minSize); 12696 backing.putInt(4, maxSize); 12697 backing.putInt(8, quietZoneWidth); 12698 } 12699 12700 public int size() { 12701 return 12; 12702 } 12703 } 12704 12705 public static class DataMatrixDescriptionOptions extends DisposedStruct { 12706 public float aspectRatio; // Specifies the ratio of the width of each Data 12707 // Matrix barcode cell (in pixels) to the height 12708 // of the Data Matrix barcode (in pixels). 12709 public int rows; // Specifies the number of rows in the Data Matrix barcode. 12710 public int columns; // Specifies the number of columns in the Data Matrix 12711 // barcode. 12712 public int rectangle; // Set this element to TRUE to specify that the Data 12713 // Matrix barcode is rectangular. 12714 public DataMatrixECC ecc; // Specifies the ECC used for this Data Matrix 12715 // barcode. 12716 public DataMatrixPolarity polarity; // Specifies the data-to-background 12717 // contrast for the Data Matrix barcode. 12718 public DataMatrixCellFillMode cellFill; // Specifies the fill percentage for 12719 // a cell of the Data Matrix barcode 12720 // that is in the "ON" state. 12721 public float minBorderIntegrity; // Specifies the minimum percentage of the 12722 // border (locator pattern and timing 12723 // pattern) the function should expect in 12724 // the Data Matrix barcode. 12725 public DataMatrixMirrorMode mirrorMode; // Specifies if the Data Matrix 12726 // barcode appears normally in the 12727 // image or if the barcode appears 12728 // mirrored in the image. 12729 12730 private void init() { 12731 12732 } 12733 12734 public DataMatrixDescriptionOptions() { 12735 super(56); 12736 init(); 12737 } 12738 12739 public DataMatrixDescriptionOptions(double aspectRatio, int rows, int columns, int rectangle, 12740 DataMatrixECC ecc, DataMatrixPolarity polarity, DataMatrixCellFillMode cellFill, 12741 double minBorderIntegrity, DataMatrixMirrorMode mirrorMode) { 12742 super(56); 12743 this.aspectRatio = (float) aspectRatio; 12744 this.rows = rows; 12745 this.columns = columns; 12746 this.rectangle = rectangle; 12747 this.ecc = ecc; 12748 this.polarity = polarity; 12749 this.cellFill = cellFill; 12750 this.minBorderIntegrity = (float) minBorderIntegrity; 12751 this.mirrorMode = mirrorMode; 12752 } 12753 12754 protected DataMatrixDescriptionOptions(ByteBuffer backing, int offset) { 12755 super(backing, offset, 56); 12756 init(); 12757 } 12758 12759 protected DataMatrixDescriptionOptions(long nativeObj, boolean owned) { 12760 super(nativeObj, owned, 56); 12761 init(); 12762 } 12763 12764 protected void setBuffer(ByteBuffer backing, int offset) { 12765 super.setBuffer(backing, offset, 56); 12766 } 12767 12768 public void read() { 12769 aspectRatio = backing.getFloat(0); 12770 rows = backing.getInt(4); 12771 columns = backing.getInt(8); 12772 rectangle = backing.getInt(12); 12773 ecc = DataMatrixECC.fromValue(backing.getInt(16)); 12774 polarity = DataMatrixPolarity.fromValue(backing.getInt(24)); 12775 cellFill = DataMatrixCellFillMode.fromValue(backing.getInt(32)); 12776 minBorderIntegrity = backing.getFloat(40); 12777 mirrorMode = DataMatrixMirrorMode.fromValue(backing.getInt(48)); 12778 } 12779 12780 public void write() { 12781 backing.putFloat(0, aspectRatio); 12782 backing.putInt(4, rows); 12783 backing.putInt(8, columns); 12784 backing.putInt(12, rectangle); 12785 if (ecc != null) 12786 backing.putInt(16, ecc.getValue()); 12787 if (polarity != null) 12788 backing.putInt(24, polarity.getValue()); 12789 if (cellFill != null) 12790 backing.putInt(32, cellFill.getValue()); 12791 backing.putFloat(40, minBorderIntegrity); 12792 if (mirrorMode != null) 12793 backing.putInt(48, mirrorMode.getValue()); 12794 } 12795 12796 public int size() { 12797 return 56; 12798 } 12799 } 12800 12801 public static class DataMatrixSearchOptions extends DisposedStruct { 12802 public DataMatrixRotationMode rotationMode; // Specifies the amount of Data 12803 // Matrix barcode rotation the 12804 // function should allow for. 12805 public int skipLocation; // If set to TRUE, specifies that the function 12806 // should assume that the Data Matrix barcode 12807 // occupies the entire image (or the entire search 12808 // region). 12809 public int edgeThreshold; // Specifies the minimum contrast a pixel must 12810 // have in order to be considered part of a matrix 12811 // cell edge. 12812 public DataMatrixDemodulationMode demodulationMode; // Specifies the mode 12813 // the function should 12814 // use to demodulate 12815 // (determine which 12816 // cells are on and 12817 // which cells are off) 12818 // the Data Matrix 12819 // barcode. 12820 public DataMatrixCellSampleSize cellSampleSize; // Specifies the sample 12821 // size, in pixels, the 12822 // function should take to 12823 // determine if each cell is 12824 // on or off. 12825 public DataMatrixCellFilterMode cellFilterMode; // Specifies the mode the 12826 // function uses to 12827 // determine the pixel value 12828 // for each cell. 12829 public int skewDegreesAllowed; // Specifies the amount of skew in the Data 12830 // Matrix barcode the function should allow 12831 // for. 12832 public int maxIterations; // Specifies the maximum number of iterations 12833 // before the function stops looking for the Data 12834 // Matrix barcode. 12835 public int initialSearchVectorWidth; // Specifies the number of pixels the 12836 // function should average together to 12837 // determine the location of an edge. 12838 12839 private void init() { 12840 12841 } 12842 12843 public DataMatrixSearchOptions() { 12844 super(56); 12845 init(); 12846 } 12847 12848 public DataMatrixSearchOptions(DataMatrixRotationMode rotationMode, int skipLocation, 12849 int edgeThreshold, DataMatrixDemodulationMode demodulationMode, 12850 DataMatrixCellSampleSize cellSampleSize, DataMatrixCellFilterMode cellFilterMode, 12851 int skewDegreesAllowed, int maxIterations, int initialSearchVectorWidth) { 12852 super(56); 12853 this.rotationMode = rotationMode; 12854 this.skipLocation = skipLocation; 12855 this.edgeThreshold = edgeThreshold; 12856 this.demodulationMode = demodulationMode; 12857 this.cellSampleSize = cellSampleSize; 12858 this.cellFilterMode = cellFilterMode; 12859 this.skewDegreesAllowed = skewDegreesAllowed; 12860 this.maxIterations = maxIterations; 12861 this.initialSearchVectorWidth = initialSearchVectorWidth; 12862 } 12863 12864 protected DataMatrixSearchOptions(ByteBuffer backing, int offset) { 12865 super(backing, offset, 56); 12866 init(); 12867 } 12868 12869 protected DataMatrixSearchOptions(long nativeObj, boolean owned) { 12870 super(nativeObj, owned, 56); 12871 init(); 12872 } 12873 12874 protected void setBuffer(ByteBuffer backing, int offset) { 12875 super.setBuffer(backing, offset, 56); 12876 } 12877 12878 public void read() { 12879 rotationMode = DataMatrixRotationMode.fromValue(backing.getInt(0)); 12880 skipLocation = backing.getInt(4); 12881 edgeThreshold = backing.getInt(8); 12882 demodulationMode = DataMatrixDemodulationMode.fromValue(backing.getInt(16)); 12883 cellSampleSize = DataMatrixCellSampleSize.fromValue(backing.getInt(24)); 12884 cellFilterMode = DataMatrixCellFilterMode.fromValue(backing.getInt(32)); 12885 skewDegreesAllowed = backing.getInt(40); 12886 maxIterations = backing.getInt(44); 12887 initialSearchVectorWidth = backing.getInt(48); 12888 } 12889 12890 public void write() { 12891 if (rotationMode != null) 12892 backing.putInt(0, rotationMode.getValue()); 12893 backing.putInt(4, skipLocation); 12894 backing.putInt(8, edgeThreshold); 12895 if (demodulationMode != null) 12896 backing.putInt(16, demodulationMode.getValue()); 12897 if (cellSampleSize != null) 12898 backing.putInt(24, cellSampleSize.getValue()); 12899 if (cellFilterMode != null) 12900 backing.putInt(32, cellFilterMode.getValue()); 12901 backing.putInt(40, skewDegreesAllowed); 12902 backing.putInt(44, maxIterations); 12903 backing.putInt(48, initialSearchVectorWidth); 12904 } 12905 12906 public int size() { 12907 return 56; 12908 } 12909 } 12910 12911 public static class DataMatrixReport extends DisposedStruct { 12912 public int found; // This element is TRUE if the function located and 12913 // decoded a Data Matrix barcode and FALSE if the function 12914 // failed to locate and decode a Data Matrix barcode. 12915 public int binary; // This element is TRUE if the Data Matrix barcode 12916 // contains binary data and FALSE if the Data Matrix 12917 // barcode contains text data. 12918 public byte[] data; // The data encoded in the Data Matrix barcode. 12919 public PointFloat[] boundingBox; // An array of four points describing the 12920 // rectangle surrounding the Data Matrix 12921 // barcode. 12922 public int numErrorsCorrected; // The number of errors the function 12923 // corrected when decoding the Data Matrix 12924 // barcode. 12925 public int numErasuresCorrected; // The number of erasures the function 12926 // corrected when decoding the Data Matrix 12927 // barcode. 12928 public float aspectRatio; // Specifies the aspect ratio of the Data Matrix 12929 // barcode in the image, which equals the ratio of 12930 // the width of a Data Matrix barcode cell (in 12931 // pixels) to the height of a Data Matrix barcode 12932 // cell (in pixels). 12933 public int rows; // The number of rows in the Data Matrix barcode. 12934 public int columns; // The number of columns in the Data Matrix barcode. 12935 public DataMatrixECC ecc; // The Error Correction Code (ECC) used by the 12936 // Data Matrix barcode. 12937 public DataMatrixPolarity polarity; // The polarity of the Data Matrix 12938 // barcode. 12939 public DataMatrixCellFillMode cellFill; // The cell fill percentage of the 12940 // Data Matrix barcode. 12941 public float borderIntegrity; // The percentage of the Data Matrix barcode 12942 // border that appears correctly in the image. 12943 public int mirrored; // This element is TRUE if the Data Matrix barcode 12944 // appears mirrored in the image and FALSE if the Data 12945 // Matrix barcode appears normally in the image. 12946 public int minimumEdgeStrength; // The strength of the weakest edge the 12947 // function used to find the coarse location 12948 // of the Data Matrix barcode in the image. 12949 public DataMatrixDemodulationMode demodulationMode; // The demodulation mode 12950 // the function used to 12951 // locate the Data 12952 // Matrix barcode. 12953 public DataMatrixCellSampleSize cellSampleSize; // The cell sample size the 12954 // function used to locate 12955 // the Data Matrix barcode. 12956 public DataMatrixCellFilterMode cellFilterMode; // The cell filter mode the 12957 // function used to locate 12958 // the Data Matrix barcode. 12959 public int iterations; // The number of iterations the function took in 12960 // attempting to locate the Data Matrix barcode. 12961 private ByteBuffer data_buf; 12962 12963 private void init() { 12964 data = new byte[0]; 12965 boundingBox = new PointFloat[4]; 12966 12967 for (int i = 0, off = 16; i < 4; i++, off += 8) 12968 boundingBox[i] = new PointFloat(backing, off); 12969 } 12970 12971 public DataMatrixReport() { 12972 super(144); 12973 init(); 12974 } 12975 12976 public DataMatrixReport(int found, int binary, byte[] data, PointFloat[] boundingBox, 12977 int numErrorsCorrected, int numErasuresCorrected, double aspectRatio, int rows, 12978 int columns, DataMatrixECC ecc, DataMatrixPolarity polarity, 12979 DataMatrixCellFillMode cellFill, double borderIntegrity, int mirrored, 12980 int minimumEdgeStrength, DataMatrixDemodulationMode demodulationMode, 12981 DataMatrixCellSampleSize cellSampleSize, DataMatrixCellFilterMode cellFilterMode, 12982 int iterations) { 12983 super(144); 12984 this.found = found; 12985 this.binary = binary; 12986 this.data = data; 12987 this.boundingBox = boundingBox; 12988 this.numErrorsCorrected = numErrorsCorrected; 12989 this.numErasuresCorrected = numErasuresCorrected; 12990 this.aspectRatio = (float) aspectRatio; 12991 this.rows = rows; 12992 this.columns = columns; 12993 this.ecc = ecc; 12994 this.polarity = polarity; 12995 this.cellFill = cellFill; 12996 this.borderIntegrity = (float) borderIntegrity; 12997 this.mirrored = mirrored; 12998 this.minimumEdgeStrength = minimumEdgeStrength; 12999 this.demodulationMode = demodulationMode; 13000 this.cellSampleSize = cellSampleSize; 13001 this.cellFilterMode = cellFilterMode; 13002 this.iterations = iterations; 13003 } 13004 13005 protected DataMatrixReport(ByteBuffer backing, int offset) { 13006 super(backing, offset, 144); 13007 init(); 13008 } 13009 13010 protected DataMatrixReport(long nativeObj, boolean owned) { 13011 super(nativeObj, owned, 144); 13012 init(); 13013 } 13014 13015 protected void setBuffer(ByteBuffer backing, int offset) { 13016 super.setBuffer(backing, offset, 144); 13017 } 13018 13019 public void read() { 13020 found = backing.getInt(0); 13021 binary = backing.getInt(4); 13022 int data_dataLength = backing.getInt(12); 13023 long data_addr = getPointer(backing, 8); 13024 data = new byte[data_dataLength]; 13025 if (data_dataLength > 0 && data_addr != 0) { 13026 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 13027 } 13028 for (PointFloat it : boundingBox) { 13029 it.read(); 13030 } 13031 numErrorsCorrected = backing.getInt(48); 13032 numErasuresCorrected = backing.getInt(52); 13033 aspectRatio = backing.getFloat(56); 13034 rows = backing.getInt(60); 13035 columns = backing.getInt(64); 13036 ecc = DataMatrixECC.fromValue(backing.getInt(72)); 13037 polarity = DataMatrixPolarity.fromValue(backing.getInt(80)); 13038 cellFill = DataMatrixCellFillMode.fromValue(backing.getInt(88)); 13039 borderIntegrity = backing.getFloat(96); 13040 mirrored = backing.getInt(100); 13041 minimumEdgeStrength = backing.getInt(104); 13042 demodulationMode = DataMatrixDemodulationMode.fromValue(backing.getInt(112)); 13043 cellSampleSize = DataMatrixCellSampleSize.fromValue(backing.getInt(120)); 13044 cellFilterMode = DataMatrixCellFilterMode.fromValue(backing.getInt(128)); 13045 iterations = backing.getInt(136); 13046 } 13047 13048 public void write() { 13049 backing.putInt(0, found); 13050 backing.putInt(4, binary); 13051 data_buf = ByteBuffer.allocateDirect(data.length); 13052 putBytes(data_buf, data, 0, data.length); 13053 backing.putInt(12, data.length); 13054 putPointer(backing, 8, data_buf); 13055 for (PointFloat it : boundingBox) { 13056 it.write(); 13057 } 13058 backing.putInt(48, numErrorsCorrected); 13059 backing.putInt(52, numErasuresCorrected); 13060 backing.putFloat(56, aspectRatio); 13061 backing.putInt(60, rows); 13062 backing.putInt(64, columns); 13063 if (ecc != null) 13064 backing.putInt(72, ecc.getValue()); 13065 if (polarity != null) 13066 backing.putInt(80, polarity.getValue()); 13067 if (cellFill != null) 13068 backing.putInt(88, cellFill.getValue()); 13069 backing.putFloat(96, borderIntegrity); 13070 backing.putInt(100, mirrored); 13071 backing.putInt(104, minimumEdgeStrength); 13072 if (demodulationMode != null) 13073 backing.putInt(112, demodulationMode.getValue()); 13074 if (cellSampleSize != null) 13075 backing.putInt(120, cellSampleSize.getValue()); 13076 if (cellFilterMode != null) 13077 backing.putInt(128, cellFilterMode.getValue()); 13078 backing.putInt(136, iterations); 13079 } 13080 13081 public int size() { 13082 return 144; 13083 } 13084 } 13085 13086 public static class JPEG2000FileAdvancedOptions extends DisposedStruct { 13087 public WaveletTransformMode waveletMode; // Determines which wavelet 13088 // transform to use when writing 13089 // the file. 13090 public int useMultiComponentTransform; // Set this parameter to TRUE to use 13091 // an additional transform on RGB 13092 // images. 13093 public int maxWaveletTransformLevel; // Specifies the maximum allowed level 13094 // of wavelet transform. 13095 public float quantizationStepSize; // Specifies the absolute base 13096 // quantization step size for derived 13097 // quantization mode. 13098 13099 private void init() { 13100 13101 } 13102 13103 public JPEG2000FileAdvancedOptions() { 13104 super(16); 13105 init(); 13106 } 13107 13108 public JPEG2000FileAdvancedOptions(WaveletTransformMode waveletMode, 13109 int useMultiComponentTransform, int maxWaveletTransformLevel, double quantizationStepSize) { 13110 super(16); 13111 this.waveletMode = waveletMode; 13112 this.useMultiComponentTransform = useMultiComponentTransform; 13113 this.maxWaveletTransformLevel = maxWaveletTransformLevel; 13114 this.quantizationStepSize = (float) quantizationStepSize; 13115 } 13116 13117 protected JPEG2000FileAdvancedOptions(ByteBuffer backing, int offset) { 13118 super(backing, offset, 16); 13119 init(); 13120 } 13121 13122 protected JPEG2000FileAdvancedOptions(long nativeObj, boolean owned) { 13123 super(nativeObj, owned, 16); 13124 init(); 13125 } 13126 13127 protected void setBuffer(ByteBuffer backing, int offset) { 13128 super.setBuffer(backing, offset, 16); 13129 } 13130 13131 public void read() { 13132 waveletMode = WaveletTransformMode.fromValue(backing.getInt(0)); 13133 useMultiComponentTransform = backing.getInt(4); 13134 maxWaveletTransformLevel = backing.getInt(8); 13135 quantizationStepSize = backing.getFloat(12); 13136 } 13137 13138 public void write() { 13139 if (waveletMode != null) 13140 backing.putInt(0, waveletMode.getValue()); 13141 backing.putInt(4, useMultiComponentTransform); 13142 backing.putInt(8, maxWaveletTransformLevel); 13143 backing.putFloat(12, quantizationStepSize); 13144 } 13145 13146 public int size() { 13147 return 16; 13148 } 13149 } 13150 13151 public static class MatchGeometricPatternAdvancedOptions2 extends DisposedStruct { 13152 public int minFeaturesUsed; // Specifies the minimum number of features the 13153 // function uses when matching. 13154 public int maxFeaturesUsed; // Specifies the maximum number of features the 13155 // function uses when matching. 13156 public int subpixelIterations; // Specifies the maximum number of 13157 // incremental improvements used to refine 13158 // matches with subpixel information. 13159 public double subpixelTolerance; // Specifies the maximum amount of change, 13160 // in pixels, between consecutive 13161 // incremental improvements in the match 13162 // position before the function stops 13163 // refining the match position. 13164 public int initialMatchListLength; // Specifies the maximum size of the 13165 // match list. 13166 public float matchTemplateCurveScore; // Set this element to TRUE to specify 13167 // that the function should calculate 13168 // the match curve to template curve 13169 // score and return it for each match 13170 // result. 13171 public int correlationScore; // Set this element to TRUE to specify that the 13172 // function should calculate the correlation 13173 // score and return it for each match result. 13174 public double minMatchSeparationDistance; // Specifies the minimum 13175 // separation distance, in pixels, 13176 // between the origins of two 13177 // matches that have unique 13178 // positions. 13179 public double minMatchSeparationAngle; // Specifies the minimum angular 13180 // difference, in degrees, between 13181 // two matches that have unique 13182 // angles. 13183 public double minMatchSeparationScale; // Specifies the minimum difference 13184 // in scale, expressed as a 13185 // percentage, between two matches 13186 // that have unique scales. 13187 public double maxMatchOverlap; // Specifies the maximum amount of overlap, 13188 // expressed as a percentage, allowed between 13189 // the bounding rectangles of two unique 13190 // matches. 13191 public int coarseResult; // Specifies whether you want the function to spend 13192 // less time accurately estimating the location of 13193 // a match. 13194 public int smoothContours; // Set this element to TRUE to specify smoothing 13195 // be done on the contours of the inspection 13196 // image before feature extraction. 13197 public int enableCalibrationSupport; // Set this element to TRUE to specify 13198 // the algorithm treat the inspection 13199 // image as a calibrated image. 13200 13201 private void init() { 13202 13203 } 13204 13205 public MatchGeometricPatternAdvancedOptions2() { 13206 super(88); 13207 init(); 13208 } 13209 13210 public MatchGeometricPatternAdvancedOptions2(int minFeaturesUsed, int maxFeaturesUsed, 13211 int subpixelIterations, double subpixelTolerance, int initialMatchListLength, 13212 double matchTemplateCurveScore, int correlationScore, double minMatchSeparationDistance, 13213 double minMatchSeparationAngle, double minMatchSeparationScale, double maxMatchOverlap, 13214 int coarseResult, int smoothContours, int enableCalibrationSupport) { 13215 super(88); 13216 this.minFeaturesUsed = minFeaturesUsed; 13217 this.maxFeaturesUsed = maxFeaturesUsed; 13218 this.subpixelIterations = subpixelIterations; 13219 this.subpixelTolerance = subpixelTolerance; 13220 this.initialMatchListLength = initialMatchListLength; 13221 this.matchTemplateCurveScore = (float) matchTemplateCurveScore; 13222 this.correlationScore = correlationScore; 13223 this.minMatchSeparationDistance = minMatchSeparationDistance; 13224 this.minMatchSeparationAngle = minMatchSeparationAngle; 13225 this.minMatchSeparationScale = minMatchSeparationScale; 13226 this.maxMatchOverlap = maxMatchOverlap; 13227 this.coarseResult = coarseResult; 13228 this.smoothContours = smoothContours; 13229 this.enableCalibrationSupport = enableCalibrationSupport; 13230 } 13231 13232 protected MatchGeometricPatternAdvancedOptions2(ByteBuffer backing, int offset) { 13233 super(backing, offset, 88); 13234 init(); 13235 } 13236 13237 protected MatchGeometricPatternAdvancedOptions2(long nativeObj, boolean owned) { 13238 super(nativeObj, owned, 88); 13239 init(); 13240 } 13241 13242 protected void setBuffer(ByteBuffer backing, int offset) { 13243 super.setBuffer(backing, offset, 88); 13244 } 13245 13246 public void read() { 13247 minFeaturesUsed = backing.getInt(0); 13248 maxFeaturesUsed = backing.getInt(4); 13249 subpixelIterations = backing.getInt(8); 13250 subpixelTolerance = backing.getDouble(16); 13251 initialMatchListLength = backing.getInt(24); 13252 matchTemplateCurveScore = backing.getFloat(28); 13253 correlationScore = backing.getInt(32); 13254 minMatchSeparationDistance = backing.getDouble(40); 13255 minMatchSeparationAngle = backing.getDouble(48); 13256 minMatchSeparationScale = backing.getDouble(56); 13257 maxMatchOverlap = backing.getDouble(64); 13258 coarseResult = backing.getInt(72); 13259 smoothContours = backing.getInt(76); 13260 enableCalibrationSupport = backing.getInt(80); 13261 } 13262 13263 public void write() { 13264 backing.putInt(0, minFeaturesUsed); 13265 backing.putInt(4, maxFeaturesUsed); 13266 backing.putInt(8, subpixelIterations); 13267 backing.putDouble(16, subpixelTolerance); 13268 backing.putInt(24, initialMatchListLength); 13269 backing.putFloat(28, matchTemplateCurveScore); 13270 backing.putInt(32, correlationScore); 13271 backing.putDouble(40, minMatchSeparationDistance); 13272 backing.putDouble(48, minMatchSeparationAngle); 13273 backing.putDouble(56, minMatchSeparationScale); 13274 backing.putDouble(64, maxMatchOverlap); 13275 backing.putInt(72, coarseResult); 13276 backing.putInt(76, smoothContours); 13277 backing.putInt(80, enableCalibrationSupport); 13278 } 13279 13280 public int size() { 13281 return 88; 13282 } 13283 } 13284 13285 public static class InspectionAlignment extends DisposedStruct { 13286 public PointFloat position; // The location of the center of the golden 13287 // template in the image under inspection. 13288 public float rotation; // The rotation of the golden template in the image 13289 // under inspection, in degrees. 13290 public float scale; // The percentage of the size of the area under 13291 // inspection compared to the size of the golden 13292 // template. 13293 13294 private void init() { 13295 position = new PointFloat(backing, 0); 13296 } 13297 13298 public InspectionAlignment() { 13299 super(16); 13300 init(); 13301 } 13302 13303 public InspectionAlignment(PointFloat position, double rotation, double scale) { 13304 super(16); 13305 this.position = position; 13306 this.rotation = (float) rotation; 13307 this.scale = (float) scale; 13308 } 13309 13310 protected InspectionAlignment(ByteBuffer backing, int offset) { 13311 super(backing, offset, 16); 13312 init(); 13313 } 13314 13315 protected InspectionAlignment(long nativeObj, boolean owned) { 13316 super(nativeObj, owned, 16); 13317 init(); 13318 } 13319 13320 protected void setBuffer(ByteBuffer backing, int offset) { 13321 super.setBuffer(backing, offset, 16); 13322 } 13323 13324 public void read() { 13325 position.read(); 13326 rotation = backing.getFloat(8); 13327 scale = backing.getFloat(12); 13328 } 13329 13330 public void write() { 13331 position.write(); 13332 backing.putFloat(8, rotation); 13333 backing.putFloat(12, scale); 13334 } 13335 13336 public int size() { 13337 return 16; 13338 } 13339 } 13340 13341 public static class InspectionOptions extends DisposedStruct { 13342 public RegistrationMethod registrationMethod; // Specifies how the function 13343 // registers the golden 13344 // template and the target 13345 // image. 13346 public NormalizationMethod normalizationMethod; // Specifies how the 13347 // function normalizes the 13348 // golden template to the 13349 // target image. 13350 public int edgeThicknessToIgnore; // Specifies desired thickness of edges to 13351 // be ignored. 13352 public float brightThreshold; // Specifies the threshold for areas where the 13353 // target image is brighter than the golden 13354 // template. 13355 public float darkThreshold; // Specifies the threshold for areas where the 13356 // target image is darker than the golden 13357 // template. 13358 public int binary; // Specifies whether the function should return a binary 13359 // image giving the location of defects, or a grayscale 13360 // image giving the intensity of defects. 13361 13362 private void init() { 13363 13364 } 13365 13366 public InspectionOptions() { 13367 super(24); 13368 init(); 13369 } 13370 13371 public InspectionOptions(RegistrationMethod registrationMethod, 13372 NormalizationMethod normalizationMethod, int edgeThicknessToIgnore, double brightThreshold, 13373 double darkThreshold, int binary) { 13374 super(24); 13375 this.registrationMethod = registrationMethod; 13376 this.normalizationMethod = normalizationMethod; 13377 this.edgeThicknessToIgnore = edgeThicknessToIgnore; 13378 this.brightThreshold = (float) brightThreshold; 13379 this.darkThreshold = (float) darkThreshold; 13380 this.binary = binary; 13381 } 13382 13383 protected InspectionOptions(ByteBuffer backing, int offset) { 13384 super(backing, offset, 24); 13385 init(); 13386 } 13387 13388 protected InspectionOptions(long nativeObj, boolean owned) { 13389 super(nativeObj, owned, 24); 13390 init(); 13391 } 13392 13393 protected void setBuffer(ByteBuffer backing, int offset) { 13394 super.setBuffer(backing, offset, 24); 13395 } 13396 13397 public void read() { 13398 registrationMethod = RegistrationMethod.fromValue(backing.getInt(0)); 13399 normalizationMethod = NormalizationMethod.fromValue(backing.getInt(4)); 13400 edgeThicknessToIgnore = backing.getInt(8); 13401 brightThreshold = backing.getFloat(12); 13402 darkThreshold = backing.getFloat(16); 13403 binary = backing.getInt(20); 13404 } 13405 13406 public void write() { 13407 if (registrationMethod != null) 13408 backing.putInt(0, registrationMethod.getValue()); 13409 if (normalizationMethod != null) 13410 backing.putInt(4, normalizationMethod.getValue()); 13411 backing.putInt(8, edgeThicknessToIgnore); 13412 backing.putFloat(12, brightThreshold); 13413 backing.putFloat(16, darkThreshold); 13414 backing.putInt(20, binary); 13415 } 13416 13417 public int size() { 13418 return 24; 13419 } 13420 } 13421 13422 public static class CharReport2 extends DisposedStruct { 13423 public String character; // The character value. 13424 public PointFloat[] corner; // An array of four points that describes the 13425 // rectangle that surrounds the character. 13426 public int lowThreshold; // The minimum value of the threshold range used 13427 // for this character. 13428 public int highThreshold; // The maximum value of the threshold range used 13429 // for this character. 13430 public int classificationScore; // The degree to which the assigned 13431 // character class represents the object 13432 // better than the other character classes 13433 // in the character set. 13434 public int verificationScore; // The similarity of the character and the 13435 // reference character for the character 13436 // class. 13437 public int verified; // This element is TRUE if a reference character was 13438 // found for the character class and FALSE if a 13439 // reference character was not found. 13440 private ByteBuffer character_buf; 13441 13442 private void init() { 13443 corner = new PointFloat[4]; 13444 13445 for (int i = 0, off = 4; i < 4; i++, off += 8) 13446 corner[i] = new PointFloat(backing, off); 13447 } 13448 13449 public CharReport2() { 13450 super(56); 13451 init(); 13452 } 13453 13454 public CharReport2(String character, PointFloat[] corner, int lowThreshold, int highThreshold, 13455 int classificationScore, int verificationScore, int verified) { 13456 super(56); 13457 this.character = character; 13458 this.corner = corner; 13459 this.lowThreshold = lowThreshold; 13460 this.highThreshold = highThreshold; 13461 this.classificationScore = classificationScore; 13462 this.verificationScore = verificationScore; 13463 this.verified = verified; 13464 } 13465 13466 protected CharReport2(ByteBuffer backing, int offset) { 13467 super(backing, offset, 56); 13468 init(); 13469 } 13470 13471 protected CharReport2(long nativeObj, boolean owned) { 13472 super(nativeObj, owned, 56); 13473 init(); 13474 } 13475 13476 protected void setBuffer(ByteBuffer backing, int offset) { 13477 super.setBuffer(backing, offset, 56); 13478 } 13479 13480 public void read() { 13481 long character_addr = getPointer(backing, 0); 13482 if (character_addr == 0) 13483 character = null; 13484 else { 13485 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 13486 while (bb.get() != 0) { 13487 } 13488 byte[] bytes = new byte[bb.position() - 1]; 13489 getBytes(bb, bytes, 0, bytes.length); 13490 try { 13491 character = new String(bytes, "UTF-8"); 13492 } catch (UnsupportedEncodingException e) { 13493 character = ""; 13494 } 13495 } 13496 13497 for (PointFloat it : corner) { 13498 it.read(); 13499 } 13500 lowThreshold = backing.getInt(36); 13501 highThreshold = backing.getInt(40); 13502 classificationScore = backing.getInt(44); 13503 verificationScore = backing.getInt(48); 13504 verified = backing.getInt(52); 13505 } 13506 13507 public void write() { 13508 if (character != null) { 13509 byte[] character_bytes; 13510 try { 13511 character_bytes = character.getBytes("UTF-8"); 13512 } catch (UnsupportedEncodingException e) { 13513 character_bytes = new byte[0]; 13514 } 13515 character_buf = ByteBuffer.allocateDirect(character_bytes.length + 1); 13516 putBytes(character_buf, character_bytes, 0, character_bytes.length).put( 13517 character_bytes.length, (byte) 0); 13518 } 13519 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 13520 for (PointFloat it : corner) { 13521 it.write(); 13522 } 13523 backing.putInt(36, lowThreshold); 13524 backing.putInt(40, highThreshold); 13525 backing.putInt(44, classificationScore); 13526 backing.putInt(48, verificationScore); 13527 backing.putInt(52, verified); 13528 } 13529 13530 public int size() { 13531 return 56; 13532 } 13533 } 13534 13535 public static class CharInfo2 extends DisposedStruct { 13536 public String charValue; // Retrieves the character value of the 13537 // corresponding character in the character set. 13538 public Image charImage; // The image you used to train this character. 13539 public Image internalImage; // The internal representation that NI Vision 13540 // uses to match objects to this character. 13541 public int isReferenceChar; // This element is TRUE if the character is the 13542 // reference character for the character class. 13543 private ByteBuffer charValue_buf; 13544 13545 private void init() { 13546 13547 } 13548 13549 public CharInfo2() { 13550 super(16); 13551 init(); 13552 } 13553 13554 public CharInfo2(String charValue, Image charImage, Image internalImage, int isReferenceChar) { 13555 super(16); 13556 this.charValue = charValue; 13557 this.charImage = charImage; 13558 this.internalImage = internalImage; 13559 this.isReferenceChar = isReferenceChar; 13560 } 13561 13562 protected CharInfo2(ByteBuffer backing, int offset) { 13563 super(backing, offset, 16); 13564 init(); 13565 } 13566 13567 protected CharInfo2(long nativeObj, boolean owned) { 13568 super(nativeObj, owned, 16); 13569 init(); 13570 } 13571 13572 protected void setBuffer(ByteBuffer backing, int offset) { 13573 super.setBuffer(backing, offset, 16); 13574 } 13575 13576 public void read() { 13577 long charValue_addr = getPointer(backing, 0); 13578 if (charValue_addr == 0) 13579 charValue = null; 13580 else { 13581 ByteBuffer bb = newDirectByteBuffer(charValue_addr, 1000); // FIXME 13582 while (bb.get() != 0) { 13583 } 13584 byte[] bytes = new byte[bb.position() - 1]; 13585 getBytes(bb, bytes, 0, bytes.length); 13586 try { 13587 charValue = new String(bytes, "UTF-8"); 13588 } catch (UnsupportedEncodingException e) { 13589 charValue = ""; 13590 } 13591 } 13592 13593 long charImage_addr = getPointer(backing, 4); 13594 if (charImage_addr == 0) 13595 charImage = null; 13596 else 13597 charImage = new Image(charImage_addr, false); 13598 long internalImage_addr = getPointer(backing, 8); 13599 if (internalImage_addr == 0) 13600 internalImage = null; 13601 else 13602 internalImage = new Image(internalImage_addr, false); 13603 isReferenceChar = backing.getInt(12); 13604 } 13605 13606 public void write() { 13607 if (charValue != null) { 13608 byte[] charValue_bytes; 13609 try { 13610 charValue_bytes = charValue.getBytes("UTF-8"); 13611 } catch (UnsupportedEncodingException e) { 13612 charValue_bytes = new byte[0]; 13613 } 13614 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length + 1); 13615 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put( 13616 charValue_bytes.length, (byte) 0); 13617 } 13618 putPointer(backing, 0, charValue == null ? 0 : getByteBufferAddress(charValue_buf)); 13619 putPointer(backing, 4, charImage); 13620 putPointer(backing, 8, internalImage); 13621 backing.putInt(12, isReferenceChar); 13622 } 13623 13624 public int size() { 13625 return 16; 13626 } 13627 } 13628 13629 public static class ReadTextReport2 extends DisposedStruct { 13630 public String readString; // The read string. 13631 public CharReport2[] characterReport; // An array of reports describing the 13632 // properties of each identified 13633 // character. 13634 private ByteBuffer readString_buf; 13635 private ByteBuffer characterReport_buf; 13636 13637 private void init() { 13638 characterReport = new CharReport2[0]; 13639 } 13640 13641 public ReadTextReport2() { 13642 super(12); 13643 init(); 13644 } 13645 13646 public ReadTextReport2(String readString, CharReport2[] characterReport) { 13647 super(12); 13648 this.readString = readString; 13649 this.characterReport = characterReport; 13650 } 13651 13652 protected ReadTextReport2(ByteBuffer backing, int offset) { 13653 super(backing, offset, 12); 13654 init(); 13655 } 13656 13657 protected ReadTextReport2(long nativeObj, boolean owned) { 13658 super(nativeObj, owned, 12); 13659 init(); 13660 } 13661 13662 protected void setBuffer(ByteBuffer backing, int offset) { 13663 super.setBuffer(backing, offset, 12); 13664 } 13665 13666 public void read() { 13667 long readString_addr = getPointer(backing, 0); 13668 if (readString_addr == 0) 13669 readString = null; 13670 else { 13671 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 13672 while (bb.get() != 0) { 13673 } 13674 byte[] bytes = new byte[bb.position() - 1]; 13675 getBytes(bb, bytes, 0, bytes.length); 13676 try { 13677 readString = new String(bytes, "UTF-8"); 13678 } catch (UnsupportedEncodingException e) { 13679 readString = ""; 13680 } 13681 } 13682 13683 int characterReport_numCharacterReports = backing.getInt(8); 13684 long characterReport_addr = getPointer(backing, 4); 13685 characterReport = new CharReport2[characterReport_numCharacterReports]; 13686 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 13687 ByteBuffer bb = 13688 newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports * 56); 13689 for (int i = 0, off = 0; i < characterReport_numCharacterReports; i++, off += 56) { 13690 characterReport[i] = new CharReport2(bb, off); 13691 characterReport[i].read(); 13692 } 13693 } 13694 } 13695 13696 public void write() { 13697 if (readString != null) { 13698 byte[] readString_bytes; 13699 try { 13700 readString_bytes = readString.getBytes("UTF-8"); 13701 } catch (UnsupportedEncodingException e) { 13702 readString_bytes = new byte[0]; 13703 } 13704 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length + 1); 13705 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put( 13706 readString_bytes.length, (byte) 0); 13707 } 13708 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 13709 characterReport_buf = 13710 ByteBuffer.allocateDirect(characterReport.length * 56).order(ByteOrder.nativeOrder()); 13711 for (int i = 0, off = 0; i < characterReport.length; i++, off += 56) { 13712 characterReport[i].setBuffer(characterReport_buf, off); 13713 characterReport[i].write(); 13714 } 13715 backing.putInt(8, characterReport.length); 13716 putPointer(backing, 4, characterReport_buf); 13717 } 13718 13719 public int size() { 13720 return 12; 13721 } 13722 } 13723 13724 public static class EllipseFeature extends DisposedStruct { 13725 public PointFloat position; // The location of the center of the ellipse. 13726 public double rotation; // The orientation of the semi-major axis of the 13727 // ellipse with respect to the horizontal. 13728 public double minorRadius; // The length of the semi-minor axis of the 13729 // ellipse. 13730 public double majorRadius; // The length of the semi-major axis of the 13731 // ellipse. 13732 13733 private void init() { 13734 position = new PointFloat(backing, 0); 13735 } 13736 13737 public EllipseFeature() { 13738 super(32); 13739 init(); 13740 } 13741 13742 public EllipseFeature(PointFloat position, double rotation, double minorRadius, 13743 double majorRadius) { 13744 super(32); 13745 this.position = position; 13746 this.rotation = rotation; 13747 this.minorRadius = minorRadius; 13748 this.majorRadius = majorRadius; 13749 } 13750 13751 protected EllipseFeature(ByteBuffer backing, int offset) { 13752 super(backing, offset, 32); 13753 init(); 13754 } 13755 13756 protected EllipseFeature(long nativeObj, boolean owned) { 13757 super(nativeObj, owned, 32); 13758 init(); 13759 } 13760 13761 protected void setBuffer(ByteBuffer backing, int offset) { 13762 super.setBuffer(backing, offset, 32); 13763 } 13764 13765 public void read() { 13766 position.read(); 13767 rotation = backing.getDouble(8); 13768 minorRadius = backing.getDouble(16); 13769 majorRadius = backing.getDouble(24); 13770 } 13771 13772 public void write() { 13773 position.write(); 13774 backing.putDouble(8, rotation); 13775 backing.putDouble(16, minorRadius); 13776 backing.putDouble(24, majorRadius); 13777 } 13778 13779 public int size() { 13780 return 32; 13781 } 13782 } 13783 13784 public static class CircleFeature extends DisposedStruct { 13785 public PointFloat position; // The location of the center of the circle. 13786 public double radius; // The radius of the circle. 13787 13788 private void init() { 13789 position = new PointFloat(backing, 0); 13790 } 13791 13792 public CircleFeature() { 13793 super(16); 13794 init(); 13795 } 13796 13797 public CircleFeature(PointFloat position, double radius) { 13798 super(16); 13799 this.position = position; 13800 this.radius = radius; 13801 } 13802 13803 protected CircleFeature(ByteBuffer backing, int offset) { 13804 super(backing, offset, 16); 13805 init(); 13806 } 13807 13808 protected CircleFeature(long nativeObj, boolean owned) { 13809 super(nativeObj, owned, 16); 13810 init(); 13811 } 13812 13813 protected void setBuffer(ByteBuffer backing, int offset) { 13814 super.setBuffer(backing, offset, 16); 13815 } 13816 13817 public void read() { 13818 position.read(); 13819 radius = backing.getDouble(8); 13820 } 13821 13822 public void write() { 13823 position.write(); 13824 backing.putDouble(8, radius); 13825 } 13826 13827 public int size() { 13828 return 16; 13829 } 13830 } 13831 13832 public static class ConstCurveFeature extends DisposedStruct { 13833 public PointFloat position; // The center of the circle that this constant 13834 // curve lies upon. 13835 public double radius; // The radius of the circle that this constant curve 13836 // lies upon. 13837 public double startAngle; // When traveling along the constant curve from 13838 // one endpoint to the next in a counterclockwise 13839 // manner, this is the angular component of the 13840 // vector originating at the center of the 13841 // constant curve and pointing towards the first 13842 // endpoint of the constant curve. 13843 public double endAngle; // When traveling along the constant curve from one 13844 // endpoint to the next in a counterclockwise 13845 // manner, this is the angular component of the 13846 // vector originating at the center of the constant 13847 // curve and pointing towards the second endpoint of 13848 // the constant curve. 13849 13850 private void init() { 13851 position = new PointFloat(backing, 0); 13852 } 13853 13854 public ConstCurveFeature() { 13855 super(32); 13856 init(); 13857 } 13858 13859 public ConstCurveFeature(PointFloat position, double radius, double startAngle, double endAngle) { 13860 super(32); 13861 this.position = position; 13862 this.radius = radius; 13863 this.startAngle = startAngle; 13864 this.endAngle = endAngle; 13865 } 13866 13867 protected ConstCurveFeature(ByteBuffer backing, int offset) { 13868 super(backing, offset, 32); 13869 init(); 13870 } 13871 13872 protected ConstCurveFeature(long nativeObj, boolean owned) { 13873 super(nativeObj, owned, 32); 13874 init(); 13875 } 13876 13877 protected void setBuffer(ByteBuffer backing, int offset) { 13878 super.setBuffer(backing, offset, 32); 13879 } 13880 13881 public void read() { 13882 position.read(); 13883 radius = backing.getDouble(8); 13884 startAngle = backing.getDouble(16); 13885 endAngle = backing.getDouble(24); 13886 } 13887 13888 public void write() { 13889 position.write(); 13890 backing.putDouble(8, radius); 13891 backing.putDouble(16, startAngle); 13892 backing.putDouble(24, endAngle); 13893 } 13894 13895 public int size() { 13896 return 32; 13897 } 13898 } 13899 13900 public static class RectangleFeature extends DisposedStruct { 13901 public PointFloat position; // The center of the rectangle. 13902 public PointFloat[] corner; // The four corners of the rectangle. 13903 public double rotation; // The orientation of the rectangle with respect to 13904 // the horizontal. 13905 public double width; // The width of the rectangle. 13906 public double height; // The height of the rectangle. 13907 13908 private void init() { 13909 position = new PointFloat(backing, 0); 13910 corner = new PointFloat[4]; 13911 13912 for (int i = 0, off = 8; i < 4; i++, off += 8) 13913 corner[i] = new PointFloat(backing, off); 13914 } 13915 13916 public RectangleFeature() { 13917 super(64); 13918 init(); 13919 } 13920 13921 public RectangleFeature(PointFloat position, PointFloat[] corner, double rotation, 13922 double width, double height) { 13923 super(64); 13924 this.position = position; 13925 this.corner = corner; 13926 this.rotation = rotation; 13927 this.width = width; 13928 this.height = height; 13929 } 13930 13931 protected RectangleFeature(ByteBuffer backing, int offset) { 13932 super(backing, offset, 64); 13933 init(); 13934 } 13935 13936 protected RectangleFeature(long nativeObj, boolean owned) { 13937 super(nativeObj, owned, 64); 13938 init(); 13939 } 13940 13941 protected void setBuffer(ByteBuffer backing, int offset) { 13942 super.setBuffer(backing, offset, 64); 13943 } 13944 13945 public void read() { 13946 position.read(); 13947 for (PointFloat it : corner) { 13948 it.read(); 13949 } 13950 rotation = backing.getDouble(40); 13951 width = backing.getDouble(48); 13952 height = backing.getDouble(56); 13953 } 13954 13955 public void write() { 13956 position.write(); 13957 for (PointFloat it : corner) { 13958 it.write(); 13959 } 13960 backing.putDouble(40, rotation); 13961 backing.putDouble(48, width); 13962 backing.putDouble(56, height); 13963 } 13964 13965 public int size() { 13966 return 64; 13967 } 13968 } 13969 13970 public static class LegFeature extends DisposedStruct { 13971 public PointFloat position; // The location of the leg feature. 13972 public PointFloat[] corner; // The four corners of the leg feature. 13973 public double rotation; // The orientation of the leg with respect to the 13974 // horizontal. 13975 public double width; // The width of the leg. 13976 public double height; // The height of the leg. 13977 13978 private void init() { 13979 position = new PointFloat(backing, 0); 13980 corner = new PointFloat[4]; 13981 13982 for (int i = 0, off = 8; i < 4; i++, off += 8) 13983 corner[i] = new PointFloat(backing, off); 13984 } 13985 13986 public LegFeature() { 13987 super(64); 13988 init(); 13989 } 13990 13991 public LegFeature(PointFloat position, PointFloat[] corner, double rotation, double width, 13992 double height) { 13993 super(64); 13994 this.position = position; 13995 this.corner = corner; 13996 this.rotation = rotation; 13997 this.width = width; 13998 this.height = height; 13999 } 14000 14001 protected LegFeature(ByteBuffer backing, int offset) { 14002 super(backing, offset, 64); 14003 init(); 14004 } 14005 14006 protected LegFeature(long nativeObj, boolean owned) { 14007 super(nativeObj, owned, 64); 14008 init(); 14009 } 14010 14011 protected void setBuffer(ByteBuffer backing, int offset) { 14012 super.setBuffer(backing, offset, 64); 14013 } 14014 14015 public void read() { 14016 position.read(); 14017 for (PointFloat it : corner) { 14018 it.read(); 14019 } 14020 rotation = backing.getDouble(40); 14021 width = backing.getDouble(48); 14022 height = backing.getDouble(56); 14023 } 14024 14025 public void write() { 14026 position.write(); 14027 for (PointFloat it : corner) { 14028 it.write(); 14029 } 14030 backing.putDouble(40, rotation); 14031 backing.putDouble(48, width); 14032 backing.putDouble(56, height); 14033 } 14034 14035 public int size() { 14036 return 64; 14037 } 14038 } 14039 14040 public static class CornerFeature extends DisposedStruct { 14041 public PointFloat position; // The location of the corner feature. 14042 public double rotation; // The angular component of the vector bisecting the 14043 // corner from position. 14044 public double enclosedAngle; // The measure of the enclosed angle of the 14045 // corner. 14046 public int isVirtual; 14047 14048 private void init() { 14049 position = new PointFloat(backing, 0); 14050 } 14051 14052 public CornerFeature() { 14053 super(32); 14054 init(); 14055 } 14056 14057 public CornerFeature(PointFloat position, double rotation, double enclosedAngle, int isVirtual) { 14058 super(32); 14059 this.position = position; 14060 this.rotation = rotation; 14061 this.enclosedAngle = enclosedAngle; 14062 this.isVirtual = isVirtual; 14063 } 14064 14065 protected CornerFeature(ByteBuffer backing, int offset) { 14066 super(backing, offset, 32); 14067 init(); 14068 } 14069 14070 protected CornerFeature(long nativeObj, boolean owned) { 14071 super(nativeObj, owned, 32); 14072 init(); 14073 } 14074 14075 protected void setBuffer(ByteBuffer backing, int offset) { 14076 super.setBuffer(backing, offset, 32); 14077 } 14078 14079 public void read() { 14080 position.read(); 14081 rotation = backing.getDouble(8); 14082 enclosedAngle = backing.getDouble(16); 14083 isVirtual = backing.getInt(24); 14084 } 14085 14086 public void write() { 14087 position.write(); 14088 backing.putDouble(8, rotation); 14089 backing.putDouble(16, enclosedAngle); 14090 backing.putInt(24, isVirtual); 14091 } 14092 14093 public int size() { 14094 return 32; 14095 } 14096 } 14097 14098 public static class LineFeature extends DisposedStruct { 14099 public PointFloat startPoint; // The starting point of the line. 14100 public PointFloat endPoint; // The ending point of the line. 14101 public double length; // The length of the line measured in pixels from the 14102 // start point to the end point. 14103 public double rotation; // The orientation of the line with respect to the 14104 // horizontal. 14105 14106 private void init() { 14107 startPoint = new PointFloat(backing, 0); 14108 endPoint = new PointFloat(backing, 8); 14109 } 14110 14111 public LineFeature() { 14112 super(32); 14113 init(); 14114 } 14115 14116 public LineFeature(PointFloat startPoint, PointFloat endPoint, double length, double rotation) { 14117 super(32); 14118 this.startPoint = startPoint; 14119 this.endPoint = endPoint; 14120 this.length = length; 14121 this.rotation = rotation; 14122 } 14123 14124 protected LineFeature(ByteBuffer backing, int offset) { 14125 super(backing, offset, 32); 14126 init(); 14127 } 14128 14129 protected LineFeature(long nativeObj, boolean owned) { 14130 super(nativeObj, owned, 32); 14131 init(); 14132 } 14133 14134 protected void setBuffer(ByteBuffer backing, int offset) { 14135 super.setBuffer(backing, offset, 32); 14136 } 14137 14138 public void read() { 14139 startPoint.read(); 14140 endPoint.read(); 14141 length = backing.getDouble(16); 14142 rotation = backing.getDouble(24); 14143 } 14144 14145 public void write() { 14146 startPoint.write(); 14147 endPoint.write(); 14148 backing.putDouble(16, length); 14149 backing.putDouble(24, rotation); 14150 } 14151 14152 public int size() { 14153 return 32; 14154 } 14155 } 14156 14157 public static class ParallelLinePairFeature extends DisposedStruct { 14158 public PointFloat firstStartPoint; // The starting point of the first line 14159 // of the pair. 14160 public PointFloat firstEndPoint; // The ending point of the first line of 14161 // the pair. 14162 public PointFloat secondStartPoint; // The starting point of the second line 14163 // of the pair. 14164 public PointFloat secondEndPoint; // The ending point of the second line of 14165 // the pair. 14166 public double rotation; // The orientation of the feature with respect to 14167 // the horizontal. 14168 public double distance; // The distance from the first line to the second 14169 // line. 14170 14171 private void init() { 14172 firstStartPoint = new PointFloat(backing, 0); 14173 firstEndPoint = new PointFloat(backing, 8); 14174 secondStartPoint = new PointFloat(backing, 16); 14175 secondEndPoint = new PointFloat(backing, 24); 14176 } 14177 14178 public ParallelLinePairFeature() { 14179 super(48); 14180 init(); 14181 } 14182 14183 public ParallelLinePairFeature(PointFloat firstStartPoint, PointFloat firstEndPoint, 14184 PointFloat secondStartPoint, PointFloat secondEndPoint, double rotation, double distance) { 14185 super(48); 14186 this.firstStartPoint = firstStartPoint; 14187 this.firstEndPoint = firstEndPoint; 14188 this.secondStartPoint = secondStartPoint; 14189 this.secondEndPoint = secondEndPoint; 14190 this.rotation = rotation; 14191 this.distance = distance; 14192 } 14193 14194 protected ParallelLinePairFeature(ByteBuffer backing, int offset) { 14195 super(backing, offset, 48); 14196 init(); 14197 } 14198 14199 protected ParallelLinePairFeature(long nativeObj, boolean owned) { 14200 super(nativeObj, owned, 48); 14201 init(); 14202 } 14203 14204 protected void setBuffer(ByteBuffer backing, int offset) { 14205 super.setBuffer(backing, offset, 48); 14206 } 14207 14208 public void read() { 14209 firstStartPoint.read(); 14210 firstEndPoint.read(); 14211 secondStartPoint.read(); 14212 secondEndPoint.read(); 14213 rotation = backing.getDouble(32); 14214 distance = backing.getDouble(40); 14215 } 14216 14217 public void write() { 14218 firstStartPoint.write(); 14219 firstEndPoint.write(); 14220 secondStartPoint.write(); 14221 secondEndPoint.write(); 14222 backing.putDouble(32, rotation); 14223 backing.putDouble(40, distance); 14224 } 14225 14226 public int size() { 14227 return 48; 14228 } 14229 } 14230 14231 public static class PairOfParallelLinePairsFeature extends DisposedStruct { 14232 public ParallelLinePairFeature firstParallelLinePair; // The first parallel 14233 // line pair. 14234 public ParallelLinePairFeature secondParallelLinePair; // The second 14235 // parallel line 14236 // pair. 14237 public double rotation; // The orientation of the feature with respect to 14238 // the horizontal. 14239 public double distance; // The distance from the midline of the first 14240 // parallel line pair to the midline of the second 14241 // parallel line pair. 14242 14243 private void init() { 14244 firstParallelLinePair = new ParallelLinePairFeature(backing, 0); 14245 secondParallelLinePair = new ParallelLinePairFeature(backing, 48); 14246 } 14247 14248 public PairOfParallelLinePairsFeature() { 14249 super(112); 14250 init(); 14251 } 14252 14253 public PairOfParallelLinePairsFeature(ParallelLinePairFeature firstParallelLinePair, 14254 ParallelLinePairFeature secondParallelLinePair, double rotation, double distance) { 14255 super(112); 14256 this.firstParallelLinePair = firstParallelLinePair; 14257 this.secondParallelLinePair = secondParallelLinePair; 14258 this.rotation = rotation; 14259 this.distance = distance; 14260 } 14261 14262 protected PairOfParallelLinePairsFeature(ByteBuffer backing, int offset) { 14263 super(backing, offset, 112); 14264 init(); 14265 } 14266 14267 protected PairOfParallelLinePairsFeature(long nativeObj, boolean owned) { 14268 super(nativeObj, owned, 112); 14269 init(); 14270 } 14271 14272 protected void setBuffer(ByteBuffer backing, int offset) { 14273 super.setBuffer(backing, offset, 112); 14274 } 14275 14276 public void read() { 14277 firstParallelLinePair.read(); 14278 secondParallelLinePair.read(); 14279 rotation = backing.getDouble(96); 14280 distance = backing.getDouble(104); 14281 } 14282 14283 public void write() { 14284 firstParallelLinePair.write(); 14285 secondParallelLinePair.write(); 14286 backing.putDouble(96, rotation); 14287 backing.putDouble(104, distance); 14288 } 14289 14290 public int size() { 14291 return 112; 14292 } 14293 } 14294 14295 public static class FeatureData extends DisposedStruct { 14296 public FeatureType type; // An enumeration representing the type of the 14297 // feature. 14298 public PointFloat[] contourPoints; // A set of points describing the contour 14299 // of the feature. 14300 public CircleFeature circle; // A pointer to a CircleFeature. 14301 public EllipseFeature ellipse; // A pointer to an EllipseFeature. 14302 public ConstCurveFeature constCurve; // A pointer to a ConstCurveFeature. 14303 public RectangleFeature rectangle; // A pointer to a RectangleFeature. 14304 public LegFeature leg; // A pointer to a LegFeature. 14305 public CornerFeature corner; // A pointer to a CornerFeature. 14306 public ParallelLinePairFeature parallelLinePair; // A pointer to a 14307 // ParallelLinePairFeature. 14308 public PairOfParallelLinePairsFeature pairOfParallelLinePairs; // A pointer 14309 // to a 14310 // PairOfParallelLinePairsFeature. 14311 public LineFeature line; // A pointer to a LineFeature. 14312 public ClosedCurveFeature closedCurve; // A pointer to a ClosedCurveFeature. 14313 private ByteBuffer contourPoints_buf; 14314 14315 private void init() { 14316 contourPoints = new PointFloat[0]; 14317 } 14318 14319 public FeatureData() { 14320 super(16); 14321 init(); 14322 } 14323 14324 public FeatureData(FeatureType type, PointFloat[] contourPoints) { 14325 super(16); 14326 this.type = type; 14327 this.contourPoints = contourPoints; 14328 } 14329 14330 protected FeatureData(ByteBuffer backing, int offset) { 14331 super(backing, offset, 16); 14332 init(); 14333 } 14334 14335 protected FeatureData(long nativeObj, boolean owned) { 14336 super(nativeObj, owned, 16); 14337 init(); 14338 } 14339 14340 protected void setBuffer(ByteBuffer backing, int offset) { 14341 super.setBuffer(backing, offset, 16); 14342 } 14343 14344 public void read() { 14345 type = FeatureType.fromValue(backing.getInt(0)); 14346 int contourPoints_numContourPoints = backing.getInt(8); 14347 long contourPoints_addr = getPointer(backing, 4); 14348 contourPoints = new PointFloat[contourPoints_numContourPoints]; 14349 if (contourPoints_numContourPoints > 0 && contourPoints_addr != 0) { 14350 ByteBuffer bb = newDirectByteBuffer(contourPoints_addr, contourPoints_numContourPoints * 8); 14351 for (int i = 0, off = 0; i < contourPoints_numContourPoints; i++, off += 8) { 14352 contourPoints[i] = new PointFloat(bb, off); 14353 contourPoints[i].read(); 14354 } 14355 } 14356 if (type == FeatureType.CIRCLE_FEATURE) { 14357 long circle_addr = getPointer(backing, 12); 14358 if (circle_addr == 0) 14359 circle = null; 14360 else 14361 circle = new CircleFeature(circle_addr, false); 14362 } 14363 if (type == FeatureType.ELLIPSE_FEATURE) { 14364 long ellipse_addr = getPointer(backing, 12); 14365 if (ellipse_addr == 0) 14366 ellipse = null; 14367 else 14368 ellipse = new EllipseFeature(ellipse_addr, false); 14369 } 14370 if (type == FeatureType.CONST_CURVE_FEATURE) { 14371 long constCurve_addr = getPointer(backing, 12); 14372 if (constCurve_addr == 0) 14373 constCurve = null; 14374 else 14375 constCurve = new ConstCurveFeature(constCurve_addr, false); 14376 } 14377 if (type == FeatureType.RECTANGLE_FEATURE) { 14378 long rectangle_addr = getPointer(backing, 12); 14379 if (rectangle_addr == 0) 14380 rectangle = null; 14381 else 14382 rectangle = new RectangleFeature(rectangle_addr, false); 14383 } 14384 if (type == FeatureType.LEG_FEATURE) { 14385 long leg_addr = getPointer(backing, 12); 14386 if (leg_addr == 0) 14387 leg = null; 14388 else 14389 leg = new LegFeature(leg_addr, false); 14390 } 14391 if (type == FeatureType.CORNER_FEATURE) { 14392 long corner_addr = getPointer(backing, 12); 14393 if (corner_addr == 0) 14394 corner = null; 14395 else 14396 corner = new CornerFeature(corner_addr, false); 14397 } 14398 if (type == FeatureType.PARALLEL_LINE_PAIR_FEATURE) { 14399 long parallelLinePair_addr = getPointer(backing, 12); 14400 if (parallelLinePair_addr == 0) 14401 parallelLinePair = null; 14402 else 14403 parallelLinePair = new ParallelLinePairFeature(parallelLinePair_addr, false); 14404 } 14405 if (type == FeatureType.PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE) { 14406 long pairOfParallelLinePairs_addr = getPointer(backing, 12); 14407 if (pairOfParallelLinePairs_addr == 0) 14408 pairOfParallelLinePairs = null; 14409 else 14410 pairOfParallelLinePairs = 14411 new PairOfParallelLinePairsFeature(pairOfParallelLinePairs_addr, false); 14412 } 14413 if (type == FeatureType.LINE_FEATURE) { 14414 long line_addr = getPointer(backing, 12); 14415 if (line_addr == 0) 14416 line = null; 14417 else 14418 line = new LineFeature(line_addr, false); 14419 } 14420 if (type == FeatureType.CLOSED_CURVE_FEATURE) { 14421 long closedCurve_addr = getPointer(backing, 12); 14422 if (closedCurve_addr == 0) 14423 closedCurve = null; 14424 else 14425 closedCurve = new ClosedCurveFeature(closedCurve_addr, false); 14426 } 14427 } 14428 14429 public void write() { 14430 if (type != null) 14431 backing.putInt(0, type.getValue()); 14432 contourPoints_buf = 14433 ByteBuffer.allocateDirect(contourPoints.length * 8).order(ByteOrder.nativeOrder()); 14434 for (int i = 0, off = 0; i < contourPoints.length; i++, off += 8) { 14435 contourPoints[i].setBuffer(contourPoints_buf, off); 14436 contourPoints[i].write(); 14437 } 14438 backing.putInt(8, contourPoints.length); 14439 putPointer(backing, 4, contourPoints_buf); 14440 if (type == FeatureType.CIRCLE_FEATURE) { 14441 putPointer(backing, 12, circle); 14442 } 14443 if (type == FeatureType.ELLIPSE_FEATURE) { 14444 putPointer(backing, 12, ellipse); 14445 } 14446 if (type == FeatureType.CONST_CURVE_FEATURE) { 14447 putPointer(backing, 12, constCurve); 14448 } 14449 if (type == FeatureType.RECTANGLE_FEATURE) { 14450 putPointer(backing, 12, rectangle); 14451 } 14452 if (type == FeatureType.LEG_FEATURE) { 14453 putPointer(backing, 12, leg); 14454 } 14455 if (type == FeatureType.CORNER_FEATURE) { 14456 putPointer(backing, 12, corner); 14457 } 14458 if (type == FeatureType.PARALLEL_LINE_PAIR_FEATURE) { 14459 putPointer(backing, 12, parallelLinePair); 14460 } 14461 if (type == FeatureType.PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE) { 14462 putPointer(backing, 12, pairOfParallelLinePairs); 14463 } 14464 if (type == FeatureType.LINE_FEATURE) { 14465 putPointer(backing, 12, line); 14466 } 14467 if (type == FeatureType.CLOSED_CURVE_FEATURE) { 14468 putPointer(backing, 12, closedCurve); 14469 } 14470 } 14471 14472 public int size() { 14473 return 16; 14474 } 14475 } 14476 14477 public static class GeometricPatternMatch2 extends DisposedStruct { 14478 public PointFloat position; // The location of the origin of the template in 14479 // the match. 14480 public float rotation; // The rotation of the match relative to the template 14481 // image, in degrees. 14482 public float scale; // The size of the match relative to the size of the 14483 // template image, expressed as a percentage. 14484 public float score; // The accuracy of the match. 14485 public PointFloat[] corner; // An array of four points describing the 14486 // rectangle surrounding the template image. 14487 public int inverse; // This element is TRUE if the match is an inverse of 14488 // the template image. 14489 public float occlusion; // The percentage of the match that is occluded. 14490 public float templateMatchCurveScore; // The accuracy of the match obtained 14491 // by comparing the template curves to 14492 // the curves in the match region. 14493 public float matchTemplateCurveScore; // The accuracy of the match obtained 14494 // by comparing the curves in the 14495 // match region to the template 14496 // curves. 14497 public float correlationScore; // The accuracy of the match obtained by 14498 // comparing the template image to the match 14499 // region using a correlation metric that 14500 // compares the two regions as a function of 14501 // their pixel values. 14502 public String label; // The label corresponding to this match when the match 14503 // is returned by imaqMatchMultipleGeometricPatterns(). 14504 public FeatureData[] featureData; // The features used in this match. 14505 public PointFloat calibratedPosition; // The location of the origin of the 14506 // template in the match. 14507 public float calibratedRotation; // The rotation of the match relative to 14508 // the template image, in degrees. 14509 public PointFloat[] calibratedCorner; // An array of four points describing 14510 // the rectangle surrounding the 14511 // template image. 14512 private ByteBuffer featureData_buf; 14513 14514 private void init() { 14515 position = new PointFloat(backing, 0); 14516 corner = new PointFloat[4]; 14517 14518 for (int i = 0, off = 20; i < 4; i++, off += 8) 14519 corner[i] = new PointFloat(backing, off); 14520 featureData = new FeatureData[0]; 14521 calibratedPosition = new PointFloat(backing, 336); 14522 calibratedCorner = new PointFloat[4]; 14523 14524 for (int i = 0, off = 348; i < 4; i++, off += 8) 14525 calibratedCorner[i] = new PointFloat(backing, off); 14526 } 14527 14528 public GeometricPatternMatch2() { 14529 super(380); 14530 init(); 14531 } 14532 14533 public GeometricPatternMatch2(PointFloat position, double rotation, double scale, double score, 14534 PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, 14535 double matchTemplateCurveScore, double correlationScore, String label, 14536 FeatureData[] featureData, PointFloat calibratedPosition, double calibratedRotation, 14537 PointFloat[] calibratedCorner) { 14538 super(380); 14539 this.position = position; 14540 this.rotation = (float) rotation; 14541 this.scale = (float) scale; 14542 this.score = (float) score; 14543 this.corner = corner; 14544 this.inverse = inverse; 14545 this.occlusion = (float) occlusion; 14546 this.templateMatchCurveScore = (float) templateMatchCurveScore; 14547 this.matchTemplateCurveScore = (float) matchTemplateCurveScore; 14548 this.correlationScore = (float) correlationScore; 14549 this.label = label; 14550 this.featureData = featureData; 14551 this.calibratedPosition = calibratedPosition; 14552 this.calibratedRotation = (float) calibratedRotation; 14553 this.calibratedCorner = calibratedCorner; 14554 } 14555 14556 protected GeometricPatternMatch2(ByteBuffer backing, int offset) { 14557 super(backing, offset, 380); 14558 init(); 14559 } 14560 14561 protected GeometricPatternMatch2(long nativeObj, boolean owned) { 14562 super(nativeObj, owned, 380); 14563 init(); 14564 } 14565 14566 protected void setBuffer(ByteBuffer backing, int offset) { 14567 super.setBuffer(backing, offset, 380); 14568 } 14569 14570 public void read() { 14571 position.read(); 14572 rotation = backing.getFloat(8); 14573 scale = backing.getFloat(12); 14574 score = backing.getFloat(16); 14575 for (PointFloat it : corner) { 14576 it.read(); 14577 } 14578 inverse = backing.getInt(52); 14579 occlusion = backing.getFloat(56); 14580 templateMatchCurveScore = backing.getFloat(60); 14581 matchTemplateCurveScore = backing.getFloat(64); 14582 correlationScore = backing.getFloat(68); 14583 { 14584 byte[] bytes = new byte[256]; 14585 getBytes(backing, bytes, 72, 256); 14586 int len; 14587 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 14588 } 14589 try { 14590 label = new String(bytes, 0, len, "UTF-8"); 14591 } catch (UnsupportedEncodingException e) { 14592 label = ""; 14593 } 14594 } 14595 int featureData_numFeatureData = backing.getInt(332); 14596 long featureData_addr = getPointer(backing, 328); 14597 featureData = new FeatureData[featureData_numFeatureData]; 14598 if (featureData_numFeatureData > 0 && featureData_addr != 0) { 14599 ByteBuffer bb = newDirectByteBuffer(featureData_addr, featureData_numFeatureData * 16); 14600 for (int i = 0, off = 0; i < featureData_numFeatureData; i++, off += 16) { 14601 featureData[i] = new FeatureData(bb, off); 14602 featureData[i].read(); 14603 } 14604 } 14605 calibratedPosition.read(); 14606 calibratedRotation = backing.getFloat(344); 14607 for (PointFloat it : calibratedCorner) { 14608 it.read(); 14609 } 14610 } 14611 14612 public void write() { 14613 position.write(); 14614 backing.putFloat(8, rotation); 14615 backing.putFloat(12, scale); 14616 backing.putFloat(16, score); 14617 for (PointFloat it : corner) { 14618 it.write(); 14619 } 14620 backing.putInt(52, inverse); 14621 backing.putFloat(56, occlusion); 14622 backing.putFloat(60, templateMatchCurveScore); 14623 backing.putFloat(64, matchTemplateCurveScore); 14624 backing.putFloat(68, correlationScore); 14625 if (label != null) { 14626 byte[] bytes; 14627 try { 14628 bytes = label.getBytes("UTF-8"); 14629 } catch (UnsupportedEncodingException e) { 14630 bytes = new byte[0]; 14631 } 14632 putBytes(backing, bytes, 72, bytes.length); 14633 for (int i = bytes.length; i < 256; i++) 14634 backing.put(i, (byte) 0); // fill with zero 14635 } 14636 featureData_buf = 14637 ByteBuffer.allocateDirect(featureData.length * 16).order(ByteOrder.nativeOrder()); 14638 for (int i = 0, off = 0; i < featureData.length; i++, off += 16) { 14639 featureData[i].setBuffer(featureData_buf, off); 14640 featureData[i].write(); 14641 } 14642 backing.putInt(332, featureData.length); 14643 putPointer(backing, 328, featureData_buf); 14644 calibratedPosition.write(); 14645 backing.putFloat(344, calibratedRotation); 14646 for (PointFloat it : calibratedCorner) { 14647 it.write(); 14648 } 14649 } 14650 14651 public int size() { 14652 return 380; 14653 } 14654 } 14655 14656 public static class ClosedCurveFeature extends DisposedStruct { 14657 public PointFloat position; // The center of the closed curve feature. 14658 public double arcLength; // The arc length of the closed curve feature. 14659 14660 private void init() { 14661 position = new PointFloat(backing, 0); 14662 } 14663 14664 public ClosedCurveFeature() { 14665 super(16); 14666 init(); 14667 } 14668 14669 public ClosedCurveFeature(PointFloat position, double arcLength) { 14670 super(16); 14671 this.position = position; 14672 this.arcLength = arcLength; 14673 } 14674 14675 protected ClosedCurveFeature(ByteBuffer backing, int offset) { 14676 super(backing, offset, 16); 14677 init(); 14678 } 14679 14680 protected ClosedCurveFeature(long nativeObj, boolean owned) { 14681 super(nativeObj, owned, 16); 14682 init(); 14683 } 14684 14685 protected void setBuffer(ByteBuffer backing, int offset) { 14686 super.setBuffer(backing, offset, 16); 14687 } 14688 14689 public void read() { 14690 position.read(); 14691 arcLength = backing.getDouble(8); 14692 } 14693 14694 public void write() { 14695 position.write(); 14696 backing.putDouble(8, arcLength); 14697 } 14698 14699 public int size() { 14700 return 16; 14701 } 14702 } 14703 14704 public static class LineMatch extends DisposedStruct { 14705 public PointFloat startPoint; // The starting point of the matched line. 14706 public PointFloat endPoint; // The ending point of the matched line. 14707 public double length; // The length of the line measured in pixels from the 14708 // start point to the end point. 14709 public double rotation; // The orientation of the matched line. 14710 public double score; // The score of the matched line. 14711 14712 private void init() { 14713 startPoint = new PointFloat(backing, 0); 14714 endPoint = new PointFloat(backing, 8); 14715 } 14716 14717 public LineMatch() { 14718 super(40); 14719 init(); 14720 } 14721 14722 public LineMatch(PointFloat startPoint, PointFloat endPoint, double length, double rotation, 14723 double score) { 14724 super(40); 14725 this.startPoint = startPoint; 14726 this.endPoint = endPoint; 14727 this.length = length; 14728 this.rotation = rotation; 14729 this.score = score; 14730 } 14731 14732 protected LineMatch(ByteBuffer backing, int offset) { 14733 super(backing, offset, 40); 14734 init(); 14735 } 14736 14737 protected LineMatch(long nativeObj, boolean owned) { 14738 super(nativeObj, owned, 40); 14739 init(); 14740 } 14741 14742 protected void setBuffer(ByteBuffer backing, int offset) { 14743 super.setBuffer(backing, offset, 40); 14744 } 14745 14746 public void read() { 14747 startPoint.read(); 14748 endPoint.read(); 14749 length = backing.getDouble(16); 14750 rotation = backing.getDouble(24); 14751 score = backing.getDouble(32); 14752 } 14753 14754 public void write() { 14755 startPoint.write(); 14756 endPoint.write(); 14757 backing.putDouble(16, length); 14758 backing.putDouble(24, rotation); 14759 backing.putDouble(32, score); 14760 } 14761 14762 public int size() { 14763 return 40; 14764 } 14765 } 14766 14767 public static class LineDescriptor extends DisposedStruct { 14768 public double minLength; // Specifies the minimum length of a line the 14769 // function will return. 14770 public double maxLength; // Specifies the maximum length of a line the 14771 // function will return. 14772 14773 private void init() { 14774 14775 } 14776 14777 public LineDescriptor() { 14778 super(16); 14779 init(); 14780 } 14781 14782 public LineDescriptor(double minLength, double maxLength) { 14783 super(16); 14784 this.minLength = minLength; 14785 this.maxLength = maxLength; 14786 } 14787 14788 protected LineDescriptor(ByteBuffer backing, int offset) { 14789 super(backing, offset, 16); 14790 init(); 14791 } 14792 14793 protected LineDescriptor(long nativeObj, boolean owned) { 14794 super(nativeObj, owned, 16); 14795 init(); 14796 } 14797 14798 protected void setBuffer(ByteBuffer backing, int offset) { 14799 super.setBuffer(backing, offset, 16); 14800 } 14801 14802 public void read() { 14803 minLength = backing.getDouble(0); 14804 maxLength = backing.getDouble(8); 14805 } 14806 14807 public void write() { 14808 backing.putDouble(0, minLength); 14809 backing.putDouble(8, maxLength); 14810 } 14811 14812 public int size() { 14813 return 16; 14814 } 14815 } 14816 14817 public static class RectangleDescriptor extends DisposedStruct { 14818 public double minWidth; // Specifies the minimum width of a rectangle the 14819 // algorithm will return. 14820 public double maxWidth; // Specifies the maximum width of a rectangle the 14821 // algorithm will return. 14822 public double minHeight; // Specifies the minimum height of a rectangle the 14823 // algorithm will return. 14824 public double maxHeight; // Specifies the maximum height of a rectangle the 14825 // algorithm will return. 14826 14827 private void init() { 14828 14829 } 14830 14831 public RectangleDescriptor() { 14832 super(32); 14833 init(); 14834 } 14835 14836 public RectangleDescriptor(double minWidth, double maxWidth, double minHeight, double maxHeight) { 14837 super(32); 14838 this.minWidth = minWidth; 14839 this.maxWidth = maxWidth; 14840 this.minHeight = minHeight; 14841 this.maxHeight = maxHeight; 14842 } 14843 14844 protected RectangleDescriptor(ByteBuffer backing, int offset) { 14845 super(backing, offset, 32); 14846 init(); 14847 } 14848 14849 protected RectangleDescriptor(long nativeObj, boolean owned) { 14850 super(nativeObj, owned, 32); 14851 init(); 14852 } 14853 14854 protected void setBuffer(ByteBuffer backing, int offset) { 14855 super.setBuffer(backing, offset, 32); 14856 } 14857 14858 public void read() { 14859 minWidth = backing.getDouble(0); 14860 maxWidth = backing.getDouble(8); 14861 minHeight = backing.getDouble(16); 14862 maxHeight = backing.getDouble(24); 14863 } 14864 14865 public void write() { 14866 backing.putDouble(0, minWidth); 14867 backing.putDouble(8, maxWidth); 14868 backing.putDouble(16, minHeight); 14869 backing.putDouble(24, maxHeight); 14870 } 14871 14872 public int size() { 14873 return 32; 14874 } 14875 } 14876 14877 public static class RectangleMatch extends DisposedStruct { 14878 public PointFloat[] corner; // The corners of the matched rectangle. 14879 public double rotation; // The orientation of the matched rectangle. 14880 public double width; // The width of the matched rectangle. 14881 public double height; // The height of the matched rectangle. 14882 public double score; // The score of the matched rectangle. 14883 14884 private void init() { 14885 corner = new PointFloat[4]; 14886 14887 for (int i = 0, off = 0; i < 4; i++, off += 8) 14888 corner[i] = new PointFloat(backing, off); 14889 } 14890 14891 public RectangleMatch() { 14892 super(64); 14893 init(); 14894 } 14895 14896 public RectangleMatch(PointFloat[] corner, double rotation, double width, double height, 14897 double score) { 14898 super(64); 14899 this.corner = corner; 14900 this.rotation = rotation; 14901 this.width = width; 14902 this.height = height; 14903 this.score = score; 14904 } 14905 14906 protected RectangleMatch(ByteBuffer backing, int offset) { 14907 super(backing, offset, 64); 14908 init(); 14909 } 14910 14911 protected RectangleMatch(long nativeObj, boolean owned) { 14912 super(nativeObj, owned, 64); 14913 init(); 14914 } 14915 14916 protected void setBuffer(ByteBuffer backing, int offset) { 14917 super.setBuffer(backing, offset, 64); 14918 } 14919 14920 public void read() { 14921 for (PointFloat it : corner) { 14922 it.read(); 14923 } 14924 rotation = backing.getDouble(32); 14925 width = backing.getDouble(40); 14926 height = backing.getDouble(48); 14927 score = backing.getDouble(56); 14928 } 14929 14930 public void write() { 14931 for (PointFloat it : corner) { 14932 it.write(); 14933 } 14934 backing.putDouble(32, rotation); 14935 backing.putDouble(40, width); 14936 backing.putDouble(48, height); 14937 backing.putDouble(56, score); 14938 } 14939 14940 public int size() { 14941 return 64; 14942 } 14943 } 14944 14945 public static class EllipseDescriptor extends DisposedStruct { 14946 public double minMajorRadius; // Specifies the minimum length of the 14947 // semi-major axis of an ellipse the function 14948 // will return. 14949 public double maxMajorRadius; // Specifies the maximum length of the 14950 // semi-major axis of an ellipse the function 14951 // will return. 14952 public double minMinorRadius; // Specifies the minimum length of the 14953 // semi-minor axis of an ellipse the function 14954 // will return. 14955 public double maxMinorRadius; // Specifies the maximum length of the 14956 // semi-minor axis of an ellipse the function 14957 // will return. 14958 14959 private void init() { 14960 14961 } 14962 14963 public EllipseDescriptor() { 14964 super(32); 14965 init(); 14966 } 14967 14968 public EllipseDescriptor(double minMajorRadius, double maxMajorRadius, double minMinorRadius, 14969 double maxMinorRadius) { 14970 super(32); 14971 this.minMajorRadius = minMajorRadius; 14972 this.maxMajorRadius = maxMajorRadius; 14973 this.minMinorRadius = minMinorRadius; 14974 this.maxMinorRadius = maxMinorRadius; 14975 } 14976 14977 protected EllipseDescriptor(ByteBuffer backing, int offset) { 14978 super(backing, offset, 32); 14979 init(); 14980 } 14981 14982 protected EllipseDescriptor(long nativeObj, boolean owned) { 14983 super(nativeObj, owned, 32); 14984 init(); 14985 } 14986 14987 protected void setBuffer(ByteBuffer backing, int offset) { 14988 super.setBuffer(backing, offset, 32); 14989 } 14990 14991 public void read() { 14992 minMajorRadius = backing.getDouble(0); 14993 maxMajorRadius = backing.getDouble(8); 14994 minMinorRadius = backing.getDouble(16); 14995 maxMinorRadius = backing.getDouble(24); 14996 } 14997 14998 public void write() { 14999 backing.putDouble(0, minMajorRadius); 15000 backing.putDouble(8, maxMajorRadius); 15001 backing.putDouble(16, minMinorRadius); 15002 backing.putDouble(24, maxMinorRadius); 15003 } 15004 15005 public int size() { 15006 return 32; 15007 } 15008 } 15009 15010 public static class EllipseMatch extends DisposedStruct { 15011 public PointFloat position; // The location of the center of the matched 15012 // ellipse. 15013 public double rotation; // The orientation of the matched ellipse. 15014 public double majorRadius; // The length of the semi-major axis of the 15015 // matched ellipse. 15016 public double minorRadius; // The length of the semi-minor axis of the 15017 // matched ellipse. 15018 public double score; // The score of the matched ellipse. 15019 15020 private void init() { 15021 position = new PointFloat(backing, 0); 15022 } 15023 15024 public EllipseMatch() { 15025 super(40); 15026 init(); 15027 } 15028 15029 public EllipseMatch(PointFloat position, double rotation, double majorRadius, 15030 double minorRadius, double score) { 15031 super(40); 15032 this.position = position; 15033 this.rotation = rotation; 15034 this.majorRadius = majorRadius; 15035 this.minorRadius = minorRadius; 15036 this.score = score; 15037 } 15038 15039 protected EllipseMatch(ByteBuffer backing, int offset) { 15040 super(backing, offset, 40); 15041 init(); 15042 } 15043 15044 protected EllipseMatch(long nativeObj, boolean owned) { 15045 super(nativeObj, owned, 40); 15046 init(); 15047 } 15048 15049 protected void setBuffer(ByteBuffer backing, int offset) { 15050 super.setBuffer(backing, offset, 40); 15051 } 15052 15053 public void read() { 15054 position.read(); 15055 rotation = backing.getDouble(8); 15056 majorRadius = backing.getDouble(16); 15057 minorRadius = backing.getDouble(24); 15058 score = backing.getDouble(32); 15059 } 15060 15061 public void write() { 15062 position.write(); 15063 backing.putDouble(8, rotation); 15064 backing.putDouble(16, majorRadius); 15065 backing.putDouble(24, minorRadius); 15066 backing.putDouble(32, score); 15067 } 15068 15069 public int size() { 15070 return 40; 15071 } 15072 } 15073 15074 public static class CircleMatch extends DisposedStruct { 15075 public PointFloat position; // The location of the center of the matched 15076 // circle. 15077 public double radius; // The radius of the matched circle. 15078 public double score; // The score of the matched circle. 15079 15080 private void init() { 15081 position = new PointFloat(backing, 0); 15082 } 15083 15084 public CircleMatch() { 15085 super(24); 15086 init(); 15087 } 15088 15089 public CircleMatch(PointFloat position, double radius, double score) { 15090 super(24); 15091 this.position = position; 15092 this.radius = radius; 15093 this.score = score; 15094 } 15095 15096 protected CircleMatch(ByteBuffer backing, int offset) { 15097 super(backing, offset, 24); 15098 init(); 15099 } 15100 15101 protected CircleMatch(long nativeObj, boolean owned) { 15102 super(nativeObj, owned, 24); 15103 init(); 15104 } 15105 15106 protected void setBuffer(ByteBuffer backing, int offset) { 15107 super.setBuffer(backing, offset, 24); 15108 } 15109 15110 public void read() { 15111 position.read(); 15112 radius = backing.getDouble(8); 15113 score = backing.getDouble(16); 15114 } 15115 15116 public void write() { 15117 position.write(); 15118 backing.putDouble(8, radius); 15119 backing.putDouble(16, score); 15120 } 15121 15122 public int size() { 15123 return 24; 15124 } 15125 } 15126 15127 public static class CircleDescriptor extends DisposedStruct { 15128 public double minRadius; // Specifies the minimum radius of a circle the 15129 // function will return. 15130 public double maxRadius; // Specifies the maximum radius of a circle the 15131 // function will return. 15132 15133 private void init() { 15134 15135 } 15136 15137 public CircleDescriptor() { 15138 super(16); 15139 init(); 15140 } 15141 15142 public CircleDescriptor(double minRadius, double maxRadius) { 15143 super(16); 15144 this.minRadius = minRadius; 15145 this.maxRadius = maxRadius; 15146 } 15147 15148 protected CircleDescriptor(ByteBuffer backing, int offset) { 15149 super(backing, offset, 16); 15150 init(); 15151 } 15152 15153 protected CircleDescriptor(long nativeObj, boolean owned) { 15154 super(nativeObj, owned, 16); 15155 init(); 15156 } 15157 15158 protected void setBuffer(ByteBuffer backing, int offset) { 15159 super.setBuffer(backing, offset, 16); 15160 } 15161 15162 public void read() { 15163 minRadius = backing.getDouble(0); 15164 maxRadius = backing.getDouble(8); 15165 } 15166 15167 public void write() { 15168 backing.putDouble(0, minRadius); 15169 backing.putDouble(8, maxRadius); 15170 } 15171 15172 public int size() { 15173 return 16; 15174 } 15175 } 15176 15177 public static class ShapeDetectionOptions extends DisposedStruct { 15178 public int mode; // Specifies the method used when looking for the shape in 15179 // the image. 15180 public RangeFloat[] angleRanges; // An array of angle ranges, in degrees, 15181 // where each range specifies how much you 15182 // expect the shape to be rotated in the 15183 // image. 15184 public RangeFloat scaleRange; // A range that specifies the sizes of the 15185 // shapes you expect to be in the image, 15186 // expressed as a ratio percentage 15187 // representing the size of the pattern in the 15188 // image divided by size of the original 15189 // pattern multiplied by 100. 15190 public double minMatchScore; 15191 private ByteBuffer angleRanges_buf; 15192 15193 private void init() { 15194 angleRanges = new RangeFloat[0]; 15195 scaleRange = new RangeFloat(backing, 12); 15196 } 15197 15198 public ShapeDetectionOptions() { 15199 super(32); 15200 init(); 15201 } 15202 15203 public ShapeDetectionOptions(int mode, RangeFloat[] angleRanges, RangeFloat scaleRange, 15204 double minMatchScore) { 15205 super(32); 15206 this.mode = mode; 15207 this.angleRanges = angleRanges; 15208 this.scaleRange = scaleRange; 15209 this.minMatchScore = minMatchScore; 15210 } 15211 15212 protected ShapeDetectionOptions(ByteBuffer backing, int offset) { 15213 super(backing, offset, 32); 15214 init(); 15215 } 15216 15217 protected ShapeDetectionOptions(long nativeObj, boolean owned) { 15218 super(nativeObj, owned, 32); 15219 init(); 15220 } 15221 15222 protected void setBuffer(ByteBuffer backing, int offset) { 15223 super.setBuffer(backing, offset, 32); 15224 } 15225 15226 public void read() { 15227 mode = backing.getInt(0); 15228 int angleRanges_numAngleRanges = backing.getInt(8); 15229 long angleRanges_addr = getPointer(backing, 4); 15230 angleRanges = new RangeFloat[angleRanges_numAngleRanges]; 15231 if (angleRanges_numAngleRanges > 0 && angleRanges_addr != 0) { 15232 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numAngleRanges * 8); 15233 for (int i = 0, off = 0; i < angleRanges_numAngleRanges; i++, off += 8) { 15234 angleRanges[i] = new RangeFloat(bb, off); 15235 angleRanges[i].read(); 15236 } 15237 } 15238 scaleRange.read(); 15239 minMatchScore = backing.getDouble(24); 15240 } 15241 15242 public void write() { 15243 backing.putInt(0, mode); 15244 angleRanges_buf = 15245 ByteBuffer.allocateDirect(angleRanges.length * 8).order(ByteOrder.nativeOrder()); 15246 for (int i = 0, off = 0; i < angleRanges.length; i++, off += 8) { 15247 angleRanges[i].setBuffer(angleRanges_buf, off); 15248 angleRanges[i].write(); 15249 } 15250 backing.putInt(8, angleRanges.length); 15251 putPointer(backing, 4, angleRanges_buf); 15252 scaleRange.write(); 15253 backing.putDouble(24, minMatchScore); 15254 } 15255 15256 public int size() { 15257 return 32; 15258 } 15259 } 15260 15261 public static class Curve extends DisposedStruct { 15262 public PointFloat[] points; // The points on the curve. 15263 public int closed; // This element is TRUE if the curve is closed and FALSE 15264 // if the curve is open. 15265 public double curveLength; // The length of the curve. 15266 public double minEdgeStrength; // The lowest edge strength detected on the 15267 // curve. 15268 public double maxEdgeStrength; // The highest edge strength detected on the 15269 // curve. 15270 public double averageEdgeStrength; // The average of all edge strengths 15271 // detected on the curve. 15272 private ByteBuffer points_buf; 15273 15274 private void init() { 15275 points = new PointFloat[0]; 15276 } 15277 15278 public Curve() { 15279 super(48); 15280 init(); 15281 } 15282 15283 public Curve(PointFloat[] points, int closed, double curveLength, double minEdgeStrength, 15284 double maxEdgeStrength, double averageEdgeStrength) { 15285 super(48); 15286 this.points = points; 15287 this.closed = closed; 15288 this.curveLength = curveLength; 15289 this.minEdgeStrength = minEdgeStrength; 15290 this.maxEdgeStrength = maxEdgeStrength; 15291 this.averageEdgeStrength = averageEdgeStrength; 15292 } 15293 15294 protected Curve(ByteBuffer backing, int offset) { 15295 super(backing, offset, 48); 15296 init(); 15297 } 15298 15299 protected Curve(long nativeObj, boolean owned) { 15300 super(nativeObj, owned, 48); 15301 init(); 15302 } 15303 15304 protected void setBuffer(ByteBuffer backing, int offset) { 15305 super.setBuffer(backing, offset, 48); 15306 } 15307 15308 public void read() { 15309 int points_numPoints = backing.getInt(4); 15310 long points_addr = getPointer(backing, 0); 15311 points = new PointFloat[points_numPoints]; 15312 if (points_numPoints > 0 && points_addr != 0) { 15313 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints * 8); 15314 for (int i = 0, off = 0; i < points_numPoints; i++, off += 8) { 15315 points[i] = new PointFloat(bb, off); 15316 points[i].read(); 15317 } 15318 } 15319 closed = backing.getInt(8); 15320 curveLength = backing.getDouble(16); 15321 minEdgeStrength = backing.getDouble(24); 15322 maxEdgeStrength = backing.getDouble(32); 15323 averageEdgeStrength = backing.getDouble(40); 15324 } 15325 15326 public void write() { 15327 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 15328 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 15329 points[i].setBuffer(points_buf, off); 15330 points[i].write(); 15331 } 15332 backing.putInt(4, points.length); 15333 putPointer(backing, 0, points_buf); 15334 backing.putInt(8, closed); 15335 backing.putDouble(16, curveLength); 15336 backing.putDouble(24, minEdgeStrength); 15337 backing.putDouble(32, maxEdgeStrength); 15338 backing.putDouble(40, averageEdgeStrength); 15339 } 15340 15341 public int size() { 15342 return 48; 15343 } 15344 } 15345 15346 public static class CurveOptions extends DisposedStruct { 15347 public ExtractionMode extractionMode; // Specifies the method the function 15348 // uses to identify curves in the 15349 // image. 15350 public int threshold; // Specifies the minimum contrast a seed point must 15351 // have in order to begin a curve. 15352 public EdgeFilterSize filterSize; // Specifies the width of the edge filter 15353 // the function uses to identify curves in 15354 // the image. 15355 public int minLength; // Specifies the length, in pixels, of the smallest 15356 // curve the function will extract. 15357 public int rowStepSize; // Specifies the distance, in the y direction, 15358 // between lines the function inspects for curve 15359 // seed points. 15360 public int columnStepSize; // Specifies the distance, in the x direction, 15361 // between columns the function inspects for 15362 // curve seed points. 15363 public int maxEndPointGap; // Specifies the maximum gap, in pixels, between 15364 // the endpoints of a curve that the function 15365 // identifies as a closed curve. 15366 public int onlyClosed; // Set this element to TRUE to specify that the 15367 // function should only identify closed curves in the 15368 // image. 15369 public int subpixelAccuracy; // Set this element to TRUE to specify that the 15370 // function identifies the location of curves 15371 // with subpixel accuracy by interpolating 15372 // between points to find the crossing of 15373 // threshold. 15374 15375 private void init() { 15376 15377 } 15378 15379 public CurveOptions() { 15380 super(36); 15381 init(); 15382 } 15383 15384 public CurveOptions(ExtractionMode extractionMode, int threshold, EdgeFilterSize filterSize, 15385 int minLength, int rowStepSize, int columnStepSize, int maxEndPointGap, int onlyClosed, 15386 int subpixelAccuracy) { 15387 super(36); 15388 this.extractionMode = extractionMode; 15389 this.threshold = threshold; 15390 this.filterSize = filterSize; 15391 this.minLength = minLength; 15392 this.rowStepSize = rowStepSize; 15393 this.columnStepSize = columnStepSize; 15394 this.maxEndPointGap = maxEndPointGap; 15395 this.onlyClosed = onlyClosed; 15396 this.subpixelAccuracy = subpixelAccuracy; 15397 } 15398 15399 protected CurveOptions(ByteBuffer backing, int offset) { 15400 super(backing, offset, 36); 15401 init(); 15402 } 15403 15404 protected CurveOptions(long nativeObj, boolean owned) { 15405 super(nativeObj, owned, 36); 15406 init(); 15407 } 15408 15409 protected void setBuffer(ByteBuffer backing, int offset) { 15410 super.setBuffer(backing, offset, 36); 15411 } 15412 15413 public void read() { 15414 extractionMode = ExtractionMode.fromValue(backing.getInt(0)); 15415 threshold = backing.getInt(4); 15416 filterSize = EdgeFilterSize.fromValue(backing.getInt(8)); 15417 minLength = backing.getInt(12); 15418 rowStepSize = backing.getInt(16); 15419 columnStepSize = backing.getInt(20); 15420 maxEndPointGap = backing.getInt(24); 15421 onlyClosed = backing.getInt(28); 15422 subpixelAccuracy = backing.getInt(32); 15423 } 15424 15425 public void write() { 15426 if (extractionMode != null) 15427 backing.putInt(0, extractionMode.getValue()); 15428 backing.putInt(4, threshold); 15429 if (filterSize != null) 15430 backing.putInt(8, filterSize.getValue()); 15431 backing.putInt(12, minLength); 15432 backing.putInt(16, rowStepSize); 15433 backing.putInt(20, columnStepSize); 15434 backing.putInt(24, maxEndPointGap); 15435 backing.putInt(28, onlyClosed); 15436 backing.putInt(32, subpixelAccuracy); 15437 } 15438 15439 public int size() { 15440 return 36; 15441 } 15442 } 15443 15444 public static class Barcode2DInfo extends DisposedStruct { 15445 public Barcode2DType type; // The type of the 2D barcode. 15446 public int binary; // This element is TRUE if the 2D barcode contains binary 15447 // data and FALSE if the 2D barcode contains text data. 15448 public byte[] data; // The data encoded in the 2D barcode. 15449 public PointFloat[] boundingBox; // An array of four points describing the 15450 // rectangle surrounding the 2D barcode. 15451 public int numErrorsCorrected; // The number of errors the function 15452 // corrected when decoding the 2D barcode. 15453 public int numErasuresCorrected; // The number of erasures the function 15454 // corrected when decoding the 2D barcode. 15455 public int rows; // The number of rows in the 2D barcode. 15456 public int columns; // The number of columns in the 2D barcode. 15457 private ByteBuffer data_buf; 15458 15459 private void init() { 15460 data = new byte[0]; 15461 boundingBox = new PointFloat[4]; 15462 15463 for (int i = 0, off = 16; i < 4; i++, off += 8) 15464 boundingBox[i] = new PointFloat(backing, off); 15465 } 15466 15467 public Barcode2DInfo() { 15468 super(64); 15469 init(); 15470 } 15471 15472 public Barcode2DInfo(Barcode2DType type, int binary, byte[] data, PointFloat[] boundingBox, 15473 int numErrorsCorrected, int numErasuresCorrected, int rows, int columns) { 15474 super(64); 15475 this.type = type; 15476 this.binary = binary; 15477 this.data = data; 15478 this.boundingBox = boundingBox; 15479 this.numErrorsCorrected = numErrorsCorrected; 15480 this.numErasuresCorrected = numErasuresCorrected; 15481 this.rows = rows; 15482 this.columns = columns; 15483 } 15484 15485 protected Barcode2DInfo(ByteBuffer backing, int offset) { 15486 super(backing, offset, 64); 15487 init(); 15488 } 15489 15490 protected Barcode2DInfo(long nativeObj, boolean owned) { 15491 super(nativeObj, owned, 64); 15492 init(); 15493 } 15494 15495 protected void setBuffer(ByteBuffer backing, int offset) { 15496 super.setBuffer(backing, offset, 64); 15497 } 15498 15499 public void read() { 15500 type = Barcode2DType.fromValue(backing.getInt(0)); 15501 binary = backing.getInt(4); 15502 int data_dataLength = backing.getInt(12); 15503 long data_addr = getPointer(backing, 8); 15504 data = new byte[data_dataLength]; 15505 if (data_dataLength > 0 && data_addr != 0) { 15506 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 15507 } 15508 for (PointFloat it : boundingBox) { 15509 it.read(); 15510 } 15511 numErrorsCorrected = backing.getInt(48); 15512 numErasuresCorrected = backing.getInt(52); 15513 rows = backing.getInt(56); 15514 columns = backing.getInt(60); 15515 } 15516 15517 public void write() { 15518 if (type != null) 15519 backing.putInt(0, type.getValue()); 15520 backing.putInt(4, binary); 15521 data_buf = ByteBuffer.allocateDirect(data.length); 15522 putBytes(data_buf, data, 0, data.length); 15523 backing.putInt(12, data.length); 15524 putPointer(backing, 8, data_buf); 15525 for (PointFloat it : boundingBox) { 15526 it.write(); 15527 } 15528 backing.putInt(48, numErrorsCorrected); 15529 backing.putInt(52, numErasuresCorrected); 15530 backing.putInt(56, rows); 15531 backing.putInt(60, columns); 15532 } 15533 15534 public int size() { 15535 return 64; 15536 } 15537 } 15538 15539 public static class DataMatrixOptions extends DisposedStruct { 15540 public Barcode2DSearchMode searchMode; // Specifies the mode the function 15541 // uses to search for barcodes. 15542 public Barcode2DContrast contrast; // Specifies the contrast of the barcodes 15543 // that the function searches for. 15544 public Barcode2DCellShape cellShape; // Specifies the shape of the barcode 15545 // data cells, which affects how the 15546 // function decodes the barcode. 15547 public Barcode2DShape barcodeShape; // Specifies the shape of the barcodes 15548 // that the function searches for. 15549 public DataMatrixSubtype subtype; // Specifies the Data Matrix subtypes of 15550 // the barcodes that the function searches 15551 // for. 15552 15553 private void init() { 15554 15555 } 15556 15557 public DataMatrixOptions() { 15558 super(20); 15559 init(); 15560 } 15561 15562 public DataMatrixOptions(Barcode2DSearchMode searchMode, Barcode2DContrast contrast, 15563 Barcode2DCellShape cellShape, Barcode2DShape barcodeShape, DataMatrixSubtype subtype) { 15564 super(20); 15565 this.searchMode = searchMode; 15566 this.contrast = contrast; 15567 this.cellShape = cellShape; 15568 this.barcodeShape = barcodeShape; 15569 this.subtype = subtype; 15570 } 15571 15572 protected DataMatrixOptions(ByteBuffer backing, int offset) { 15573 super(backing, offset, 20); 15574 init(); 15575 } 15576 15577 protected DataMatrixOptions(long nativeObj, boolean owned) { 15578 super(nativeObj, owned, 20); 15579 init(); 15580 } 15581 15582 protected void setBuffer(ByteBuffer backing, int offset) { 15583 super.setBuffer(backing, offset, 20); 15584 } 15585 15586 public void read() { 15587 searchMode = Barcode2DSearchMode.fromValue(backing.getInt(0)); 15588 contrast = Barcode2DContrast.fromValue(backing.getInt(4)); 15589 cellShape = Barcode2DCellShape.fromValue(backing.getInt(8)); 15590 barcodeShape = Barcode2DShape.fromValue(backing.getInt(12)); 15591 subtype = DataMatrixSubtype.fromValue(backing.getInt(16)); 15592 } 15593 15594 public void write() { 15595 if (searchMode != null) 15596 backing.putInt(0, searchMode.getValue()); 15597 if (contrast != null) 15598 backing.putInt(4, contrast.getValue()); 15599 if (cellShape != null) 15600 backing.putInt(8, cellShape.getValue()); 15601 if (barcodeShape != null) 15602 backing.putInt(12, barcodeShape.getValue()); 15603 if (subtype != null) 15604 backing.putInt(16, subtype.getValue()); 15605 } 15606 15607 public int size() { 15608 return 20; 15609 } 15610 } 15611 15612 public static class ClassifierAccuracyReport extends DisposedStruct { 15613 public float accuracy; // The overall accuracy of the classifier, from 0 to 15614 // 1000. 15615 public String[] classNames; // The names of the classes of this classifier. 15616 public double[] classAccuracy; // An array of size elements that contains 15617 // accuracy information for each class. 15618 public double[] classPredictiveValue; // An array containing size elements 15619 // that contains the predictive values 15620 // of each class. 15621 private ByteBuffer classNames_buf; 15622 private ByteBuffer[] classNames_bufs; 15623 private ByteBuffer classAccuracy_buf; 15624 private ByteBuffer classPredictiveValue_buf; 15625 15626 private void init() { 15627 classNames = new String[0]; 15628 classAccuracy = new double[0]; 15629 classPredictiveValue = new double[0]; 15630 } 15631 15632 public ClassifierAccuracyReport() { 15633 super(24); 15634 init(); 15635 } 15636 15637 public ClassifierAccuracyReport(double accuracy, String[] classNames, double[] classAccuracy, 15638 double[] classPredictiveValue) { 15639 super(24); 15640 this.accuracy = (float) accuracy; 15641 this.classNames = classNames; 15642 this.classAccuracy = classAccuracy; 15643 this.classPredictiveValue = classPredictiveValue; 15644 } 15645 15646 protected ClassifierAccuracyReport(ByteBuffer backing, int offset) { 15647 super(backing, offset, 24); 15648 init(); 15649 } 15650 15651 protected ClassifierAccuracyReport(long nativeObj, boolean owned) { 15652 super(nativeObj, owned, 24); 15653 init(); 15654 } 15655 15656 protected void setBuffer(ByteBuffer backing, int offset) { 15657 super.setBuffer(backing, offset, 24); 15658 } 15659 15660 public void read() { 15661 accuracy = backing.getFloat(4); 15662 int classNames_size = backing.getInt(0); 15663 long classNames_addr = getPointer(backing, 8); 15664 classNames = new String[classNames_size]; 15665 if (classNames_size > 0 && classNames_addr != 0) { 15666 ByteBuffer bb = newDirectByteBuffer(classNames_addr, classNames_size * 4); 15667 for (int i = 0, off = 0; i < classNames_size; i++, off += 4) { 15668 long addr = getPointer(bb, off); 15669 if (addr == 0) 15670 classNames[i] = null; 15671 else { 15672 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 15673 while (bb2.get() != 0) { 15674 } 15675 byte[] bytes = new byte[bb2.position() - 1]; 15676 bb2.rewind(); 15677 getBytes(bb2, bytes, 0, bytes.length); 15678 try { 15679 classNames[i] = new String(bytes, "UTF-8"); 15680 } catch (UnsupportedEncodingException e) { 15681 classNames[i] = ""; 15682 } 15683 } 15684 } 15685 } 15686 int classAccuracy_size = backing.getInt(0); 15687 long classAccuracy_addr = getPointer(backing, 12); 15688 classAccuracy = new double[classAccuracy_size]; 15689 if (classAccuracy_size > 0 && classAccuracy_addr != 0) { 15690 newDirectByteBuffer(classAccuracy_addr, classAccuracy_size * 8).asDoubleBuffer().get( 15691 classAccuracy); 15692 } 15693 int classPredictiveValue_size = backing.getInt(0); 15694 long classPredictiveValue_addr = getPointer(backing, 16); 15695 classPredictiveValue = new double[classPredictiveValue_size]; 15696 if (classPredictiveValue_size > 0 && classPredictiveValue_addr != 0) { 15697 newDirectByteBuffer(classPredictiveValue_addr, classPredictiveValue_size * 8) 15698 .asDoubleBuffer().get(classPredictiveValue); 15699 } 15700 } 15701 15702 public void write() { 15703 backing.putFloat(4, accuracy); 15704 classNames_buf = 15705 ByteBuffer.allocateDirect(classNames.length * 4).order(ByteOrder.nativeOrder()); 15706 for (int i = 0, off = 0; i < classNames.length; i++, off += 4) { 15707 if (classNames[i] == null) 15708 putPointer(classNames_buf, off, 0); 15709 else { 15710 byte[] bytes; 15711 try { 15712 bytes = classNames[i].getBytes("UTF-8"); 15713 } catch (UnsupportedEncodingException e) { 15714 bytes = new byte[0]; 15715 } 15716 classNames_bufs[i] = ByteBuffer.allocateDirect(bytes.length + 1); 15717 putBytes(classNames_bufs[i], bytes, 0, bytes.length).put(bytes.length, (byte) 0); 15718 putPointer(classNames_buf, off, getByteBufferAddress(classNames_bufs[i])); 15719 } 15720 } 15721 backing.putInt(0, classNames.length); 15722 putPointer(backing, 8, classNames_buf); 15723 classAccuracy_buf = 15724 ByteBuffer.allocateDirect(classAccuracy.length * 8).order(ByteOrder.nativeOrder()); 15725 classAccuracy_buf.asDoubleBuffer().put(classAccuracy).rewind(); 15726 backing.putInt(0, classAccuracy.length); 15727 putPointer(backing, 12, classAccuracy_buf); 15728 classPredictiveValue_buf = 15729 ByteBuffer.allocateDirect(classPredictiveValue.length * 8).order(ByteOrder.nativeOrder()); 15730 classPredictiveValue_buf.asDoubleBuffer().put(classPredictiveValue).rewind(); 15731 backing.putInt(0, classPredictiveValue.length); 15732 putPointer(backing, 16, classPredictiveValue_buf); 15733 } 15734 15735 public int size() { 15736 return 24; 15737 } 15738 } 15739 15740 public static class NearestNeighborClassResult extends DisposedStruct { 15741 public String className; // The name of the class. 15742 public float standardDeviation; // The standard deviation of the members of 15743 // this class. 15744 public int count; // The number of samples in this class. 15745 private ByteBuffer className_buf; 15746 15747 private void init() { 15748 15749 } 15750 15751 public NearestNeighborClassResult() { 15752 super(12); 15753 init(); 15754 } 15755 15756 public NearestNeighborClassResult(String className, double standardDeviation, int count) { 15757 super(12); 15758 this.className = className; 15759 this.standardDeviation = (float) standardDeviation; 15760 this.count = count; 15761 } 15762 15763 protected NearestNeighborClassResult(ByteBuffer backing, int offset) { 15764 super(backing, offset, 12); 15765 init(); 15766 } 15767 15768 protected NearestNeighborClassResult(long nativeObj, boolean owned) { 15769 super(nativeObj, owned, 12); 15770 init(); 15771 } 15772 15773 protected void setBuffer(ByteBuffer backing, int offset) { 15774 super.setBuffer(backing, offset, 12); 15775 } 15776 15777 public void read() { 15778 long className_addr = getPointer(backing, 0); 15779 if (className_addr == 0) 15780 className = null; 15781 else { 15782 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 15783 while (bb.get() != 0) { 15784 } 15785 byte[] bytes = new byte[bb.position() - 1]; 15786 getBytes(bb, bytes, 0, bytes.length); 15787 try { 15788 className = new String(bytes, "UTF-8"); 15789 } catch (UnsupportedEncodingException e) { 15790 className = ""; 15791 } 15792 } 15793 15794 standardDeviation = backing.getFloat(4); 15795 count = backing.getInt(8); 15796 } 15797 15798 public void write() { 15799 if (className != null) { 15800 byte[] className_bytes; 15801 try { 15802 className_bytes = className.getBytes("UTF-8"); 15803 } catch (UnsupportedEncodingException e) { 15804 className_bytes = new byte[0]; 15805 } 15806 className_buf = ByteBuffer.allocateDirect(className_bytes.length + 1); 15807 putBytes(className_buf, className_bytes, 0, className_bytes.length).put( 15808 className_bytes.length, (byte) 0); 15809 } 15810 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 15811 backing.putFloat(4, standardDeviation); 15812 backing.putInt(8, count); 15813 } 15814 15815 public int size() { 15816 return 12; 15817 } 15818 } 15819 15820 public static class NearestNeighborTrainingReport extends DisposedStruct { 15821 public NearestNeighborClassResult[] allScores; // All classes and their 15822 // scores. 15823 private ByteBuffer allScores_buf; 15824 15825 private void init() { 15826 allScores = new NearestNeighborClassResult[0]; 15827 } 15828 15829 public NearestNeighborTrainingReport() { 15830 super(12); 15831 init(); 15832 } 15833 15834 public NearestNeighborTrainingReport(NearestNeighborClassResult[] allScores) { 15835 super(12); 15836 this.allScores = allScores; 15837 } 15838 15839 protected NearestNeighborTrainingReport(ByteBuffer backing, int offset) { 15840 super(backing, offset, 12); 15841 init(); 15842 } 15843 15844 protected NearestNeighborTrainingReport(long nativeObj, boolean owned) { 15845 super(nativeObj, owned, 12); 15846 init(); 15847 } 15848 15849 protected void setBuffer(ByteBuffer backing, int offset) { 15850 super.setBuffer(backing, offset, 12); 15851 } 15852 15853 public void read() { 15854 int allScores_allScoresSize = backing.getInt(8); 15855 long allScores_addr = getPointer(backing, 4); 15856 allScores = new NearestNeighborClassResult[allScores_allScoresSize]; 15857 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 15858 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize * 12); 15859 for (int i = 0, off = 0; i < allScores_allScoresSize; i++, off += 12) { 15860 allScores[i] = new NearestNeighborClassResult(bb, off); 15861 allScores[i].read(); 15862 } 15863 } 15864 } 15865 15866 public void write() { 15867 allScores_buf = 15868 ByteBuffer.allocateDirect(allScores.length * 12).order(ByteOrder.nativeOrder()); 15869 for (int i = 0, off = 0; i < allScores.length; i++, off += 12) { 15870 allScores[i].setBuffer(allScores_buf, off); 15871 allScores[i].write(); 15872 } 15873 backing.putInt(8, allScores.length); 15874 putPointer(backing, 4, allScores_buf); 15875 } 15876 15877 public int size() { 15878 return 12; 15879 } 15880 } 15881 15882 public static class ParticleClassifierPreprocessingOptions extends DisposedStruct { 15883 public int manualThreshold; // Set this element to TRUE to specify the 15884 // threshold range manually. 15885 public RangeFloat manualThresholdRange; // If a manual threshold is being 15886 // done, the range of pixels to 15887 // keep. 15888 public ThresholdMethod autoThresholdMethod; // If an automatic threshold is 15889 // being done, the method used 15890 // to calculate the threshold 15891 // range. 15892 public RangeFloat limits; // The limits on the automatic threshold range. 15893 public ParticleType particleType; // Specifies what kind of particles to 15894 // look for. 15895 public int rejectBorder; // Set this element to TRUE to reject border 15896 // particles. 15897 public int numErosions; // The number of erosions to perform. 15898 15899 private void init() { 15900 manualThresholdRange = new RangeFloat(backing, 4); 15901 limits = new RangeFloat(backing, 16); 15902 } 15903 15904 public ParticleClassifierPreprocessingOptions() { 15905 super(36); 15906 init(); 15907 } 15908 15909 public ParticleClassifierPreprocessingOptions(int manualThreshold, 15910 RangeFloat manualThresholdRange, ThresholdMethod autoThresholdMethod, RangeFloat limits, 15911 ParticleType particleType, int rejectBorder, int numErosions) { 15912 super(36); 15913 this.manualThreshold = manualThreshold; 15914 this.manualThresholdRange = manualThresholdRange; 15915 this.autoThresholdMethod = autoThresholdMethod; 15916 this.limits = limits; 15917 this.particleType = particleType; 15918 this.rejectBorder = rejectBorder; 15919 this.numErosions = numErosions; 15920 } 15921 15922 protected ParticleClassifierPreprocessingOptions(ByteBuffer backing, int offset) { 15923 super(backing, offset, 36); 15924 init(); 15925 } 15926 15927 protected ParticleClassifierPreprocessingOptions(long nativeObj, boolean owned) { 15928 super(nativeObj, owned, 36); 15929 init(); 15930 } 15931 15932 protected void setBuffer(ByteBuffer backing, int offset) { 15933 super.setBuffer(backing, offset, 36); 15934 } 15935 15936 public void read() { 15937 manualThreshold = backing.getInt(0); 15938 manualThresholdRange.read(); 15939 autoThresholdMethod = ThresholdMethod.fromValue(backing.getInt(12)); 15940 limits.read(); 15941 particleType = ParticleType.fromValue(backing.getInt(24)); 15942 rejectBorder = backing.getInt(28); 15943 numErosions = backing.getInt(32); 15944 } 15945 15946 public void write() { 15947 backing.putInt(0, manualThreshold); 15948 manualThresholdRange.write(); 15949 if (autoThresholdMethod != null) 15950 backing.putInt(12, autoThresholdMethod.getValue()); 15951 limits.write(); 15952 if (particleType != null) 15953 backing.putInt(24, particleType.getValue()); 15954 backing.putInt(28, rejectBorder); 15955 backing.putInt(32, numErosions); 15956 } 15957 15958 public int size() { 15959 return 36; 15960 } 15961 } 15962 15963 public static class ClassifierSampleInfo extends DisposedStruct { 15964 public String className; // The name of the class this sample is in. 15965 public double[] featureVector; // The feature vector of this sample, or NULL 15966 // if this is not a custom classifier 15967 // session. 15968 public Image thumbnail; // A thumbnail image of this sample, or NULL if no 15969 // image was specified. 15970 private ByteBuffer className_buf; 15971 private ByteBuffer featureVector_buf; 15972 15973 private void init() { 15974 featureVector = new double[0]; 15975 } 15976 15977 public ClassifierSampleInfo() { 15978 super(16); 15979 init(); 15980 } 15981 15982 public ClassifierSampleInfo(String className, double[] featureVector, Image thumbnail) { 15983 super(16); 15984 this.className = className; 15985 this.featureVector = featureVector; 15986 this.thumbnail = thumbnail; 15987 } 15988 15989 protected ClassifierSampleInfo(ByteBuffer backing, int offset) { 15990 super(backing, offset, 16); 15991 init(); 15992 } 15993 15994 protected ClassifierSampleInfo(long nativeObj, boolean owned) { 15995 super(nativeObj, owned, 16); 15996 init(); 15997 } 15998 15999 protected void setBuffer(ByteBuffer backing, int offset) { 16000 super.setBuffer(backing, offset, 16); 16001 } 16002 16003 public void read() { 16004 long className_addr = getPointer(backing, 0); 16005 if (className_addr == 0) 16006 className = null; 16007 else { 16008 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 16009 while (bb.get() != 0) { 16010 } 16011 byte[] bytes = new byte[bb.position() - 1]; 16012 getBytes(bb, bytes, 0, bytes.length); 16013 try { 16014 className = new String(bytes, "UTF-8"); 16015 } catch (UnsupportedEncodingException e) { 16016 className = ""; 16017 } 16018 } 16019 16020 int featureVector_featureVectorSize = backing.getInt(8); 16021 long featureVector_addr = getPointer(backing, 4); 16022 featureVector = new double[featureVector_featureVectorSize]; 16023 if (featureVector_featureVectorSize > 0 && featureVector_addr != 0) { 16024 newDirectByteBuffer(featureVector_addr, featureVector_featureVectorSize * 8) 16025 .asDoubleBuffer().get(featureVector); 16026 } 16027 long thumbnail_addr = getPointer(backing, 12); 16028 if (thumbnail_addr == 0) 16029 thumbnail = null; 16030 else 16031 thumbnail = new Image(thumbnail_addr, false); 16032 } 16033 16034 public void write() { 16035 if (className != null) { 16036 byte[] className_bytes; 16037 try { 16038 className_bytes = className.getBytes("UTF-8"); 16039 } catch (UnsupportedEncodingException e) { 16040 className_bytes = new byte[0]; 16041 } 16042 className_buf = ByteBuffer.allocateDirect(className_bytes.length + 1); 16043 putBytes(className_buf, className_bytes, 0, className_bytes.length).put( 16044 className_bytes.length, (byte) 0); 16045 } 16046 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 16047 featureVector_buf = 16048 ByteBuffer.allocateDirect(featureVector.length * 8).order(ByteOrder.nativeOrder()); 16049 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 16050 backing.putInt(8, featureVector.length); 16051 putPointer(backing, 4, featureVector_buf); 16052 putPointer(backing, 12, thumbnail); 16053 } 16054 16055 public int size() { 16056 return 16; 16057 } 16058 } 16059 16060 public static class ClassScore extends DisposedStruct { 16061 public String className; // The name of the class. 16062 public float distance; // The distance from the item to this class. 16063 private ByteBuffer className_buf; 16064 16065 private void init() { 16066 16067 } 16068 16069 public ClassScore() { 16070 super(8); 16071 init(); 16072 } 16073 16074 public ClassScore(String className, double distance) { 16075 super(8); 16076 this.className = className; 16077 this.distance = (float) distance; 16078 } 16079 16080 protected ClassScore(ByteBuffer backing, int offset) { 16081 super(backing, offset, 8); 16082 init(); 16083 } 16084 16085 protected ClassScore(long nativeObj, boolean owned) { 16086 super(nativeObj, owned, 8); 16087 init(); 16088 } 16089 16090 protected void setBuffer(ByteBuffer backing, int offset) { 16091 super.setBuffer(backing, offset, 8); 16092 } 16093 16094 public void read() { 16095 long className_addr = getPointer(backing, 0); 16096 if (className_addr == 0) 16097 className = null; 16098 else { 16099 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 16100 while (bb.get() != 0) { 16101 } 16102 byte[] bytes = new byte[bb.position() - 1]; 16103 getBytes(bb, bytes, 0, bytes.length); 16104 try { 16105 className = new String(bytes, "UTF-8"); 16106 } catch (UnsupportedEncodingException e) { 16107 className = ""; 16108 } 16109 } 16110 16111 distance = backing.getFloat(4); 16112 } 16113 16114 public void write() { 16115 if (className != null) { 16116 byte[] className_bytes; 16117 try { 16118 className_bytes = className.getBytes("UTF-8"); 16119 } catch (UnsupportedEncodingException e) { 16120 className_bytes = new byte[0]; 16121 } 16122 className_buf = ByteBuffer.allocateDirect(className_bytes.length + 1); 16123 putBytes(className_buf, className_bytes, 0, className_bytes.length).put( 16124 className_bytes.length, (byte) 0); 16125 } 16126 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 16127 backing.putFloat(4, distance); 16128 } 16129 16130 public int size() { 16131 return 8; 16132 } 16133 } 16134 16135 public static class ClassifierReport extends DisposedStruct { 16136 public String bestClassName; // The name of the best class for the sample. 16137 public float classificationScore; // The similarity of the sample and the 16138 // two closest classes in the classifier. 16139 public float identificationScore; // The similarity of the sample and the 16140 // assigned class. 16141 public ClassScore[] allScores; // All classes and their scores. 16142 private ByteBuffer bestClassName_buf; 16143 private ByteBuffer allScores_buf; 16144 16145 private void init() { 16146 allScores = new ClassScore[0]; 16147 } 16148 16149 public ClassifierReport() { 16150 super(20); 16151 init(); 16152 } 16153 16154 public ClassifierReport(String bestClassName, double classificationScore, 16155 double identificationScore, ClassScore[] allScores) { 16156 super(20); 16157 this.bestClassName = bestClassName; 16158 this.classificationScore = (float) classificationScore; 16159 this.identificationScore = (float) identificationScore; 16160 this.allScores = allScores; 16161 } 16162 16163 protected ClassifierReport(ByteBuffer backing, int offset) { 16164 super(backing, offset, 20); 16165 init(); 16166 } 16167 16168 protected ClassifierReport(long nativeObj, boolean owned) { 16169 super(nativeObj, owned, 20); 16170 init(); 16171 } 16172 16173 protected void setBuffer(ByteBuffer backing, int offset) { 16174 super.setBuffer(backing, offset, 20); 16175 } 16176 16177 public void read() { 16178 long bestClassName_addr = getPointer(backing, 0); 16179 if (bestClassName_addr == 0) 16180 bestClassName = null; 16181 else { 16182 ByteBuffer bb = newDirectByteBuffer(bestClassName_addr, 1000); // FIXME 16183 while (bb.get() != 0) { 16184 } 16185 byte[] bytes = new byte[bb.position() - 1]; 16186 getBytes(bb, bytes, 0, bytes.length); 16187 try { 16188 bestClassName = new String(bytes, "UTF-8"); 16189 } catch (UnsupportedEncodingException e) { 16190 bestClassName = ""; 16191 } 16192 } 16193 16194 classificationScore = backing.getFloat(4); 16195 identificationScore = backing.getFloat(8); 16196 int allScores_allScoresSize = backing.getInt(16); 16197 long allScores_addr = getPointer(backing, 12); 16198 allScores = new ClassScore[allScores_allScoresSize]; 16199 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 16200 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize * 8); 16201 for (int i = 0, off = 0; i < allScores_allScoresSize; i++, off += 8) { 16202 allScores[i] = new ClassScore(bb, off); 16203 allScores[i].read(); 16204 } 16205 } 16206 } 16207 16208 public void write() { 16209 if (bestClassName != null) { 16210 byte[] bestClassName_bytes; 16211 try { 16212 bestClassName_bytes = bestClassName.getBytes("UTF-8"); 16213 } catch (UnsupportedEncodingException e) { 16214 bestClassName_bytes = new byte[0]; 16215 } 16216 bestClassName_buf = ByteBuffer.allocateDirect(bestClassName_bytes.length + 1); 16217 putBytes(bestClassName_buf, bestClassName_bytes, 0, bestClassName_bytes.length).put( 16218 bestClassName_bytes.length, (byte) 0); 16219 } 16220 putPointer(backing, 0, bestClassName == null ? 0 : getByteBufferAddress(bestClassName_buf)); 16221 backing.putFloat(4, classificationScore); 16222 backing.putFloat(8, identificationScore); 16223 allScores_buf = 16224 ByteBuffer.allocateDirect(allScores.length * 8).order(ByteOrder.nativeOrder()); 16225 for (int i = 0, off = 0; i < allScores.length; i++, off += 8) { 16226 allScores[i].setBuffer(allScores_buf, off); 16227 allScores[i].write(); 16228 } 16229 backing.putInt(16, allScores.length); 16230 putPointer(backing, 12, allScores_buf); 16231 } 16232 16233 public int size() { 16234 return 20; 16235 } 16236 } 16237 16238 public static class NearestNeighborOptions extends DisposedStruct { 16239 public NearestNeighborMethod method; // The method to use. 16240 public NearestNeighborMetric metric; // The metric to use. 16241 public int k; // The value of k, if the IMAQ_K_NEAREST_NEIGHBOR method is 16242 // used. 16243 16244 private void init() { 16245 16246 } 16247 16248 public NearestNeighborOptions() { 16249 super(12); 16250 init(); 16251 } 16252 16253 public NearestNeighborOptions(NearestNeighborMethod method, NearestNeighborMetric metric, int k) { 16254 super(12); 16255 this.method = method; 16256 this.metric = metric; 16257 this.k = k; 16258 } 16259 16260 protected NearestNeighborOptions(ByteBuffer backing, int offset) { 16261 super(backing, offset, 12); 16262 init(); 16263 } 16264 16265 protected NearestNeighborOptions(long nativeObj, boolean owned) { 16266 super(nativeObj, owned, 12); 16267 init(); 16268 } 16269 16270 protected void setBuffer(ByteBuffer backing, int offset) { 16271 super.setBuffer(backing, offset, 12); 16272 } 16273 16274 public void read() { 16275 method = NearestNeighborMethod.fromValue(backing.getInt(0)); 16276 metric = NearestNeighborMetric.fromValue(backing.getInt(4)); 16277 k = backing.getInt(8); 16278 } 16279 16280 public void write() { 16281 if (method != null) 16282 backing.putInt(0, method.getValue()); 16283 if (metric != null) 16284 backing.putInt(4, metric.getValue()); 16285 backing.putInt(8, k); 16286 } 16287 16288 public int size() { 16289 return 12; 16290 } 16291 } 16292 16293 public static class ParticleClassifierOptions extends DisposedStruct { 16294 public float scaleDependence; // The relative importance of scale when 16295 // classifying particles. 16296 public float mirrorDependence; // The relative importance of mirror symmetry 16297 // when classifying particles. 16298 16299 private void init() { 16300 16301 } 16302 16303 public ParticleClassifierOptions() { 16304 super(8); 16305 init(); 16306 } 16307 16308 public ParticleClassifierOptions(double scaleDependence, double mirrorDependence) { 16309 super(8); 16310 this.scaleDependence = (float) scaleDependence; 16311 this.mirrorDependence = (float) mirrorDependence; 16312 } 16313 16314 protected ParticleClassifierOptions(ByteBuffer backing, int offset) { 16315 super(backing, offset, 8); 16316 init(); 16317 } 16318 16319 protected ParticleClassifierOptions(long nativeObj, boolean owned) { 16320 super(nativeObj, owned, 8); 16321 init(); 16322 } 16323 16324 protected void setBuffer(ByteBuffer backing, int offset) { 16325 super.setBuffer(backing, offset, 8); 16326 } 16327 16328 public void read() { 16329 scaleDependence = backing.getFloat(0); 16330 mirrorDependence = backing.getFloat(4); 16331 } 16332 16333 public void write() { 16334 backing.putFloat(0, scaleDependence); 16335 backing.putFloat(4, mirrorDependence); 16336 } 16337 16338 public int size() { 16339 return 8; 16340 } 16341 } 16342 16343 public static class RGBU64Value extends DisposedStruct { 16344 public int B; // The blue value of the color. 16345 public int G; // The green value of the color. 16346 public int R; // The red value of the color. 16347 public int alpha; // The alpha value of the color, which represents extra 16348 // information about a color image, such as gamma 16349 // correction. 16350 16351 private void init() { 16352 16353 } 16354 16355 public RGBU64Value() { 16356 super(8); 16357 init(); 16358 } 16359 16360 public RGBU64Value(int B, int G, int R, int alpha) { 16361 super(8); 16362 this.B = B; 16363 this.G = G; 16364 this.R = R; 16365 this.alpha = alpha; 16366 } 16367 16368 protected RGBU64Value(ByteBuffer backing, int offset) { 16369 super(backing, offset, 8); 16370 init(); 16371 } 16372 16373 protected RGBU64Value(long nativeObj, boolean owned) { 16374 super(nativeObj, owned, 8); 16375 init(); 16376 } 16377 16378 protected void setBuffer(ByteBuffer backing, int offset) { 16379 super.setBuffer(backing, offset, 8); 16380 } 16381 16382 public void read() { 16383 B = (int) (backing.getShort(0) & 0xffff); 16384 G = (int) (backing.getShort(2) & 0xffff); 16385 R = (int) (backing.getShort(4) & 0xffff); 16386 alpha = (int) (backing.getShort(6) & 0xffff); 16387 } 16388 16389 public void write() { 16390 backing.putShort(0, (short) (B & 0xffff)); 16391 backing.putShort(2, (short) (G & 0xffff)); 16392 backing.putShort(4, (short) (R & 0xffff)); 16393 backing.putShort(6, (short) (alpha & 0xffff)); 16394 } 16395 16396 public int size() { 16397 return 8; 16398 } 16399 } 16400 16401 public static class GeometricPatternMatch extends DisposedStruct { 16402 public PointFloat position; // The location of the origin of the template in 16403 // the match. 16404 public float rotation; // The rotation of the match relative to the template 16405 // image, in degrees. 16406 public float scale; // The size of the match relative to the size of the 16407 // template image, expressed as a percentage. 16408 public float score; // The accuracy of the match. 16409 public PointFloat[] corner; // An array of four points describing the 16410 // rectangle surrounding the template image. 16411 public int inverse; // This element is TRUE if the match is an inverse of 16412 // the template image. 16413 public float occlusion; // The percentage of the match that is occluded. 16414 public float templateMatchCurveScore; // The accuracy of the match obtained 16415 // by comparing the template curves to 16416 // the curves in the match region. 16417 public float matchTemplateCurveScore; // The accuracy of the match obtained 16418 // by comparing the curves in the 16419 // match region to the template 16420 // curves. 16421 public float correlationScore; // The accuracy of the match obtained by 16422 // comparing the template image to the match 16423 // region using a correlation metric that 16424 // compares the two regions as a function of 16425 // their pixel values. 16426 16427 private void init() { 16428 position = new PointFloat(backing, 0); 16429 corner = new PointFloat[4]; 16430 16431 for (int i = 0, off = 20; i < 4; i++, off += 8) 16432 corner[i] = new PointFloat(backing, off); 16433 } 16434 16435 public GeometricPatternMatch() { 16436 super(72); 16437 init(); 16438 } 16439 16440 public GeometricPatternMatch(PointFloat position, double rotation, double scale, double score, 16441 PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, 16442 double matchTemplateCurveScore, double correlationScore) { 16443 super(72); 16444 this.position = position; 16445 this.rotation = (float) rotation; 16446 this.scale = (float) scale; 16447 this.score = (float) score; 16448 this.corner = corner; 16449 this.inverse = inverse; 16450 this.occlusion = (float) occlusion; 16451 this.templateMatchCurveScore = (float) templateMatchCurveScore; 16452 this.matchTemplateCurveScore = (float) matchTemplateCurveScore; 16453 this.correlationScore = (float) correlationScore; 16454 } 16455 16456 protected GeometricPatternMatch(ByteBuffer backing, int offset) { 16457 super(backing, offset, 72); 16458 init(); 16459 } 16460 16461 protected GeometricPatternMatch(long nativeObj, boolean owned) { 16462 super(nativeObj, owned, 72); 16463 init(); 16464 } 16465 16466 protected void setBuffer(ByteBuffer backing, int offset) { 16467 super.setBuffer(backing, offset, 72); 16468 } 16469 16470 public void read() { 16471 position.read(); 16472 rotation = backing.getFloat(8); 16473 scale = backing.getFloat(12); 16474 score = backing.getFloat(16); 16475 for (PointFloat it : corner) { 16476 it.read(); 16477 } 16478 inverse = backing.getInt(52); 16479 occlusion = backing.getFloat(56); 16480 templateMatchCurveScore = backing.getFloat(60); 16481 matchTemplateCurveScore = backing.getFloat(64); 16482 correlationScore = backing.getFloat(68); 16483 } 16484 16485 public void write() { 16486 position.write(); 16487 backing.putFloat(8, rotation); 16488 backing.putFloat(12, scale); 16489 backing.putFloat(16, score); 16490 for (PointFloat it : corner) { 16491 it.write(); 16492 } 16493 backing.putInt(52, inverse); 16494 backing.putFloat(56, occlusion); 16495 backing.putFloat(60, templateMatchCurveScore); 16496 backing.putFloat(64, matchTemplateCurveScore); 16497 backing.putFloat(68, correlationScore); 16498 } 16499 16500 public int size() { 16501 return 72; 16502 } 16503 } 16504 16505 public static class MatchGeometricPatternAdvancedOptions extends DisposedStruct { 16506 public int minFeaturesUsed; // Specifies the minimum number of features the 16507 // function uses when matching. 16508 public int maxFeaturesUsed; // Specifies the maximum number of features the 16509 // function uses when matching. 16510 public int subpixelIterations; // Specifies the maximum number of 16511 // incremental improvements used to refine 16512 // matches with subpixel information. 16513 public double subpixelTolerance; // Specifies the maximum amount of change, 16514 // in pixels, between consecutive 16515 // incremental improvements in the match 16516 // position before the function stops 16517 // refining the match position. 16518 public int initialMatchListLength; // Specifies the maximum size of the 16519 // match list. 16520 public int matchTemplateCurveScore; // Set this element to TRUE to specify 16521 // that the function should calculate 16522 // the match curve to template curve 16523 // score and return it for each match 16524 // result. 16525 public int correlationScore; // Set this element to TRUE to specify that the 16526 // function should calculate the correlation 16527 // score and return it for each match result. 16528 public double minMatchSeparationDistance; // Specifies the minimum 16529 // separation distance, in pixels, 16530 // between the origins of two 16531 // matches that have unique 16532 // positions. 16533 public double minMatchSeparationAngle; // Specifies the minimum angular 16534 // difference, in degrees, between 16535 // two matches that have unique 16536 // angles. 16537 public double minMatchSeparationScale; // Specifies the minimum difference 16538 // in scale, expressed as a 16539 // percentage, between two matches 16540 // that have unique scales. 16541 public double maxMatchOverlap; // Specifies the maximum amount of overlap, 16542 // expressed as a percentage, allowed between 16543 // the bounding rectangles of two unique 16544 // matches. 16545 public int coarseResult; // Specifies whether you want the function to spend 16546 // less time accurately estimating the location of 16547 // a match. 16548 16549 private void init() { 16550 16551 } 16552 16553 public MatchGeometricPatternAdvancedOptions() { 16554 super(80); 16555 init(); 16556 } 16557 16558 public MatchGeometricPatternAdvancedOptions(int minFeaturesUsed, int maxFeaturesUsed, 16559 int subpixelIterations, double subpixelTolerance, int initialMatchListLength, 16560 int matchTemplateCurveScore, int correlationScore, double minMatchSeparationDistance, 16561 double minMatchSeparationAngle, double minMatchSeparationScale, double maxMatchOverlap, 16562 int coarseResult) { 16563 super(80); 16564 this.minFeaturesUsed = minFeaturesUsed; 16565 this.maxFeaturesUsed = maxFeaturesUsed; 16566 this.subpixelIterations = subpixelIterations; 16567 this.subpixelTolerance = subpixelTolerance; 16568 this.initialMatchListLength = initialMatchListLength; 16569 this.matchTemplateCurveScore = matchTemplateCurveScore; 16570 this.correlationScore = correlationScore; 16571 this.minMatchSeparationDistance = minMatchSeparationDistance; 16572 this.minMatchSeparationAngle = minMatchSeparationAngle; 16573 this.minMatchSeparationScale = minMatchSeparationScale; 16574 this.maxMatchOverlap = maxMatchOverlap; 16575 this.coarseResult = coarseResult; 16576 } 16577 16578 protected MatchGeometricPatternAdvancedOptions(ByteBuffer backing, int offset) { 16579 super(backing, offset, 80); 16580 init(); 16581 } 16582 16583 protected MatchGeometricPatternAdvancedOptions(long nativeObj, boolean owned) { 16584 super(nativeObj, owned, 80); 16585 init(); 16586 } 16587 16588 protected void setBuffer(ByteBuffer backing, int offset) { 16589 super.setBuffer(backing, offset, 80); 16590 } 16591 16592 public void read() { 16593 minFeaturesUsed = backing.getInt(0); 16594 maxFeaturesUsed = backing.getInt(4); 16595 subpixelIterations = backing.getInt(8); 16596 subpixelTolerance = backing.getDouble(16); 16597 initialMatchListLength = backing.getInt(24); 16598 matchTemplateCurveScore = backing.getInt(28); 16599 correlationScore = backing.getInt(32); 16600 minMatchSeparationDistance = backing.getDouble(40); 16601 minMatchSeparationAngle = backing.getDouble(48); 16602 minMatchSeparationScale = backing.getDouble(56); 16603 maxMatchOverlap = backing.getDouble(64); 16604 coarseResult = backing.getInt(72); 16605 } 16606 16607 public void write() { 16608 backing.putInt(0, minFeaturesUsed); 16609 backing.putInt(4, maxFeaturesUsed); 16610 backing.putInt(8, subpixelIterations); 16611 backing.putDouble(16, subpixelTolerance); 16612 backing.putInt(24, initialMatchListLength); 16613 backing.putInt(28, matchTemplateCurveScore); 16614 backing.putInt(32, correlationScore); 16615 backing.putDouble(40, minMatchSeparationDistance); 16616 backing.putDouble(48, minMatchSeparationAngle); 16617 backing.putDouble(56, minMatchSeparationScale); 16618 backing.putDouble(64, maxMatchOverlap); 16619 backing.putInt(72, coarseResult); 16620 } 16621 16622 public int size() { 16623 return 80; 16624 } 16625 } 16626 16627 public static class MatchGeometricPatternOptions extends DisposedStruct { 16628 public int mode; // Specifies the method imaqMatchGeometricPattern() uses 16629 // when looking for the pattern in the image. 16630 public int subpixelAccuracy; // Set this element to TRUE to specify that the 16631 // function should calculate match locations 16632 // with subpixel accuracy. 16633 public RangeFloat[] angleRanges; // An array of angle ranges, in degrees, 16634 // where each range specifies how much you 16635 // expect the template to be rotated in the 16636 // image. 16637 public RangeFloat scaleRange; // A range that specifies the sizes of the 16638 // pattern you expect to be in the image, 16639 // expressed as a ratio percentage 16640 // representing the size of the pattern in the 16641 // image divided by size of the original 16642 // pattern multiplied by 100. 16643 public RangeFloat occlusionRange; // A range that specifies the percentage 16644 // of the pattern you expect to be 16645 // occluded in the image. 16646 public int numMatchesRequested; // Number of valid matches expected. 16647 public float minMatchScore; // The minimum score a match can have for the 16648 // function to consider the match valid. 16649 private ByteBuffer angleRanges_buf; 16650 16651 private void init() { 16652 angleRanges = new RangeFloat[0]; 16653 scaleRange = new RangeFloat(backing, 16); 16654 occlusionRange = new RangeFloat(backing, 24); 16655 } 16656 16657 public MatchGeometricPatternOptions() { 16658 super(40); 16659 init(); 16660 } 16661 16662 public MatchGeometricPatternOptions(int mode, int subpixelAccuracy, RangeFloat[] angleRanges, 16663 RangeFloat scaleRange, RangeFloat occlusionRange, int numMatchesRequested, 16664 double minMatchScore) { 16665 super(40); 16666 this.mode = mode; 16667 this.subpixelAccuracy = subpixelAccuracy; 16668 this.angleRanges = angleRanges; 16669 this.scaleRange = scaleRange; 16670 this.occlusionRange = occlusionRange; 16671 this.numMatchesRequested = numMatchesRequested; 16672 this.minMatchScore = (float) minMatchScore; 16673 } 16674 16675 protected MatchGeometricPatternOptions(ByteBuffer backing, int offset) { 16676 super(backing, offset, 40); 16677 init(); 16678 } 16679 16680 protected MatchGeometricPatternOptions(long nativeObj, boolean owned) { 16681 super(nativeObj, owned, 40); 16682 init(); 16683 } 16684 16685 protected void setBuffer(ByteBuffer backing, int offset) { 16686 super.setBuffer(backing, offset, 40); 16687 } 16688 16689 public void read() { 16690 mode = backing.getInt(0); 16691 subpixelAccuracy = backing.getInt(4); 16692 int angleRanges_numAngleRanges = backing.getInt(12); 16693 long angleRanges_addr = getPointer(backing, 8); 16694 angleRanges = new RangeFloat[angleRanges_numAngleRanges]; 16695 if (angleRanges_numAngleRanges > 0 && angleRanges_addr != 0) { 16696 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numAngleRanges * 8); 16697 for (int i = 0, off = 0; i < angleRanges_numAngleRanges; i++, off += 8) { 16698 angleRanges[i] = new RangeFloat(bb, off); 16699 angleRanges[i].read(); 16700 } 16701 } 16702 scaleRange.read(); 16703 occlusionRange.read(); 16704 numMatchesRequested = backing.getInt(32); 16705 minMatchScore = backing.getFloat(36); 16706 } 16707 16708 public void write() { 16709 backing.putInt(0, mode); 16710 backing.putInt(4, subpixelAccuracy); 16711 angleRanges_buf = 16712 ByteBuffer.allocateDirect(angleRanges.length * 8).order(ByteOrder.nativeOrder()); 16713 for (int i = 0, off = 0; i < angleRanges.length; i++, off += 8) { 16714 angleRanges[i].setBuffer(angleRanges_buf, off); 16715 angleRanges[i].write(); 16716 } 16717 backing.putInt(12, angleRanges.length); 16718 putPointer(backing, 8, angleRanges_buf); 16719 scaleRange.write(); 16720 occlusionRange.write(); 16721 backing.putInt(32, numMatchesRequested); 16722 backing.putFloat(36, minMatchScore); 16723 } 16724 16725 public int size() { 16726 return 40; 16727 } 16728 } 16729 16730 public static class LearnGeometricPatternAdvancedOptions extends DisposedStruct { 16731 public int minRectLength; // Specifies the minimum length for each side of a 16732 // rectangular feature. 16733 public double minRectAspectRatio; // Specifies the minimum aspect ratio of a 16734 // rectangular feature. 16735 public int minRadius; // Specifies the minimum radius for a circular 16736 // feature. 16737 public int minLineLength; // Specifies the minimum length for a linear 16738 // feature. 16739 public double minFeatureStrength; // Specifies the minimum strength for a 16740 // feature. 16741 public int maxFeaturesUsed; // Specifies the maximum number of features the 16742 // function uses when learning. 16743 public int maxPixelDistanceFromLine; // Specifies the maximum number of 16744 // pixels between an edge pixel and a 16745 // linear feature for the function to 16746 // consider that edge pixel as part of 16747 // the linear feature. 16748 16749 private void init() { 16750 16751 } 16752 16753 public LearnGeometricPatternAdvancedOptions() { 16754 super(40); 16755 init(); 16756 } 16757 16758 public LearnGeometricPatternAdvancedOptions(int minRectLength, double minRectAspectRatio, 16759 int minRadius, int minLineLength, double minFeatureStrength, int maxFeaturesUsed, 16760 int maxPixelDistanceFromLine) { 16761 super(40); 16762 this.minRectLength = minRectLength; 16763 this.minRectAspectRatio = minRectAspectRatio; 16764 this.minRadius = minRadius; 16765 this.minLineLength = minLineLength; 16766 this.minFeatureStrength = minFeatureStrength; 16767 this.maxFeaturesUsed = maxFeaturesUsed; 16768 this.maxPixelDistanceFromLine = maxPixelDistanceFromLine; 16769 } 16770 16771 protected LearnGeometricPatternAdvancedOptions(ByteBuffer backing, int offset) { 16772 super(backing, offset, 40); 16773 init(); 16774 } 16775 16776 protected LearnGeometricPatternAdvancedOptions(long nativeObj, boolean owned) { 16777 super(nativeObj, owned, 40); 16778 init(); 16779 } 16780 16781 protected void setBuffer(ByteBuffer backing, int offset) { 16782 super.setBuffer(backing, offset, 40); 16783 } 16784 16785 public void read() { 16786 minRectLength = backing.getInt(0); 16787 minRectAspectRatio = backing.getDouble(8); 16788 minRadius = backing.getInt(16); 16789 minLineLength = backing.getInt(20); 16790 minFeatureStrength = backing.getDouble(24); 16791 maxFeaturesUsed = backing.getInt(32); 16792 maxPixelDistanceFromLine = backing.getInt(36); 16793 } 16794 16795 public void write() { 16796 backing.putInt(0, minRectLength); 16797 backing.putDouble(8, minRectAspectRatio); 16798 backing.putInt(16, minRadius); 16799 backing.putInt(20, minLineLength); 16800 backing.putDouble(24, minFeatureStrength); 16801 backing.putInt(32, maxFeaturesUsed); 16802 backing.putInt(36, maxPixelDistanceFromLine); 16803 } 16804 16805 public int size() { 16806 return 40; 16807 } 16808 } 16809 16810 public static class FitEllipseOptions extends DisposedStruct { 16811 public int rejectOutliers; // Whether to use every given point or only a 16812 // subset of the points to fit the ellipse. 16813 public double minScore; // Specifies the required quality of the fitted 16814 // ellipse. 16815 public double pixelRadius; // The acceptable distance, in pixels, that a 16816 // point determined to belong to the ellipse can 16817 // be from the circumference of the ellipse. 16818 public int maxIterations; // Specifies the number of refinement iterations 16819 // you allow the function to perform on the 16820 // initial subset of points. 16821 16822 private void init() { 16823 16824 } 16825 16826 public FitEllipseOptions() { 16827 super(32); 16828 init(); 16829 } 16830 16831 public FitEllipseOptions(int rejectOutliers, double minScore, double pixelRadius, 16832 int maxIterations) { 16833 super(32); 16834 this.rejectOutliers = rejectOutliers; 16835 this.minScore = minScore; 16836 this.pixelRadius = pixelRadius; 16837 this.maxIterations = maxIterations; 16838 } 16839 16840 protected FitEllipseOptions(ByteBuffer backing, int offset) { 16841 super(backing, offset, 32); 16842 init(); 16843 } 16844 16845 protected FitEllipseOptions(long nativeObj, boolean owned) { 16846 super(nativeObj, owned, 32); 16847 init(); 16848 } 16849 16850 protected void setBuffer(ByteBuffer backing, int offset) { 16851 super.setBuffer(backing, offset, 32); 16852 } 16853 16854 public void read() { 16855 rejectOutliers = backing.getInt(0); 16856 minScore = backing.getDouble(8); 16857 pixelRadius = backing.getDouble(16); 16858 maxIterations = backing.getInt(24); 16859 } 16860 16861 public void write() { 16862 backing.putInt(0, rejectOutliers); 16863 backing.putDouble(8, minScore); 16864 backing.putDouble(16, pixelRadius); 16865 backing.putInt(24, maxIterations); 16866 } 16867 16868 public int size() { 16869 return 32; 16870 } 16871 } 16872 16873 public static class FitCircleOptions extends DisposedStruct { 16874 public int rejectOutliers; // Whether to use every given point or only a 16875 // subset of the points to fit the circle. 16876 public double minScore; // Specifies the required quality of the fitted 16877 // circle. 16878 public double pixelRadius; // The acceptable distance, in pixels, that a 16879 // point determined to belong to the circle can 16880 // be from the circumference of the circle. 16881 public int maxIterations; // Specifies the number of refinement iterations 16882 // you allow the function to perform on the 16883 // initial subset of points. 16884 16885 private void init() { 16886 16887 } 16888 16889 public FitCircleOptions() { 16890 super(32); 16891 init(); 16892 } 16893 16894 public FitCircleOptions(int rejectOutliers, double minScore, double pixelRadius, 16895 int maxIterations) { 16896 super(32); 16897 this.rejectOutliers = rejectOutliers; 16898 this.minScore = minScore; 16899 this.pixelRadius = pixelRadius; 16900 this.maxIterations = maxIterations; 16901 } 16902 16903 protected FitCircleOptions(ByteBuffer backing, int offset) { 16904 super(backing, offset, 32); 16905 init(); 16906 } 16907 16908 protected FitCircleOptions(long nativeObj, boolean owned) { 16909 super(nativeObj, owned, 32); 16910 init(); 16911 } 16912 16913 protected void setBuffer(ByteBuffer backing, int offset) { 16914 super.setBuffer(backing, offset, 32); 16915 } 16916 16917 public void read() { 16918 rejectOutliers = backing.getInt(0); 16919 minScore = backing.getDouble(8); 16920 pixelRadius = backing.getDouble(16); 16921 maxIterations = backing.getInt(24); 16922 } 16923 16924 public void write() { 16925 backing.putInt(0, rejectOutliers); 16926 backing.putDouble(8, minScore); 16927 backing.putDouble(16, pixelRadius); 16928 backing.putInt(24, maxIterations); 16929 } 16930 16931 public int size() { 16932 return 32; 16933 } 16934 } 16935 16936 public static class ConstructROIOptions2 extends DisposedStruct { 16937 public int windowNumber; // The window number of the image window. 16938 public String windowTitle; // Specifies the message string that the function 16939 // displays in the title bar of the window. 16940 public PaletteType type; // The palette type to use. 16941 public RGBValue[] palette; // If type is IMAQ_PALETTE_USER, this array is 16942 // the palette of colors to use with the window. 16943 public int maxContours; // The maximum number of contours the user will be 16944 // able to select. 16945 private ByteBuffer windowTitle_buf; 16946 private ByteBuffer palette_buf; 16947 16948 private void init() { 16949 palette = new RGBValue[0]; 16950 } 16951 16952 public ConstructROIOptions2() { 16953 super(24); 16954 init(); 16955 } 16956 16957 public ConstructROIOptions2(int windowNumber, String windowTitle, PaletteType type, 16958 RGBValue[] palette, int maxContours) { 16959 super(24); 16960 this.windowNumber = windowNumber; 16961 this.windowTitle = windowTitle; 16962 this.type = type; 16963 this.palette = palette; 16964 this.maxContours = maxContours; 16965 } 16966 16967 protected ConstructROIOptions2(ByteBuffer backing, int offset) { 16968 super(backing, offset, 24); 16969 init(); 16970 } 16971 16972 protected ConstructROIOptions2(long nativeObj, boolean owned) { 16973 super(nativeObj, owned, 24); 16974 init(); 16975 } 16976 16977 protected void setBuffer(ByteBuffer backing, int offset) { 16978 super.setBuffer(backing, offset, 24); 16979 } 16980 16981 public void read() { 16982 windowNumber = backing.getInt(0); 16983 long windowTitle_addr = getPointer(backing, 4); 16984 if (windowTitle_addr == 0) 16985 windowTitle = null; 16986 else { 16987 ByteBuffer bb = newDirectByteBuffer(windowTitle_addr, 1000); // FIXME 16988 while (bb.get() != 0) { 16989 } 16990 byte[] bytes = new byte[bb.position() - 1]; 16991 getBytes(bb, bytes, 0, bytes.length); 16992 try { 16993 windowTitle = new String(bytes, "UTF-8"); 16994 } catch (UnsupportedEncodingException e) { 16995 windowTitle = ""; 16996 } 16997 } 16998 16999 type = PaletteType.fromValue(backing.getInt(8)); 17000 int palette_numColors = backing.getInt(16); 17001 long palette_addr = getPointer(backing, 12); 17002 palette = new RGBValue[palette_numColors]; 17003 if (palette_numColors > 0 && palette_addr != 0) { 17004 ByteBuffer bb = newDirectByteBuffer(palette_addr, palette_numColors * 4); 17005 for (int i = 0, off = 0; i < palette_numColors; i++, off += 4) { 17006 palette[i] = new RGBValue(bb, off); 17007 palette[i].read(); 17008 } 17009 } 17010 maxContours = backing.getInt(20); 17011 } 17012 17013 public void write() { 17014 backing.putInt(0, windowNumber); 17015 if (windowTitle != null) { 17016 byte[] windowTitle_bytes; 17017 try { 17018 windowTitle_bytes = windowTitle.getBytes("UTF-8"); 17019 } catch (UnsupportedEncodingException e) { 17020 windowTitle_bytes = new byte[0]; 17021 } 17022 windowTitle_buf = ByteBuffer.allocateDirect(windowTitle_bytes.length + 1); 17023 putBytes(windowTitle_buf, windowTitle_bytes, 0, windowTitle_bytes.length).put( 17024 windowTitle_bytes.length, (byte) 0); 17025 } 17026 putPointer(backing, 4, windowTitle == null ? 0 : getByteBufferAddress(windowTitle_buf)); 17027 if (type != null) 17028 backing.putInt(8, type.getValue()); 17029 palette_buf = ByteBuffer.allocateDirect(palette.length * 4).order(ByteOrder.nativeOrder()); 17030 for (int i = 0, off = 0; i < palette.length; i++, off += 4) { 17031 palette[i].setBuffer(palette_buf, off); 17032 palette[i].write(); 17033 } 17034 backing.putInt(16, palette.length); 17035 putPointer(backing, 12, palette_buf); 17036 backing.putInt(20, maxContours); 17037 } 17038 17039 public int size() { 17040 return 24; 17041 } 17042 } 17043 17044 public static class HSLValue extends DisposedStruct { 17045 public short L; // The color luminance. 17046 public short S; // The color saturation. 17047 public short H; // The color hue. 17048 public short alpha; // The alpha value of the color, which represents extra 17049 // information about a color image, such as gamma 17050 // correction. 17051 17052 private void init() { 17053 17054 } 17055 17056 public HSLValue() { 17057 super(4); 17058 init(); 17059 } 17060 17061 public HSLValue(int L, int S, int H, int alpha) { 17062 super(4); 17063 this.L = (short) L; 17064 this.S = (short) S; 17065 this.H = (short) H; 17066 this.alpha = (short) alpha; 17067 } 17068 17069 protected HSLValue(ByteBuffer backing, int offset) { 17070 super(backing, offset, 4); 17071 init(); 17072 } 17073 17074 protected HSLValue(long nativeObj, boolean owned) { 17075 super(nativeObj, owned, 4); 17076 init(); 17077 } 17078 17079 protected void setBuffer(ByteBuffer backing, int offset) { 17080 super.setBuffer(backing, offset, 4); 17081 } 17082 17083 public void read() { 17084 L = (short) (backing.get(0) & 0xff); 17085 S = (short) (backing.get(1) & 0xff); 17086 H = (short) (backing.get(2) & 0xff); 17087 alpha = (short) (backing.get(3) & 0xff); 17088 } 17089 17090 public void write() { 17091 backing.put(0, (byte) (L & 0xff)); 17092 backing.put(1, (byte) (S & 0xff)); 17093 backing.put(2, (byte) (H & 0xff)); 17094 backing.put(3, (byte) (alpha & 0xff)); 17095 } 17096 17097 public int size() { 17098 return 4; 17099 } 17100 } 17101 17102 public static class HSVValue extends DisposedStruct { 17103 public short V; // The color value. 17104 public short S; // The color saturation. 17105 public short H; // The color hue. 17106 public short alpha; // The alpha value of the color, which represents extra 17107 // information about a color image, such as gamma 17108 // correction. 17109 17110 private void init() { 17111 17112 } 17113 17114 public HSVValue() { 17115 super(4); 17116 init(); 17117 } 17118 17119 public HSVValue(int V, int S, int H, int alpha) { 17120 super(4); 17121 this.V = (short) V; 17122 this.S = (short) S; 17123 this.H = (short) H; 17124 this.alpha = (short) alpha; 17125 } 17126 17127 protected HSVValue(ByteBuffer backing, int offset) { 17128 super(backing, offset, 4); 17129 init(); 17130 } 17131 17132 protected HSVValue(long nativeObj, boolean owned) { 17133 super(nativeObj, owned, 4); 17134 init(); 17135 } 17136 17137 protected void setBuffer(ByteBuffer backing, int offset) { 17138 super.setBuffer(backing, offset, 4); 17139 } 17140 17141 public void read() { 17142 V = (short) (backing.get(0) & 0xff); 17143 S = (short) (backing.get(1) & 0xff); 17144 H = (short) (backing.get(2) & 0xff); 17145 alpha = (short) (backing.get(3) & 0xff); 17146 } 17147 17148 public void write() { 17149 backing.put(0, (byte) (V & 0xff)); 17150 backing.put(1, (byte) (S & 0xff)); 17151 backing.put(2, (byte) (H & 0xff)); 17152 backing.put(3, (byte) (alpha & 0xff)); 17153 } 17154 17155 public int size() { 17156 return 4; 17157 } 17158 } 17159 17160 public static class HSIValue extends DisposedStruct { 17161 public short I; // The color intensity. 17162 public short S; // The color saturation. 17163 public short H; // The color hue. 17164 public short alpha; // The alpha value of the color, which represents extra 17165 // information about a color image, such as gamma 17166 // correction. 17167 17168 private void init() { 17169 17170 } 17171 17172 public HSIValue() { 17173 super(4); 17174 init(); 17175 } 17176 17177 public HSIValue(int I, int S, int H, int alpha) { 17178 super(4); 17179 this.I = (short) I; 17180 this.S = (short) S; 17181 this.H = (short) H; 17182 this.alpha = (short) alpha; 17183 } 17184 17185 protected HSIValue(ByteBuffer backing, int offset) { 17186 super(backing, offset, 4); 17187 init(); 17188 } 17189 17190 protected HSIValue(long nativeObj, boolean owned) { 17191 super(nativeObj, owned, 4); 17192 init(); 17193 } 17194 17195 protected void setBuffer(ByteBuffer backing, int offset) { 17196 super.setBuffer(backing, offset, 4); 17197 } 17198 17199 public void read() { 17200 I = (short) (backing.get(0) & 0xff); 17201 S = (short) (backing.get(1) & 0xff); 17202 H = (short) (backing.get(2) & 0xff); 17203 alpha = (short) (backing.get(3) & 0xff); 17204 } 17205 17206 public void write() { 17207 backing.put(0, (byte) (I & 0xff)); 17208 backing.put(1, (byte) (S & 0xff)); 17209 backing.put(2, (byte) (H & 0xff)); 17210 backing.put(3, (byte) (alpha & 0xff)); 17211 } 17212 17213 public int size() { 17214 return 4; 17215 } 17216 } 17217 17218 public static class CIELabValue extends DisposedStruct { 17219 public double b; // The yellow/blue information of the color. 17220 public double a; // The red/green information of the color. 17221 public double L; // The color lightness. 17222 public short alpha; // The alpha value of the color, which represents extra 17223 // information about a color image, such as gamma 17224 // correction. 17225 17226 private void init() { 17227 17228 } 17229 17230 public CIELabValue() { 17231 super(32); 17232 init(); 17233 } 17234 17235 public CIELabValue(double b, double a, double L, int alpha) { 17236 super(32); 17237 this.b = b; 17238 this.a = a; 17239 this.L = L; 17240 this.alpha = (short) alpha; 17241 } 17242 17243 protected CIELabValue(ByteBuffer backing, int offset) { 17244 super(backing, offset, 32); 17245 init(); 17246 } 17247 17248 protected CIELabValue(long nativeObj, boolean owned) { 17249 super(nativeObj, owned, 32); 17250 init(); 17251 } 17252 17253 protected void setBuffer(ByteBuffer backing, int offset) { 17254 super.setBuffer(backing, offset, 32); 17255 } 17256 17257 public void read() { 17258 b = backing.getDouble(0); 17259 a = backing.getDouble(8); 17260 L = backing.getDouble(16); 17261 alpha = (short) (backing.get(24) & 0xff); 17262 } 17263 17264 public void write() { 17265 backing.putDouble(0, b); 17266 backing.putDouble(8, a); 17267 backing.putDouble(16, L); 17268 backing.put(24, (byte) (alpha & 0xff)); 17269 } 17270 17271 public int size() { 17272 return 32; 17273 } 17274 } 17275 17276 public static class CIEXYZValue extends DisposedStruct { 17277 public double Z; // The Z color information. 17278 public double Y; // The color luminance. 17279 public double X; // The X color information. 17280 public short alpha; // The alpha value of the color, which represents extra 17281 // information about a color image, such as gamma 17282 // correction. 17283 17284 private void init() { 17285 17286 } 17287 17288 public CIEXYZValue() { 17289 super(32); 17290 init(); 17291 } 17292 17293 public CIEXYZValue(double Z, double Y, double X, int alpha) { 17294 super(32); 17295 this.Z = Z; 17296 this.Y = Y; 17297 this.X = X; 17298 this.alpha = (short) alpha; 17299 } 17300 17301 protected CIEXYZValue(ByteBuffer backing, int offset) { 17302 super(backing, offset, 32); 17303 init(); 17304 } 17305 17306 protected CIEXYZValue(long nativeObj, boolean owned) { 17307 super(nativeObj, owned, 32); 17308 init(); 17309 } 17310 17311 protected void setBuffer(ByteBuffer backing, int offset) { 17312 super.setBuffer(backing, offset, 32); 17313 } 17314 17315 public void read() { 17316 Z = backing.getDouble(0); 17317 Y = backing.getDouble(8); 17318 X = backing.getDouble(16); 17319 alpha = (short) (backing.get(24) & 0xff); 17320 } 17321 17322 public void write() { 17323 backing.putDouble(0, Z); 17324 backing.putDouble(8, Y); 17325 backing.putDouble(16, X); 17326 backing.put(24, (byte) (alpha & 0xff)); 17327 } 17328 17329 public int size() { 17330 return 32; 17331 } 17332 } 17333 17334 public static class BestEllipse2 extends DisposedStruct { 17335 public PointFloat center; // The coordinate location of the center of the 17336 // ellipse. 17337 public PointFloat majorAxisStart; // The coordinate location of the start of 17338 // the major axis of the ellipse. 17339 public PointFloat majorAxisEnd; // The coordinate location of the end of the 17340 // major axis of the ellipse. 17341 public PointFloat minorAxisStart; // The coordinate location of the start of 17342 // the minor axis of the ellipse. 17343 public PointFloat minorAxisEnd; // The coordinate location of the end of the 17344 // minor axis of the ellipse. 17345 public double area; // The area of the ellipse. 17346 public double perimeter; // The length of the perimeter of the ellipse. 17347 public double error; // Represents the least square error of the fitted 17348 // ellipse to the entire set of points. 17349 public int valid; // This element is TRUE if the function achieved the 17350 // minimum score within the number of allowed refinement 17351 // iterations and FALSE if the function did not achieve 17352 // the minimum score. 17353 public int[] pointsUsed; // An array of the indexes for the points array 17354 // indicating which points the function used to fit 17355 // the ellipse. 17356 private ByteBuffer pointsUsed_buf; 17357 17358 private void init() { 17359 center = new PointFloat(backing, 0); 17360 majorAxisStart = new PointFloat(backing, 8); 17361 majorAxisEnd = new PointFloat(backing, 16); 17362 minorAxisStart = new PointFloat(backing, 24); 17363 minorAxisEnd = new PointFloat(backing, 32); 17364 pointsUsed = new int[0]; 17365 } 17366 17367 public BestEllipse2() { 17368 super(80); 17369 init(); 17370 } 17371 17372 public BestEllipse2(PointFloat center, PointFloat majorAxisStart, PointFloat majorAxisEnd, 17373 PointFloat minorAxisStart, PointFloat minorAxisEnd, double area, double perimeter, 17374 double error, int valid, int[] pointsUsed) { 17375 super(80); 17376 this.center = center; 17377 this.majorAxisStart = majorAxisStart; 17378 this.majorAxisEnd = majorAxisEnd; 17379 this.minorAxisStart = minorAxisStart; 17380 this.minorAxisEnd = minorAxisEnd; 17381 this.area = area; 17382 this.perimeter = perimeter; 17383 this.error = error; 17384 this.valid = valid; 17385 this.pointsUsed = pointsUsed; 17386 } 17387 17388 protected BestEllipse2(ByteBuffer backing, int offset) { 17389 super(backing, offset, 80); 17390 init(); 17391 } 17392 17393 protected BestEllipse2(long nativeObj, boolean owned) { 17394 super(nativeObj, owned, 80); 17395 init(); 17396 } 17397 17398 protected void setBuffer(ByteBuffer backing, int offset) { 17399 super.setBuffer(backing, offset, 80); 17400 } 17401 17402 public void read() { 17403 center.read(); 17404 majorAxisStart.read(); 17405 majorAxisEnd.read(); 17406 minorAxisStart.read(); 17407 minorAxisEnd.read(); 17408 area = backing.getDouble(40); 17409 perimeter = backing.getDouble(48); 17410 error = backing.getDouble(56); 17411 valid = backing.getInt(64); 17412 int pointsUsed_numPointsUsed = backing.getInt(72); 17413 long pointsUsed_addr = getPointer(backing, 68); 17414 pointsUsed = new int[pointsUsed_numPointsUsed]; 17415 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 17416 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed * 4).asIntBuffer().get( 17417 pointsUsed); 17418 } 17419 } 17420 17421 public void write() { 17422 center.write(); 17423 majorAxisStart.write(); 17424 majorAxisEnd.write(); 17425 minorAxisStart.write(); 17426 minorAxisEnd.write(); 17427 backing.putDouble(40, area); 17428 backing.putDouble(48, perimeter); 17429 backing.putDouble(56, error); 17430 backing.putInt(64, valid); 17431 pointsUsed_buf = 17432 ByteBuffer.allocateDirect(pointsUsed.length * 4).order(ByteOrder.nativeOrder()); 17433 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 17434 backing.putInt(72, pointsUsed.length); 17435 putPointer(backing, 68, pointsUsed_buf); 17436 } 17437 17438 public int size() { 17439 return 80; 17440 } 17441 } 17442 17443 public static class LearnPatternAdvancedOptions extends DisposedStruct { 17444 public LearnPatternAdvancedShiftOptions shiftOptions; // Use this element to 17445 // control the 17446 // behavior of 17447 // imaqLearnPattern2() 17448 // during the 17449 // shift-invariant 17450 // learning phase. 17451 public LearnPatternAdvancedRotationOptions rotationOptions; // Use this 17452 // element to 17453 // control the 17454 // behavior of 17455 // imaqLearnPattern2()during 17456 // the 17457 // rotation-invariant 17458 // learning 17459 // phase. 17460 17461 private void init() { 17462 17463 } 17464 17465 public LearnPatternAdvancedOptions() { 17466 super(8); 17467 init(); 17468 } 17469 17470 public LearnPatternAdvancedOptions(LearnPatternAdvancedShiftOptions shiftOptions, 17471 LearnPatternAdvancedRotationOptions rotationOptions) { 17472 super(8); 17473 this.shiftOptions = shiftOptions; 17474 this.rotationOptions = rotationOptions; 17475 } 17476 17477 protected LearnPatternAdvancedOptions(ByteBuffer backing, int offset) { 17478 super(backing, offset, 8); 17479 init(); 17480 } 17481 17482 protected LearnPatternAdvancedOptions(long nativeObj, boolean owned) { 17483 super(nativeObj, owned, 8); 17484 init(); 17485 } 17486 17487 protected void setBuffer(ByteBuffer backing, int offset) { 17488 super.setBuffer(backing, offset, 8); 17489 } 17490 17491 public void read() { 17492 long shiftOptions_addr = getPointer(backing, 0); 17493 if (shiftOptions_addr == 0) 17494 shiftOptions = null; 17495 else 17496 shiftOptions = new LearnPatternAdvancedShiftOptions(shiftOptions_addr, false); 17497 long rotationOptions_addr = getPointer(backing, 4); 17498 if (rotationOptions_addr == 0) 17499 rotationOptions = null; 17500 else 17501 rotationOptions = new LearnPatternAdvancedRotationOptions(rotationOptions_addr, false); 17502 } 17503 17504 public void write() { 17505 putPointer(backing, 0, shiftOptions); 17506 putPointer(backing, 4, rotationOptions); 17507 } 17508 17509 public int size() { 17510 return 8; 17511 } 17512 } 17513 17514 public static class AVIInfo extends DisposedStruct { 17515 public int width; // The width of each frame. 17516 public int height; // The height of each frame. 17517 public ImageType imageType; // The type of images this AVI contains. 17518 public int numFrames; // The number of frames in the AVI. 17519 public int framesPerSecond; // The number of frames per second this AVI 17520 // should be shown at. 17521 public String filterName; // The name of the compression filter used to 17522 // create this AVI. 17523 public int hasData; // Specifies whether this AVI has data attached to each 17524 // frame or not. 17525 public int maxDataSize; // If this AVI has data, the maximum size of the 17526 // data in each frame. 17527 private ByteBuffer filterName_buf; 17528 17529 private void init() { 17530 17531 } 17532 17533 public AVIInfo() { 17534 super(32); 17535 init(); 17536 } 17537 17538 public AVIInfo(int width, int height, ImageType imageType, int numFrames, int framesPerSecond, 17539 String filterName, int hasData, int maxDataSize) { 17540 super(32); 17541 this.width = width; 17542 this.height = height; 17543 this.imageType = imageType; 17544 this.numFrames = numFrames; 17545 this.framesPerSecond = framesPerSecond; 17546 this.filterName = filterName; 17547 this.hasData = hasData; 17548 this.maxDataSize = maxDataSize; 17549 } 17550 17551 protected AVIInfo(ByteBuffer backing, int offset) { 17552 super(backing, offset, 32); 17553 init(); 17554 } 17555 17556 protected AVIInfo(long nativeObj, boolean owned) { 17557 super(nativeObj, owned, 32); 17558 init(); 17559 } 17560 17561 protected void setBuffer(ByteBuffer backing, int offset) { 17562 super.setBuffer(backing, offset, 32); 17563 } 17564 17565 public void read() { 17566 width = backing.getInt(0); 17567 height = backing.getInt(4); 17568 imageType = ImageType.fromValue(backing.getInt(8)); 17569 numFrames = backing.getInt(12); 17570 framesPerSecond = backing.getInt(16); 17571 long filterName_addr = getPointer(backing, 20); 17572 if (filterName_addr == 0) 17573 filterName = null; 17574 else { 17575 ByteBuffer bb = newDirectByteBuffer(filterName_addr, 1000); // FIXME 17576 while (bb.get() != 0) { 17577 } 17578 byte[] bytes = new byte[bb.position() - 1]; 17579 getBytes(bb, bytes, 0, bytes.length); 17580 try { 17581 filterName = new String(bytes, "UTF-8"); 17582 } catch (UnsupportedEncodingException e) { 17583 filterName = ""; 17584 } 17585 } 17586 17587 hasData = backing.getInt(24); 17588 maxDataSize = backing.getInt(28); 17589 } 17590 17591 public void write() { 17592 backing.putInt(0, width); 17593 backing.putInt(4, height); 17594 if (imageType != null) 17595 backing.putInt(8, imageType.getValue()); 17596 backing.putInt(12, numFrames); 17597 backing.putInt(16, framesPerSecond); 17598 if (filterName != null) { 17599 byte[] filterName_bytes; 17600 try { 17601 filterName_bytes = filterName.getBytes("UTF-8"); 17602 } catch (UnsupportedEncodingException e) { 17603 filterName_bytes = new byte[0]; 17604 } 17605 filterName_buf = ByteBuffer.allocateDirect(filterName_bytes.length + 1); 17606 putBytes(filterName_buf, filterName_bytes, 0, filterName_bytes.length).put( 17607 filterName_bytes.length, (byte) 0); 17608 } 17609 putPointer(backing, 20, filterName == null ? 0 : getByteBufferAddress(filterName_buf)); 17610 backing.putInt(24, hasData); 17611 backing.putInt(28, maxDataSize); 17612 } 17613 17614 public int size() { 17615 return 32; 17616 } 17617 } 17618 17619 public static class LearnPatternAdvancedShiftOptions extends DisposedStruct { 17620 public int initialStepSize; // The largest number of image pixels to shift 17621 // the sample across the inspection image during 17622 // the initial phase of shift-invariant 17623 // matching. 17624 public int initialSampleSize; // Specifies the number of template pixels 17625 // that you want to include in a sample for 17626 // the initial phase of shift-invariant 17627 // matching. 17628 public double initialSampleSizeFactor; // Specifies the size of the sample 17629 // for the initial phase of 17630 // shift-invariant matching as a 17631 // percent of the template size, in 17632 // pixels. 17633 public int finalSampleSize; // Specifies the number of template pixels you 17634 // want to add to initialSampleSize for the 17635 // final phase of shift-invariant matching. 17636 public double finalSampleSizeFactor; // Specifies the size of the sample for 17637 // the final phase of shift-invariant 17638 // matching as a percent of the edge 17639 // points in the template, in pixels. 17640 public int subpixelSampleSize; // Specifies the number of template pixels 17641 // that you want to include in a sample for 17642 // the subpixel phase of shift-invariant 17643 // matching. 17644 public double subpixelSampleSizeFactor; // Specifies the size of the sample 17645 // for the subpixel phase of 17646 // shift-invariant matching as a 17647 // percent of the template size, in 17648 // pixels. 17649 17650 private void init() { 17651 17652 } 17653 17654 public LearnPatternAdvancedShiftOptions() { 17655 super(48); 17656 init(); 17657 } 17658 17659 public LearnPatternAdvancedShiftOptions(int initialStepSize, int initialSampleSize, 17660 double initialSampleSizeFactor, int finalSampleSize, double finalSampleSizeFactor, 17661 int subpixelSampleSize, double subpixelSampleSizeFactor) { 17662 super(48); 17663 this.initialStepSize = initialStepSize; 17664 this.initialSampleSize = initialSampleSize; 17665 this.initialSampleSizeFactor = initialSampleSizeFactor; 17666 this.finalSampleSize = finalSampleSize; 17667 this.finalSampleSizeFactor = finalSampleSizeFactor; 17668 this.subpixelSampleSize = subpixelSampleSize; 17669 this.subpixelSampleSizeFactor = subpixelSampleSizeFactor; 17670 } 17671 17672 protected LearnPatternAdvancedShiftOptions(ByteBuffer backing, int offset) { 17673 super(backing, offset, 48); 17674 init(); 17675 } 17676 17677 protected LearnPatternAdvancedShiftOptions(long nativeObj, boolean owned) { 17678 super(nativeObj, owned, 48); 17679 init(); 17680 } 17681 17682 protected void setBuffer(ByteBuffer backing, int offset) { 17683 super.setBuffer(backing, offset, 48); 17684 } 17685 17686 public void read() { 17687 initialStepSize = backing.getInt(0); 17688 initialSampleSize = backing.getInt(4); 17689 initialSampleSizeFactor = backing.getDouble(8); 17690 finalSampleSize = backing.getInt(16); 17691 finalSampleSizeFactor = backing.getDouble(24); 17692 subpixelSampleSize = backing.getInt(32); 17693 subpixelSampleSizeFactor = backing.getDouble(40); 17694 } 17695 17696 public void write() { 17697 backing.putInt(0, initialStepSize); 17698 backing.putInt(4, initialSampleSize); 17699 backing.putDouble(8, initialSampleSizeFactor); 17700 backing.putInt(16, finalSampleSize); 17701 backing.putDouble(24, finalSampleSizeFactor); 17702 backing.putInt(32, subpixelSampleSize); 17703 backing.putDouble(40, subpixelSampleSizeFactor); 17704 } 17705 17706 public int size() { 17707 return 48; 17708 } 17709 } 17710 17711 public static class LearnPatternAdvancedRotationOptions extends DisposedStruct { 17712 public SearchStrategy searchStrategySupport; // Specifies the aggressiveness 17713 // of the rotation search 17714 // strategy available during 17715 // the matching phase. 17716 public int initialStepSize; // The largest number of image pixels to shift 17717 // the sample across the inspection image during 17718 // the initial phase of matching. 17719 public int initialSampleSize; // Specifies the number of template pixels 17720 // that you want to include in a sample for 17721 // the initial phase of rotation-invariant 17722 // matching. 17723 public double initialSampleSizeFactor; // Specifies the size of the sample 17724 // for the initial phase of 17725 // rotation-invariant matching as a 17726 // percent of the template size, in 17727 // pixels. 17728 public int initialAngularAccuracy; // Sets the angle accuracy, in degrees, 17729 // to use during the initial phase of 17730 // rotation-invariant matching. 17731 public int finalSampleSize; // Specifies the number of template pixels you 17732 // want to add to initialSampleSize for the 17733 // final phase of rotation-invariant matching. 17734 public double finalSampleSizeFactor; // Specifies the size of the sample for 17735 // the final phase of 17736 // rotation-invariant matching as a 17737 // percent of the edge points in the 17738 // template, in pixels. 17739 public int finalAngularAccuracy; // Sets the angle accuracy, in degrees, to 17740 // use during the final phase of the 17741 // rotation-invariant matching. 17742 public int subpixelSampleSize; // Specifies the number of template pixels 17743 // that you want to include in a sample for 17744 // the subpixel phase of rotation-invariant 17745 // matching. 17746 public double subpixelSampleSizeFactor; // Specifies the size of the sample 17747 // for the subpixel phase of 17748 // rotation-invariant matching as a 17749 // percent of the template size, in 17750 // pixels. 17751 17752 private void init() { 17753 17754 } 17755 17756 public LearnPatternAdvancedRotationOptions() { 17757 super(56); 17758 init(); 17759 } 17760 17761 public LearnPatternAdvancedRotationOptions(SearchStrategy searchStrategySupport, 17762 int initialStepSize, int initialSampleSize, double initialSampleSizeFactor, 17763 int initialAngularAccuracy, int finalSampleSize, double finalSampleSizeFactor, 17764 int finalAngularAccuracy, int subpixelSampleSize, double subpixelSampleSizeFactor) { 17765 super(56); 17766 this.searchStrategySupport = searchStrategySupport; 17767 this.initialStepSize = initialStepSize; 17768 this.initialSampleSize = initialSampleSize; 17769 this.initialSampleSizeFactor = initialSampleSizeFactor; 17770 this.initialAngularAccuracy = initialAngularAccuracy; 17771 this.finalSampleSize = finalSampleSize; 17772 this.finalSampleSizeFactor = finalSampleSizeFactor; 17773 this.finalAngularAccuracy = finalAngularAccuracy; 17774 this.subpixelSampleSize = subpixelSampleSize; 17775 this.subpixelSampleSizeFactor = subpixelSampleSizeFactor; 17776 } 17777 17778 protected LearnPatternAdvancedRotationOptions(ByteBuffer backing, int offset) { 17779 super(backing, offset, 56); 17780 init(); 17781 } 17782 17783 protected LearnPatternAdvancedRotationOptions(long nativeObj, boolean owned) { 17784 super(nativeObj, owned, 56); 17785 init(); 17786 } 17787 17788 protected void setBuffer(ByteBuffer backing, int offset) { 17789 super.setBuffer(backing, offset, 56); 17790 } 17791 17792 public void read() { 17793 searchStrategySupport = SearchStrategy.fromValue(backing.getInt(0)); 17794 initialStepSize = backing.getInt(4); 17795 initialSampleSize = backing.getInt(8); 17796 initialSampleSizeFactor = backing.getDouble(16); 17797 initialAngularAccuracy = backing.getInt(24); 17798 finalSampleSize = backing.getInt(28); 17799 finalSampleSizeFactor = backing.getDouble(32); 17800 finalAngularAccuracy = backing.getInt(40); 17801 subpixelSampleSize = backing.getInt(44); 17802 subpixelSampleSizeFactor = backing.getDouble(48); 17803 } 17804 17805 public void write() { 17806 if (searchStrategySupport != null) 17807 backing.putInt(0, searchStrategySupport.getValue()); 17808 backing.putInt(4, initialStepSize); 17809 backing.putInt(8, initialSampleSize); 17810 backing.putDouble(16, initialSampleSizeFactor); 17811 backing.putInt(24, initialAngularAccuracy); 17812 backing.putInt(28, finalSampleSize); 17813 backing.putDouble(32, finalSampleSizeFactor); 17814 backing.putInt(40, finalAngularAccuracy); 17815 backing.putInt(44, subpixelSampleSize); 17816 backing.putDouble(48, subpixelSampleSizeFactor); 17817 } 17818 17819 public int size() { 17820 return 56; 17821 } 17822 } 17823 17824 public static class MatchPatternAdvancedOptions extends DisposedStruct { 17825 public int subpixelIterations; // Defines the maximum number of incremental 17826 // improvements used to refine matching using 17827 // subpixel information. 17828 public double subpixelTolerance; // Defines the maximum amount of change, in 17829 // pixels, between consecutive incremental 17830 // improvements in the match position that 17831 // you want to trigger the end of the 17832 // refinement process. 17833 public int initialMatchListLength; // Specifies the maximum size of the 17834 // match list. 17835 public int matchListReductionFactor; // Specifies the reduction of the match 17836 // list as matches are refined. 17837 public int initialStepSize; // Specifies the number of pixels to shift the 17838 // sample across the inspection image during the 17839 // initial phase of shift-invariant matching. 17840 public SearchStrategy searchStrategy; // Specifies the aggressiveness of the 17841 // rotation search strategy. 17842 public int intermediateAngularAccuracy; // Specifies the accuracy to use 17843 // during the intermediate phase of 17844 // rotation-invariant matching. 17845 17846 private void init() { 17847 17848 } 17849 17850 public MatchPatternAdvancedOptions() { 17851 super(40); 17852 init(); 17853 } 17854 17855 public MatchPatternAdvancedOptions(int subpixelIterations, double subpixelTolerance, 17856 int initialMatchListLength, int matchListReductionFactor, int initialStepSize, 17857 SearchStrategy searchStrategy, int intermediateAngularAccuracy) { 17858 super(40); 17859 this.subpixelIterations = subpixelIterations; 17860 this.subpixelTolerance = subpixelTolerance; 17861 this.initialMatchListLength = initialMatchListLength; 17862 this.matchListReductionFactor = matchListReductionFactor; 17863 this.initialStepSize = initialStepSize; 17864 this.searchStrategy = searchStrategy; 17865 this.intermediateAngularAccuracy = intermediateAngularAccuracy; 17866 } 17867 17868 protected MatchPatternAdvancedOptions(ByteBuffer backing, int offset) { 17869 super(backing, offset, 40); 17870 init(); 17871 } 17872 17873 protected MatchPatternAdvancedOptions(long nativeObj, boolean owned) { 17874 super(nativeObj, owned, 40); 17875 init(); 17876 } 17877 17878 protected void setBuffer(ByteBuffer backing, int offset) { 17879 super.setBuffer(backing, offset, 40); 17880 } 17881 17882 public void read() { 17883 subpixelIterations = backing.getInt(0); 17884 subpixelTolerance = backing.getDouble(8); 17885 initialMatchListLength = backing.getInt(16); 17886 matchListReductionFactor = backing.getInt(20); 17887 initialStepSize = backing.getInt(24); 17888 searchStrategy = SearchStrategy.fromValue(backing.getInt(28)); 17889 intermediateAngularAccuracy = backing.getInt(32); 17890 } 17891 17892 public void write() { 17893 backing.putInt(0, subpixelIterations); 17894 backing.putDouble(8, subpixelTolerance); 17895 backing.putInt(16, initialMatchListLength); 17896 backing.putInt(20, matchListReductionFactor); 17897 backing.putInt(24, initialStepSize); 17898 if (searchStrategy != null) 17899 backing.putInt(28, searchStrategy.getValue()); 17900 backing.putInt(32, intermediateAngularAccuracy); 17901 } 17902 17903 public int size() { 17904 return 40; 17905 } 17906 } 17907 17908 public static class ParticleFilterCriteria2 extends DisposedStruct { 17909 public MeasurementType parameter; // The morphological measurement that the 17910 // function uses for filtering. 17911 public float lower; // The lower bound of the criteria range. 17912 public float upper; // The upper bound of the criteria range. 17913 public int calibrated; // Set this element to TRUE to take calibrated 17914 // measurements. 17915 public int exclude; // Set this element to TRUE to indicate that a match 17916 // occurs when the measurement is outside the criteria 17917 // range. 17918 17919 private void init() { 17920 17921 } 17922 17923 public ParticleFilterCriteria2() { 17924 super(20); 17925 init(); 17926 } 17927 17928 public ParticleFilterCriteria2(MeasurementType parameter, double lower, double upper, 17929 int calibrated, int exclude) { 17930 super(20); 17931 this.parameter = parameter; 17932 this.lower = (float) lower; 17933 this.upper = (float) upper; 17934 this.calibrated = calibrated; 17935 this.exclude = exclude; 17936 } 17937 17938 protected ParticleFilterCriteria2(ByteBuffer backing, int offset) { 17939 super(backing, offset, 20); 17940 init(); 17941 } 17942 17943 protected ParticleFilterCriteria2(long nativeObj, boolean owned) { 17944 super(nativeObj, owned, 20); 17945 init(); 17946 } 17947 17948 protected void setBuffer(ByteBuffer backing, int offset) { 17949 super.setBuffer(backing, offset, 20); 17950 } 17951 17952 public void read() { 17953 parameter = MeasurementType.fromValue(backing.getInt(0)); 17954 lower = backing.getFloat(4); 17955 upper = backing.getFloat(8); 17956 calibrated = backing.getInt(12); 17957 exclude = backing.getInt(16); 17958 } 17959 17960 public void write() { 17961 if (parameter != null) 17962 backing.putInt(0, parameter.getValue()); 17963 backing.putFloat(4, lower); 17964 backing.putFloat(8, upper); 17965 backing.putInt(12, calibrated); 17966 backing.putInt(16, exclude); 17967 } 17968 17969 public int size() { 17970 return 20; 17971 } 17972 } 17973 17974 public static class BestCircle2 extends DisposedStruct { 17975 public PointFloat center; // The coordinate location of the center of the 17976 // circle. 17977 public double radius; // The radius of the circle. 17978 public double area; // The area of the circle. 17979 public double perimeter; // The length of the perimeter of the circle. 17980 public double error; // Represents the least square error of the fitted 17981 // circle to the entire set of points. 17982 public int valid; // This element is TRUE if the function achieved the 17983 // minimum score within the number of allowed refinement 17984 // iterations and FALSE if the function did not achieve 17985 // the minimum score. 17986 public int[] pointsUsed; // An array of the indexes for the points array 17987 // indicating which points the function used to fit 17988 // the circle. 17989 private ByteBuffer pointsUsed_buf; 17990 17991 private void init() { 17992 center = new PointFloat(backing, 0); 17993 pointsUsed = new int[0]; 17994 } 17995 17996 public BestCircle2() { 17997 super(56); 17998 init(); 17999 } 18000 18001 public BestCircle2(PointFloat center, double radius, double area, double perimeter, 18002 double error, int valid, int[] pointsUsed) { 18003 super(56); 18004 this.center = center; 18005 this.radius = radius; 18006 this.area = area; 18007 this.perimeter = perimeter; 18008 this.error = error; 18009 this.valid = valid; 18010 this.pointsUsed = pointsUsed; 18011 } 18012 18013 protected BestCircle2(ByteBuffer backing, int offset) { 18014 super(backing, offset, 56); 18015 init(); 18016 } 18017 18018 protected BestCircle2(long nativeObj, boolean owned) { 18019 super(nativeObj, owned, 56); 18020 init(); 18021 } 18022 18023 protected void setBuffer(ByteBuffer backing, int offset) { 18024 super.setBuffer(backing, offset, 56); 18025 } 18026 18027 public void read() { 18028 center.read(); 18029 radius = backing.getDouble(8); 18030 area = backing.getDouble(16); 18031 perimeter = backing.getDouble(24); 18032 error = backing.getDouble(32); 18033 valid = backing.getInt(40); 18034 int pointsUsed_numPointsUsed = backing.getInt(48); 18035 long pointsUsed_addr = getPointer(backing, 44); 18036 pointsUsed = new int[pointsUsed_numPointsUsed]; 18037 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 18038 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed * 4).asIntBuffer().get( 18039 pointsUsed); 18040 } 18041 } 18042 18043 public void write() { 18044 center.write(); 18045 backing.putDouble(8, radius); 18046 backing.putDouble(16, area); 18047 backing.putDouble(24, perimeter); 18048 backing.putDouble(32, error); 18049 backing.putInt(40, valid); 18050 pointsUsed_buf = 18051 ByteBuffer.allocateDirect(pointsUsed.length * 4).order(ByteOrder.nativeOrder()); 18052 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 18053 backing.putInt(48, pointsUsed.length); 18054 putPointer(backing, 44, pointsUsed_buf); 18055 } 18056 18057 public int size() { 18058 return 56; 18059 } 18060 } 18061 18062 public static class OCRSpacingOptions extends DisposedStruct { 18063 public int minCharSpacing; // The minimum number of pixels that must be 18064 // between two characters for NI Vision to train 18065 // or read the characters separately. 18066 public int minCharSize; // The minimum number of pixels required for an 18067 // object to be a potentially identifiable 18068 // character. 18069 public int maxCharSize; // The maximum number of pixels required for an 18070 // object to be a potentially identifiable 18071 // character. 18072 public int maxHorizontalElementSpacing; // The maximum horizontal spacing, 18073 // in pixels, allowed between 18074 // character elements to train or 18075 // read the character elements as a 18076 // single character. 18077 public int maxVerticalElementSpacing; // The maximum vertical element 18078 // spacing in pixels. 18079 public int minBoundingRectWidth; // The minimum possible width, in pixels, 18080 // for a character bounding rectangle. 18081 public int maxBoundingRectWidth; // The maximum possible width, in pixels, 18082 // for a character bounding rectangle. 18083 public int minBoundingRectHeight; // The minimum possible height, in pixels, 18084 // for a character bounding rectangle. 18085 public int maxBoundingRectHeight; // The maximum possible height, in pixels, 18086 // for a character bounding rectangle. 18087 public int autoSplit; // Set this element to TRUE to automatically adjust 18088 // the location of the character bounding rectangle 18089 // when characters overlap vertically. 18090 18091 private void init() { 18092 18093 } 18094 18095 public OCRSpacingOptions() { 18096 super(40); 18097 init(); 18098 } 18099 18100 public OCRSpacingOptions(int minCharSpacing, int minCharSize, int maxCharSize, 18101 int maxHorizontalElementSpacing, int maxVerticalElementSpacing, int minBoundingRectWidth, 18102 int maxBoundingRectWidth, int minBoundingRectHeight, int maxBoundingRectHeight, 18103 int autoSplit) { 18104 super(40); 18105 this.minCharSpacing = minCharSpacing; 18106 this.minCharSize = minCharSize; 18107 this.maxCharSize = maxCharSize; 18108 this.maxHorizontalElementSpacing = maxHorizontalElementSpacing; 18109 this.maxVerticalElementSpacing = maxVerticalElementSpacing; 18110 this.minBoundingRectWidth = minBoundingRectWidth; 18111 this.maxBoundingRectWidth = maxBoundingRectWidth; 18112 this.minBoundingRectHeight = minBoundingRectHeight; 18113 this.maxBoundingRectHeight = maxBoundingRectHeight; 18114 this.autoSplit = autoSplit; 18115 } 18116 18117 protected OCRSpacingOptions(ByteBuffer backing, int offset) { 18118 super(backing, offset, 40); 18119 init(); 18120 } 18121 18122 protected OCRSpacingOptions(long nativeObj, boolean owned) { 18123 super(nativeObj, owned, 40); 18124 init(); 18125 } 18126 18127 protected void setBuffer(ByteBuffer backing, int offset) { 18128 super.setBuffer(backing, offset, 40); 18129 } 18130 18131 public void read() { 18132 minCharSpacing = backing.getInt(0); 18133 minCharSize = backing.getInt(4); 18134 maxCharSize = backing.getInt(8); 18135 maxHorizontalElementSpacing = backing.getInt(12); 18136 maxVerticalElementSpacing = backing.getInt(16); 18137 minBoundingRectWidth = backing.getInt(20); 18138 maxBoundingRectWidth = backing.getInt(24); 18139 minBoundingRectHeight = backing.getInt(28); 18140 maxBoundingRectHeight = backing.getInt(32); 18141 autoSplit = backing.getInt(36); 18142 } 18143 18144 public void write() { 18145 backing.putInt(0, minCharSpacing); 18146 backing.putInt(4, minCharSize); 18147 backing.putInt(8, maxCharSize); 18148 backing.putInt(12, maxHorizontalElementSpacing); 18149 backing.putInt(16, maxVerticalElementSpacing); 18150 backing.putInt(20, minBoundingRectWidth); 18151 backing.putInt(24, maxBoundingRectWidth); 18152 backing.putInt(28, minBoundingRectHeight); 18153 backing.putInt(32, maxBoundingRectHeight); 18154 backing.putInt(36, autoSplit); 18155 } 18156 18157 public int size() { 18158 return 40; 18159 } 18160 } 18161 18162 public static class OCRProcessingOptions extends DisposedStruct { 18163 public ThresholdMode mode; // The thresholding mode. 18164 public int lowThreshold; // The low threshold value when you set mode to 18165 // IMAQ_FIXED_RANGE. 18166 public int highThreshold; // The high threshold value when you set mode to 18167 // IMAQ_FIXED_RANGE. 18168 public int blockCount; // The number of blocks for threshold calculation 18169 // algorithms that require blocks. 18170 public int fastThreshold; // Set this element to TRUE to use a faster, less 18171 // accurate threshold calculation algorithm. 18172 public int biModalCalculation; // Set this element to TRUE to calculate both 18173 // the low and high threshold values when 18174 // using the fast thresholding method. 18175 public int darkCharacters; // Set this element to TRUE to read or train dark 18176 // characters on a light background. 18177 public int removeParticlesTouchingROI; // Set this element to TRUE to remove 18178 // the particles touching the ROI. 18179 public int erosionCount; // The number of erosions to perform. 18180 18181 private void init() { 18182 18183 } 18184 18185 public OCRProcessingOptions() { 18186 super(36); 18187 init(); 18188 } 18189 18190 public OCRProcessingOptions(ThresholdMode mode, int lowThreshold, int highThreshold, 18191 int blockCount, int fastThreshold, int biModalCalculation, int darkCharacters, 18192 int removeParticlesTouchingROI, int erosionCount) { 18193 super(36); 18194 this.mode = mode; 18195 this.lowThreshold = lowThreshold; 18196 this.highThreshold = highThreshold; 18197 this.blockCount = blockCount; 18198 this.fastThreshold = fastThreshold; 18199 this.biModalCalculation = biModalCalculation; 18200 this.darkCharacters = darkCharacters; 18201 this.removeParticlesTouchingROI = removeParticlesTouchingROI; 18202 this.erosionCount = erosionCount; 18203 } 18204 18205 protected OCRProcessingOptions(ByteBuffer backing, int offset) { 18206 super(backing, offset, 36); 18207 init(); 18208 } 18209 18210 protected OCRProcessingOptions(long nativeObj, boolean owned) { 18211 super(nativeObj, owned, 36); 18212 init(); 18213 } 18214 18215 protected void setBuffer(ByteBuffer backing, int offset) { 18216 super.setBuffer(backing, offset, 36); 18217 } 18218 18219 public void read() { 18220 mode = ThresholdMode.fromValue(backing.getInt(0)); 18221 lowThreshold = backing.getInt(4); 18222 highThreshold = backing.getInt(8); 18223 blockCount = backing.getInt(12); 18224 fastThreshold = backing.getInt(16); 18225 biModalCalculation = backing.getInt(20); 18226 darkCharacters = backing.getInt(24); 18227 removeParticlesTouchingROI = backing.getInt(28); 18228 erosionCount = backing.getInt(32); 18229 } 18230 18231 public void write() { 18232 if (mode != null) 18233 backing.putInt(0, mode.getValue()); 18234 backing.putInt(4, lowThreshold); 18235 backing.putInt(8, highThreshold); 18236 backing.putInt(12, blockCount); 18237 backing.putInt(16, fastThreshold); 18238 backing.putInt(20, biModalCalculation); 18239 backing.putInt(24, darkCharacters); 18240 backing.putInt(28, removeParticlesTouchingROI); 18241 backing.putInt(32, erosionCount); 18242 } 18243 18244 public int size() { 18245 return 36; 18246 } 18247 } 18248 18249 public static class ReadTextOptions extends DisposedStruct { 18250 public String[] validChars; // An array of strings that specifies the valid 18251 // characters. 18252 public byte substitutionChar; // The character to substitute for objects 18253 // that the function cannot match with any of 18254 // the trained characters. 18255 public ReadStrategy readStrategy; // The read strategy, which determines how 18256 // closely the function analyzes images in 18257 // the reading process to match objects 18258 // with trained characters. 18259 public int acceptanceLevel; // The minimum acceptance level at which an 18260 // object is considered a trained character. 18261 public int aspectRatio; // The maximum aspect ratio variance percentage for 18262 // valid characters. 18263 public ReadResolution readResolution; // The read resolution, which 18264 // determines how much of the trained 18265 // character data the function uses to 18266 // match objects to trained 18267 // characters. 18268 private ByteBuffer validChars_buf; 18269 private ByteBuffer[] validChars_bufs; 18270 18271 private void init() { 18272 validChars = new String[0]; 18273 } 18274 18275 public ReadTextOptions() { 18276 super(65304); 18277 init(); 18278 } 18279 18280 public ReadTextOptions(String[] validChars, byte substitutionChar, ReadStrategy readStrategy, 18281 int acceptanceLevel, int aspectRatio, ReadResolution readResolution) { 18282 super(65304); 18283 this.validChars = validChars; 18284 this.substitutionChar = substitutionChar; 18285 this.readStrategy = readStrategy; 18286 this.acceptanceLevel = acceptanceLevel; 18287 this.aspectRatio = aspectRatio; 18288 this.readResolution = readResolution; 18289 } 18290 18291 protected ReadTextOptions(ByteBuffer backing, int offset) { 18292 super(backing, offset, 65304); 18293 init(); 18294 } 18295 18296 protected ReadTextOptions(long nativeObj, boolean owned) { 18297 super(nativeObj, owned, 65304); 18298 init(); 18299 } 18300 18301 protected void setBuffer(ByteBuffer backing, int offset) { 18302 super.setBuffer(backing, offset, 65304); 18303 } 18304 18305 public void read() { 18306 int validChars_numValidChars = backing.getInt(65280); 18307 long validChars_addr = getPointer(backing, 0); 18308 validChars = new String[validChars_numValidChars]; 18309 if (validChars_numValidChars > 0 && validChars_addr != 0) { 18310 ByteBuffer bb = newDirectByteBuffer(validChars_addr, validChars_numValidChars * 4); 18311 for (int i = 0, off = 0; i < validChars_numValidChars; i++, off += 4) { 18312 long addr = getPointer(bb, off); 18313 if (addr == 0) 18314 validChars[i] = null; 18315 else { 18316 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 18317 while (bb2.get() != 0) { 18318 } 18319 byte[] bytes = new byte[bb2.position() - 1]; 18320 bb2.rewind(); 18321 getBytes(bb2, bytes, 0, bytes.length); 18322 try { 18323 validChars[i] = new String(bytes, "UTF-8"); 18324 } catch (UnsupportedEncodingException e) { 18325 validChars[i] = ""; 18326 } 18327 } 18328 } 18329 } 18330 substitutionChar = backing.get(65284); 18331 readStrategy = ReadStrategy.fromValue(backing.getInt(65288)); 18332 acceptanceLevel = backing.getInt(65292); 18333 aspectRatio = backing.getInt(65296); 18334 readResolution = ReadResolution.fromValue(backing.getInt(65300)); 18335 } 18336 18337 public void write() { 18338 validChars_buf = 18339 ByteBuffer.allocateDirect(validChars.length * 4).order(ByteOrder.nativeOrder()); 18340 for (int i = 0, off = 0; i < validChars.length; i++, off += 4) { 18341 if (validChars[i] == null) 18342 putPointer(validChars_buf, off, 0); 18343 else { 18344 byte[] bytes; 18345 try { 18346 bytes = validChars[i].getBytes("UTF-8"); 18347 } catch (UnsupportedEncodingException e) { 18348 bytes = new byte[0]; 18349 } 18350 validChars_bufs[i] = ByteBuffer.allocateDirect(bytes.length + 1); 18351 putBytes(validChars_bufs[i], bytes, 0, bytes.length).put(bytes.length, (byte) 0); 18352 putPointer(validChars_buf, off, getByteBufferAddress(validChars_bufs[i])); 18353 } 18354 } 18355 backing.putInt(65280, validChars.length); 18356 putPointer(backing, 0, validChars_buf); 18357 backing.put(65284, substitutionChar); 18358 if (readStrategy != null) 18359 backing.putInt(65288, readStrategy.getValue()); 18360 backing.putInt(65292, acceptanceLevel); 18361 backing.putInt(65296, aspectRatio); 18362 if (readResolution != null) 18363 backing.putInt(65300, readResolution.getValue()); 18364 } 18365 18366 public int size() { 18367 return 65304; 18368 } 18369 } 18370 18371 public static class CharInfo extends DisposedStruct { 18372 public String charValue; // Retrieves the character value of the 18373 // corresponding character in the character set. 18374 public Image charImage; // The image you used to train this character. 18375 public Image internalImage; // The internal representation that NI Vision 18376 // uses to match objects to this character. 18377 private ByteBuffer charValue_buf; 18378 18379 private void init() { 18380 18381 } 18382 18383 public CharInfo() { 18384 super(12); 18385 init(); 18386 } 18387 18388 public CharInfo(String charValue, Image charImage, Image internalImage) { 18389 super(12); 18390 this.charValue = charValue; 18391 this.charImage = charImage; 18392 this.internalImage = internalImage; 18393 } 18394 18395 protected CharInfo(ByteBuffer backing, int offset) { 18396 super(backing, offset, 12); 18397 init(); 18398 } 18399 18400 protected CharInfo(long nativeObj, boolean owned) { 18401 super(nativeObj, owned, 12); 18402 init(); 18403 } 18404 18405 protected void setBuffer(ByteBuffer backing, int offset) { 18406 super.setBuffer(backing, offset, 12); 18407 } 18408 18409 public void read() { 18410 long charValue_addr = getPointer(backing, 0); 18411 if (charValue_addr == 0) 18412 charValue = null; 18413 else { 18414 ByteBuffer bb = newDirectByteBuffer(charValue_addr, 1000); // FIXME 18415 while (bb.get() != 0) { 18416 } 18417 byte[] bytes = new byte[bb.position() - 1]; 18418 getBytes(bb, bytes, 0, bytes.length); 18419 try { 18420 charValue = new String(bytes, "UTF-8"); 18421 } catch (UnsupportedEncodingException e) { 18422 charValue = ""; 18423 } 18424 } 18425 18426 long charImage_addr = getPointer(backing, 4); 18427 if (charImage_addr == 0) 18428 charImage = null; 18429 else 18430 charImage = new Image(charImage_addr, false); 18431 long internalImage_addr = getPointer(backing, 8); 18432 if (internalImage_addr == 0) 18433 internalImage = null; 18434 else 18435 internalImage = new Image(internalImage_addr, false); 18436 } 18437 18438 public void write() { 18439 if (charValue != null) { 18440 byte[] charValue_bytes; 18441 try { 18442 charValue_bytes = charValue.getBytes("UTF-8"); 18443 } catch (UnsupportedEncodingException e) { 18444 charValue_bytes = new byte[0]; 18445 } 18446 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length + 1); 18447 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put( 18448 charValue_bytes.length, (byte) 0); 18449 } 18450 putPointer(backing, 0, charValue == null ? 0 : getByteBufferAddress(charValue_buf)); 18451 putPointer(backing, 4, charImage); 18452 putPointer(backing, 8, internalImage); 18453 } 18454 18455 public int size() { 18456 return 12; 18457 } 18458 } 18459 18460 public static class Rect extends DisposedStruct { 18461 public int top; // Location of the top edge of the rectangle. 18462 public int left; // Location of the left edge of the rectangle. 18463 public int height; // Height of the rectangle. 18464 public int width; // Width of the rectangle. 18465 18466 private void init() { 18467 18468 } 18469 18470 public Rect() { 18471 super(16); 18472 init(); 18473 } 18474 18475 public Rect(int top, int left, int height, int width) { 18476 super(16); 18477 this.top = top; 18478 this.left = left; 18479 this.height = height; 18480 this.width = width; 18481 } 18482 18483 protected Rect(ByteBuffer backing, int offset) { 18484 super(backing, offset, 16); 18485 init(); 18486 } 18487 18488 protected Rect(long nativeObj, boolean owned) { 18489 super(nativeObj, owned, 16); 18490 init(); 18491 } 18492 18493 protected void setBuffer(ByteBuffer backing, int offset) { 18494 super.setBuffer(backing, offset, 16); 18495 } 18496 18497 public void read() { 18498 top = backing.getInt(0); 18499 left = backing.getInt(4); 18500 height = backing.getInt(8); 18501 width = backing.getInt(12); 18502 } 18503 18504 public void write() { 18505 backing.putInt(0, top); 18506 backing.putInt(4, left); 18507 backing.putInt(8, height); 18508 backing.putInt(12, width); 18509 } 18510 18511 public int size() { 18512 return 16; 18513 } 18514 } 18515 18516 public static class CharReport extends DisposedStruct { 18517 public String character; // The character value. 18518 public PointFloat[] corner; // An array of four points that describes the 18519 // rectangle that surrounds the character. 18520 public int reserved; // This element is reserved. 18521 public int lowThreshold; // The minimum value of the threshold range used 18522 // for this character. 18523 public int highThreshold; // The maximum value of the threshold range used 18524 // for this character. 18525 private ByteBuffer character_buf; 18526 18527 private void init() { 18528 corner = new PointFloat[4]; 18529 18530 for (int i = 0, off = 4; i < 4; i++, off += 8) 18531 corner[i] = new PointFloat(backing, off); 18532 } 18533 18534 public CharReport() { 18535 super(48); 18536 init(); 18537 } 18538 18539 public CharReport(String character, PointFloat[] corner, int reserved, int lowThreshold, 18540 int highThreshold) { 18541 super(48); 18542 this.character = character; 18543 this.corner = corner; 18544 this.reserved = reserved; 18545 this.lowThreshold = lowThreshold; 18546 this.highThreshold = highThreshold; 18547 } 18548 18549 protected CharReport(ByteBuffer backing, int offset) { 18550 super(backing, offset, 48); 18551 init(); 18552 } 18553 18554 protected CharReport(long nativeObj, boolean owned) { 18555 super(nativeObj, owned, 48); 18556 init(); 18557 } 18558 18559 protected void setBuffer(ByteBuffer backing, int offset) { 18560 super.setBuffer(backing, offset, 48); 18561 } 18562 18563 public void read() { 18564 long character_addr = getPointer(backing, 0); 18565 if (character_addr == 0) 18566 character = null; 18567 else { 18568 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 18569 while (bb.get() != 0) { 18570 } 18571 byte[] bytes = new byte[bb.position() - 1]; 18572 getBytes(bb, bytes, 0, bytes.length); 18573 try { 18574 character = new String(bytes, "UTF-8"); 18575 } catch (UnsupportedEncodingException e) { 18576 character = ""; 18577 } 18578 } 18579 18580 for (PointFloat it : corner) { 18581 it.read(); 18582 } 18583 reserved = backing.getInt(36); 18584 lowThreshold = backing.getInt(40); 18585 highThreshold = backing.getInt(44); 18586 } 18587 18588 public void write() { 18589 if (character != null) { 18590 byte[] character_bytes; 18591 try { 18592 character_bytes = character.getBytes("UTF-8"); 18593 } catch (UnsupportedEncodingException e) { 18594 character_bytes = new byte[0]; 18595 } 18596 character_buf = ByteBuffer.allocateDirect(character_bytes.length + 1); 18597 putBytes(character_buf, character_bytes, 0, character_bytes.length).put( 18598 character_bytes.length, (byte) 0); 18599 } 18600 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 18601 for (PointFloat it : corner) { 18602 it.write(); 18603 } 18604 backing.putInt(36, reserved); 18605 backing.putInt(40, lowThreshold); 18606 backing.putInt(44, highThreshold); 18607 } 18608 18609 public int size() { 18610 return 48; 18611 } 18612 } 18613 18614 public static class ReadTextReport extends DisposedStruct { 18615 public String readString; // The read string. 18616 public CharReport[] characterReport; // An array of reports describing the 18617 // properties of each identified 18618 // character. 18619 private ByteBuffer readString_buf; 18620 private ByteBuffer characterReport_buf; 18621 18622 private void init() { 18623 characterReport = new CharReport[0]; 18624 } 18625 18626 public ReadTextReport() { 18627 super(12); 18628 init(); 18629 } 18630 18631 public ReadTextReport(String readString, CharReport[] characterReport) { 18632 super(12); 18633 this.readString = readString; 18634 this.characterReport = characterReport; 18635 } 18636 18637 protected ReadTextReport(ByteBuffer backing, int offset) { 18638 super(backing, offset, 12); 18639 init(); 18640 } 18641 18642 protected ReadTextReport(long nativeObj, boolean owned) { 18643 super(nativeObj, owned, 12); 18644 init(); 18645 } 18646 18647 protected void setBuffer(ByteBuffer backing, int offset) { 18648 super.setBuffer(backing, offset, 12); 18649 } 18650 18651 public void read() { 18652 long readString_addr = getPointer(backing, 0); 18653 if (readString_addr == 0) 18654 readString = null; 18655 else { 18656 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 18657 while (bb.get() != 0) { 18658 } 18659 byte[] bytes = new byte[bb.position() - 1]; 18660 getBytes(bb, bytes, 0, bytes.length); 18661 try { 18662 readString = new String(bytes, "UTF-8"); 18663 } catch (UnsupportedEncodingException e) { 18664 readString = ""; 18665 } 18666 } 18667 18668 int characterReport_numCharacterReports = backing.getInt(8); 18669 long characterReport_addr = getPointer(backing, 4); 18670 characterReport = new CharReport[characterReport_numCharacterReports]; 18671 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 18672 ByteBuffer bb = 18673 newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports * 48); 18674 for (int i = 0, off = 0; i < characterReport_numCharacterReports; i++, off += 48) { 18675 characterReport[i] = new CharReport(bb, off); 18676 characterReport[i].read(); 18677 } 18678 } 18679 } 18680 18681 public void write() { 18682 if (readString != null) { 18683 byte[] readString_bytes; 18684 try { 18685 readString_bytes = readString.getBytes("UTF-8"); 18686 } catch (UnsupportedEncodingException e) { 18687 readString_bytes = new byte[0]; 18688 } 18689 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length + 1); 18690 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put( 18691 readString_bytes.length, (byte) 0); 18692 } 18693 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 18694 characterReport_buf = 18695 ByteBuffer.allocateDirect(characterReport.length * 48).order(ByteOrder.nativeOrder()); 18696 for (int i = 0, off = 0; i < characterReport.length; i++, off += 48) { 18697 characterReport[i].setBuffer(characterReport_buf, off); 18698 characterReport[i].write(); 18699 } 18700 backing.putInt(8, characterReport.length); 18701 putPointer(backing, 4, characterReport_buf); 18702 } 18703 18704 public int size() { 18705 return 12; 18706 } 18707 } 18708 18709 public static class Point extends DisposedStruct { 18710 public int x; // The x-coordinate of the point. 18711 public int y; // The y-coordinate of the point. 18712 18713 private void init() { 18714 18715 } 18716 18717 public Point() { 18718 super(8); 18719 init(); 18720 } 18721 18722 public Point(int x, int y) { 18723 super(8); 18724 this.x = x; 18725 this.y = y; 18726 } 18727 18728 protected Point(ByteBuffer backing, int offset) { 18729 super(backing, offset, 8); 18730 init(); 18731 } 18732 18733 protected Point(long nativeObj, boolean owned) { 18734 super(nativeObj, owned, 8); 18735 init(); 18736 } 18737 18738 protected void setBuffer(ByteBuffer backing, int offset) { 18739 super.setBuffer(backing, offset, 8); 18740 } 18741 18742 public void read() { 18743 x = backing.getInt(0); 18744 y = backing.getInt(4); 18745 } 18746 18747 public void write() { 18748 backing.putInt(0, x); 18749 backing.putInt(4, y); 18750 } 18751 18752 public int size() { 18753 return 8; 18754 } 18755 } 18756 18757 public static class Annulus extends DisposedStruct { 18758 public Point center; // The coordinate location of the center of the 18759 // annulus. 18760 public int innerRadius; // The internal radius of the annulus. 18761 public int outerRadius; // The external radius of the annulus. 18762 public double startAngle; // The start angle, in degrees, of the annulus. 18763 public double endAngle; // The end angle, in degrees, of the annulus. 18764 18765 private void init() { 18766 center = new Point(backing, 0); 18767 } 18768 18769 public Annulus() { 18770 super(32); 18771 init(); 18772 } 18773 18774 public Annulus(Point center, int innerRadius, int outerRadius, double startAngle, 18775 double endAngle) { 18776 super(32); 18777 this.center = center; 18778 this.innerRadius = innerRadius; 18779 this.outerRadius = outerRadius; 18780 this.startAngle = startAngle; 18781 this.endAngle = endAngle; 18782 } 18783 18784 protected Annulus(ByteBuffer backing, int offset) { 18785 super(backing, offset, 32); 18786 init(); 18787 } 18788 18789 protected Annulus(long nativeObj, boolean owned) { 18790 super(nativeObj, owned, 32); 18791 init(); 18792 } 18793 18794 protected void setBuffer(ByteBuffer backing, int offset) { 18795 super.setBuffer(backing, offset, 32); 18796 } 18797 18798 public void read() { 18799 center.read(); 18800 innerRadius = backing.getInt(8); 18801 outerRadius = backing.getInt(12); 18802 startAngle = backing.getDouble(16); 18803 endAngle = backing.getDouble(24); 18804 } 18805 18806 public void write() { 18807 center.write(); 18808 backing.putInt(8, innerRadius); 18809 backing.putInt(12, outerRadius); 18810 backing.putDouble(16, startAngle); 18811 backing.putDouble(24, endAngle); 18812 } 18813 18814 public int size() { 18815 return 32; 18816 } 18817 } 18818 18819 public static class EdgeLocationReport extends DisposedStruct { 18820 public PointFloat[] edges; // The coordinate location of all edges detected 18821 // by the search line. 18822 private ByteBuffer edges_buf; 18823 18824 private void init() { 18825 edges = new PointFloat[0]; 18826 } 18827 18828 public EdgeLocationReport() { 18829 super(8); 18830 init(); 18831 } 18832 18833 public EdgeLocationReport(PointFloat[] edges) { 18834 super(8); 18835 this.edges = edges; 18836 } 18837 18838 protected EdgeLocationReport(ByteBuffer backing, int offset) { 18839 super(backing, offset, 8); 18840 init(); 18841 } 18842 18843 protected EdgeLocationReport(long nativeObj, boolean owned) { 18844 super(nativeObj, owned, 8); 18845 init(); 18846 } 18847 18848 protected void setBuffer(ByteBuffer backing, int offset) { 18849 super.setBuffer(backing, offset, 8); 18850 } 18851 18852 public void read() { 18853 int edges_numEdges = backing.getInt(4); 18854 long edges_addr = getPointer(backing, 0); 18855 edges = new PointFloat[edges_numEdges]; 18856 if (edges_numEdges > 0 && edges_addr != 0) { 18857 ByteBuffer bb = newDirectByteBuffer(edges_addr, edges_numEdges * 8); 18858 for (int i = 0, off = 0; i < edges_numEdges; i++, off += 8) { 18859 edges[i] = new PointFloat(bb, off); 18860 edges[i].read(); 18861 } 18862 } 18863 } 18864 18865 public void write() { 18866 edges_buf = ByteBuffer.allocateDirect(edges.length * 8).order(ByteOrder.nativeOrder()); 18867 for (int i = 0, off = 0; i < edges.length; i++, off += 8) { 18868 edges[i].setBuffer(edges_buf, off); 18869 edges[i].write(); 18870 } 18871 backing.putInt(4, edges.length); 18872 putPointer(backing, 0, edges_buf); 18873 } 18874 18875 public int size() { 18876 return 8; 18877 } 18878 } 18879 18880 public static class EdgeOptions extends DisposedStruct { 18881 public int threshold; // Specifies the threshold value for the contrast of 18882 // the edge. 18883 public int width; // The number of pixels that the function averages to find 18884 // the contrast at either side of the edge. 18885 public int steepness; // The span, in pixels, of the slope of the edge 18886 // projected along the path specified by the input 18887 // points. 18888 public InterpolationMethod subpixelType; // The method for interpolating. 18889 public int subpixelDivisions; // The number of samples the function obtains 18890 // from a pixel. 18891 18892 private void init() { 18893 18894 } 18895 18896 public EdgeOptions() { 18897 super(20); 18898 init(); 18899 } 18900 18901 public EdgeOptions(int threshold, int width, int steepness, InterpolationMethod subpixelType, 18902 int subpixelDivisions) { 18903 super(20); 18904 this.threshold = threshold; 18905 this.width = width; 18906 this.steepness = steepness; 18907 this.subpixelType = subpixelType; 18908 this.subpixelDivisions = subpixelDivisions; 18909 } 18910 18911 protected EdgeOptions(ByteBuffer backing, int offset) { 18912 super(backing, offset, 20); 18913 init(); 18914 } 18915 18916 protected EdgeOptions(long nativeObj, boolean owned) { 18917 super(nativeObj, owned, 20); 18918 init(); 18919 } 18920 18921 protected void setBuffer(ByteBuffer backing, int offset) { 18922 super.setBuffer(backing, offset, 20); 18923 } 18924 18925 public void read() { 18926 threshold = backing.getInt(0); 18927 width = backing.getInt(4); 18928 steepness = backing.getInt(8); 18929 subpixelType = InterpolationMethod.fromValue(backing.getInt(12)); 18930 subpixelDivisions = backing.getInt(16); 18931 } 18932 18933 public void write() { 18934 backing.putInt(0, threshold); 18935 backing.putInt(4, width); 18936 backing.putInt(8, steepness); 18937 if (subpixelType != null) 18938 backing.putInt(12, subpixelType.getValue()); 18939 backing.putInt(16, subpixelDivisions); 18940 } 18941 18942 public int size() { 18943 return 20; 18944 } 18945 } 18946 18947 public static class EdgeReport extends DisposedStruct { 18948 public float location; // The location of the edge from the first point in 18949 // the points array. 18950 public float contrast; // The contrast at the edge. 18951 public PolarityType polarity; // The polarity of the edge. 18952 public float reserved; // This element is reserved. 18953 public PointFloat coordinate; // The coordinates of the edge. 18954 18955 private void init() { 18956 coordinate = new PointFloat(backing, 20); 18957 } 18958 18959 public EdgeReport() { 18960 super(32); 18961 init(); 18962 } 18963 18964 public EdgeReport(double location, double contrast, PolarityType polarity, double reserved, 18965 PointFloat coordinate) { 18966 super(32); 18967 this.location = (float) location; 18968 this.contrast = (float) contrast; 18969 this.polarity = polarity; 18970 this.reserved = (float) reserved; 18971 this.coordinate = coordinate; 18972 } 18973 18974 protected EdgeReport(ByteBuffer backing, int offset) { 18975 super(backing, offset, 32); 18976 init(); 18977 } 18978 18979 protected EdgeReport(long nativeObj, boolean owned) { 18980 super(nativeObj, owned, 32); 18981 init(); 18982 } 18983 18984 protected void setBuffer(ByteBuffer backing, int offset) { 18985 super.setBuffer(backing, offset, 32); 18986 } 18987 18988 public void read() { 18989 location = backing.getFloat(0); 18990 contrast = backing.getFloat(4); 18991 polarity = PolarityType.fromValue(backing.getInt(8)); 18992 reserved = backing.getFloat(16); 18993 coordinate.read(); 18994 } 18995 18996 public void write() { 18997 backing.putFloat(0, location); 18998 backing.putFloat(4, contrast); 18999 if (polarity != null) 19000 backing.putInt(8, polarity.getValue()); 19001 backing.putFloat(16, reserved); 19002 coordinate.write(); 19003 } 19004 19005 public int size() { 19006 return 32; 19007 } 19008 } 19009 19010 public static class ExtremeReport extends DisposedStruct { 19011 public double location; // The locations of the extreme. 19012 public double amplitude; // The amplitude of the extreme. 19013 public double secondDerivative; // The second derivative of the extreme. 19014 19015 private void init() { 19016 19017 } 19018 19019 public ExtremeReport() { 19020 super(24); 19021 init(); 19022 } 19023 19024 public ExtremeReport(double location, double amplitude, double secondDerivative) { 19025 super(24); 19026 this.location = location; 19027 this.amplitude = amplitude; 19028 this.secondDerivative = secondDerivative; 19029 } 19030 19031 protected ExtremeReport(ByteBuffer backing, int offset) { 19032 super(backing, offset, 24); 19033 init(); 19034 } 19035 19036 protected ExtremeReport(long nativeObj, boolean owned) { 19037 super(nativeObj, owned, 24); 19038 init(); 19039 } 19040 19041 protected void setBuffer(ByteBuffer backing, int offset) { 19042 super.setBuffer(backing, offset, 24); 19043 } 19044 19045 public void read() { 19046 location = backing.getDouble(0); 19047 amplitude = backing.getDouble(8); 19048 secondDerivative = backing.getDouble(16); 19049 } 19050 19051 public void write() { 19052 backing.putDouble(0, location); 19053 backing.putDouble(8, amplitude); 19054 backing.putDouble(16, secondDerivative); 19055 } 19056 19057 public int size() { 19058 return 24; 19059 } 19060 } 19061 19062 public static class FitLineOptions extends DisposedStruct { 19063 public float minScore; // Specifies the required quality of the fitted line. 19064 public float pixelRadius; // Specifies the neighborhood pixel relationship 19065 // for the initial subset of points being used. 19066 public int numRefinements; // Specifies the number of refinement iterations 19067 // you allow the function to perform on the 19068 // initial subset of points. 19069 19070 private void init() { 19071 19072 } 19073 19074 public FitLineOptions() { 19075 super(12); 19076 init(); 19077 } 19078 19079 public FitLineOptions(double minScore, double pixelRadius, int numRefinements) { 19080 super(12); 19081 this.minScore = (float) minScore; 19082 this.pixelRadius = (float) pixelRadius; 19083 this.numRefinements = numRefinements; 19084 } 19085 19086 protected FitLineOptions(ByteBuffer backing, int offset) { 19087 super(backing, offset, 12); 19088 init(); 19089 } 19090 19091 protected FitLineOptions(long nativeObj, boolean owned) { 19092 super(nativeObj, owned, 12); 19093 init(); 19094 } 19095 19096 protected void setBuffer(ByteBuffer backing, int offset) { 19097 super.setBuffer(backing, offset, 12); 19098 } 19099 19100 public void read() { 19101 minScore = backing.getFloat(0); 19102 pixelRadius = backing.getFloat(4); 19103 numRefinements = backing.getInt(8); 19104 } 19105 19106 public void write() { 19107 backing.putFloat(0, minScore); 19108 backing.putFloat(4, pixelRadius); 19109 backing.putInt(8, numRefinements); 19110 } 19111 19112 public int size() { 19113 return 12; 19114 } 19115 } 19116 19117 public static class DisplayMapping extends DisposedStruct { 19118 public MappingMethod method; // Describes the method for converting 16-bit 19119 // pixels to 8-bit pixels. 19120 public int minimumValue; // When method is IMAQ_RANGE, minimumValue 19121 // represents the value that is mapped to 0. 19122 public int maximumValue; // When method is IMAQ_RANGE, maximumValue 19123 // represents the value that is mapped to 255. 19124 public int shiftCount; // When method is IMAQ_DOWNSHIFT, shiftCount 19125 // represents the number of bits the function 19126 // right-shifts the 16-bit pixel values. 19127 19128 private void init() { 19129 19130 } 19131 19132 public DisplayMapping() { 19133 super(16); 19134 init(); 19135 } 19136 19137 public DisplayMapping(MappingMethod method, int minimumValue, int maximumValue, int shiftCount) { 19138 super(16); 19139 this.method = method; 19140 this.minimumValue = minimumValue; 19141 this.maximumValue = maximumValue; 19142 this.shiftCount = shiftCount; 19143 } 19144 19145 protected DisplayMapping(ByteBuffer backing, int offset) { 19146 super(backing, offset, 16); 19147 init(); 19148 } 19149 19150 protected DisplayMapping(long nativeObj, boolean owned) { 19151 super(nativeObj, owned, 16); 19152 init(); 19153 } 19154 19155 protected void setBuffer(ByteBuffer backing, int offset) { 19156 super.setBuffer(backing, offset, 16); 19157 } 19158 19159 public void read() { 19160 method = MappingMethod.fromValue(backing.getInt(0)); 19161 minimumValue = backing.getInt(4); 19162 maximumValue = backing.getInt(8); 19163 shiftCount = backing.getInt(12); 19164 } 19165 19166 public void write() { 19167 if (method != null) 19168 backing.putInt(0, method.getValue()); 19169 backing.putInt(4, minimumValue); 19170 backing.putInt(8, maximumValue); 19171 backing.putInt(12, shiftCount); 19172 } 19173 19174 public int size() { 19175 return 16; 19176 } 19177 } 19178 19179 public static class DetectExtremesOptions extends DisposedStruct { 19180 public double threshold; // Defines which extremes are too small. 19181 public int width; // Specifies the number of consecutive data points the 19182 // function uses in the quadratic least-squares fit. 19183 19184 private void init() { 19185 19186 } 19187 19188 public DetectExtremesOptions() { 19189 super(16); 19190 init(); 19191 } 19192 19193 public DetectExtremesOptions(double threshold, int width) { 19194 super(16); 19195 this.threshold = threshold; 19196 this.width = width; 19197 } 19198 19199 protected DetectExtremesOptions(ByteBuffer backing, int offset) { 19200 super(backing, offset, 16); 19201 init(); 19202 } 19203 19204 protected DetectExtremesOptions(long nativeObj, boolean owned) { 19205 super(nativeObj, owned, 16); 19206 init(); 19207 } 19208 19209 protected void setBuffer(ByteBuffer backing, int offset) { 19210 super.setBuffer(backing, offset, 16); 19211 } 19212 19213 public void read() { 19214 threshold = backing.getDouble(0); 19215 width = backing.getInt(8); 19216 } 19217 19218 public void write() { 19219 backing.putDouble(0, threshold); 19220 backing.putInt(8, width); 19221 } 19222 19223 public int size() { 19224 return 16; 19225 } 19226 } 19227 19228 public static class ImageInfo extends DisposedStruct { 19229 public CalibrationUnit imageUnit; // If you set calibration information with 19230 // imaqSetSimpleCalibrationInfo(), 19231 // imageUnit is the calibration unit. 19232 public float stepX; // If you set calibration information with 19233 // imaqSetCalibrationInfo(), stepX is the distance in 19234 // the calibration unit between two pixels in the x 19235 // direction. 19236 public float stepY; // If you set calibration information with 19237 // imaqSetCalibrationInfo(), stepY is the distance in 19238 // the calibration unit between two pixels in the y 19239 // direction. 19240 public ImageType imageType; // The type of the image. 19241 public int xRes; // The number of columns in the image. 19242 public int yRes; // The number of rows in the image. 19243 public int xOffset; // If you set mask offset information with 19244 // imaqSetMaskOffset(), xOffset is the offset of the 19245 // mask origin in the x direction. 19246 public int yOffset; // If you set mask offset information with 19247 // imaqSetMaskOffset(), yOffset is the offset of the 19248 // mask origin in the y direction. 19249 public int border; // The number of border pixels around the image. 19250 public int pixelsPerLine; // The number of pixels stored for each line of 19251 // the image. 19252 19253 private void init() { 19254 19255 } 19256 19257 public ImageInfo() { 19258 super(52); 19259 init(); 19260 } 19261 19262 public ImageInfo(CalibrationUnit imageUnit, double stepX, double stepY, ImageType imageType, 19263 int xRes, int yRes, int xOffset, int yOffset, int border, int pixelsPerLine) { 19264 super(52); 19265 this.imageUnit = imageUnit; 19266 this.stepX = (float) stepX; 19267 this.stepY = (float) stepY; 19268 this.imageType = imageType; 19269 this.xRes = xRes; 19270 this.yRes = yRes; 19271 this.xOffset = xOffset; 19272 this.yOffset = yOffset; 19273 this.border = border; 19274 this.pixelsPerLine = pixelsPerLine; 19275 } 19276 19277 protected ImageInfo(ByteBuffer backing, int offset) { 19278 super(backing, offset, 52); 19279 init(); 19280 } 19281 19282 protected ImageInfo(long nativeObj, boolean owned) { 19283 super(nativeObj, owned, 52); 19284 init(); 19285 } 19286 19287 protected void setBuffer(ByteBuffer backing, int offset) { 19288 super.setBuffer(backing, offset, 52); 19289 } 19290 19291 public void read() { 19292 imageUnit = CalibrationUnit.fromValue(backing.getInt(0)); 19293 stepX = backing.getFloat(4); 19294 stepY = backing.getFloat(8); 19295 imageType = ImageType.fromValue(backing.getInt(12)); 19296 xRes = backing.getInt(16); 19297 yRes = backing.getInt(20); 19298 xOffset = backing.getInt(24); 19299 yOffset = backing.getInt(28); 19300 border = backing.getInt(32); 19301 pixelsPerLine = backing.getInt(36); 19302 } 19303 19304 public void write() { 19305 if (imageUnit != null) 19306 backing.putInt(0, imageUnit.getValue()); 19307 backing.putFloat(4, stepX); 19308 backing.putFloat(8, stepY); 19309 if (imageType != null) 19310 backing.putInt(12, imageType.getValue()); 19311 backing.putInt(16, xRes); 19312 backing.putInt(20, yRes); 19313 backing.putInt(24, xOffset); 19314 backing.putInt(28, yOffset); 19315 backing.putInt(32, border); 19316 backing.putInt(36, pixelsPerLine); 19317 } 19318 19319 public int size() { 19320 return 52; 19321 } 19322 } 19323 19324 public static class LCDOptions extends DisposedStruct { 19325 public int litSegments; // Set this parameter to TRUE if the segments are 19326 // brighter than the background. 19327 public float threshold; // Determines whether a segment is ON or OFF. 19328 public int sign; // Indicates whether the function must read the sign of the 19329 // indicator. 19330 public int decimalPoint; // Determines whether to look for a decimal 19331 // separator after each digit. 19332 19333 private void init() { 19334 19335 } 19336 19337 public LCDOptions() { 19338 super(16); 19339 init(); 19340 } 19341 19342 public LCDOptions(int litSegments, double threshold, int sign, int decimalPoint) { 19343 super(16); 19344 this.litSegments = litSegments; 19345 this.threshold = (float) threshold; 19346 this.sign = sign; 19347 this.decimalPoint = decimalPoint; 19348 } 19349 19350 protected LCDOptions(ByteBuffer backing, int offset) { 19351 super(backing, offset, 16); 19352 init(); 19353 } 19354 19355 protected LCDOptions(long nativeObj, boolean owned) { 19356 super(nativeObj, owned, 16); 19357 init(); 19358 } 19359 19360 protected void setBuffer(ByteBuffer backing, int offset) { 19361 super.setBuffer(backing, offset, 16); 19362 } 19363 19364 public void read() { 19365 litSegments = backing.getInt(0); 19366 threshold = backing.getFloat(4); 19367 sign = backing.getInt(8); 19368 decimalPoint = backing.getInt(12); 19369 } 19370 19371 public void write() { 19372 backing.putInt(0, litSegments); 19373 backing.putFloat(4, threshold); 19374 backing.putInt(8, sign); 19375 backing.putInt(12, decimalPoint); 19376 } 19377 19378 public int size() { 19379 return 16; 19380 } 19381 } 19382 19383 public static class LCDReport extends DisposedStruct { 19384 public String text; // A string of the characters of the LCD. 19385 public LCDSegments[] segmentInfo; // An array of LCDSegment structures 19386 // describing which segments of each digit 19387 // are on. 19388 private ByteBuffer text_buf; 19389 private ByteBuffer segmentInfo_buf; 19390 19391 private void init() { 19392 segmentInfo = new LCDSegments[0]; 19393 } 19394 19395 public LCDReport() { 19396 super(16); 19397 init(); 19398 } 19399 19400 public LCDReport(String text, LCDSegments[] segmentInfo) { 19401 super(16); 19402 this.text = text; 19403 this.segmentInfo = segmentInfo; 19404 } 19405 19406 protected LCDReport(ByteBuffer backing, int offset) { 19407 super(backing, offset, 16); 19408 init(); 19409 } 19410 19411 protected LCDReport(long nativeObj, boolean owned) { 19412 super(nativeObj, owned, 16); 19413 init(); 19414 } 19415 19416 protected void setBuffer(ByteBuffer backing, int offset) { 19417 super.setBuffer(backing, offset, 16); 19418 } 19419 19420 public void read() { 19421 long text_addr = getPointer(backing, 0); 19422 if (text_addr == 0) 19423 text = null; 19424 else { 19425 ByteBuffer bb = newDirectByteBuffer(text_addr, 1000); // FIXME 19426 while (bb.get() != 0) { 19427 } 19428 byte[] bytes = new byte[bb.position() - 1]; 19429 getBytes(bb, bytes, 0, bytes.length); 19430 try { 19431 text = new String(bytes, "UTF-8"); 19432 } catch (UnsupportedEncodingException e) { 19433 text = ""; 19434 } 19435 } 19436 19437 int segmentInfo_numCharacters = backing.getInt(8); 19438 long segmentInfo_addr = getPointer(backing, 4); 19439 segmentInfo = new LCDSegments[segmentInfo_numCharacters]; 19440 if (segmentInfo_numCharacters > 0 && segmentInfo_addr != 0) { 19441 ByteBuffer bb = newDirectByteBuffer(segmentInfo_addr, segmentInfo_numCharacters * 4); 19442 for (int i = 0, off = 0; i < segmentInfo_numCharacters; i++, off += 4) { 19443 segmentInfo[i] = new LCDSegments(bb, off); 19444 segmentInfo[i].read(); 19445 } 19446 } 19447 } 19448 19449 public void write() { 19450 if (text != null) { 19451 byte[] text_bytes; 19452 try { 19453 text_bytes = text.getBytes("UTF-8"); 19454 } catch (UnsupportedEncodingException e) { 19455 text_bytes = new byte[0]; 19456 } 19457 text_buf = ByteBuffer.allocateDirect(text_bytes.length + 1); 19458 putBytes(text_buf, text_bytes, 0, text_bytes.length).put(text_bytes.length, (byte) 0); 19459 } 19460 putPointer(backing, 0, text == null ? 0 : getByteBufferAddress(text_buf)); 19461 segmentInfo_buf = 19462 ByteBuffer.allocateDirect(segmentInfo.length * 4).order(ByteOrder.nativeOrder()); 19463 for (int i = 0, off = 0; i < segmentInfo.length; i++, off += 4) { 19464 segmentInfo[i].setBuffer(segmentInfo_buf, off); 19465 segmentInfo[i].write(); 19466 } 19467 backing.putInt(8, segmentInfo.length); 19468 putPointer(backing, 4, segmentInfo_buf); 19469 } 19470 19471 public int size() { 19472 return 16; 19473 } 19474 } 19475 19476 public static class LCDSegments extends DisposedStruct { 19477 19478 19479 private void init() { 19480 19481 } 19482 19483 public LCDSegments() { 19484 super(4); 19485 init(); 19486 } 19487 19488 protected LCDSegments(ByteBuffer backing, int offset) { 19489 super(backing, offset, 4); 19490 init(); 19491 } 19492 19493 protected LCDSegments(long nativeObj, boolean owned) { 19494 super(nativeObj, owned, 4); 19495 init(); 19496 } 19497 19498 protected void setBuffer(ByteBuffer backing, int offset) { 19499 super.setBuffer(backing, offset, 4); 19500 } 19501 19502 public void read() { 19503 19504 } 19505 19506 public void write() { 19507 19508 } 19509 19510 public int size() { 19511 return 4; 19512 } 19513 } 19514 19515 public static class LearnCalibrationOptions extends DisposedStruct { 19516 public CalibrationMode mode; // Specifies the type of algorithm you want to 19517 // use to reduce distortion in your image. 19518 public ScalingMethod method; // Defines the scaling method correction 19519 // functions use to correct the image. 19520 public CalibrationROI roi; // Specifies the ROI correction functions use 19521 // when correcting an image. 19522 public int learnMap; // Set this element to TRUE if you want the function to 19523 // calculate and store an error map during the learning 19524 // process. 19525 public int learnTable; // Set this element to TRUE if you want the function 19526 // to calculate and store the correction table. 19527 19528 private void init() { 19529 19530 } 19531 19532 public LearnCalibrationOptions() { 19533 super(20); 19534 init(); 19535 } 19536 19537 public LearnCalibrationOptions(CalibrationMode mode, ScalingMethod method, CalibrationROI roi, 19538 int learnMap, int learnTable) { 19539 super(20); 19540 this.mode = mode; 19541 this.method = method; 19542 this.roi = roi; 19543 this.learnMap = learnMap; 19544 this.learnTable = learnTable; 19545 } 19546 19547 protected LearnCalibrationOptions(ByteBuffer backing, int offset) { 19548 super(backing, offset, 20); 19549 init(); 19550 } 19551 19552 protected LearnCalibrationOptions(long nativeObj, boolean owned) { 19553 super(nativeObj, owned, 20); 19554 init(); 19555 } 19556 19557 protected void setBuffer(ByteBuffer backing, int offset) { 19558 super.setBuffer(backing, offset, 20); 19559 } 19560 19561 public void read() { 19562 mode = CalibrationMode.fromValue(backing.getInt(0)); 19563 method = ScalingMethod.fromValue(backing.getInt(4)); 19564 roi = CalibrationROI.fromValue(backing.getInt(8)); 19565 learnMap = backing.getInt(12); 19566 learnTable = backing.getInt(16); 19567 } 19568 19569 public void write() { 19570 if (mode != null) 19571 backing.putInt(0, mode.getValue()); 19572 if (method != null) 19573 backing.putInt(4, method.getValue()); 19574 if (roi != null) 19575 backing.putInt(8, roi.getValue()); 19576 backing.putInt(12, learnMap); 19577 backing.putInt(16, learnTable); 19578 } 19579 19580 public int size() { 19581 return 20; 19582 } 19583 } 19584 19585 public static class LearnColorPatternOptions extends DisposedStruct { 19586 public LearningMode learnMode; // Specifies the invariance mode the function 19587 // uses when learning the pattern. 19588 public ImageFeatureMode featureMode; // Specifies the features the function 19589 // uses when learning the color 19590 // pattern. 19591 public int threshold; // Specifies the saturation threshold the function 19592 // uses to distinguish between two colors that have 19593 // the same hue values. 19594 public ColorIgnoreMode ignoreMode; // Specifies whether the function 19595 // excludes certain colors from the color 19596 // features of the template image. 19597 public ColorInformation[] colorsToIgnore; // An array of ColorInformation 19598 // structures providing a set of 19599 // colors to exclude from the 19600 // color features of the template 19601 // image. 19602 private ByteBuffer colorsToIgnore_buf; 19603 19604 private void init() { 19605 colorsToIgnore = new ColorInformation[0]; 19606 } 19607 19608 public LearnColorPatternOptions() { 19609 super(24); 19610 init(); 19611 } 19612 19613 public LearnColorPatternOptions(LearningMode learnMode, ImageFeatureMode featureMode, 19614 int threshold, ColorIgnoreMode ignoreMode, ColorInformation[] colorsToIgnore) { 19615 super(24); 19616 this.learnMode = learnMode; 19617 this.featureMode = featureMode; 19618 this.threshold = threshold; 19619 this.ignoreMode = ignoreMode; 19620 this.colorsToIgnore = colorsToIgnore; 19621 } 19622 19623 protected LearnColorPatternOptions(ByteBuffer backing, int offset) { 19624 super(backing, offset, 24); 19625 init(); 19626 } 19627 19628 protected LearnColorPatternOptions(long nativeObj, boolean owned) { 19629 super(nativeObj, owned, 24); 19630 init(); 19631 } 19632 19633 protected void setBuffer(ByteBuffer backing, int offset) { 19634 super.setBuffer(backing, offset, 24); 19635 } 19636 19637 public void read() { 19638 learnMode = LearningMode.fromValue(backing.getInt(0)); 19639 featureMode = ImageFeatureMode.fromValue(backing.getInt(4)); 19640 threshold = backing.getInt(8); 19641 ignoreMode = ColorIgnoreMode.fromValue(backing.getInt(12)); 19642 int colorsToIgnore_numColorsToIgnore = backing.getInt(20); 19643 long colorsToIgnore_addr = getPointer(backing, 16); 19644 colorsToIgnore = new ColorInformation[colorsToIgnore_numColorsToIgnore]; 19645 if (colorsToIgnore_numColorsToIgnore > 0 && colorsToIgnore_addr != 0) { 19646 ByteBuffer bb = 19647 newDirectByteBuffer(colorsToIgnore_addr, colorsToIgnore_numColorsToIgnore * 12); 19648 for (int i = 0, off = 0; i < colorsToIgnore_numColorsToIgnore; i++, off += 12) { 19649 colorsToIgnore[i] = new ColorInformation(bb, off); 19650 colorsToIgnore[i].read(); 19651 } 19652 } 19653 } 19654 19655 public void write() { 19656 if (learnMode != null) 19657 backing.putInt(0, learnMode.getValue()); 19658 if (featureMode != null) 19659 backing.putInt(4, featureMode.getValue()); 19660 backing.putInt(8, threshold); 19661 if (ignoreMode != null) 19662 backing.putInt(12, ignoreMode.getValue()); 19663 colorsToIgnore_buf = 19664 ByteBuffer.allocateDirect(colorsToIgnore.length * 12).order(ByteOrder.nativeOrder()); 19665 for (int i = 0, off = 0; i < colorsToIgnore.length; i++, off += 12) { 19666 colorsToIgnore[i].setBuffer(colorsToIgnore_buf, off); 19667 colorsToIgnore[i].write(); 19668 } 19669 backing.putInt(20, colorsToIgnore.length); 19670 putPointer(backing, 16, colorsToIgnore_buf); 19671 } 19672 19673 public int size() { 19674 return 24; 19675 } 19676 } 19677 19678 public static class Line extends DisposedStruct { 19679 public Point start; // The coordinate location of the start of the line. 19680 public Point end; // The coordinate location of the end of the line. 19681 19682 private void init() { 19683 start = new Point(backing, 0); 19684 end = new Point(backing, 8); 19685 } 19686 19687 public Line() { 19688 super(16); 19689 init(); 19690 } 19691 19692 public Line(Point start, Point end) { 19693 super(16); 19694 this.start = start; 19695 this.end = end; 19696 } 19697 19698 protected Line(ByteBuffer backing, int offset) { 19699 super(backing, offset, 16); 19700 init(); 19701 } 19702 19703 protected Line(long nativeObj, boolean owned) { 19704 super(nativeObj, owned, 16); 19705 init(); 19706 } 19707 19708 protected void setBuffer(ByteBuffer backing, int offset) { 19709 super.setBuffer(backing, offset, 16); 19710 } 19711 19712 public void read() { 19713 start.read(); 19714 end.read(); 19715 } 19716 19717 public void write() { 19718 start.write(); 19719 end.write(); 19720 } 19721 19722 public int size() { 19723 return 16; 19724 } 19725 } 19726 19727 public static class LinearAverages extends DisposedStruct { 19728 public float[] columnAverages; // An array containing the mean pixel value 19729 // of each column. 19730 public float[] rowAverages; // An array containing the mean pixel value of 19731 // each row. 19732 public float[] risingDiagAverages; // An array containing the mean pixel 19733 // value of each diagonal running from 19734 // the lower left to the upper right of 19735 // the inspected area of the image. 19736 public float[] fallingDiagAverages; // An array containing the mean pixel 19737 // value of each diagonal running from 19738 // the upper left to the lower right of 19739 // the inspected area of the image. 19740 private ByteBuffer columnAverages_buf; 19741 private ByteBuffer rowAverages_buf; 19742 private ByteBuffer risingDiagAverages_buf; 19743 private ByteBuffer fallingDiagAverages_buf; 19744 19745 private void init() { 19746 columnAverages = new float[0]; 19747 rowAverages = new float[0]; 19748 risingDiagAverages = new float[0]; 19749 fallingDiagAverages = new float[0]; 19750 } 19751 19752 public LinearAverages() { 19753 super(32); 19754 init(); 19755 } 19756 19757 public LinearAverages(float[] columnAverages, float[] rowAverages, float[] risingDiagAverages, 19758 float[] fallingDiagAverages) { 19759 super(32); 19760 this.columnAverages = columnAverages; 19761 this.rowAverages = rowAverages; 19762 this.risingDiagAverages = risingDiagAverages; 19763 this.fallingDiagAverages = fallingDiagAverages; 19764 } 19765 19766 protected LinearAverages(ByteBuffer backing, int offset) { 19767 super(backing, offset, 32); 19768 init(); 19769 } 19770 19771 protected LinearAverages(long nativeObj, boolean owned) { 19772 super(nativeObj, owned, 32); 19773 init(); 19774 } 19775 19776 protected void setBuffer(ByteBuffer backing, int offset) { 19777 super.setBuffer(backing, offset, 32); 19778 } 19779 19780 public void read() { 19781 int columnAverages_columnCount = backing.getInt(4); 19782 long columnAverages_addr = getPointer(backing, 0); 19783 columnAverages = new float[columnAverages_columnCount]; 19784 if (columnAverages_columnCount > 0 && columnAverages_addr != 0) { 19785 newDirectByteBuffer(columnAverages_addr, columnAverages_columnCount * 4).asFloatBuffer() 19786 .get(columnAverages); 19787 } 19788 int rowAverages_rowCount = backing.getInt(12); 19789 long rowAverages_addr = getPointer(backing, 8); 19790 rowAverages = new float[rowAverages_rowCount]; 19791 if (rowAverages_rowCount > 0 && rowAverages_addr != 0) { 19792 newDirectByteBuffer(rowAverages_addr, rowAverages_rowCount * 4).asFloatBuffer().get( 19793 rowAverages); 19794 } 19795 int risingDiagAverages_risingDiagCount = backing.getInt(20); 19796 long risingDiagAverages_addr = getPointer(backing, 16); 19797 risingDiagAverages = new float[risingDiagAverages_risingDiagCount]; 19798 if (risingDiagAverages_risingDiagCount > 0 && risingDiagAverages_addr != 0) { 19799 newDirectByteBuffer(risingDiagAverages_addr, risingDiagAverages_risingDiagCount * 4) 19800 .asFloatBuffer().get(risingDiagAverages); 19801 } 19802 int fallingDiagAverages_fallingDiagCount = backing.getInt(28); 19803 long fallingDiagAverages_addr = getPointer(backing, 24); 19804 fallingDiagAverages = new float[fallingDiagAverages_fallingDiagCount]; 19805 if (fallingDiagAverages_fallingDiagCount > 0 && fallingDiagAverages_addr != 0) { 19806 newDirectByteBuffer(fallingDiagAverages_addr, fallingDiagAverages_fallingDiagCount * 4) 19807 .asFloatBuffer().get(fallingDiagAverages); 19808 } 19809 } 19810 19811 public void write() { 19812 columnAverages_buf = 19813 ByteBuffer.allocateDirect(columnAverages.length * 4).order(ByteOrder.nativeOrder()); 19814 columnAverages_buf.asFloatBuffer().put(columnAverages).rewind(); 19815 backing.putInt(4, columnAverages.length); 19816 putPointer(backing, 0, columnAverages_buf); 19817 rowAverages_buf = 19818 ByteBuffer.allocateDirect(rowAverages.length * 4).order(ByteOrder.nativeOrder()); 19819 rowAverages_buf.asFloatBuffer().put(rowAverages).rewind(); 19820 backing.putInt(12, rowAverages.length); 19821 putPointer(backing, 8, rowAverages_buf); 19822 risingDiagAverages_buf = 19823 ByteBuffer.allocateDirect(risingDiagAverages.length * 4).order(ByteOrder.nativeOrder()); 19824 risingDiagAverages_buf.asFloatBuffer().put(risingDiagAverages).rewind(); 19825 backing.putInt(20, risingDiagAverages.length); 19826 putPointer(backing, 16, risingDiagAverages_buf); 19827 fallingDiagAverages_buf = 19828 ByteBuffer.allocateDirect(fallingDiagAverages.length * 4).order(ByteOrder.nativeOrder()); 19829 fallingDiagAverages_buf.asFloatBuffer().put(fallingDiagAverages).rewind(); 19830 backing.putInt(28, fallingDiagAverages.length); 19831 putPointer(backing, 24, fallingDiagAverages_buf); 19832 } 19833 19834 public int size() { 19835 return 32; 19836 } 19837 } 19838 19839 public static class LineProfile extends DisposedStruct { 19840 public float[] profileData; // An array containing the value of each pixel 19841 // in the line. 19842 public Rect boundingBox; // The bounding rectangle of the line. 19843 public float min; // The smallest pixel value in the line profile. 19844 public float max; // The largest pixel value in the line profile. 19845 public float mean; // The mean value of the pixels in the line profile. 19846 public float stdDev; // The standard deviation of the line profile. 19847 private ByteBuffer profileData_buf; 19848 19849 private void init() { 19850 profileData = new float[0]; 19851 boundingBox = new Rect(backing, 4); 19852 } 19853 19854 public LineProfile() { 19855 super(40); 19856 init(); 19857 } 19858 19859 public LineProfile(float[] profileData, Rect boundingBox, double min, double max, double mean, 19860 double stdDev) { 19861 super(40); 19862 this.profileData = profileData; 19863 this.boundingBox = boundingBox; 19864 this.min = (float) min; 19865 this.max = (float) max; 19866 this.mean = (float) mean; 19867 this.stdDev = (float) stdDev; 19868 } 19869 19870 protected LineProfile(ByteBuffer backing, int offset) { 19871 super(backing, offset, 40); 19872 init(); 19873 } 19874 19875 protected LineProfile(long nativeObj, boolean owned) { 19876 super(nativeObj, owned, 40); 19877 init(); 19878 } 19879 19880 protected void setBuffer(ByteBuffer backing, int offset) { 19881 super.setBuffer(backing, offset, 40); 19882 } 19883 19884 public void read() { 19885 int profileData_dataCount = backing.getInt(36); 19886 long profileData_addr = getPointer(backing, 0); 19887 profileData = new float[profileData_dataCount]; 19888 if (profileData_dataCount > 0 && profileData_addr != 0) { 19889 newDirectByteBuffer(profileData_addr, profileData_dataCount * 4).asFloatBuffer().get( 19890 profileData); 19891 } 19892 boundingBox.read(); 19893 min = backing.getFloat(20); 19894 max = backing.getFloat(24); 19895 mean = backing.getFloat(28); 19896 stdDev = backing.getFloat(32); 19897 } 19898 19899 public void write() { 19900 profileData_buf = 19901 ByteBuffer.allocateDirect(profileData.length * 4).order(ByteOrder.nativeOrder()); 19902 profileData_buf.asFloatBuffer().put(profileData).rewind(); 19903 backing.putInt(36, profileData.length); 19904 putPointer(backing, 0, profileData_buf); 19905 boundingBox.write(); 19906 backing.putFloat(20, min); 19907 backing.putFloat(24, max); 19908 backing.putFloat(28, mean); 19909 backing.putFloat(32, stdDev); 19910 } 19911 19912 public int size() { 19913 return 40; 19914 } 19915 } 19916 19917 public static class MatchColorPatternOptions extends DisposedStruct { 19918 public MatchingMode matchMode; // Specifies the method to use when looking 19919 // for the color pattern in the image. 19920 public ImageFeatureMode featureMode; // Specifies the features to use when 19921 // looking for the color pattern in the 19922 // image. 19923 public int minContrast; // Specifies the minimum contrast expected in the 19924 // image. 19925 public int subpixelAccuracy; // Set this parameter to TRUE to return areas 19926 // in the image that match the pattern area 19927 // with subpixel accuracy. 19928 public RotationAngleRange[] angleRanges; // An array of angle ranges, in 19929 // degrees, where each range 19930 // specifies how much you expect 19931 // the pattern to be rotated in the 19932 // image. 19933 public double colorWeight; // Determines the percent contribution of the 19934 // color score to the final color pattern 19935 // matching score. 19936 public ColorSensitivity sensitivity; // Specifies the sensitivity of the 19937 // color information in the image. 19938 public SearchStrategy strategy; // Specifies how the color features of the 19939 // image are used during the search phase. 19940 public int numMatchesRequested; // Number of valid matches expected. 19941 public float minMatchScore; // The minimum score a match can have for the 19942 // function to consider the match valid. 19943 private ByteBuffer angleRanges_buf; 19944 19945 private void init() { 19946 angleRanges = new RotationAngleRange[0]; 19947 } 19948 19949 public MatchColorPatternOptions() { 19950 super(48); 19951 init(); 19952 } 19953 19954 public MatchColorPatternOptions(MatchingMode matchMode, ImageFeatureMode featureMode, 19955 int minContrast, int subpixelAccuracy, RotationAngleRange[] angleRanges, 19956 double colorWeight, ColorSensitivity sensitivity, SearchStrategy strategy, 19957 int numMatchesRequested, double minMatchScore) { 19958 super(48); 19959 this.matchMode = matchMode; 19960 this.featureMode = featureMode; 19961 this.minContrast = minContrast; 19962 this.subpixelAccuracy = subpixelAccuracy; 19963 this.angleRanges = angleRanges; 19964 this.colorWeight = colorWeight; 19965 this.sensitivity = sensitivity; 19966 this.strategy = strategy; 19967 this.numMatchesRequested = numMatchesRequested; 19968 this.minMatchScore = (float) minMatchScore; 19969 } 19970 19971 protected MatchColorPatternOptions(ByteBuffer backing, int offset) { 19972 super(backing, offset, 48); 19973 init(); 19974 } 19975 19976 protected MatchColorPatternOptions(long nativeObj, boolean owned) { 19977 super(nativeObj, owned, 48); 19978 init(); 19979 } 19980 19981 protected void setBuffer(ByteBuffer backing, int offset) { 19982 super.setBuffer(backing, offset, 48); 19983 } 19984 19985 public void read() { 19986 matchMode = MatchingMode.fromValue(backing.getInt(0)); 19987 featureMode = ImageFeatureMode.fromValue(backing.getInt(4)); 19988 minContrast = backing.getInt(8); 19989 subpixelAccuracy = backing.getInt(12); 19990 int angleRanges_numRanges = backing.getInt(20); 19991 long angleRanges_addr = getPointer(backing, 16); 19992 angleRanges = new RotationAngleRange[angleRanges_numRanges]; 19993 if (angleRanges_numRanges > 0 && angleRanges_addr != 0) { 19994 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numRanges * 8); 19995 for (int i = 0, off = 0; i < angleRanges_numRanges; i++, off += 8) { 19996 angleRanges[i] = new RotationAngleRange(bb, off); 19997 angleRanges[i].read(); 19998 } 19999 } 20000 colorWeight = backing.getDouble(24); 20001 sensitivity = ColorSensitivity.fromValue(backing.getInt(32)); 20002 strategy = SearchStrategy.fromValue(backing.getInt(36)); 20003 numMatchesRequested = backing.getInt(40); 20004 minMatchScore = backing.getFloat(44); 20005 } 20006 20007 public void write() { 20008 if (matchMode != null) 20009 backing.putInt(0, matchMode.getValue()); 20010 if (featureMode != null) 20011 backing.putInt(4, featureMode.getValue()); 20012 backing.putInt(8, minContrast); 20013 backing.putInt(12, subpixelAccuracy); 20014 angleRanges_buf = 20015 ByteBuffer.allocateDirect(angleRanges.length * 8).order(ByteOrder.nativeOrder()); 20016 for (int i = 0, off = 0; i < angleRanges.length; i++, off += 8) { 20017 angleRanges[i].setBuffer(angleRanges_buf, off); 20018 angleRanges[i].write(); 20019 } 20020 backing.putInt(20, angleRanges.length); 20021 putPointer(backing, 16, angleRanges_buf); 20022 backing.putDouble(24, colorWeight); 20023 if (sensitivity != null) 20024 backing.putInt(32, sensitivity.getValue()); 20025 if (strategy != null) 20026 backing.putInt(36, strategy.getValue()); 20027 backing.putInt(40, numMatchesRequested); 20028 backing.putFloat(44, minMatchScore); 20029 } 20030 20031 public int size() { 20032 return 48; 20033 } 20034 } 20035 20036 public static class HistogramReport extends DisposedStruct { 20037 public int[] histogram; // An array describing the number of pixels that 20038 // fell into each class. 20039 public float min; // The smallest pixel value that the function classified. 20040 public float max; // The largest pixel value that the function classified. 20041 public float start; // The smallest pixel value that fell into the first 20042 // class. 20043 public float width; // The size of each class. 20044 public float mean; // The mean value of the pixels that the function 20045 // classified. 20046 public float stdDev; // The standard deviation of the pixels that the 20047 // function classified. 20048 public int numPixels; // The number of pixels that the function classified. 20049 private ByteBuffer histogram_buf; 20050 20051 private void init() { 20052 histogram = new int[0]; 20053 } 20054 20055 public HistogramReport() { 20056 super(36); 20057 init(); 20058 } 20059 20060 public HistogramReport(int[] histogram, double min, double max, double start, double width, 20061 double mean, double stdDev, int numPixels) { 20062 super(36); 20063 this.histogram = histogram; 20064 this.min = (float) min; 20065 this.max = (float) max; 20066 this.start = (float) start; 20067 this.width = (float) width; 20068 this.mean = (float) mean; 20069 this.stdDev = (float) stdDev; 20070 this.numPixels = numPixels; 20071 } 20072 20073 protected HistogramReport(ByteBuffer backing, int offset) { 20074 super(backing, offset, 36); 20075 init(); 20076 } 20077 20078 protected HistogramReport(long nativeObj, boolean owned) { 20079 super(nativeObj, owned, 36); 20080 init(); 20081 } 20082 20083 protected void setBuffer(ByteBuffer backing, int offset) { 20084 super.setBuffer(backing, offset, 36); 20085 } 20086 20087 public void read() { 20088 int histogram_histogramCount = backing.getInt(4); 20089 long histogram_addr = getPointer(backing, 0); 20090 histogram = new int[histogram_histogramCount]; 20091 if (histogram_histogramCount > 0 && histogram_addr != 0) { 20092 newDirectByteBuffer(histogram_addr, histogram_histogramCount * 4).asIntBuffer().get( 20093 histogram); 20094 } 20095 min = backing.getFloat(8); 20096 max = backing.getFloat(12); 20097 start = backing.getFloat(16); 20098 width = backing.getFloat(20); 20099 mean = backing.getFloat(24); 20100 stdDev = backing.getFloat(28); 20101 numPixels = backing.getInt(32); 20102 } 20103 20104 public void write() { 20105 histogram_buf = 20106 ByteBuffer.allocateDirect(histogram.length * 4).order(ByteOrder.nativeOrder()); 20107 histogram_buf.asIntBuffer().put(histogram).rewind(); 20108 backing.putInt(4, histogram.length); 20109 putPointer(backing, 0, histogram_buf); 20110 backing.putFloat(8, min); 20111 backing.putFloat(12, max); 20112 backing.putFloat(16, start); 20113 backing.putFloat(20, width); 20114 backing.putFloat(24, mean); 20115 backing.putFloat(28, stdDev); 20116 backing.putInt(32, numPixels); 20117 } 20118 20119 public int size() { 20120 return 36; 20121 } 20122 } 20123 20124 public static class ArcInfo extends DisposedStruct { 20125 public Rect boundingBox; // The coordinate location of the bounding box of 20126 // the arc. 20127 public double startAngle; // The counterclockwise angle from the x-axis in 20128 // degrees to the start of the arc. 20129 public double endAngle; // The counterclockwise angle from the x-axis in 20130 // degrees to the end of the arc. 20131 20132 private void init() { 20133 boundingBox = new Rect(backing, 0); 20134 } 20135 20136 public ArcInfo() { 20137 super(32); 20138 init(); 20139 } 20140 20141 public ArcInfo(Rect boundingBox, double startAngle, double endAngle) { 20142 super(32); 20143 this.boundingBox = boundingBox; 20144 this.startAngle = startAngle; 20145 this.endAngle = endAngle; 20146 } 20147 20148 protected ArcInfo(ByteBuffer backing, int offset) { 20149 super(backing, offset, 32); 20150 init(); 20151 } 20152 20153 protected ArcInfo(long nativeObj, boolean owned) { 20154 super(nativeObj, owned, 32); 20155 init(); 20156 } 20157 20158 protected void setBuffer(ByteBuffer backing, int offset) { 20159 super.setBuffer(backing, offset, 32); 20160 } 20161 20162 public void read() { 20163 boundingBox.read(); 20164 startAngle = backing.getDouble(16); 20165 endAngle = backing.getDouble(24); 20166 } 20167 20168 public void write() { 20169 boundingBox.write(); 20170 backing.putDouble(16, startAngle); 20171 backing.putDouble(24, endAngle); 20172 } 20173 20174 public int size() { 20175 return 32; 20176 } 20177 } 20178 20179 public static class AxisReport extends DisposedStruct { 20180 public PointFloat origin; // The origin of the coordinate system, which is 20181 // the intersection of the two axes of the 20182 // coordinate system. 20183 public PointFloat mainAxisEnd; // The end of the main axis, which is the 20184 // result of the computation of the 20185 // intersection of the main axis with the 20186 // rectangular search area. 20187 public PointFloat secondaryAxisEnd; // The end of the secondary axis, which 20188 // is the result of the computation of 20189 // the intersection of the secondary 20190 // axis with the rectangular search 20191 // area. 20192 20193 private void init() { 20194 origin = new PointFloat(backing, 0); 20195 mainAxisEnd = new PointFloat(backing, 8); 20196 secondaryAxisEnd = new PointFloat(backing, 16); 20197 } 20198 20199 public AxisReport() { 20200 super(24); 20201 init(); 20202 } 20203 20204 public AxisReport(PointFloat origin, PointFloat mainAxisEnd, PointFloat secondaryAxisEnd) { 20205 super(24); 20206 this.origin = origin; 20207 this.mainAxisEnd = mainAxisEnd; 20208 this.secondaryAxisEnd = secondaryAxisEnd; 20209 } 20210 20211 protected AxisReport(ByteBuffer backing, int offset) { 20212 super(backing, offset, 24); 20213 init(); 20214 } 20215 20216 protected AxisReport(long nativeObj, boolean owned) { 20217 super(nativeObj, owned, 24); 20218 init(); 20219 } 20220 20221 protected void setBuffer(ByteBuffer backing, int offset) { 20222 super.setBuffer(backing, offset, 24); 20223 } 20224 20225 public void read() { 20226 origin.read(); 20227 mainAxisEnd.read(); 20228 secondaryAxisEnd.read(); 20229 } 20230 20231 public void write() { 20232 origin.write(); 20233 mainAxisEnd.write(); 20234 secondaryAxisEnd.write(); 20235 } 20236 20237 public int size() { 20238 return 24; 20239 } 20240 } 20241 20242 public static class BarcodeInfo extends DisposedStruct { 20243 public String outputString; // A string containing the decoded barcode data. 20244 public int size; // The size of the output string. 20245 public byte outputChar1; // The contents of this character depend on the 20246 // barcode type. 20247 public byte outputChar2; // The contents of this character depend on the 20248 // barcode type. 20249 public double confidenceLevel; // A quality measure of the decoded barcode 20250 // ranging from 0 to 100, with 100 being the 20251 // best. 20252 public BarcodeType type; // The type of barcode. 20253 private ByteBuffer outputString_buf; 20254 20255 private void init() { 20256 20257 } 20258 20259 public BarcodeInfo() { 20260 super(32); 20261 init(); 20262 } 20263 20264 public BarcodeInfo(String outputString, int size, byte outputChar1, byte outputChar2, 20265 double confidenceLevel, BarcodeType type) { 20266 super(32); 20267 this.outputString = outputString; 20268 this.size = size; 20269 this.outputChar1 = outputChar1; 20270 this.outputChar2 = outputChar2; 20271 this.confidenceLevel = confidenceLevel; 20272 this.type = type; 20273 } 20274 20275 protected BarcodeInfo(ByteBuffer backing, int offset) { 20276 super(backing, offset, 32); 20277 init(); 20278 } 20279 20280 protected BarcodeInfo(long nativeObj, boolean owned) { 20281 super(nativeObj, owned, 32); 20282 init(); 20283 } 20284 20285 protected void setBuffer(ByteBuffer backing, int offset) { 20286 super.setBuffer(backing, offset, 32); 20287 } 20288 20289 public void read() { 20290 long outputString_addr = getPointer(backing, 0); 20291 if (outputString_addr == 0) 20292 outputString = null; 20293 else { 20294 ByteBuffer bb = newDirectByteBuffer(outputString_addr, 1000); // FIXME 20295 while (bb.get() != 0) { 20296 } 20297 byte[] bytes = new byte[bb.position() - 1]; 20298 getBytes(bb, bytes, 0, bytes.length); 20299 try { 20300 outputString = new String(bytes, "UTF-8"); 20301 } catch (UnsupportedEncodingException e) { 20302 outputString = ""; 20303 } 20304 } 20305 20306 size = backing.getInt(4); 20307 outputChar1 = backing.get(8); 20308 outputChar2 = backing.get(9); 20309 confidenceLevel = backing.getDouble(16); 20310 type = BarcodeType.fromValue(backing.getInt(24)); 20311 } 20312 20313 public void write() { 20314 if (outputString != null) { 20315 byte[] outputString_bytes; 20316 try { 20317 outputString_bytes = outputString.getBytes("UTF-8"); 20318 } catch (UnsupportedEncodingException e) { 20319 outputString_bytes = new byte[0]; 20320 } 20321 outputString_buf = ByteBuffer.allocateDirect(outputString_bytes.length + 1); 20322 putBytes(outputString_buf, outputString_bytes, 0, outputString_bytes.length).put( 20323 outputString_bytes.length, (byte) 0); 20324 } 20325 putPointer(backing, 0, outputString == null ? 0 : getByteBufferAddress(outputString_buf)); 20326 backing.putInt(4, size); 20327 backing.put(8, outputChar1); 20328 backing.put(9, outputChar2); 20329 backing.putDouble(16, confidenceLevel); 20330 if (type != null) 20331 backing.putInt(24, type.getValue()); 20332 } 20333 20334 public int size() { 20335 return 32; 20336 } 20337 } 20338 20339 public static class BCGOptions extends DisposedStruct { 20340 public float brightness; // Adjusts the brightness of the image. 20341 public float contrast; // Adjusts the contrast of the image. 20342 public float gamma; // Performs gamma correction. 20343 20344 private void init() { 20345 20346 } 20347 20348 public BCGOptions() { 20349 super(12); 20350 init(); 20351 } 20352 20353 public BCGOptions(double brightness, double contrast, double gamma) { 20354 super(12); 20355 this.brightness = (float) brightness; 20356 this.contrast = (float) contrast; 20357 this.gamma = (float) gamma; 20358 } 20359 20360 protected BCGOptions(ByteBuffer backing, int offset) { 20361 super(backing, offset, 12); 20362 init(); 20363 } 20364 20365 protected BCGOptions(long nativeObj, boolean owned) { 20366 super(nativeObj, owned, 12); 20367 init(); 20368 } 20369 20370 protected void setBuffer(ByteBuffer backing, int offset) { 20371 super.setBuffer(backing, offset, 12); 20372 } 20373 20374 public void read() { 20375 brightness = backing.getFloat(0); 20376 contrast = backing.getFloat(4); 20377 gamma = backing.getFloat(8); 20378 } 20379 20380 public void write() { 20381 backing.putFloat(0, brightness); 20382 backing.putFloat(4, contrast); 20383 backing.putFloat(8, gamma); 20384 } 20385 20386 public int size() { 20387 return 12; 20388 } 20389 } 20390 20391 public static class BestCircle extends DisposedStruct { 20392 public PointFloat center; // The coordinate location of the center of the 20393 // circle. 20394 public double radius; // The radius of the circle. 20395 public double area; // The area of the circle. 20396 public double perimeter; // The length of the perimeter of the circle. 20397 public double error; // Represents the least square error of the fitted 20398 // circle to the entire set of points. 20399 20400 private void init() { 20401 center = new PointFloat(backing, 0); 20402 } 20403 20404 public BestCircle() { 20405 super(40); 20406 init(); 20407 } 20408 20409 public BestCircle(PointFloat center, double radius, double area, double perimeter, double error) { 20410 super(40); 20411 this.center = center; 20412 this.radius = radius; 20413 this.area = area; 20414 this.perimeter = perimeter; 20415 this.error = error; 20416 } 20417 20418 protected BestCircle(ByteBuffer backing, int offset) { 20419 super(backing, offset, 40); 20420 init(); 20421 } 20422 20423 protected BestCircle(long nativeObj, boolean owned) { 20424 super(nativeObj, owned, 40); 20425 init(); 20426 } 20427 20428 protected void setBuffer(ByteBuffer backing, int offset) { 20429 super.setBuffer(backing, offset, 40); 20430 } 20431 20432 public void read() { 20433 center.read(); 20434 radius = backing.getDouble(8); 20435 area = backing.getDouble(16); 20436 perimeter = backing.getDouble(24); 20437 error = backing.getDouble(32); 20438 } 20439 20440 public void write() { 20441 center.write(); 20442 backing.putDouble(8, radius); 20443 backing.putDouble(16, area); 20444 backing.putDouble(24, perimeter); 20445 backing.putDouble(32, error); 20446 } 20447 20448 public int size() { 20449 return 40; 20450 } 20451 } 20452 20453 public static class BestEllipse extends DisposedStruct { 20454 public PointFloat center; // The coordinate location of the center of the 20455 // ellipse. 20456 public PointFloat majorAxisStart; // The coordinate location of the start of 20457 // the major axis of the ellipse. 20458 public PointFloat majorAxisEnd; // The coordinate location of the end of the 20459 // major axis of the ellipse. 20460 public PointFloat minorAxisStart; // The coordinate location of the start of 20461 // the minor axis of the ellipse. 20462 public PointFloat minorAxisEnd; // The coordinate location of the end of the 20463 // minor axis of the ellipse. 20464 public double area; // The area of the ellipse. 20465 public double perimeter; // The length of the perimeter of the ellipse. 20466 20467 private void init() { 20468 center = new PointFloat(backing, 0); 20469 majorAxisStart = new PointFloat(backing, 8); 20470 majorAxisEnd = new PointFloat(backing, 16); 20471 minorAxisStart = new PointFloat(backing, 24); 20472 minorAxisEnd = new PointFloat(backing, 32); 20473 } 20474 20475 public BestEllipse() { 20476 super(56); 20477 init(); 20478 } 20479 20480 public BestEllipse(PointFloat center, PointFloat majorAxisStart, PointFloat majorAxisEnd, 20481 PointFloat minorAxisStart, PointFloat minorAxisEnd, double area, double perimeter) { 20482 super(56); 20483 this.center = center; 20484 this.majorAxisStart = majorAxisStart; 20485 this.majorAxisEnd = majorAxisEnd; 20486 this.minorAxisStart = minorAxisStart; 20487 this.minorAxisEnd = minorAxisEnd; 20488 this.area = area; 20489 this.perimeter = perimeter; 20490 } 20491 20492 protected BestEllipse(ByteBuffer backing, int offset) { 20493 super(backing, offset, 56); 20494 init(); 20495 } 20496 20497 protected BestEllipse(long nativeObj, boolean owned) { 20498 super(nativeObj, owned, 56); 20499 init(); 20500 } 20501 20502 protected void setBuffer(ByteBuffer backing, int offset) { 20503 super.setBuffer(backing, offset, 56); 20504 } 20505 20506 public void read() { 20507 center.read(); 20508 majorAxisStart.read(); 20509 majorAxisEnd.read(); 20510 minorAxisStart.read(); 20511 minorAxisEnd.read(); 20512 area = backing.getDouble(40); 20513 perimeter = backing.getDouble(48); 20514 } 20515 20516 public void write() { 20517 center.write(); 20518 majorAxisStart.write(); 20519 majorAxisEnd.write(); 20520 minorAxisStart.write(); 20521 minorAxisEnd.write(); 20522 backing.putDouble(40, area); 20523 backing.putDouble(48, perimeter); 20524 } 20525 20526 public int size() { 20527 return 56; 20528 } 20529 } 20530 20531 public static class BestLine extends DisposedStruct { 20532 public PointFloat start; // The coordinate location of the start of the 20533 // line. 20534 public PointFloat end; // The coordinate location of the end of the line. 20535 public LineEquation equation; // Defines the three coefficients of the 20536 // equation of the best fit line. 20537 public int valid; // This element is TRUE if the function achieved the 20538 // minimum score within the number of allowed refinement 20539 // iterations and FALSE if the function did not achieve 20540 // the minimum score. 20541 public double error; // Represents the least square error of the fitted line 20542 // to the entire set of points. 20543 public int[] pointsUsed; // An array of the indexes for the points array 20544 // indicating which points the function used to fit 20545 // the line. 20546 private ByteBuffer pointsUsed_buf; 20547 20548 private void init() { 20549 start = new PointFloat(backing, 0); 20550 end = new PointFloat(backing, 8); 20551 equation = new LineEquation(backing, 16); 20552 pointsUsed = new int[0]; 20553 } 20554 20555 public BestLine() { 20556 super(64); 20557 init(); 20558 } 20559 20560 public BestLine(PointFloat start, PointFloat end, LineEquation equation, int valid, 20561 double error, int[] pointsUsed) { 20562 super(64); 20563 this.start = start; 20564 this.end = end; 20565 this.equation = equation; 20566 this.valid = valid; 20567 this.error = error; 20568 this.pointsUsed = pointsUsed; 20569 } 20570 20571 protected BestLine(ByteBuffer backing, int offset) { 20572 super(backing, offset, 64); 20573 init(); 20574 } 20575 20576 protected BestLine(long nativeObj, boolean owned) { 20577 super(nativeObj, owned, 64); 20578 init(); 20579 } 20580 20581 protected void setBuffer(ByteBuffer backing, int offset) { 20582 super.setBuffer(backing, offset, 64); 20583 } 20584 20585 public void read() { 20586 start.read(); 20587 end.read(); 20588 equation.read(); 20589 valid = backing.getInt(40); 20590 error = backing.getDouble(48); 20591 int pointsUsed_numPointsUsed = backing.getInt(60); 20592 long pointsUsed_addr = getPointer(backing, 56); 20593 pointsUsed = new int[pointsUsed_numPointsUsed]; 20594 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 20595 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed * 4).asIntBuffer().get( 20596 pointsUsed); 20597 } 20598 } 20599 20600 public void write() { 20601 start.write(); 20602 end.write(); 20603 equation.write(); 20604 backing.putInt(40, valid); 20605 backing.putDouble(48, error); 20606 pointsUsed_buf = 20607 ByteBuffer.allocateDirect(pointsUsed.length * 4).order(ByteOrder.nativeOrder()); 20608 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 20609 backing.putInt(60, pointsUsed.length); 20610 putPointer(backing, 56, pointsUsed_buf); 20611 } 20612 20613 public int size() { 20614 return 64; 20615 } 20616 } 20617 20618 public static class BrowserOptions extends DisposedStruct { 20619 public int width; // The width to make the browser. 20620 public int height; // The height to make the browser image. 20621 public int imagesPerLine; // The number of images to place on a single line. 20622 public RGBValue backgroundColor; // The background color of the browser. 20623 public int frameSize; // Specifies the number of pixels with which to border 20624 // each thumbnail. 20625 public BrowserFrameStyle style; // The style for the frame around each 20626 // thumbnail. 20627 public float ratio; // Specifies the width to height ratio of each 20628 // thumbnail. 20629 public RGBValue focusColor; // The color to use to display focused cells. 20630 20631 private void init() { 20632 backgroundColor = new RGBValue(backing, 12); 20633 focusColor = new RGBValue(backing, 28); 20634 } 20635 20636 public BrowserOptions() { 20637 super(32); 20638 init(); 20639 } 20640 20641 public BrowserOptions(int width, int height, int imagesPerLine, RGBValue backgroundColor, 20642 int frameSize, BrowserFrameStyle style, double ratio, RGBValue focusColor) { 20643 super(32); 20644 this.width = width; 20645 this.height = height; 20646 this.imagesPerLine = imagesPerLine; 20647 this.backgroundColor = backgroundColor; 20648 this.frameSize = frameSize; 20649 this.style = style; 20650 this.ratio = (float) ratio; 20651 this.focusColor = focusColor; 20652 } 20653 20654 protected BrowserOptions(ByteBuffer backing, int offset) { 20655 super(backing, offset, 32); 20656 init(); 20657 } 20658 20659 protected BrowserOptions(long nativeObj, boolean owned) { 20660 super(nativeObj, owned, 32); 20661 init(); 20662 } 20663 20664 protected void setBuffer(ByteBuffer backing, int offset) { 20665 super.setBuffer(backing, offset, 32); 20666 } 20667 20668 public void read() { 20669 width = backing.getInt(0); 20670 height = backing.getInt(4); 20671 imagesPerLine = backing.getInt(8); 20672 backgroundColor.read(); 20673 frameSize = backing.getInt(16); 20674 style = BrowserFrameStyle.fromValue(backing.getInt(20)); 20675 ratio = backing.getFloat(24); 20676 focusColor.read(); 20677 } 20678 20679 public void write() { 20680 backing.putInt(0, width); 20681 backing.putInt(4, height); 20682 backing.putInt(8, imagesPerLine); 20683 backgroundColor.write(); 20684 backing.putInt(16, frameSize); 20685 if (style != null) 20686 backing.putInt(20, style.getValue()); 20687 backing.putFloat(24, ratio); 20688 focusColor.write(); 20689 } 20690 20691 public int size() { 20692 return 32; 20693 } 20694 } 20695 20696 public static class CoordinateSystem extends DisposedStruct { 20697 public PointFloat origin; // The origin of the coordinate system. 20698 public float angle; // The angle, in degrees, of the x-axis of the 20699 // coordinate system relative to the image x-axis. 20700 public AxisOrientation axisOrientation; // The direction of the y-axis of 20701 // the coordinate reference system. 20702 20703 private void init() { 20704 origin = new PointFloat(backing, 0); 20705 } 20706 20707 public CoordinateSystem() { 20708 super(16); 20709 init(); 20710 } 20711 20712 public CoordinateSystem(PointFloat origin, double angle, AxisOrientation axisOrientation) { 20713 super(16); 20714 this.origin = origin; 20715 this.angle = (float) angle; 20716 this.axisOrientation = axisOrientation; 20717 } 20718 20719 protected CoordinateSystem(ByteBuffer backing, int offset) { 20720 super(backing, offset, 16); 20721 init(); 20722 } 20723 20724 protected CoordinateSystem(long nativeObj, boolean owned) { 20725 super(nativeObj, owned, 16); 20726 init(); 20727 } 20728 20729 protected void setBuffer(ByteBuffer backing, int offset) { 20730 super.setBuffer(backing, offset, 16); 20731 } 20732 20733 public void read() { 20734 origin.read(); 20735 angle = backing.getFloat(8); 20736 axisOrientation = AxisOrientation.fromValue(backing.getInt(12)); 20737 } 20738 20739 public void write() { 20740 origin.write(); 20741 backing.putFloat(8, angle); 20742 if (axisOrientation != null) 20743 backing.putInt(12, axisOrientation.getValue()); 20744 } 20745 20746 public int size() { 20747 return 16; 20748 } 20749 } 20750 20751 public static class CalibrationInfo extends DisposedStruct { 20752 public int mapColumns; // The number of columns in the error map. 20753 public int mapRows; // The number of rows in the error map. 20754 public ROI userRoi; // Specifies the ROI the user provided when learning the 20755 // calibration. 20756 public ROI calibrationRoi; // Specifies the ROI that corresponds to the 20757 // region of the image where the calibration 20758 // information is accurate. 20759 public LearnCalibrationOptions options; // Specifies the calibration options 20760 // the user provided when learning 20761 // the calibration. 20762 public GridDescriptor grid; // Specifies the scaling constants for the 20763 // image. 20764 public CoordinateSystem system; // Specifies the coordinate system for the 20765 // real world coordinates. 20766 public RangeFloat range; // The range of the grayscale the function used to 20767 // represent the circles in the grid image. 20768 public float quality; // The quality score of the learning process, which is 20769 // a value between 0-1000. 20770 20771 private void init() { 20772 options = new LearnCalibrationOptions(backing, 20); 20773 grid = new GridDescriptor(backing, 40); 20774 system = new CoordinateSystem(backing, 52); 20775 range = new RangeFloat(backing, 68); 20776 } 20777 20778 public CalibrationInfo() { 20779 super(80); 20780 init(); 20781 } 20782 20783 public CalibrationInfo(int mapColumns, int mapRows, ROI userRoi, ROI calibrationRoi, 20784 LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system, 20785 RangeFloat range, double quality) { 20786 super(80); 20787 this.mapColumns = mapColumns; 20788 this.mapRows = mapRows; 20789 this.userRoi = userRoi; 20790 this.calibrationRoi = calibrationRoi; 20791 this.options = options; 20792 this.grid = grid; 20793 this.system = system; 20794 this.range = range; 20795 this.quality = (float) quality; 20796 } 20797 20798 protected CalibrationInfo(ByteBuffer backing, int offset) { 20799 super(backing, offset, 80); 20800 init(); 20801 } 20802 20803 protected CalibrationInfo(long nativeObj, boolean owned) { 20804 super(nativeObj, owned, 80); 20805 init(); 20806 } 20807 20808 protected void setBuffer(ByteBuffer backing, int offset) { 20809 super.setBuffer(backing, offset, 80); 20810 } 20811 20812 public void read() { 20813 mapColumns = backing.getInt(4); 20814 mapRows = backing.getInt(8); 20815 long userRoi_addr = getPointer(backing, 12); 20816 if (userRoi_addr == 0) 20817 userRoi = null; 20818 else 20819 userRoi = new ROI(userRoi_addr, false); 20820 long calibrationRoi_addr = getPointer(backing, 16); 20821 if (calibrationRoi_addr == 0) 20822 calibrationRoi = null; 20823 else 20824 calibrationRoi = new ROI(calibrationRoi_addr, false); 20825 options.read(); 20826 grid.read(); 20827 system.read(); 20828 range.read(); 20829 quality = backing.getFloat(76); 20830 } 20831 20832 public void write() { 20833 backing.putInt(4, mapColumns); 20834 backing.putInt(8, mapRows); 20835 putPointer(backing, 12, userRoi); 20836 putPointer(backing, 16, calibrationRoi); 20837 options.write(); 20838 grid.write(); 20839 system.write(); 20840 range.write(); 20841 backing.putFloat(76, quality); 20842 } 20843 20844 public int size() { 20845 return 80; 20846 } 20847 } 20848 20849 public static class CalibrationPoints extends DisposedStruct { 20850 public PointFloat[] pixelCoordinates; // The array of pixel coordinates. 20851 public PointFloat[] realWorldCoordinates; // The array of corresponding 20852 // real-world coordinates. 20853 private ByteBuffer pixelCoordinates_buf; 20854 private ByteBuffer realWorldCoordinates_buf; 20855 20856 private void init() { 20857 pixelCoordinates = new PointFloat[0]; 20858 realWorldCoordinates = new PointFloat[0]; 20859 } 20860 20861 public CalibrationPoints() { 20862 super(12); 20863 init(); 20864 } 20865 20866 public CalibrationPoints(PointFloat[] pixelCoordinates, PointFloat[] realWorldCoordinates) { 20867 super(12); 20868 this.pixelCoordinates = pixelCoordinates; 20869 this.realWorldCoordinates = realWorldCoordinates; 20870 } 20871 20872 protected CalibrationPoints(ByteBuffer backing, int offset) { 20873 super(backing, offset, 12); 20874 init(); 20875 } 20876 20877 protected CalibrationPoints(long nativeObj, boolean owned) { 20878 super(nativeObj, owned, 12); 20879 init(); 20880 } 20881 20882 protected void setBuffer(ByteBuffer backing, int offset) { 20883 super.setBuffer(backing, offset, 12); 20884 } 20885 20886 public void read() { 20887 int pixelCoordinates_numCoordinates = backing.getInt(8); 20888 long pixelCoordinates_addr = getPointer(backing, 0); 20889 pixelCoordinates = new PointFloat[pixelCoordinates_numCoordinates]; 20890 if (pixelCoordinates_numCoordinates > 0 && pixelCoordinates_addr != 0) { 20891 ByteBuffer bb = 20892 newDirectByteBuffer(pixelCoordinates_addr, pixelCoordinates_numCoordinates * 8); 20893 for (int i = 0, off = 0; i < pixelCoordinates_numCoordinates; i++, off += 8) { 20894 pixelCoordinates[i] = new PointFloat(bb, off); 20895 pixelCoordinates[i].read(); 20896 } 20897 } 20898 int realWorldCoordinates_numCoordinates = backing.getInt(8); 20899 long realWorldCoordinates_addr = getPointer(backing, 4); 20900 realWorldCoordinates = new PointFloat[realWorldCoordinates_numCoordinates]; 20901 if (realWorldCoordinates_numCoordinates > 0 && realWorldCoordinates_addr != 0) { 20902 ByteBuffer bb = 20903 newDirectByteBuffer(realWorldCoordinates_addr, realWorldCoordinates_numCoordinates * 8); 20904 for (int i = 0, off = 0; i < realWorldCoordinates_numCoordinates; i++, off += 8) { 20905 realWorldCoordinates[i] = new PointFloat(bb, off); 20906 realWorldCoordinates[i].read(); 20907 } 20908 } 20909 } 20910 20911 public void write() { 20912 pixelCoordinates_buf = 20913 ByteBuffer.allocateDirect(pixelCoordinates.length * 8).order(ByteOrder.nativeOrder()); 20914 for (int i = 0, off = 0; i < pixelCoordinates.length; i++, off += 8) { 20915 pixelCoordinates[i].setBuffer(pixelCoordinates_buf, off); 20916 pixelCoordinates[i].write(); 20917 } 20918 backing.putInt(8, pixelCoordinates.length); 20919 putPointer(backing, 0, pixelCoordinates_buf); 20920 realWorldCoordinates_buf = 20921 ByteBuffer.allocateDirect(realWorldCoordinates.length * 8).order(ByteOrder.nativeOrder()); 20922 for (int i = 0, off = 0; i < realWorldCoordinates.length; i++, off += 8) { 20923 realWorldCoordinates[i].setBuffer(realWorldCoordinates_buf, off); 20924 realWorldCoordinates[i].write(); 20925 } 20926 backing.putInt(8, realWorldCoordinates.length); 20927 putPointer(backing, 4, realWorldCoordinates_buf); 20928 } 20929 20930 public int size() { 20931 return 12; 20932 } 20933 } 20934 20935 public static class CaliperOptions extends DisposedStruct { 20936 public TwoEdgePolarityType polarity; // Specifies the edge polarity of the 20937 // edge pairs. 20938 public float separation; // The distance between edge pairs. 20939 public float separationDeviation; // Sets the range around the separation 20940 // value. 20941 20942 private void init() { 20943 20944 } 20945 20946 public CaliperOptions() { 20947 super(12); 20948 init(); 20949 } 20950 20951 public CaliperOptions(TwoEdgePolarityType polarity, double separation, 20952 double separationDeviation) { 20953 super(12); 20954 this.polarity = polarity; 20955 this.separation = (float) separation; 20956 this.separationDeviation = (float) separationDeviation; 20957 } 20958 20959 protected CaliperOptions(ByteBuffer backing, int offset) { 20960 super(backing, offset, 12); 20961 init(); 20962 } 20963 20964 protected CaliperOptions(long nativeObj, boolean owned) { 20965 super(nativeObj, owned, 12); 20966 init(); 20967 } 20968 20969 protected void setBuffer(ByteBuffer backing, int offset) { 20970 super.setBuffer(backing, offset, 12); 20971 } 20972 20973 public void read() { 20974 polarity = TwoEdgePolarityType.fromValue(backing.getInt(0)); 20975 separation = backing.getFloat(4); 20976 separationDeviation = backing.getFloat(8); 20977 } 20978 20979 public void write() { 20980 if (polarity != null) 20981 backing.putInt(0, polarity.getValue()); 20982 backing.putFloat(4, separation); 20983 backing.putFloat(8, separationDeviation); 20984 } 20985 20986 public int size() { 20987 return 12; 20988 } 20989 } 20990 20991 public static class CaliperReport extends DisposedStruct { 20992 public float edge1Contrast; // The contrast of the first edge. 20993 public PointFloat edge1Coord; // The coordinates of the first edge. 20994 public float edge2Contrast; // The contrast of the second edge. 20995 public PointFloat edge2Coord; // The coordinates of the second edge. 20996 public float separation; // The distance between the two edges. 20997 20998 private void init() { 20999 edge1Coord = new PointFloat(backing, 4); 21000 edge2Coord = new PointFloat(backing, 16); 21001 } 21002 21003 public CaliperReport() { 21004 super(32); 21005 init(); 21006 } 21007 21008 public CaliperReport(double edge1Contrast, PointFloat edge1Coord, double edge2Contrast, 21009 PointFloat edge2Coord, double separation) { 21010 super(32); 21011 this.edge1Contrast = (float) edge1Contrast; 21012 this.edge1Coord = edge1Coord; 21013 this.edge2Contrast = (float) edge2Contrast; 21014 this.edge2Coord = edge2Coord; 21015 this.separation = (float) separation; 21016 } 21017 21018 protected CaliperReport(ByteBuffer backing, int offset) { 21019 super(backing, offset, 32); 21020 init(); 21021 } 21022 21023 protected CaliperReport(long nativeObj, boolean owned) { 21024 super(nativeObj, owned, 32); 21025 init(); 21026 } 21027 21028 protected void setBuffer(ByteBuffer backing, int offset) { 21029 super.setBuffer(backing, offset, 32); 21030 } 21031 21032 public void read() { 21033 edge1Contrast = backing.getFloat(0); 21034 edge1Coord.read(); 21035 edge2Contrast = backing.getFloat(12); 21036 edge2Coord.read(); 21037 separation = backing.getFloat(24); 21038 } 21039 21040 public void write() { 21041 backing.putFloat(0, edge1Contrast); 21042 edge1Coord.write(); 21043 backing.putFloat(12, edge2Contrast); 21044 edge2Coord.write(); 21045 backing.putFloat(24, separation); 21046 } 21047 21048 public int size() { 21049 return 32; 21050 } 21051 } 21052 21053 public static class DrawTextOptions extends DisposedStruct { 21054 public String fontName; // The font name to use. 21055 public int fontSize; // The size of the font. 21056 public int bold; // Set this parameter to TRUE to bold text. 21057 public int italic; // Set this parameter to TRUE to italicize text. 21058 public int underline; // Set this parameter to TRUE to underline text. 21059 public int strikeout; // Set this parameter to TRUE to strikeout text. 21060 public TextAlignment textAlignment; // Sets the alignment of text. 21061 public FontColor fontColor; // Sets the font color. 21062 21063 private void init() { 21064 21065 } 21066 21067 public DrawTextOptions() { 21068 super(60); 21069 init(); 21070 } 21071 21072 public DrawTextOptions(String fontName, int fontSize, int bold, int italic, int underline, 21073 int strikeout, TextAlignment textAlignment, FontColor fontColor) { 21074 super(60); 21075 this.fontName = fontName; 21076 this.fontSize = fontSize; 21077 this.bold = bold; 21078 this.italic = italic; 21079 this.underline = underline; 21080 this.strikeout = strikeout; 21081 this.textAlignment = textAlignment; 21082 this.fontColor = fontColor; 21083 } 21084 21085 protected DrawTextOptions(ByteBuffer backing, int offset) { 21086 super(backing, offset, 60); 21087 init(); 21088 } 21089 21090 protected DrawTextOptions(long nativeObj, boolean owned) { 21091 super(nativeObj, owned, 60); 21092 init(); 21093 } 21094 21095 protected void setBuffer(ByteBuffer backing, int offset) { 21096 super.setBuffer(backing, offset, 60); 21097 } 21098 21099 public void read() { 21100 { 21101 byte[] bytes = new byte[32]; 21102 getBytes(backing, bytes, 0, 32); 21103 int len; 21104 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 21105 } 21106 try { 21107 fontName = new String(bytes, 0, len, "UTF-8"); 21108 } catch (UnsupportedEncodingException e) { 21109 fontName = ""; 21110 } 21111 } 21112 fontSize = backing.getInt(32); 21113 bold = backing.getInt(36); 21114 italic = backing.getInt(40); 21115 underline = backing.getInt(44); 21116 strikeout = backing.getInt(48); 21117 textAlignment = TextAlignment.fromValue(backing.getInt(52)); 21118 fontColor = FontColor.fromValue(backing.getInt(56)); 21119 } 21120 21121 public void write() { 21122 if (fontName != null) { 21123 byte[] bytes; 21124 try { 21125 bytes = fontName.getBytes("UTF-8"); 21126 } catch (UnsupportedEncodingException e) { 21127 bytes = new byte[0]; 21128 } 21129 putBytes(backing, bytes, 0, bytes.length); 21130 for (int i = bytes.length; i < 32; i++) 21131 backing.put(i, (byte) 0); // fill with zero 21132 } 21133 backing.putInt(32, fontSize); 21134 backing.putInt(36, bold); 21135 backing.putInt(40, italic); 21136 backing.putInt(44, underline); 21137 backing.putInt(48, strikeout); 21138 if (textAlignment != null) 21139 backing.putInt(52, textAlignment.getValue()); 21140 if (fontColor != null) 21141 backing.putInt(56, fontColor.getValue()); 21142 } 21143 21144 public int size() { 21145 return 60; 21146 } 21147 } 21148 21149 public static class CircleReport extends DisposedStruct { 21150 public Point center; // The coordinate point of the center of the circle. 21151 public int radius; // The radius of the circle, in pixels. 21152 public int area; // The area of the circle, in pixels. 21153 21154 private void init() { 21155 center = new Point(backing, 0); 21156 } 21157 21158 public CircleReport() { 21159 super(16); 21160 init(); 21161 } 21162 21163 public CircleReport(Point center, int radius, int area) { 21164 super(16); 21165 this.center = center; 21166 this.radius = radius; 21167 this.area = area; 21168 } 21169 21170 protected CircleReport(ByteBuffer backing, int offset) { 21171 super(backing, offset, 16); 21172 init(); 21173 } 21174 21175 protected CircleReport(long nativeObj, boolean owned) { 21176 super(nativeObj, owned, 16); 21177 init(); 21178 } 21179 21180 protected void setBuffer(ByteBuffer backing, int offset) { 21181 super.setBuffer(backing, offset, 16); 21182 } 21183 21184 public void read() { 21185 center.read(); 21186 radius = backing.getInt(8); 21187 area = backing.getInt(12); 21188 } 21189 21190 public void write() { 21191 center.write(); 21192 backing.putInt(8, radius); 21193 backing.putInt(12, area); 21194 } 21195 21196 public int size() { 21197 return 16; 21198 } 21199 } 21200 21201 public static class ClosedContour extends DisposedStruct { 21202 public Point[] points; // The points that make up the closed contour. 21203 private ByteBuffer points_buf; 21204 21205 private void init() { 21206 points = new Point[0]; 21207 } 21208 21209 public ClosedContour() { 21210 super(8); 21211 init(); 21212 } 21213 21214 public ClosedContour(Point[] points) { 21215 super(8); 21216 this.points = points; 21217 } 21218 21219 protected ClosedContour(ByteBuffer backing, int offset) { 21220 super(backing, offset, 8); 21221 init(); 21222 } 21223 21224 protected ClosedContour(long nativeObj, boolean owned) { 21225 super(nativeObj, owned, 8); 21226 init(); 21227 } 21228 21229 protected void setBuffer(ByteBuffer backing, int offset) { 21230 super.setBuffer(backing, offset, 8); 21231 } 21232 21233 public void read() { 21234 int points_numPoints = backing.getInt(4); 21235 long points_addr = getPointer(backing, 0); 21236 points = new Point[points_numPoints]; 21237 if (points_numPoints > 0 && points_addr != 0) { 21238 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints * 8); 21239 for (int i = 0, off = 0; i < points_numPoints; i++, off += 8) { 21240 points[i] = new Point(bb, off); 21241 points[i].read(); 21242 } 21243 } 21244 } 21245 21246 public void write() { 21247 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 21248 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 21249 points[i].setBuffer(points_buf, off); 21250 points[i].write(); 21251 } 21252 backing.putInt(4, points.length); 21253 putPointer(backing, 0, points_buf); 21254 } 21255 21256 public int size() { 21257 return 8; 21258 } 21259 } 21260 21261 public static class ColorHistogramReport extends DisposedStruct { 21262 public HistogramReport plane1; // The histogram report of the first color 21263 // plane. 21264 public HistogramReport plane2; // The histogram report of the second plane. 21265 public HistogramReport plane3; // The histogram report of the third plane. 21266 21267 private void init() { 21268 plane1 = new HistogramReport(backing, 0); 21269 plane2 = new HistogramReport(backing, 36); 21270 plane3 = new HistogramReport(backing, 72); 21271 } 21272 21273 public ColorHistogramReport() { 21274 super(108); 21275 init(); 21276 } 21277 21278 public ColorHistogramReport(HistogramReport plane1, HistogramReport plane2, 21279 HistogramReport plane3) { 21280 super(108); 21281 this.plane1 = plane1; 21282 this.plane2 = plane2; 21283 this.plane3 = plane3; 21284 } 21285 21286 protected ColorHistogramReport(ByteBuffer backing, int offset) { 21287 super(backing, offset, 108); 21288 init(); 21289 } 21290 21291 protected ColorHistogramReport(long nativeObj, boolean owned) { 21292 super(nativeObj, owned, 108); 21293 init(); 21294 } 21295 21296 protected void setBuffer(ByteBuffer backing, int offset) { 21297 super.setBuffer(backing, offset, 108); 21298 } 21299 21300 public void read() { 21301 plane1.read(); 21302 plane2.read(); 21303 plane3.read(); 21304 } 21305 21306 public void write() { 21307 plane1.write(); 21308 plane2.write(); 21309 plane3.write(); 21310 } 21311 21312 public int size() { 21313 return 108; 21314 } 21315 } 21316 21317 public static class ColorInformation extends DisposedStruct { 21318 public int saturation; // The saturation level the function uses to learn 21319 // the color information. 21320 public double[] info; // An array of color information that represents the 21321 // color spectrum analysis of a region of an image in 21322 // a compact form. 21323 private ByteBuffer info_buf; 21324 21325 private void init() { 21326 info = new double[0]; 21327 } 21328 21329 public ColorInformation() { 21330 super(12); 21331 init(); 21332 } 21333 21334 public ColorInformation(int saturation, double[] info) { 21335 super(12); 21336 this.saturation = saturation; 21337 this.info = info; 21338 } 21339 21340 protected ColorInformation(ByteBuffer backing, int offset) { 21341 super(backing, offset, 12); 21342 init(); 21343 } 21344 21345 protected ColorInformation(long nativeObj, boolean owned) { 21346 super(nativeObj, owned, 12); 21347 init(); 21348 } 21349 21350 protected void setBuffer(ByteBuffer backing, int offset) { 21351 super.setBuffer(backing, offset, 12); 21352 } 21353 21354 public void read() { 21355 saturation = backing.getInt(4); 21356 int info_infoCount = backing.getInt(0); 21357 long info_addr = getPointer(backing, 8); 21358 info = new double[info_infoCount]; 21359 if (info_infoCount > 0 && info_addr != 0) { 21360 newDirectByteBuffer(info_addr, info_infoCount * 8).asDoubleBuffer().get(info); 21361 } 21362 } 21363 21364 public void write() { 21365 backing.putInt(4, saturation); 21366 info_buf = ByteBuffer.allocateDirect(info.length * 8).order(ByteOrder.nativeOrder()); 21367 info_buf.asDoubleBuffer().put(info).rewind(); 21368 backing.putInt(0, info.length); 21369 putPointer(backing, 8, info_buf); 21370 } 21371 21372 public int size() { 21373 return 12; 21374 } 21375 } 21376 21377 public static class Complex extends DisposedStruct { 21378 public float r; // The real part of the value. 21379 public float i; // The imaginary part of the value. 21380 21381 private void init() { 21382 21383 } 21384 21385 public Complex() { 21386 super(8); 21387 init(); 21388 } 21389 21390 public Complex(double r, double i) { 21391 super(8); 21392 this.r = (float) r; 21393 this.i = (float) i; 21394 } 21395 21396 protected Complex(ByteBuffer backing, int offset) { 21397 super(backing, offset, 8); 21398 init(); 21399 } 21400 21401 protected Complex(long nativeObj, boolean owned) { 21402 super(nativeObj, owned, 8); 21403 init(); 21404 } 21405 21406 protected void setBuffer(ByteBuffer backing, int offset) { 21407 super.setBuffer(backing, offset, 8); 21408 } 21409 21410 public void read() { 21411 r = backing.getFloat(0); 21412 i = backing.getFloat(4); 21413 } 21414 21415 public void write() { 21416 backing.putFloat(0, r); 21417 backing.putFloat(4, i); 21418 } 21419 21420 public int size() { 21421 return 8; 21422 } 21423 } 21424 21425 public static class ConcentricRakeReport extends DisposedStruct { 21426 public ArcInfo[] rakeArcs; // An array containing the location of each 21427 // concentric arc line used for edge detection. 21428 public PointFloat[] firstEdges; // The coordinate location of all edges 21429 // detected as first edges. 21430 public PointFloat[] lastEdges; // The coordinate location of all edges 21431 // detected as last edges. 21432 public EdgeLocationReport[] allEdges; // An array of reports describing the 21433 // location of the edges located by 21434 // each concentric rake arc line. 21435 public int[] linesWithEdges; // An array of indices into the rakeArcs array 21436 // indicating the concentric rake arc lines on 21437 // which the function detected at least one 21438 // edge. 21439 private ByteBuffer rakeArcs_buf; 21440 private ByteBuffer firstEdges_buf; 21441 private ByteBuffer lastEdges_buf; 21442 private ByteBuffer allEdges_buf; 21443 private ByteBuffer linesWithEdges_buf; 21444 21445 private void init() { 21446 rakeArcs = new ArcInfo[0]; 21447 firstEdges = new PointFloat[0]; 21448 lastEdges = new PointFloat[0]; 21449 allEdges = new EdgeLocationReport[0]; 21450 linesWithEdges = new int[0]; 21451 } 21452 21453 public ConcentricRakeReport() { 21454 super(36); 21455 init(); 21456 } 21457 21458 public ConcentricRakeReport(ArcInfo[] rakeArcs, PointFloat[] firstEdges, 21459 PointFloat[] lastEdges, EdgeLocationReport[] allEdges, int[] linesWithEdges) { 21460 super(36); 21461 this.rakeArcs = rakeArcs; 21462 this.firstEdges = firstEdges; 21463 this.lastEdges = lastEdges; 21464 this.allEdges = allEdges; 21465 this.linesWithEdges = linesWithEdges; 21466 } 21467 21468 protected ConcentricRakeReport(ByteBuffer backing, int offset) { 21469 super(backing, offset, 36); 21470 init(); 21471 } 21472 21473 protected ConcentricRakeReport(long nativeObj, boolean owned) { 21474 super(nativeObj, owned, 36); 21475 init(); 21476 } 21477 21478 protected void setBuffer(ByteBuffer backing, int offset) { 21479 super.setBuffer(backing, offset, 36); 21480 } 21481 21482 public void read() { 21483 int rakeArcs_numArcs = backing.getInt(4); 21484 long rakeArcs_addr = getPointer(backing, 0); 21485 rakeArcs = new ArcInfo[rakeArcs_numArcs]; 21486 if (rakeArcs_numArcs > 0 && rakeArcs_addr != 0) { 21487 ByteBuffer bb = newDirectByteBuffer(rakeArcs_addr, rakeArcs_numArcs * 32); 21488 for (int i = 0, off = 0; i < rakeArcs_numArcs; i++, off += 32) { 21489 rakeArcs[i] = new ArcInfo(bb, off); 21490 rakeArcs[i].read(); 21491 } 21492 } 21493 int firstEdges_numFirstEdges = backing.getInt(12); 21494 long firstEdges_addr = getPointer(backing, 8); 21495 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 21496 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 21497 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 8); 21498 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 8) { 21499 firstEdges[i] = new PointFloat(bb, off); 21500 firstEdges[i].read(); 21501 } 21502 } 21503 int lastEdges_numLastEdges = backing.getInt(20); 21504 long lastEdges_addr = getPointer(backing, 16); 21505 lastEdges = new PointFloat[lastEdges_numLastEdges]; 21506 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 21507 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 8); 21508 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 8) { 21509 lastEdges[i] = new PointFloat(bb, off); 21510 lastEdges[i].read(); 21511 } 21512 } 21513 int allEdges_numLinesWithEdges = backing.getInt(32); 21514 long allEdges_addr = getPointer(backing, 24); 21515 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 21516 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 21517 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges * 8); 21518 for (int i = 0, off = 0; i < allEdges_numLinesWithEdges; i++, off += 8) { 21519 allEdges[i] = new EdgeLocationReport(bb, off); 21520 allEdges[i].read(); 21521 } 21522 } 21523 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 21524 long linesWithEdges_addr = getPointer(backing, 28); 21525 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 21526 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 21527 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges * 4) 21528 .asIntBuffer().get(linesWithEdges); 21529 } 21530 } 21531 21532 public void write() { 21533 rakeArcs_buf = ByteBuffer.allocateDirect(rakeArcs.length * 32).order(ByteOrder.nativeOrder()); 21534 for (int i = 0, off = 0; i < rakeArcs.length; i++, off += 32) { 21535 rakeArcs[i].setBuffer(rakeArcs_buf, off); 21536 rakeArcs[i].write(); 21537 } 21538 backing.putInt(4, rakeArcs.length); 21539 putPointer(backing, 0, rakeArcs_buf); 21540 firstEdges_buf = 21541 ByteBuffer.allocateDirect(firstEdges.length * 8).order(ByteOrder.nativeOrder()); 21542 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 8) { 21543 firstEdges[i].setBuffer(firstEdges_buf, off); 21544 firstEdges[i].write(); 21545 } 21546 backing.putInt(12, firstEdges.length); 21547 putPointer(backing, 8, firstEdges_buf); 21548 lastEdges_buf = 21549 ByteBuffer.allocateDirect(lastEdges.length * 8).order(ByteOrder.nativeOrder()); 21550 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 8) { 21551 lastEdges[i].setBuffer(lastEdges_buf, off); 21552 lastEdges[i].write(); 21553 } 21554 backing.putInt(20, lastEdges.length); 21555 putPointer(backing, 16, lastEdges_buf); 21556 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length * 8).order(ByteOrder.nativeOrder()); 21557 for (int i = 0, off = 0; i < allEdges.length; i++, off += 8) { 21558 allEdges[i].setBuffer(allEdges_buf, off); 21559 allEdges[i].write(); 21560 } 21561 backing.putInt(32, allEdges.length); 21562 putPointer(backing, 24, allEdges_buf); 21563 linesWithEdges_buf = 21564 ByteBuffer.allocateDirect(linesWithEdges.length * 4).order(ByteOrder.nativeOrder()); 21565 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 21566 backing.putInt(32, linesWithEdges.length); 21567 putPointer(backing, 28, linesWithEdges_buf); 21568 } 21569 21570 public int size() { 21571 return 36; 21572 } 21573 } 21574 21575 public static class ConstructROIOptions extends DisposedStruct { 21576 public int windowNumber; // The window number of the image window. 21577 public String windowTitle; // Specifies the message string that the function 21578 // displays in the title bar of the window. 21579 public PaletteType type; // The palette type to use. 21580 public RGBValue[] palette; // If type is IMAQ_PALETTE_USER, this array is 21581 // the palette of colors to use with the window. 21582 private ByteBuffer windowTitle_buf; 21583 private ByteBuffer palette_buf; 21584 21585 private void init() { 21586 palette = new RGBValue[0]; 21587 } 21588 21589 public ConstructROIOptions() { 21590 super(20); 21591 init(); 21592 } 21593 21594 public ConstructROIOptions(int windowNumber, String windowTitle, PaletteType type, 21595 RGBValue[] palette) { 21596 super(20); 21597 this.windowNumber = windowNumber; 21598 this.windowTitle = windowTitle; 21599 this.type = type; 21600 this.palette = palette; 21601 } 21602 21603 protected ConstructROIOptions(ByteBuffer backing, int offset) { 21604 super(backing, offset, 20); 21605 init(); 21606 } 21607 21608 protected ConstructROIOptions(long nativeObj, boolean owned) { 21609 super(nativeObj, owned, 20); 21610 init(); 21611 } 21612 21613 protected void setBuffer(ByteBuffer backing, int offset) { 21614 super.setBuffer(backing, offset, 20); 21615 } 21616 21617 public void read() { 21618 windowNumber = backing.getInt(0); 21619 long windowTitle_addr = getPointer(backing, 4); 21620 if (windowTitle_addr == 0) 21621 windowTitle = null; 21622 else { 21623 ByteBuffer bb = newDirectByteBuffer(windowTitle_addr, 1000); // FIXME 21624 while (bb.get() != 0) { 21625 } 21626 byte[] bytes = new byte[bb.position() - 1]; 21627 getBytes(bb, bytes, 0, bytes.length); 21628 try { 21629 windowTitle = new String(bytes, "UTF-8"); 21630 } catch (UnsupportedEncodingException e) { 21631 windowTitle = ""; 21632 } 21633 } 21634 21635 type = PaletteType.fromValue(backing.getInt(8)); 21636 int palette_numColors = backing.getInt(16); 21637 long palette_addr = getPointer(backing, 12); 21638 palette = new RGBValue[palette_numColors]; 21639 if (palette_numColors > 0 && palette_addr != 0) { 21640 ByteBuffer bb = newDirectByteBuffer(palette_addr, palette_numColors * 4); 21641 for (int i = 0, off = 0; i < palette_numColors; i++, off += 4) { 21642 palette[i] = new RGBValue(bb, off); 21643 palette[i].read(); 21644 } 21645 } 21646 } 21647 21648 public void write() { 21649 backing.putInt(0, windowNumber); 21650 if (windowTitle != null) { 21651 byte[] windowTitle_bytes; 21652 try { 21653 windowTitle_bytes = windowTitle.getBytes("UTF-8"); 21654 } catch (UnsupportedEncodingException e) { 21655 windowTitle_bytes = new byte[0]; 21656 } 21657 windowTitle_buf = ByteBuffer.allocateDirect(windowTitle_bytes.length + 1); 21658 putBytes(windowTitle_buf, windowTitle_bytes, 0, windowTitle_bytes.length).put( 21659 windowTitle_bytes.length, (byte) 0); 21660 } 21661 putPointer(backing, 4, windowTitle == null ? 0 : getByteBufferAddress(windowTitle_buf)); 21662 if (type != null) 21663 backing.putInt(8, type.getValue()); 21664 palette_buf = ByteBuffer.allocateDirect(palette.length * 4).order(ByteOrder.nativeOrder()); 21665 for (int i = 0, off = 0; i < palette.length; i++, off += 4) { 21666 palette[i].setBuffer(palette_buf, off); 21667 palette[i].write(); 21668 } 21669 backing.putInt(16, palette.length); 21670 putPointer(backing, 12, palette_buf); 21671 } 21672 21673 public int size() { 21674 return 20; 21675 } 21676 } 21677 21678 public static class ContourInfo extends DisposedStruct { 21679 public ContourType type; // The contour type. 21680 public Point[] points; // The points describing the contour. 21681 public RGBValue contourColor; // The contour color. 21682 private ByteBuffer points_buf; 21683 21684 private void init() { 21685 points = new Point[0]; 21686 contourColor = new RGBValue(backing, 12); 21687 } 21688 21689 public ContourInfo() { 21690 super(16); 21691 init(); 21692 } 21693 21694 public ContourInfo(ContourType type, Point[] points, RGBValue contourColor) { 21695 super(16); 21696 this.type = type; 21697 this.points = points; 21698 this.contourColor = contourColor; 21699 } 21700 21701 protected ContourInfo(ByteBuffer backing, int offset) { 21702 super(backing, offset, 16); 21703 init(); 21704 } 21705 21706 protected ContourInfo(long nativeObj, boolean owned) { 21707 super(nativeObj, owned, 16); 21708 init(); 21709 } 21710 21711 protected void setBuffer(ByteBuffer backing, int offset) { 21712 super.setBuffer(backing, offset, 16); 21713 } 21714 21715 public void read() { 21716 type = ContourType.fromValue(backing.getInt(0)); 21717 int points_numPoints = backing.getInt(4); 21718 long points_addr = getPointer(backing, 8); 21719 points = new Point[points_numPoints]; 21720 if (points_numPoints > 0 && points_addr != 0) { 21721 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints * 8); 21722 for (int i = 0, off = 0; i < points_numPoints; i++, off += 8) { 21723 points[i] = new Point(bb, off); 21724 points[i].read(); 21725 } 21726 } 21727 contourColor.read(); 21728 } 21729 21730 public void write() { 21731 if (type != null) 21732 backing.putInt(0, type.getValue()); 21733 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 21734 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 21735 points[i].setBuffer(points_buf, off); 21736 points[i].write(); 21737 } 21738 backing.putInt(4, points.length); 21739 putPointer(backing, 8, points_buf); 21740 contourColor.write(); 21741 } 21742 21743 public int size() { 21744 return 16; 21745 } 21746 } 21747 21748 public static class ContourInfo2 extends DisposedStruct { 21749 public ContourType type; // The contour type. 21750 public RGBValue color; // The contour color. 21751 public Point point; // Use this member when the contour is of type 21752 // IMAQ_POINT. 21753 public Line line; // Use this member when the contour is of type IMAQ_LINE. 21754 public Rect rect; // Use this member when the contour is of type IMAQ_RECT. 21755 public Rect ovalBoundingBox; // Use this member when the contour is of type 21756 // IMAQ_OVAL. 21757 public ClosedContour closedContour; // Use this member when the contour is 21758 // of type IMAQ_CLOSED_CONTOUR. 21759 public OpenContour openContour; // Use this member when the contour is of 21760 // type IMAQ_OPEN_CONTOUR. 21761 public Annulus annulus; // Use this member when the contour is of type 21762 // IMAQ_ANNULUS. 21763 public RotatedRect rotatedRect; // Use this member when the contour is of 21764 // type IMAQ_ROTATED_RECT. 21765 21766 private void init() { 21767 color = new RGBValue(backing, 4); 21768 } 21769 21770 public ContourInfo2() { 21771 super(12); 21772 init(); 21773 } 21774 21775 public ContourInfo2(ContourType type, RGBValue color) { 21776 super(12); 21777 this.type = type; 21778 this.color = color; 21779 } 21780 21781 protected ContourInfo2(ByteBuffer backing, int offset) { 21782 super(backing, offset, 12); 21783 init(); 21784 } 21785 21786 protected ContourInfo2(long nativeObj, boolean owned) { 21787 super(nativeObj, owned, 12); 21788 init(); 21789 } 21790 21791 protected void setBuffer(ByteBuffer backing, int offset) { 21792 super.setBuffer(backing, offset, 12); 21793 } 21794 21795 public void read() { 21796 type = ContourType.fromValue(backing.getInt(0)); 21797 color.read(); 21798 if (type == ContourType.POINT) { 21799 long point_addr = getPointer(backing, 8); 21800 if (point_addr == 0) 21801 point = null; 21802 else 21803 point = new Point(point_addr, false); 21804 } 21805 if (type == ContourType.LINE) { 21806 long line_addr = getPointer(backing, 8); 21807 if (line_addr == 0) 21808 line = null; 21809 else 21810 line = new Line(line_addr, false); 21811 } 21812 if (type == ContourType.RECT) { 21813 long rect_addr = getPointer(backing, 8); 21814 if (rect_addr == 0) 21815 rect = null; 21816 else 21817 rect = new Rect(rect_addr, false); 21818 } 21819 if (type == ContourType.OVAL) { 21820 long ovalBoundingBox_addr = getPointer(backing, 8); 21821 if (ovalBoundingBox_addr == 0) 21822 ovalBoundingBox = null; 21823 else 21824 ovalBoundingBox = new Rect(ovalBoundingBox_addr, false); 21825 } 21826 if (type == ContourType.CLOSED_CONTOUR) { 21827 long closedContour_addr = getPointer(backing, 8); 21828 if (closedContour_addr == 0) 21829 closedContour = null; 21830 else 21831 closedContour = new ClosedContour(closedContour_addr, false); 21832 } 21833 if (type == ContourType.OPEN_CONTOUR) { 21834 long openContour_addr = getPointer(backing, 8); 21835 if (openContour_addr == 0) 21836 openContour = null; 21837 else 21838 openContour = new OpenContour(openContour_addr, false); 21839 } 21840 if (type == ContourType.ANNULUS) { 21841 long annulus_addr = getPointer(backing, 8); 21842 if (annulus_addr == 0) 21843 annulus = null; 21844 else 21845 annulus = new Annulus(annulus_addr, false); 21846 } 21847 if (type == ContourType.ROTATED_RECT) { 21848 long rotatedRect_addr = getPointer(backing, 8); 21849 if (rotatedRect_addr == 0) 21850 rotatedRect = null; 21851 else 21852 rotatedRect = new RotatedRect(rotatedRect_addr, false); 21853 } 21854 } 21855 21856 public void write() { 21857 if (type != null) 21858 backing.putInt(0, type.getValue()); 21859 color.write(); 21860 if (type == ContourType.POINT) { 21861 putPointer(backing, 8, point); 21862 } 21863 if (type == ContourType.LINE) { 21864 putPointer(backing, 8, line); 21865 } 21866 if (type == ContourType.RECT) { 21867 putPointer(backing, 8, rect); 21868 } 21869 if (type == ContourType.OVAL) { 21870 putPointer(backing, 8, ovalBoundingBox); 21871 } 21872 if (type == ContourType.CLOSED_CONTOUR) { 21873 putPointer(backing, 8, closedContour); 21874 } 21875 if (type == ContourType.OPEN_CONTOUR) { 21876 putPointer(backing, 8, openContour); 21877 } 21878 if (type == ContourType.ANNULUS) { 21879 putPointer(backing, 8, annulus); 21880 } 21881 if (type == ContourType.ROTATED_RECT) { 21882 putPointer(backing, 8, rotatedRect); 21883 } 21884 } 21885 21886 public int size() { 21887 return 12; 21888 } 21889 } 21890 21891 public static class ContourPoint extends DisposedStruct { 21892 public double x; // The x-coordinate value in the image. 21893 public double y; // The y-coordinate value in the image. 21894 public double curvature; // The change in slope at this edge point of the 21895 // segment. 21896 public double xDisplacement; // The x displacement of the current edge pixel 21897 // from a cubic spline fit of the current edge 21898 // segment. 21899 public double yDisplacement; // The y displacement of the current edge pixel 21900 // from a cubic spline fit of the current edge 21901 // segment. 21902 21903 private void init() { 21904 21905 } 21906 21907 public ContourPoint() { 21908 super(40); 21909 init(); 21910 } 21911 21912 public ContourPoint(double x, double y, double curvature, double xDisplacement, 21913 double yDisplacement) { 21914 super(40); 21915 this.x = x; 21916 this.y = y; 21917 this.curvature = curvature; 21918 this.xDisplacement = xDisplacement; 21919 this.yDisplacement = yDisplacement; 21920 } 21921 21922 protected ContourPoint(ByteBuffer backing, int offset) { 21923 super(backing, offset, 40); 21924 init(); 21925 } 21926 21927 protected ContourPoint(long nativeObj, boolean owned) { 21928 super(nativeObj, owned, 40); 21929 init(); 21930 } 21931 21932 protected void setBuffer(ByteBuffer backing, int offset) { 21933 super.setBuffer(backing, offset, 40); 21934 } 21935 21936 public void read() { 21937 x = backing.getDouble(0); 21938 y = backing.getDouble(8); 21939 curvature = backing.getDouble(16); 21940 xDisplacement = backing.getDouble(24); 21941 yDisplacement = backing.getDouble(32); 21942 } 21943 21944 public void write() { 21945 backing.putDouble(0, x); 21946 backing.putDouble(8, y); 21947 backing.putDouble(16, curvature); 21948 backing.putDouble(24, xDisplacement); 21949 backing.putDouble(32, yDisplacement); 21950 } 21951 21952 public int size() { 21953 return 40; 21954 } 21955 } 21956 21957 public static class CoordinateTransform extends DisposedStruct { 21958 public Point initialOrigin; // The origin of the initial coordinate system. 21959 public float initialAngle; // The angle, in degrees, of the x-axis of the 21960 // initial coordinate system relative to the 21961 // image x-axis. 21962 public Point finalOrigin; // The origin of the final coordinate system. 21963 public float finalAngle; // The angle, in degrees, of the x-axis of the 21964 // final coordinate system relative to the image 21965 // x-axis. 21966 21967 private void init() { 21968 initialOrigin = new Point(backing, 0); 21969 finalOrigin = new Point(backing, 12); 21970 } 21971 21972 public CoordinateTransform() { 21973 super(24); 21974 init(); 21975 } 21976 21977 public CoordinateTransform(Point initialOrigin, double initialAngle, Point finalOrigin, 21978 double finalAngle) { 21979 super(24); 21980 this.initialOrigin = initialOrigin; 21981 this.initialAngle = (float) initialAngle; 21982 this.finalOrigin = finalOrigin; 21983 this.finalAngle = (float) finalAngle; 21984 } 21985 21986 protected CoordinateTransform(ByteBuffer backing, int offset) { 21987 super(backing, offset, 24); 21988 init(); 21989 } 21990 21991 protected CoordinateTransform(long nativeObj, boolean owned) { 21992 super(nativeObj, owned, 24); 21993 init(); 21994 } 21995 21996 protected void setBuffer(ByteBuffer backing, int offset) { 21997 super.setBuffer(backing, offset, 24); 21998 } 21999 22000 public void read() { 22001 initialOrigin.read(); 22002 initialAngle = backing.getFloat(8); 22003 finalOrigin.read(); 22004 finalAngle = backing.getFloat(20); 22005 } 22006 22007 public void write() { 22008 initialOrigin.write(); 22009 backing.putFloat(8, initialAngle); 22010 finalOrigin.write(); 22011 backing.putFloat(20, finalAngle); 22012 } 22013 22014 public int size() { 22015 return 24; 22016 } 22017 } 22018 22019 public static class CoordinateTransform2 extends DisposedStruct { 22020 public CoordinateSystem referenceSystem; // Defines the coordinate system 22021 // for input coordinates. 22022 public CoordinateSystem measurementSystem; // Defines the coordinate system 22023 // in which the function should 22024 // perform measurements. 22025 22026 private void init() { 22027 referenceSystem = new CoordinateSystem(backing, 0); 22028 measurementSystem = new CoordinateSystem(backing, 16); 22029 } 22030 22031 public CoordinateTransform2() { 22032 super(32); 22033 init(); 22034 } 22035 22036 public CoordinateTransform2(CoordinateSystem referenceSystem, CoordinateSystem measurementSystem) { 22037 super(32); 22038 this.referenceSystem = referenceSystem; 22039 this.measurementSystem = measurementSystem; 22040 } 22041 22042 protected CoordinateTransform2(ByteBuffer backing, int offset) { 22043 super(backing, offset, 32); 22044 init(); 22045 } 22046 22047 protected CoordinateTransform2(long nativeObj, boolean owned) { 22048 super(nativeObj, owned, 32); 22049 init(); 22050 } 22051 22052 protected void setBuffer(ByteBuffer backing, int offset) { 22053 super.setBuffer(backing, offset, 32); 22054 } 22055 22056 public void read() { 22057 referenceSystem.read(); 22058 measurementSystem.read(); 22059 } 22060 22061 public void write() { 22062 referenceSystem.write(); 22063 measurementSystem.write(); 22064 } 22065 22066 public int size() { 22067 return 32; 22068 } 22069 } 22070 22071 public static class CannyOptions extends DisposedStruct { 22072 public float sigma; // The sigma of the Gaussian smoothing filter that the 22073 // function applies to the image before edge detection. 22074 public float upperThreshold; // The upper fraction of pixel values in the 22075 // image from which the function chooses a seed 22076 // or starting point of an edge segment. 22077 public float lowerThreshold; // The function multiplies this value by 22078 // upperThreshold to determine the lower 22079 // threshold for all the pixels in an edge 22080 // segment. 22081 public int windowSize; // The window size of the Gaussian filter that the 22082 // function applies to the image. 22083 22084 private void init() { 22085 22086 } 22087 22088 public CannyOptions() { 22089 super(16); 22090 init(); 22091 } 22092 22093 public CannyOptions(double sigma, double upperThreshold, double lowerThreshold, int windowSize) { 22094 super(16); 22095 this.sigma = (float) sigma; 22096 this.upperThreshold = (float) upperThreshold; 22097 this.lowerThreshold = (float) lowerThreshold; 22098 this.windowSize = windowSize; 22099 } 22100 22101 protected CannyOptions(ByteBuffer backing, int offset) { 22102 super(backing, offset, 16); 22103 init(); 22104 } 22105 22106 protected CannyOptions(long nativeObj, boolean owned) { 22107 super(nativeObj, owned, 16); 22108 init(); 22109 } 22110 22111 protected void setBuffer(ByteBuffer backing, int offset) { 22112 super.setBuffer(backing, offset, 16); 22113 } 22114 22115 public void read() { 22116 sigma = backing.getFloat(0); 22117 upperThreshold = backing.getFloat(4); 22118 lowerThreshold = backing.getFloat(8); 22119 windowSize = backing.getInt(12); 22120 } 22121 22122 public void write() { 22123 backing.putFloat(0, sigma); 22124 backing.putFloat(4, upperThreshold); 22125 backing.putFloat(8, lowerThreshold); 22126 backing.putInt(12, windowSize); 22127 } 22128 22129 public int size() { 22130 return 16; 22131 } 22132 } 22133 22134 public static class Range extends DisposedStruct { 22135 public int minValue; // The minimum value of the range. 22136 public int maxValue; // The maximum value of the range. 22137 22138 private void init() { 22139 22140 } 22141 22142 public Range() { 22143 super(8); 22144 init(); 22145 } 22146 22147 public Range(int minValue, int maxValue) { 22148 super(8); 22149 this.minValue = minValue; 22150 this.maxValue = maxValue; 22151 } 22152 22153 protected Range(ByteBuffer backing, int offset) { 22154 super(backing, offset, 8); 22155 init(); 22156 } 22157 22158 protected Range(long nativeObj, boolean owned) { 22159 super(nativeObj, owned, 8); 22160 init(); 22161 } 22162 22163 protected void setBuffer(ByteBuffer backing, int offset) { 22164 super.setBuffer(backing, offset, 8); 22165 } 22166 22167 public void read() { 22168 minValue = backing.getInt(0); 22169 maxValue = backing.getInt(4); 22170 } 22171 22172 public void write() { 22173 backing.putInt(0, minValue); 22174 backing.putInt(4, maxValue); 22175 } 22176 22177 public int size() { 22178 return 8; 22179 } 22180 } 22181 22182 public static class UserPointSymbol extends DisposedStruct { 22183 public int cols; // Number of columns in the symbol. 22184 public int rows; // Number of rows in the symbol. 22185 22186 private void init() { 22187 22188 } 22189 22190 public UserPointSymbol() { 22191 super(12); 22192 init(); 22193 } 22194 22195 public UserPointSymbol(int cols, int rows) { 22196 super(12); 22197 this.cols = cols; 22198 this.rows = rows; 22199 } 22200 22201 protected UserPointSymbol(ByteBuffer backing, int offset) { 22202 super(backing, offset, 12); 22203 init(); 22204 } 22205 22206 protected UserPointSymbol(long nativeObj, boolean owned) { 22207 super(nativeObj, owned, 12); 22208 init(); 22209 } 22210 22211 protected void setBuffer(ByteBuffer backing, int offset) { 22212 super.setBuffer(backing, offset, 12); 22213 } 22214 22215 public void read() { 22216 cols = backing.getInt(0); 22217 rows = backing.getInt(4); 22218 } 22219 22220 public void write() { 22221 backing.putInt(0, cols); 22222 backing.putInt(4, rows); 22223 } 22224 22225 public int size() { 22226 return 12; 22227 } 22228 } 22229 22230 public static class View3DOptions extends DisposedStruct { 22231 public int sizeReduction; // A divisor the function uses when determining 22232 // the final height and width of the 3D image. 22233 public int maxHeight; // Defines the maximum height of a pixel from the 22234 // image source drawn in 3D. 22235 public Direction3D direction; // Defines the 3D orientation. 22236 public float alpha; // Determines the angle between the horizontal and the 22237 // baseline. 22238 public float beta; // Determines the angle between the horizontal and the 22239 // second baseline. 22240 public int border; // Defines the border size. 22241 public int background; // Defines the background color. 22242 public Plane3D plane; // Indicates the view a function uses to show complex 22243 // images. 22244 22245 private void init() { 22246 22247 } 22248 22249 public View3DOptions() { 22250 super(32); 22251 init(); 22252 } 22253 22254 public View3DOptions(int sizeReduction, int maxHeight, Direction3D direction, double alpha, 22255 double beta, int border, int background, Plane3D plane) { 22256 super(32); 22257 this.sizeReduction = sizeReduction; 22258 this.maxHeight = maxHeight; 22259 this.direction = direction; 22260 this.alpha = (float) alpha; 22261 this.beta = (float) beta; 22262 this.border = border; 22263 this.background = background; 22264 this.plane = plane; 22265 } 22266 22267 protected View3DOptions(ByteBuffer backing, int offset) { 22268 super(backing, offset, 32); 22269 init(); 22270 } 22271 22272 protected View3DOptions(long nativeObj, boolean owned) { 22273 super(nativeObj, owned, 32); 22274 init(); 22275 } 22276 22277 protected void setBuffer(ByteBuffer backing, int offset) { 22278 super.setBuffer(backing, offset, 32); 22279 } 22280 22281 public void read() { 22282 sizeReduction = backing.getInt(0); 22283 maxHeight = backing.getInt(4); 22284 direction = Direction3D.fromValue(backing.getInt(8)); 22285 alpha = backing.getFloat(12); 22286 beta = backing.getFloat(16); 22287 border = backing.getInt(20); 22288 background = backing.getInt(24); 22289 plane = Plane3D.fromValue(backing.getInt(28)); 22290 } 22291 22292 public void write() { 22293 backing.putInt(0, sizeReduction); 22294 backing.putInt(4, maxHeight); 22295 if (direction != null) 22296 backing.putInt(8, direction.getValue()); 22297 backing.putFloat(12, alpha); 22298 backing.putFloat(16, beta); 22299 backing.putInt(20, border); 22300 backing.putInt(24, background); 22301 if (plane != null) 22302 backing.putInt(28, plane.getValue()); 22303 } 22304 22305 public int size() { 22306 return 32; 22307 } 22308 } 22309 22310 public static class MatchPatternOptions extends DisposedStruct { 22311 public MatchingMode mode; // Specifies the method to use when looking for 22312 // the pattern in the image. 22313 public int minContrast; // Specifies the minimum contrast expected in the 22314 // image. 22315 public int subpixelAccuracy; // Set this element to TRUE to return areas in 22316 // the image that match the pattern area with 22317 // subpixel accuracy. 22318 public RotationAngleRange[] angleRanges; // An array of angle ranges, in 22319 // degrees, where each range 22320 // specifies how much you expect 22321 // the pattern to be rotated in the 22322 // image. 22323 public int numMatchesRequested; // Number of valid matches expected. 22324 public int matchFactor; // Controls the number of potential matches that the 22325 // function examines. 22326 public float minMatchScore; // The minimum score a match can have for the 22327 // function to consider the match valid. 22328 private ByteBuffer angleRanges_buf; 22329 22330 private void init() { 22331 angleRanges = new RotationAngleRange[0]; 22332 } 22333 22334 public MatchPatternOptions() { 22335 super(32); 22336 init(); 22337 } 22338 22339 public MatchPatternOptions(MatchingMode mode, int minContrast, int subpixelAccuracy, 22340 RotationAngleRange[] angleRanges, int numMatchesRequested, int matchFactor, 22341 double minMatchScore) { 22342 super(32); 22343 this.mode = mode; 22344 this.minContrast = minContrast; 22345 this.subpixelAccuracy = subpixelAccuracy; 22346 this.angleRanges = angleRanges; 22347 this.numMatchesRequested = numMatchesRequested; 22348 this.matchFactor = matchFactor; 22349 this.minMatchScore = (float) minMatchScore; 22350 } 22351 22352 protected MatchPatternOptions(ByteBuffer backing, int offset) { 22353 super(backing, offset, 32); 22354 init(); 22355 } 22356 22357 protected MatchPatternOptions(long nativeObj, boolean owned) { 22358 super(nativeObj, owned, 32); 22359 init(); 22360 } 22361 22362 protected void setBuffer(ByteBuffer backing, int offset) { 22363 super.setBuffer(backing, offset, 32); 22364 } 22365 22366 public void read() { 22367 mode = MatchingMode.fromValue(backing.getInt(0)); 22368 minContrast = backing.getInt(4); 22369 subpixelAccuracy = backing.getInt(8); 22370 int angleRanges_numRanges = backing.getInt(16); 22371 long angleRanges_addr = getPointer(backing, 12); 22372 angleRanges = new RotationAngleRange[angleRanges_numRanges]; 22373 if (angleRanges_numRanges > 0 && angleRanges_addr != 0) { 22374 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numRanges * 8); 22375 for (int i = 0, off = 0; i < angleRanges_numRanges; i++, off += 8) { 22376 angleRanges[i] = new RotationAngleRange(bb, off); 22377 angleRanges[i].read(); 22378 } 22379 } 22380 numMatchesRequested = backing.getInt(20); 22381 matchFactor = backing.getInt(24); 22382 minMatchScore = backing.getFloat(28); 22383 } 22384 22385 public void write() { 22386 if (mode != null) 22387 backing.putInt(0, mode.getValue()); 22388 backing.putInt(4, minContrast); 22389 backing.putInt(8, subpixelAccuracy); 22390 angleRanges_buf = 22391 ByteBuffer.allocateDirect(angleRanges.length * 8).order(ByteOrder.nativeOrder()); 22392 for (int i = 0, off = 0; i < angleRanges.length; i++, off += 8) { 22393 angleRanges[i].setBuffer(angleRanges_buf, off); 22394 angleRanges[i].write(); 22395 } 22396 backing.putInt(16, angleRanges.length); 22397 putPointer(backing, 12, angleRanges_buf); 22398 backing.putInt(20, numMatchesRequested); 22399 backing.putInt(24, matchFactor); 22400 backing.putFloat(28, minMatchScore); 22401 } 22402 22403 public int size() { 22404 return 32; 22405 } 22406 } 22407 22408 public static class TIFFFileOptions extends DisposedStruct { 22409 public int rowsPerStrip; // Indicates the number of rows that the function 22410 // writes per strip. 22411 public PhotometricMode photoInterp; // Designates which photometric 22412 // interpretation to use. 22413 public TIFFCompressionType compressionType; // Indicates the type of 22414 // compression to use on the 22415 // TIFF file. 22416 22417 private void init() { 22418 22419 } 22420 22421 public TIFFFileOptions() { 22422 super(12); 22423 init(); 22424 } 22425 22426 public TIFFFileOptions(int rowsPerStrip, PhotometricMode photoInterp, 22427 TIFFCompressionType compressionType) { 22428 super(12); 22429 this.rowsPerStrip = rowsPerStrip; 22430 this.photoInterp = photoInterp; 22431 this.compressionType = compressionType; 22432 } 22433 22434 protected TIFFFileOptions(ByteBuffer backing, int offset) { 22435 super(backing, offset, 12); 22436 init(); 22437 } 22438 22439 protected TIFFFileOptions(long nativeObj, boolean owned) { 22440 super(nativeObj, owned, 12); 22441 init(); 22442 } 22443 22444 protected void setBuffer(ByteBuffer backing, int offset) { 22445 super.setBuffer(backing, offset, 12); 22446 } 22447 22448 public void read() { 22449 rowsPerStrip = backing.getInt(0); 22450 photoInterp = PhotometricMode.fromValue(backing.getInt(4)); 22451 compressionType = TIFFCompressionType.fromValue(backing.getInt(8)); 22452 } 22453 22454 public void write() { 22455 backing.putInt(0, rowsPerStrip); 22456 if (photoInterp != null) 22457 backing.putInt(4, photoInterp.getValue()); 22458 if (compressionType != null) 22459 backing.putInt(8, compressionType.getValue()); 22460 } 22461 22462 public int size() { 22463 return 12; 22464 } 22465 } 22466 22467 public static class OpenContour extends DisposedStruct { 22468 public Point[] points; // The points that make up the open contour. 22469 private ByteBuffer points_buf; 22470 22471 private void init() { 22472 points = new Point[0]; 22473 } 22474 22475 public OpenContour() { 22476 super(8); 22477 init(); 22478 } 22479 22480 public OpenContour(Point[] points) { 22481 super(8); 22482 this.points = points; 22483 } 22484 22485 protected OpenContour(ByteBuffer backing, int offset) { 22486 super(backing, offset, 8); 22487 init(); 22488 } 22489 22490 protected OpenContour(long nativeObj, boolean owned) { 22491 super(nativeObj, owned, 8); 22492 init(); 22493 } 22494 22495 protected void setBuffer(ByteBuffer backing, int offset) { 22496 super.setBuffer(backing, offset, 8); 22497 } 22498 22499 public void read() { 22500 int points_numPoints = backing.getInt(4); 22501 long points_addr = getPointer(backing, 0); 22502 points = new Point[points_numPoints]; 22503 if (points_numPoints > 0 && points_addr != 0) { 22504 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints * 8); 22505 for (int i = 0, off = 0; i < points_numPoints; i++, off += 8) { 22506 points[i] = new Point(bb, off); 22507 points[i].read(); 22508 } 22509 } 22510 } 22511 22512 public void write() { 22513 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 22514 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 22515 points[i].setBuffer(points_buf, off); 22516 points[i].write(); 22517 } 22518 backing.putInt(4, points.length); 22519 putPointer(backing, 0, points_buf); 22520 } 22521 22522 public int size() { 22523 return 8; 22524 } 22525 } 22526 22527 public static class OverlayTextOptions extends DisposedStruct { 22528 public String fontName; // The name of the font to use. 22529 public int fontSize; // The size of the font. 22530 public int bold; // Set this element to TRUE to bold the text. 22531 public int italic; // Set this element to TRUE to italicize the text. 22532 public int underline; // Set this element to TRUE to underline the text. 22533 public int strikeout; // Set this element to TRUE to strikeout the text. 22534 public TextAlignment horizontalTextAlignment; // Sets the alignment of the 22535 // text. 22536 public VerticalTextAlignment verticalTextAlignment; // Sets the vertical 22537 // alignment for the 22538 // text. 22539 public RGBValue backgroundColor; // Sets the color for the text background 22540 // pixels. 22541 public double angle; // The counterclockwise angle, in degrees, of the text 22542 // relative to the x-axis. 22543 private ByteBuffer fontName_buf; 22544 22545 private void init() { 22546 backgroundColor = new RGBValue(backing, 32); 22547 } 22548 22549 public OverlayTextOptions() { 22550 super(48); 22551 init(); 22552 } 22553 22554 public OverlayTextOptions(String fontName, int fontSize, int bold, int italic, int underline, 22555 int strikeout, TextAlignment horizontalTextAlignment, 22556 VerticalTextAlignment verticalTextAlignment, RGBValue backgroundColor, double angle) { 22557 super(48); 22558 this.fontName = fontName; 22559 this.fontSize = fontSize; 22560 this.bold = bold; 22561 this.italic = italic; 22562 this.underline = underline; 22563 this.strikeout = strikeout; 22564 this.horizontalTextAlignment = horizontalTextAlignment; 22565 this.verticalTextAlignment = verticalTextAlignment; 22566 this.backgroundColor = backgroundColor; 22567 this.angle = angle; 22568 } 22569 22570 protected OverlayTextOptions(ByteBuffer backing, int offset) { 22571 super(backing, offset, 48); 22572 init(); 22573 } 22574 22575 protected OverlayTextOptions(long nativeObj, boolean owned) { 22576 super(nativeObj, owned, 48); 22577 init(); 22578 } 22579 22580 protected void setBuffer(ByteBuffer backing, int offset) { 22581 super.setBuffer(backing, offset, 48); 22582 } 22583 22584 public void read() { 22585 long fontName_addr = getPointer(backing, 0); 22586 if (fontName_addr == 0) 22587 fontName = null; 22588 else { 22589 ByteBuffer bb = newDirectByteBuffer(fontName_addr, 1000); // FIXME 22590 while (bb.get() != 0) { 22591 } 22592 byte[] bytes = new byte[bb.position() - 1]; 22593 getBytes(bb, bytes, 0, bytes.length); 22594 try { 22595 fontName = new String(bytes, "UTF-8"); 22596 } catch (UnsupportedEncodingException e) { 22597 fontName = ""; 22598 } 22599 } 22600 22601 fontSize = backing.getInt(4); 22602 bold = backing.getInt(8); 22603 italic = backing.getInt(12); 22604 underline = backing.getInt(16); 22605 strikeout = backing.getInt(20); 22606 horizontalTextAlignment = TextAlignment.fromValue(backing.getInt(24)); 22607 verticalTextAlignment = VerticalTextAlignment.fromValue(backing.getInt(28)); 22608 backgroundColor.read(); 22609 angle = backing.getDouble(40); 22610 } 22611 22612 public void write() { 22613 if (fontName != null) { 22614 byte[] fontName_bytes; 22615 try { 22616 fontName_bytes = fontName.getBytes("UTF-8"); 22617 } catch (UnsupportedEncodingException e) { 22618 fontName_bytes = new byte[0]; 22619 } 22620 fontName_buf = ByteBuffer.allocateDirect(fontName_bytes.length + 1); 22621 putBytes(fontName_buf, fontName_bytes, 0, fontName_bytes.length).put(fontName_bytes.length, 22622 (byte) 0); 22623 } 22624 putPointer(backing, 0, fontName == null ? 0 : getByteBufferAddress(fontName_buf)); 22625 backing.putInt(4, fontSize); 22626 backing.putInt(8, bold); 22627 backing.putInt(12, italic); 22628 backing.putInt(16, underline); 22629 backing.putInt(20, strikeout); 22630 if (horizontalTextAlignment != null) 22631 backing.putInt(24, horizontalTextAlignment.getValue()); 22632 if (verticalTextAlignment != null) 22633 backing.putInt(28, verticalTextAlignment.getValue()); 22634 backgroundColor.write(); 22635 backing.putDouble(40, angle); 22636 } 22637 22638 public int size() { 22639 return 48; 22640 } 22641 } 22642 22643 public static class ParticleFilterCriteria extends DisposedStruct { 22644 public MeasurementValue parameter; // The morphological measurement that the 22645 // function uses for filtering. 22646 public float lower; // The lower bound of the criteria range. 22647 public float upper; // The upper bound of the criteria range. 22648 public int exclude; // Set this element to TRUE to indicate that a match 22649 // occurs when the value is outside the criteria range. 22650 22651 private void init() { 22652 22653 } 22654 22655 public ParticleFilterCriteria() { 22656 super(16); 22657 init(); 22658 } 22659 22660 public ParticleFilterCriteria(MeasurementValue parameter, double lower, double upper, 22661 int exclude) { 22662 super(16); 22663 this.parameter = parameter; 22664 this.lower = (float) lower; 22665 this.upper = (float) upper; 22666 this.exclude = exclude; 22667 } 22668 22669 protected ParticleFilterCriteria(ByteBuffer backing, int offset) { 22670 super(backing, offset, 16); 22671 init(); 22672 } 22673 22674 protected ParticleFilterCriteria(long nativeObj, boolean owned) { 22675 super(nativeObj, owned, 16); 22676 init(); 22677 } 22678 22679 protected void setBuffer(ByteBuffer backing, int offset) { 22680 super.setBuffer(backing, offset, 16); 22681 } 22682 22683 public void read() { 22684 parameter = MeasurementValue.fromValue(backing.getInt(0)); 22685 lower = backing.getFloat(4); 22686 upper = backing.getFloat(8); 22687 exclude = backing.getInt(12); 22688 } 22689 22690 public void write() { 22691 if (parameter != null) 22692 backing.putInt(0, parameter.getValue()); 22693 backing.putFloat(4, lower); 22694 backing.putFloat(8, upper); 22695 backing.putInt(12, exclude); 22696 } 22697 22698 public int size() { 22699 return 16; 22700 } 22701 } 22702 22703 public static class ParticleReport extends DisposedStruct { 22704 public int area; // The number of pixels in the particle. 22705 public float calibratedArea; // The size of the particle, calibrated to the 22706 // calibration information of the image. 22707 public float perimeter; // The length of the perimeter, calibrated to the 22708 // calibration information of the image. 22709 public int numHoles; // The number of holes in the particle. 22710 public int areaOfHoles; // The total surface area, in pixels, of all the 22711 // holes in a particle. 22712 public float perimeterOfHoles; // The length of the perimeter of all the 22713 // holes in the particle calibrated to the 22714 // calibration information of the image. 22715 public Rect boundingBox; // The smallest rectangle that encloses the 22716 // particle. 22717 public float sigmaX; // The sum of the particle pixels on the x-axis. 22718 public float sigmaY; // The sum of the particle pixels on the y-axis. 22719 public float sigmaXX; // The sum of the particle pixels on the x-axis, 22720 // squared. 22721 public float sigmaYY; // The sum of the particle pixels on the y-axis, 22722 // squared. 22723 public float sigmaXY; // The sum of the particle pixels on the x-axis and 22724 // y-axis. 22725 public int longestLength; // The length of the longest horizontal line 22726 // segment. 22727 public Point longestPoint; // The location of the leftmost pixel of the 22728 // longest segment in the particle. 22729 public int projectionX; // The length of the particle when projected onto 22730 // the x-axis. 22731 public int projectionY; // The length of the particle when projected onto 22732 // the y-axis. 22733 public int connect8; // This element is TRUE if the function used 22734 // connectivity-8 to determine if particles are 22735 // touching. 22736 22737 private void init() { 22738 boundingBox = new Rect(backing, 24); 22739 longestPoint = new Point(backing, 64); 22740 } 22741 22742 public ParticleReport() { 22743 super(84); 22744 init(); 22745 } 22746 22747 public ParticleReport(int area, double calibratedArea, double perimeter, int numHoles, 22748 int areaOfHoles, double perimeterOfHoles, Rect boundingBox, double sigmaX, double sigmaY, 22749 double sigmaXX, double sigmaYY, double sigmaXY, int longestLength, Point longestPoint, 22750 int projectionX, int projectionY, int connect8) { 22751 super(84); 22752 this.area = area; 22753 this.calibratedArea = (float) calibratedArea; 22754 this.perimeter = (float) perimeter; 22755 this.numHoles = numHoles; 22756 this.areaOfHoles = areaOfHoles; 22757 this.perimeterOfHoles = (float) perimeterOfHoles; 22758 this.boundingBox = boundingBox; 22759 this.sigmaX = (float) sigmaX; 22760 this.sigmaY = (float) sigmaY; 22761 this.sigmaXX = (float) sigmaXX; 22762 this.sigmaYY = (float) sigmaYY; 22763 this.sigmaXY = (float) sigmaXY; 22764 this.longestLength = longestLength; 22765 this.longestPoint = longestPoint; 22766 this.projectionX = projectionX; 22767 this.projectionY = projectionY; 22768 this.connect8 = connect8; 22769 } 22770 22771 protected ParticleReport(ByteBuffer backing, int offset) { 22772 super(backing, offset, 84); 22773 init(); 22774 } 22775 22776 protected ParticleReport(long nativeObj, boolean owned) { 22777 super(nativeObj, owned, 84); 22778 init(); 22779 } 22780 22781 protected void setBuffer(ByteBuffer backing, int offset) { 22782 super.setBuffer(backing, offset, 84); 22783 } 22784 22785 public void read() { 22786 area = backing.getInt(0); 22787 calibratedArea = backing.getFloat(4); 22788 perimeter = backing.getFloat(8); 22789 numHoles = backing.getInt(12); 22790 areaOfHoles = backing.getInt(16); 22791 perimeterOfHoles = backing.getFloat(20); 22792 boundingBox.read(); 22793 sigmaX = backing.getFloat(40); 22794 sigmaY = backing.getFloat(44); 22795 sigmaXX = backing.getFloat(48); 22796 sigmaYY = backing.getFloat(52); 22797 sigmaXY = backing.getFloat(56); 22798 longestLength = backing.getInt(60); 22799 longestPoint.read(); 22800 projectionX = backing.getInt(72); 22801 projectionY = backing.getInt(76); 22802 connect8 = backing.getInt(80); 22803 } 22804 22805 public void write() { 22806 backing.putInt(0, area); 22807 backing.putFloat(4, calibratedArea); 22808 backing.putFloat(8, perimeter); 22809 backing.putInt(12, numHoles); 22810 backing.putInt(16, areaOfHoles); 22811 backing.putFloat(20, perimeterOfHoles); 22812 boundingBox.write(); 22813 backing.putFloat(40, sigmaX); 22814 backing.putFloat(44, sigmaY); 22815 backing.putFloat(48, sigmaXX); 22816 backing.putFloat(52, sigmaYY); 22817 backing.putFloat(56, sigmaXY); 22818 backing.putInt(60, longestLength); 22819 longestPoint.write(); 22820 backing.putInt(72, projectionX); 22821 backing.putInt(76, projectionY); 22822 backing.putInt(80, connect8); 22823 } 22824 22825 public int size() { 22826 return 84; 22827 } 22828 } 22829 22830 public static class PatternMatch extends DisposedStruct { 22831 public PointFloat position; // The location of the center of the match. 22832 public float rotation; // The rotation of the match relative to the template 22833 // image, in degrees. 22834 public float scale; // The size of the match relative to the size of the 22835 // template image, expressed as a percentage. 22836 public float score; // The accuracy of the match. 22837 public PointFloat[] corner; // An array of four points describing the 22838 // rectangle surrounding the template image. 22839 22840 private void init() { 22841 position = new PointFloat(backing, 0); 22842 corner = new PointFloat[4]; 22843 22844 for (int i = 0, off = 20; i < 4; i++, off += 8) 22845 corner[i] = new PointFloat(backing, off); 22846 } 22847 22848 public PatternMatch() { 22849 super(52); 22850 init(); 22851 } 22852 22853 public PatternMatch(PointFloat position, double rotation, double scale, double score, 22854 PointFloat[] corner) { 22855 super(52); 22856 this.position = position; 22857 this.rotation = (float) rotation; 22858 this.scale = (float) scale; 22859 this.score = (float) score; 22860 this.corner = corner; 22861 } 22862 22863 protected PatternMatch(ByteBuffer backing, int offset) { 22864 super(backing, offset, 52); 22865 init(); 22866 } 22867 22868 protected PatternMatch(long nativeObj, boolean owned) { 22869 super(nativeObj, owned, 52); 22870 init(); 22871 } 22872 22873 protected void setBuffer(ByteBuffer backing, int offset) { 22874 super.setBuffer(backing, offset, 52); 22875 } 22876 22877 public void read() { 22878 position.read(); 22879 rotation = backing.getFloat(8); 22880 scale = backing.getFloat(12); 22881 score = backing.getFloat(16); 22882 for (PointFloat it : corner) { 22883 it.read(); 22884 } 22885 } 22886 22887 public void write() { 22888 position.write(); 22889 backing.putFloat(8, rotation); 22890 backing.putFloat(12, scale); 22891 backing.putFloat(16, score); 22892 for (PointFloat it : corner) { 22893 it.write(); 22894 } 22895 } 22896 22897 public int size() { 22898 return 52; 22899 } 22900 } 22901 22902 public static class QuantifyData extends DisposedStruct { 22903 public float mean; // The mean value of the pixel values. 22904 public float stdDev; // The standard deviation of the pixel values. 22905 public float min; // The smallest pixel value. 22906 public float max; // The largest pixel value. 22907 public float calibratedArea; // The area, calibrated to the calibration 22908 // information of the image. 22909 public int pixelArea; // The area, in number of pixels. 22910 public float relativeSize; // The proportion, expressed as a percentage, of 22911 // the associated region relative to the whole 22912 // image. 22913 22914 private void init() { 22915 22916 } 22917 22918 public QuantifyData() { 22919 super(28); 22920 init(); 22921 } 22922 22923 public QuantifyData(double mean, double stdDev, double min, double max, double calibratedArea, 22924 int pixelArea, double relativeSize) { 22925 super(28); 22926 this.mean = (float) mean; 22927 this.stdDev = (float) stdDev; 22928 this.min = (float) min; 22929 this.max = (float) max; 22930 this.calibratedArea = (float) calibratedArea; 22931 this.pixelArea = pixelArea; 22932 this.relativeSize = (float) relativeSize; 22933 } 22934 22935 protected QuantifyData(ByteBuffer backing, int offset) { 22936 super(backing, offset, 28); 22937 init(); 22938 } 22939 22940 protected QuantifyData(long nativeObj, boolean owned) { 22941 super(nativeObj, owned, 28); 22942 init(); 22943 } 22944 22945 protected void setBuffer(ByteBuffer backing, int offset) { 22946 super.setBuffer(backing, offset, 28); 22947 } 22948 22949 public void read() { 22950 mean = backing.getFloat(0); 22951 stdDev = backing.getFloat(4); 22952 min = backing.getFloat(8); 22953 max = backing.getFloat(12); 22954 calibratedArea = backing.getFloat(16); 22955 pixelArea = backing.getInt(20); 22956 relativeSize = backing.getFloat(24); 22957 } 22958 22959 public void write() { 22960 backing.putFloat(0, mean); 22961 backing.putFloat(4, stdDev); 22962 backing.putFloat(8, min); 22963 backing.putFloat(12, max); 22964 backing.putFloat(16, calibratedArea); 22965 backing.putInt(20, pixelArea); 22966 backing.putFloat(24, relativeSize); 22967 } 22968 22969 public int size() { 22970 return 28; 22971 } 22972 } 22973 22974 public static class QuantifyReport extends DisposedStruct { 22975 public QuantifyData global; // Statistical data of the whole image. 22976 public QuantifyData[] regions; // An array of QuantifyData structures 22977 // containing statistical data of each region 22978 // of the image. 22979 private ByteBuffer regions_buf; 22980 22981 private void init() { 22982 global = new QuantifyData(backing, 0); 22983 regions = new QuantifyData[0]; 22984 } 22985 22986 public QuantifyReport() { 22987 super(36); 22988 init(); 22989 } 22990 22991 public QuantifyReport(QuantifyData global, QuantifyData[] regions) { 22992 super(36); 22993 this.global = global; 22994 this.regions = regions; 22995 } 22996 22997 protected QuantifyReport(ByteBuffer backing, int offset) { 22998 super(backing, offset, 36); 22999 init(); 23000 } 23001 23002 protected QuantifyReport(long nativeObj, boolean owned) { 23003 super(nativeObj, owned, 36); 23004 init(); 23005 } 23006 23007 protected void setBuffer(ByteBuffer backing, int offset) { 23008 super.setBuffer(backing, offset, 36); 23009 } 23010 23011 public void read() { 23012 global.read(); 23013 int regions_regionCount = backing.getInt(32); 23014 long regions_addr = getPointer(backing, 28); 23015 regions = new QuantifyData[regions_regionCount]; 23016 if (regions_regionCount > 0 && regions_addr != 0) { 23017 ByteBuffer bb = newDirectByteBuffer(regions_addr, regions_regionCount * 28); 23018 for (int i = 0, off = 0; i < regions_regionCount; i++, off += 28) { 23019 regions[i] = new QuantifyData(bb, off); 23020 regions[i].read(); 23021 } 23022 } 23023 } 23024 23025 public void write() { 23026 global.write(); 23027 regions_buf = ByteBuffer.allocateDirect(regions.length * 28).order(ByteOrder.nativeOrder()); 23028 for (int i = 0, off = 0; i < regions.length; i++, off += 28) { 23029 regions[i].setBuffer(regions_buf, off); 23030 regions[i].write(); 23031 } 23032 backing.putInt(32, regions.length); 23033 putPointer(backing, 28, regions_buf); 23034 } 23035 23036 public int size() { 23037 return 36; 23038 } 23039 } 23040 23041 public static class RakeOptions extends DisposedStruct { 23042 public int threshold; // Specifies the threshold value for the contrast of 23043 // the edge. 23044 public int width; // The number of pixels that the function averages to find 23045 // the contrast at either side of the edge. 23046 public int steepness; // The span, in pixels, of the slope of the edge 23047 // projected along the path specified by the input 23048 // points. 23049 public int subsamplingRatio; // Specifies the number of pixels that separate 23050 // two consecutive search lines. 23051 public InterpolationMethod subpixelType; // The method for interpolating. 23052 public int subpixelDivisions; // The number of samples the function obtains 23053 // from a pixel. 23054 23055 private void init() { 23056 23057 } 23058 23059 public RakeOptions() { 23060 super(24); 23061 init(); 23062 } 23063 23064 public RakeOptions(int threshold, int width, int steepness, int subsamplingRatio, 23065 InterpolationMethod subpixelType, int subpixelDivisions) { 23066 super(24); 23067 this.threshold = threshold; 23068 this.width = width; 23069 this.steepness = steepness; 23070 this.subsamplingRatio = subsamplingRatio; 23071 this.subpixelType = subpixelType; 23072 this.subpixelDivisions = subpixelDivisions; 23073 } 23074 23075 protected RakeOptions(ByteBuffer backing, int offset) { 23076 super(backing, offset, 24); 23077 init(); 23078 } 23079 23080 protected RakeOptions(long nativeObj, boolean owned) { 23081 super(nativeObj, owned, 24); 23082 init(); 23083 } 23084 23085 protected void setBuffer(ByteBuffer backing, int offset) { 23086 super.setBuffer(backing, offset, 24); 23087 } 23088 23089 public void read() { 23090 threshold = backing.getInt(0); 23091 width = backing.getInt(4); 23092 steepness = backing.getInt(8); 23093 subsamplingRatio = backing.getInt(12); 23094 subpixelType = InterpolationMethod.fromValue(backing.getInt(16)); 23095 subpixelDivisions = backing.getInt(20); 23096 } 23097 23098 public void write() { 23099 backing.putInt(0, threshold); 23100 backing.putInt(4, width); 23101 backing.putInt(8, steepness); 23102 backing.putInt(12, subsamplingRatio); 23103 if (subpixelType != null) 23104 backing.putInt(16, subpixelType.getValue()); 23105 backing.putInt(20, subpixelDivisions); 23106 } 23107 23108 public int size() { 23109 return 24; 23110 } 23111 } 23112 23113 public static class RakeReport extends DisposedStruct { 23114 public LineFloat[] rakeLines; // The coordinate location of each of the rake 23115 // lines used by the function. 23116 public PointFloat[] firstEdges; // The coordinate location of all edges 23117 // detected as first edges. 23118 public PointFloat[] lastEdges; // The coordinate location of all edges 23119 // detected as last edges. 23120 public EdgeLocationReport[] allEdges; // An array of reports describing the 23121 // location of the edges located by 23122 // each rake line. 23123 public int[] linesWithEdges; // An array of indices into the rakeLines array 23124 // indicating the rake lines on which the 23125 // function detected at least one edge. 23126 private ByteBuffer rakeLines_buf; 23127 private ByteBuffer firstEdges_buf; 23128 private ByteBuffer lastEdges_buf; 23129 private ByteBuffer allEdges_buf; 23130 private ByteBuffer linesWithEdges_buf; 23131 23132 private void init() { 23133 rakeLines = new LineFloat[0]; 23134 firstEdges = new PointFloat[0]; 23135 lastEdges = new PointFloat[0]; 23136 allEdges = new EdgeLocationReport[0]; 23137 linesWithEdges = new int[0]; 23138 } 23139 23140 public RakeReport() { 23141 super(36); 23142 init(); 23143 } 23144 23145 public RakeReport(LineFloat[] rakeLines, PointFloat[] firstEdges, PointFloat[] lastEdges, 23146 EdgeLocationReport[] allEdges, int[] linesWithEdges) { 23147 super(36); 23148 this.rakeLines = rakeLines; 23149 this.firstEdges = firstEdges; 23150 this.lastEdges = lastEdges; 23151 this.allEdges = allEdges; 23152 this.linesWithEdges = linesWithEdges; 23153 } 23154 23155 protected RakeReport(ByteBuffer backing, int offset) { 23156 super(backing, offset, 36); 23157 init(); 23158 } 23159 23160 protected RakeReport(long nativeObj, boolean owned) { 23161 super(nativeObj, owned, 36); 23162 init(); 23163 } 23164 23165 protected void setBuffer(ByteBuffer backing, int offset) { 23166 super.setBuffer(backing, offset, 36); 23167 } 23168 23169 public void read() { 23170 int rakeLines_numRakeLines = backing.getInt(4); 23171 long rakeLines_addr = getPointer(backing, 0); 23172 rakeLines = new LineFloat[rakeLines_numRakeLines]; 23173 if (rakeLines_numRakeLines > 0 && rakeLines_addr != 0) { 23174 ByteBuffer bb = newDirectByteBuffer(rakeLines_addr, rakeLines_numRakeLines * 16); 23175 for (int i = 0, off = 0; i < rakeLines_numRakeLines; i++, off += 16) { 23176 rakeLines[i] = new LineFloat(bb, off); 23177 rakeLines[i].read(); 23178 } 23179 } 23180 int firstEdges_numFirstEdges = backing.getInt(12); 23181 long firstEdges_addr = getPointer(backing, 8); 23182 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 23183 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 23184 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 8); 23185 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 8) { 23186 firstEdges[i] = new PointFloat(bb, off); 23187 firstEdges[i].read(); 23188 } 23189 } 23190 int lastEdges_numLastEdges = backing.getInt(20); 23191 long lastEdges_addr = getPointer(backing, 16); 23192 lastEdges = new PointFloat[lastEdges_numLastEdges]; 23193 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 23194 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 8); 23195 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 8) { 23196 lastEdges[i] = new PointFloat(bb, off); 23197 lastEdges[i].read(); 23198 } 23199 } 23200 int allEdges_numLinesWithEdges = backing.getInt(32); 23201 long allEdges_addr = getPointer(backing, 24); 23202 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 23203 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 23204 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges * 8); 23205 for (int i = 0, off = 0; i < allEdges_numLinesWithEdges; i++, off += 8) { 23206 allEdges[i] = new EdgeLocationReport(bb, off); 23207 allEdges[i].read(); 23208 } 23209 } 23210 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 23211 long linesWithEdges_addr = getPointer(backing, 28); 23212 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 23213 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 23214 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges * 4) 23215 .asIntBuffer().get(linesWithEdges); 23216 } 23217 } 23218 23219 public void write() { 23220 rakeLines_buf = 23221 ByteBuffer.allocateDirect(rakeLines.length * 16).order(ByteOrder.nativeOrder()); 23222 for (int i = 0, off = 0; i < rakeLines.length; i++, off += 16) { 23223 rakeLines[i].setBuffer(rakeLines_buf, off); 23224 rakeLines[i].write(); 23225 } 23226 backing.putInt(4, rakeLines.length); 23227 putPointer(backing, 0, rakeLines_buf); 23228 firstEdges_buf = 23229 ByteBuffer.allocateDirect(firstEdges.length * 8).order(ByteOrder.nativeOrder()); 23230 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 8) { 23231 firstEdges[i].setBuffer(firstEdges_buf, off); 23232 firstEdges[i].write(); 23233 } 23234 backing.putInt(12, firstEdges.length); 23235 putPointer(backing, 8, firstEdges_buf); 23236 lastEdges_buf = 23237 ByteBuffer.allocateDirect(lastEdges.length * 8).order(ByteOrder.nativeOrder()); 23238 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 8) { 23239 lastEdges[i].setBuffer(lastEdges_buf, off); 23240 lastEdges[i].write(); 23241 } 23242 backing.putInt(20, lastEdges.length); 23243 putPointer(backing, 16, lastEdges_buf); 23244 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length * 8).order(ByteOrder.nativeOrder()); 23245 for (int i = 0, off = 0; i < allEdges.length; i++, off += 8) { 23246 allEdges[i].setBuffer(allEdges_buf, off); 23247 allEdges[i].write(); 23248 } 23249 backing.putInt(32, allEdges.length); 23250 putPointer(backing, 24, allEdges_buf); 23251 linesWithEdges_buf = 23252 ByteBuffer.allocateDirect(linesWithEdges.length * 4).order(ByteOrder.nativeOrder()); 23253 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 23254 backing.putInt(32, linesWithEdges.length); 23255 putPointer(backing, 28, linesWithEdges_buf); 23256 } 23257 23258 public int size() { 23259 return 36; 23260 } 23261 } 23262 23263 public static class TransformReport extends DisposedStruct { 23264 public PointFloat[] points; // An array of transformed coordinates. 23265 public int[] validPoints; // An array of values that describe the validity 23266 // of each of the coordinates according to the 23267 // region of interest you calibrated using either 23268 // imaqLearnCalibrationGrid() or 23269 // imaqLearnCalibrationPoints(). 23270 private ByteBuffer points_buf; 23271 private ByteBuffer validPoints_buf; 23272 23273 private void init() { 23274 points = new PointFloat[0]; 23275 validPoints = new int[0]; 23276 } 23277 23278 public TransformReport() { 23279 super(12); 23280 init(); 23281 } 23282 23283 public TransformReport(PointFloat[] points, int[] validPoints) { 23284 super(12); 23285 this.points = points; 23286 this.validPoints = validPoints; 23287 } 23288 23289 protected TransformReport(ByteBuffer backing, int offset) { 23290 super(backing, offset, 12); 23291 init(); 23292 } 23293 23294 protected TransformReport(long nativeObj, boolean owned) { 23295 super(nativeObj, owned, 12); 23296 init(); 23297 } 23298 23299 protected void setBuffer(ByteBuffer backing, int offset) { 23300 super.setBuffer(backing, offset, 12); 23301 } 23302 23303 public void read() { 23304 int points_numPoints = backing.getInt(8); 23305 long points_addr = getPointer(backing, 0); 23306 points = new PointFloat[points_numPoints]; 23307 if (points_numPoints > 0 && points_addr != 0) { 23308 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints * 8); 23309 for (int i = 0, off = 0; i < points_numPoints; i++, off += 8) { 23310 points[i] = new PointFloat(bb, off); 23311 points[i].read(); 23312 } 23313 } 23314 int validPoints_numPoints = backing.getInt(8); 23315 long validPoints_addr = getPointer(backing, 4); 23316 validPoints = new int[validPoints_numPoints]; 23317 if (validPoints_numPoints > 0 && validPoints_addr != 0) { 23318 newDirectByteBuffer(validPoints_addr, validPoints_numPoints * 4).asIntBuffer().get( 23319 validPoints); 23320 } 23321 } 23322 23323 public void write() { 23324 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 23325 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 23326 points[i].setBuffer(points_buf, off); 23327 points[i].write(); 23328 } 23329 backing.putInt(8, points.length); 23330 putPointer(backing, 0, points_buf); 23331 validPoints_buf = 23332 ByteBuffer.allocateDirect(validPoints.length * 4).order(ByteOrder.nativeOrder()); 23333 validPoints_buf.asIntBuffer().put(validPoints).rewind(); 23334 backing.putInt(8, validPoints.length); 23335 putPointer(backing, 4, validPoints_buf); 23336 } 23337 23338 public int size() { 23339 return 12; 23340 } 23341 } 23342 23343 public static class ShapeReport extends DisposedStruct { 23344 public Rect coordinates; // The bounding rectangle of the object. 23345 public Point centroid; // The coordinate location of the centroid of the 23346 // object. 23347 public int size; // The size, in pixels, of the object. 23348 public double score; // A value ranging between 1 and 1,000 that specifies 23349 // how similar the object in the image is to the 23350 // template. 23351 23352 private void init() { 23353 coordinates = new Rect(backing, 0); 23354 centroid = new Point(backing, 16); 23355 } 23356 23357 public ShapeReport() { 23358 super(40); 23359 init(); 23360 } 23361 23362 public ShapeReport(Rect coordinates, Point centroid, int size, double score) { 23363 super(40); 23364 this.coordinates = coordinates; 23365 this.centroid = centroid; 23366 this.size = size; 23367 this.score = score; 23368 } 23369 23370 protected ShapeReport(ByteBuffer backing, int offset) { 23371 super(backing, offset, 40); 23372 init(); 23373 } 23374 23375 protected ShapeReport(long nativeObj, boolean owned) { 23376 super(nativeObj, owned, 40); 23377 init(); 23378 } 23379 23380 protected void setBuffer(ByteBuffer backing, int offset) { 23381 super.setBuffer(backing, offset, 40); 23382 } 23383 23384 public void read() { 23385 coordinates.read(); 23386 centroid.read(); 23387 size = backing.getInt(24); 23388 score = backing.getDouble(32); 23389 } 23390 23391 public void write() { 23392 coordinates.write(); 23393 centroid.write(); 23394 backing.putInt(24, size); 23395 backing.putDouble(32, score); 23396 } 23397 23398 public int size() { 23399 return 40; 23400 } 23401 } 23402 23403 public static class MeterArc extends DisposedStruct { 23404 public PointFloat needleBase; // The coordinate location of the base of the 23405 // meter needle. 23406 public PointFloat[] arcCoordPoints; // An array of points describing the 23407 // coordinate location of the meter arc. 23408 public int needleColor; // This element is TRUE when the meter has a 23409 // light-colored needle on a dark background. 23410 private ByteBuffer arcCoordPoints_buf; 23411 23412 private void init() { 23413 needleBase = new PointFloat(backing, 0); 23414 arcCoordPoints = new PointFloat[0]; 23415 } 23416 23417 public MeterArc() { 23418 super(20); 23419 init(); 23420 } 23421 23422 public MeterArc(PointFloat needleBase, PointFloat[] arcCoordPoints, int needleColor) { 23423 super(20); 23424 this.needleBase = needleBase; 23425 this.arcCoordPoints = arcCoordPoints; 23426 this.needleColor = needleColor; 23427 } 23428 23429 protected MeterArc(ByteBuffer backing, int offset) { 23430 super(backing, offset, 20); 23431 init(); 23432 } 23433 23434 protected MeterArc(long nativeObj, boolean owned) { 23435 super(nativeObj, owned, 20); 23436 init(); 23437 } 23438 23439 protected void setBuffer(ByteBuffer backing, int offset) { 23440 super.setBuffer(backing, offset, 20); 23441 } 23442 23443 public void read() { 23444 needleBase.read(); 23445 int arcCoordPoints_numOfArcCoordPoints = backing.getInt(12); 23446 long arcCoordPoints_addr = getPointer(backing, 8); 23447 arcCoordPoints = new PointFloat[arcCoordPoints_numOfArcCoordPoints]; 23448 if (arcCoordPoints_numOfArcCoordPoints > 0 && arcCoordPoints_addr != 0) { 23449 ByteBuffer bb = 23450 newDirectByteBuffer(arcCoordPoints_addr, arcCoordPoints_numOfArcCoordPoints * 8); 23451 for (int i = 0, off = 0; i < arcCoordPoints_numOfArcCoordPoints; i++, off += 8) { 23452 arcCoordPoints[i] = new PointFloat(bb, off); 23453 arcCoordPoints[i].read(); 23454 } 23455 } 23456 needleColor = backing.getInt(16); 23457 } 23458 23459 public void write() { 23460 needleBase.write(); 23461 arcCoordPoints_buf = 23462 ByteBuffer.allocateDirect(arcCoordPoints.length * 8).order(ByteOrder.nativeOrder()); 23463 for (int i = 0, off = 0; i < arcCoordPoints.length; i++, off += 8) { 23464 arcCoordPoints[i].setBuffer(arcCoordPoints_buf, off); 23465 arcCoordPoints[i].write(); 23466 } 23467 backing.putInt(12, arcCoordPoints.length); 23468 putPointer(backing, 8, arcCoordPoints_buf); 23469 backing.putInt(16, needleColor); 23470 } 23471 23472 public int size() { 23473 return 20; 23474 } 23475 } 23476 23477 public static class ThresholdData extends DisposedStruct { 23478 public float rangeMin; // The lower boundary of the range to keep. 23479 public float rangeMax; // The upper boundary of the range to keep. 23480 public float newValue; // If useNewValue is TRUE, newValue is the 23481 // replacement value for pixels within the range. 23482 public int useNewValue; // If TRUE, the function sets pixel values within 23483 // [rangeMin, rangeMax] to the value specified in 23484 // newValue. 23485 23486 private void init() { 23487 23488 } 23489 23490 public ThresholdData() { 23491 super(16); 23492 init(); 23493 } 23494 23495 public ThresholdData(double rangeMin, double rangeMax, double newValue, int useNewValue) { 23496 super(16); 23497 this.rangeMin = (float) rangeMin; 23498 this.rangeMax = (float) rangeMax; 23499 this.newValue = (float) newValue; 23500 this.useNewValue = useNewValue; 23501 } 23502 23503 protected ThresholdData(ByteBuffer backing, int offset) { 23504 super(backing, offset, 16); 23505 init(); 23506 } 23507 23508 protected ThresholdData(long nativeObj, boolean owned) { 23509 super(nativeObj, owned, 16); 23510 init(); 23511 } 23512 23513 protected void setBuffer(ByteBuffer backing, int offset) { 23514 super.setBuffer(backing, offset, 16); 23515 } 23516 23517 public void read() { 23518 rangeMin = backing.getFloat(0); 23519 rangeMax = backing.getFloat(4); 23520 newValue = backing.getFloat(8); 23521 useNewValue = backing.getInt(12); 23522 } 23523 23524 public void write() { 23525 backing.putFloat(0, rangeMin); 23526 backing.putFloat(4, rangeMax); 23527 backing.putFloat(8, newValue); 23528 backing.putInt(12, useNewValue); 23529 } 23530 23531 public int size() { 23532 return 16; 23533 } 23534 } 23535 23536 public static class StructuringElement extends DisposedStruct { 23537 public int matrixCols; // Number of columns in the matrix. 23538 public int matrixRows; // Number of rows in the matrix. 23539 public int hexa; // Set this element to TRUE if you specify a hexagonal 23540 // structuring element in kernel. 23541 23542 private void init() { 23543 23544 } 23545 23546 public StructuringElement() { 23547 super(16); 23548 init(); 23549 } 23550 23551 public StructuringElement(int matrixCols, int matrixRows, int hexa) { 23552 super(16); 23553 this.matrixCols = matrixCols; 23554 this.matrixRows = matrixRows; 23555 this.hexa = hexa; 23556 } 23557 23558 protected StructuringElement(ByteBuffer backing, int offset) { 23559 super(backing, offset, 16); 23560 init(); 23561 } 23562 23563 protected StructuringElement(long nativeObj, boolean owned) { 23564 super(nativeObj, owned, 16); 23565 init(); 23566 } 23567 23568 protected void setBuffer(ByteBuffer backing, int offset) { 23569 super.setBuffer(backing, offset, 16); 23570 } 23571 23572 public void read() { 23573 matrixCols = backing.getInt(0); 23574 matrixRows = backing.getInt(4); 23575 hexa = backing.getInt(8); 23576 } 23577 23578 public void write() { 23579 backing.putInt(0, matrixCols); 23580 backing.putInt(4, matrixRows); 23581 backing.putInt(8, hexa); 23582 } 23583 23584 public int size() { 23585 return 16; 23586 } 23587 } 23588 23589 public static class SpokeReport extends DisposedStruct { 23590 public LineFloat[] spokeLines; // The coordinate location of each of the 23591 // spoke lines used by the function. 23592 public PointFloat[] firstEdges; // The coordinate location of all edges 23593 // detected as first edges. 23594 public PointFloat[] lastEdges; // The coordinate location of all edges 23595 // detected as last edges. 23596 public EdgeLocationReport[] allEdges; // An array of reports describing the 23597 // location of the edges located by 23598 // each spoke line. 23599 public int[] linesWithEdges; // An array of indices into the spokeLines 23600 // array indicating the rake lines on which the 23601 // function detected at least one edge. 23602 private ByteBuffer spokeLines_buf; 23603 private ByteBuffer firstEdges_buf; 23604 private ByteBuffer lastEdges_buf; 23605 private ByteBuffer allEdges_buf; 23606 private ByteBuffer linesWithEdges_buf; 23607 23608 private void init() { 23609 spokeLines = new LineFloat[0]; 23610 firstEdges = new PointFloat[0]; 23611 lastEdges = new PointFloat[0]; 23612 allEdges = new EdgeLocationReport[0]; 23613 linesWithEdges = new int[0]; 23614 } 23615 23616 public SpokeReport() { 23617 super(36); 23618 init(); 23619 } 23620 23621 public SpokeReport(LineFloat[] spokeLines, PointFloat[] firstEdges, PointFloat[] lastEdges, 23622 EdgeLocationReport[] allEdges, int[] linesWithEdges) { 23623 super(36); 23624 this.spokeLines = spokeLines; 23625 this.firstEdges = firstEdges; 23626 this.lastEdges = lastEdges; 23627 this.allEdges = allEdges; 23628 this.linesWithEdges = linesWithEdges; 23629 } 23630 23631 protected SpokeReport(ByteBuffer backing, int offset) { 23632 super(backing, offset, 36); 23633 init(); 23634 } 23635 23636 protected SpokeReport(long nativeObj, boolean owned) { 23637 super(nativeObj, owned, 36); 23638 init(); 23639 } 23640 23641 protected void setBuffer(ByteBuffer backing, int offset) { 23642 super.setBuffer(backing, offset, 36); 23643 } 23644 23645 public void read() { 23646 int spokeLines_numSpokeLines = backing.getInt(4); 23647 long spokeLines_addr = getPointer(backing, 0); 23648 spokeLines = new LineFloat[spokeLines_numSpokeLines]; 23649 if (spokeLines_numSpokeLines > 0 && spokeLines_addr != 0) { 23650 ByteBuffer bb = newDirectByteBuffer(spokeLines_addr, spokeLines_numSpokeLines * 16); 23651 for (int i = 0, off = 0; i < spokeLines_numSpokeLines; i++, off += 16) { 23652 spokeLines[i] = new LineFloat(bb, off); 23653 spokeLines[i].read(); 23654 } 23655 } 23656 int firstEdges_numFirstEdges = backing.getInt(12); 23657 long firstEdges_addr = getPointer(backing, 8); 23658 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 23659 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 23660 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges * 8); 23661 for (int i = 0, off = 0; i < firstEdges_numFirstEdges; i++, off += 8) { 23662 firstEdges[i] = new PointFloat(bb, off); 23663 firstEdges[i].read(); 23664 } 23665 } 23666 int lastEdges_numLastEdges = backing.getInt(20); 23667 long lastEdges_addr = getPointer(backing, 16); 23668 lastEdges = new PointFloat[lastEdges_numLastEdges]; 23669 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 23670 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges * 8); 23671 for (int i = 0, off = 0; i < lastEdges_numLastEdges; i++, off += 8) { 23672 lastEdges[i] = new PointFloat(bb, off); 23673 lastEdges[i].read(); 23674 } 23675 } 23676 int allEdges_numLinesWithEdges = backing.getInt(32); 23677 long allEdges_addr = getPointer(backing, 24); 23678 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 23679 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 23680 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges * 8); 23681 for (int i = 0, off = 0; i < allEdges_numLinesWithEdges; i++, off += 8) { 23682 allEdges[i] = new EdgeLocationReport(bb, off); 23683 allEdges[i].read(); 23684 } 23685 } 23686 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 23687 long linesWithEdges_addr = getPointer(backing, 28); 23688 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 23689 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 23690 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges * 4) 23691 .asIntBuffer().get(linesWithEdges); 23692 } 23693 } 23694 23695 public void write() { 23696 spokeLines_buf = 23697 ByteBuffer.allocateDirect(spokeLines.length * 16).order(ByteOrder.nativeOrder()); 23698 for (int i = 0, off = 0; i < spokeLines.length; i++, off += 16) { 23699 spokeLines[i].setBuffer(spokeLines_buf, off); 23700 spokeLines[i].write(); 23701 } 23702 backing.putInt(4, spokeLines.length); 23703 putPointer(backing, 0, spokeLines_buf); 23704 firstEdges_buf = 23705 ByteBuffer.allocateDirect(firstEdges.length * 8).order(ByteOrder.nativeOrder()); 23706 for (int i = 0, off = 0; i < firstEdges.length; i++, off += 8) { 23707 firstEdges[i].setBuffer(firstEdges_buf, off); 23708 firstEdges[i].write(); 23709 } 23710 backing.putInt(12, firstEdges.length); 23711 putPointer(backing, 8, firstEdges_buf); 23712 lastEdges_buf = 23713 ByteBuffer.allocateDirect(lastEdges.length * 8).order(ByteOrder.nativeOrder()); 23714 for (int i = 0, off = 0; i < lastEdges.length; i++, off += 8) { 23715 lastEdges[i].setBuffer(lastEdges_buf, off); 23716 lastEdges[i].write(); 23717 } 23718 backing.putInt(20, lastEdges.length); 23719 putPointer(backing, 16, lastEdges_buf); 23720 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length * 8).order(ByteOrder.nativeOrder()); 23721 for (int i = 0, off = 0; i < allEdges.length; i++, off += 8) { 23722 allEdges[i].setBuffer(allEdges_buf, off); 23723 allEdges[i].write(); 23724 } 23725 backing.putInt(32, allEdges.length); 23726 putPointer(backing, 24, allEdges_buf); 23727 linesWithEdges_buf = 23728 ByteBuffer.allocateDirect(linesWithEdges.length * 4).order(ByteOrder.nativeOrder()); 23729 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 23730 backing.putInt(32, linesWithEdges.length); 23731 putPointer(backing, 28, linesWithEdges_buf); 23732 } 23733 23734 public int size() { 23735 return 36; 23736 } 23737 } 23738 23739 public static class SimpleEdgeOptions extends DisposedStruct { 23740 public LevelType type; // Determines how the function evaluates the 23741 // threshold and hysteresis values. 23742 public int threshold; // The pixel value at which an edge occurs. 23743 public int hysteresis; // A value that helps determine edges in noisy 23744 // images. 23745 public EdgeProcess process; // Determines which edges the function looks 23746 // for. 23747 public int subpixel; // Set this element to TRUE to find edges with subpixel 23748 // accuracy by interpolating between points to find the 23749 // crossing of the given threshold. 23750 23751 private void init() { 23752 23753 } 23754 23755 public SimpleEdgeOptions() { 23756 super(20); 23757 init(); 23758 } 23759 23760 public SimpleEdgeOptions(LevelType type, int threshold, int hysteresis, EdgeProcess process, 23761 int subpixel) { 23762 super(20); 23763 this.type = type; 23764 this.threshold = threshold; 23765 this.hysteresis = hysteresis; 23766 this.process = process; 23767 this.subpixel = subpixel; 23768 } 23769 23770 protected SimpleEdgeOptions(ByteBuffer backing, int offset) { 23771 super(backing, offset, 20); 23772 init(); 23773 } 23774 23775 protected SimpleEdgeOptions(long nativeObj, boolean owned) { 23776 super(nativeObj, owned, 20); 23777 init(); 23778 } 23779 23780 protected void setBuffer(ByteBuffer backing, int offset) { 23781 super.setBuffer(backing, offset, 20); 23782 } 23783 23784 public void read() { 23785 type = LevelType.fromValue(backing.getInt(0)); 23786 threshold = backing.getInt(4); 23787 hysteresis = backing.getInt(8); 23788 process = EdgeProcess.fromValue(backing.getInt(12)); 23789 subpixel = backing.getInt(16); 23790 } 23791 23792 public void write() { 23793 if (type != null) 23794 backing.putInt(0, type.getValue()); 23795 backing.putInt(4, threshold); 23796 backing.putInt(8, hysteresis); 23797 if (process != null) 23798 backing.putInt(12, process.getValue()); 23799 backing.putInt(16, subpixel); 23800 } 23801 23802 public int size() { 23803 return 20; 23804 } 23805 } 23806 23807 public static class SelectParticleCriteria extends DisposedStruct { 23808 public MeasurementValue parameter; // The morphological measurement that the 23809 // function uses for filtering. 23810 public float lower; // The lower boundary of the criteria range. 23811 public float upper; // The upper boundary of the criteria range. 23812 23813 private void init() { 23814 23815 } 23816 23817 public SelectParticleCriteria() { 23818 super(12); 23819 init(); 23820 } 23821 23822 public SelectParticleCriteria(MeasurementValue parameter, double lower, double upper) { 23823 super(12); 23824 this.parameter = parameter; 23825 this.lower = (float) lower; 23826 this.upper = (float) upper; 23827 } 23828 23829 protected SelectParticleCriteria(ByteBuffer backing, int offset) { 23830 super(backing, offset, 12); 23831 init(); 23832 } 23833 23834 protected SelectParticleCriteria(long nativeObj, boolean owned) { 23835 super(nativeObj, owned, 12); 23836 init(); 23837 } 23838 23839 protected void setBuffer(ByteBuffer backing, int offset) { 23840 super.setBuffer(backing, offset, 12); 23841 } 23842 23843 public void read() { 23844 parameter = MeasurementValue.fromValue(backing.getInt(0)); 23845 lower = backing.getFloat(4); 23846 upper = backing.getFloat(8); 23847 } 23848 23849 public void write() { 23850 if (parameter != null) 23851 backing.putInt(0, parameter.getValue()); 23852 backing.putFloat(4, lower); 23853 backing.putFloat(8, upper); 23854 } 23855 23856 public int size() { 23857 return 12; 23858 } 23859 } 23860 23861 public static class SegmentInfo extends DisposedStruct { 23862 public int numberOfPoints; // The number of points in the segment. 23863 public int isOpen; // If TRUE, the contour is open. 23864 public double weight; // The significance of the edge in terms of the gray 23865 // values that constitute the edge. 23866 public ContourPoint points; // The points of the segment. 23867 23868 private void init() { 23869 23870 } 23871 23872 public SegmentInfo() { 23873 super(24); 23874 init(); 23875 } 23876 23877 public SegmentInfo(int numberOfPoints, int isOpen, double weight, ContourPoint points) { 23878 super(24); 23879 this.numberOfPoints = numberOfPoints; 23880 this.isOpen = isOpen; 23881 this.weight = weight; 23882 this.points = points; 23883 } 23884 23885 protected SegmentInfo(ByteBuffer backing, int offset) { 23886 super(backing, offset, 24); 23887 init(); 23888 } 23889 23890 protected SegmentInfo(long nativeObj, boolean owned) { 23891 super(nativeObj, owned, 24); 23892 init(); 23893 } 23894 23895 protected void setBuffer(ByteBuffer backing, int offset) { 23896 super.setBuffer(backing, offset, 24); 23897 } 23898 23899 public void read() { 23900 numberOfPoints = backing.getInt(0); 23901 isOpen = backing.getInt(4); 23902 weight = backing.getDouble(8); 23903 long points_addr = getPointer(backing, 16); 23904 if (points_addr == 0) 23905 points = null; 23906 else 23907 points = new ContourPoint(points_addr, false); 23908 } 23909 23910 public void write() { 23911 backing.putInt(0, numberOfPoints); 23912 backing.putInt(4, isOpen); 23913 backing.putDouble(8, weight); 23914 putPointer(backing, 16, points); 23915 } 23916 23917 public int size() { 23918 return 24; 23919 } 23920 } 23921 23922 public static class RotationAngleRange extends DisposedStruct { 23923 public float lower; // The lowest amount of rotation, in degrees, a valid 23924 // pattern can have. 23925 public float upper; // The highest amount of rotation, in degrees, a valid 23926 // pattern can have. 23927 23928 private void init() { 23929 23930 } 23931 23932 public RotationAngleRange() { 23933 super(8); 23934 init(); 23935 } 23936 23937 public RotationAngleRange(double lower, double upper) { 23938 super(8); 23939 this.lower = (float) lower; 23940 this.upper = (float) upper; 23941 } 23942 23943 protected RotationAngleRange(ByteBuffer backing, int offset) { 23944 super(backing, offset, 8); 23945 init(); 23946 } 23947 23948 protected RotationAngleRange(long nativeObj, boolean owned) { 23949 super(nativeObj, owned, 8); 23950 init(); 23951 } 23952 23953 protected void setBuffer(ByteBuffer backing, int offset) { 23954 super.setBuffer(backing, offset, 8); 23955 } 23956 23957 public void read() { 23958 lower = backing.getFloat(0); 23959 upper = backing.getFloat(4); 23960 } 23961 23962 public void write() { 23963 backing.putFloat(0, lower); 23964 backing.putFloat(4, upper); 23965 } 23966 23967 public int size() { 23968 return 8; 23969 } 23970 } 23971 23972 public static class RotatedRect extends DisposedStruct { 23973 public int top; // Location of the top edge of the rectangle before 23974 // rotation. 23975 public int left; // Location of the left edge of the rectangle before 23976 // rotation. 23977 public int height; // Height of the rectangle. 23978 public int width; // Width of the rectangle. 23979 public double angle; // The rotation, in degrees, of the rectangle. 23980 23981 private void init() { 23982 23983 } 23984 23985 public RotatedRect() { 23986 super(24); 23987 init(); 23988 } 23989 23990 public RotatedRect(int top, int left, int height, int width, double angle) { 23991 super(24); 23992 this.top = top; 23993 this.left = left; 23994 this.height = height; 23995 this.width = width; 23996 this.angle = angle; 23997 } 23998 23999 protected RotatedRect(ByteBuffer backing, int offset) { 24000 super(backing, offset, 24); 24001 init(); 24002 } 24003 24004 protected RotatedRect(long nativeObj, boolean owned) { 24005 super(nativeObj, owned, 24); 24006 init(); 24007 } 24008 24009 protected void setBuffer(ByteBuffer backing, int offset) { 24010 super.setBuffer(backing, offset, 24); 24011 } 24012 24013 public void read() { 24014 top = backing.getInt(0); 24015 left = backing.getInt(4); 24016 height = backing.getInt(8); 24017 width = backing.getInt(12); 24018 angle = backing.getDouble(16); 24019 } 24020 24021 public void write() { 24022 backing.putInt(0, top); 24023 backing.putInt(4, left); 24024 backing.putInt(8, height); 24025 backing.putInt(12, width); 24026 backing.putDouble(16, angle); 24027 } 24028 24029 public int size() { 24030 return 24; 24031 } 24032 } 24033 24034 public static class ROIProfile extends DisposedStruct { 24035 public LineProfile report; // Quantifying information about the points along 24036 // the edge of each contour in the ROI. 24037 public Point pixels; // An array of the points along the edge of each 24038 // contour in the ROI. 24039 24040 private void init() { 24041 report = new LineProfile(backing, 0); 24042 } 24043 24044 public ROIProfile() { 24045 super(44); 24046 init(); 24047 } 24048 24049 public ROIProfile(LineProfile report, Point pixels) { 24050 super(44); 24051 this.report = report; 24052 this.pixels = pixels; 24053 } 24054 24055 protected ROIProfile(ByteBuffer backing, int offset) { 24056 super(backing, offset, 44); 24057 init(); 24058 } 24059 24060 protected ROIProfile(long nativeObj, boolean owned) { 24061 super(nativeObj, owned, 44); 24062 init(); 24063 } 24064 24065 protected void setBuffer(ByteBuffer backing, int offset) { 24066 super.setBuffer(backing, offset, 44); 24067 } 24068 24069 public void read() { 24070 report.read(); 24071 long pixels_addr = getPointer(backing, 40); 24072 if (pixels_addr == 0) 24073 pixels = null; 24074 else 24075 pixels = new Point(pixels_addr, false); 24076 } 24077 24078 public void write() { 24079 report.write(); 24080 putPointer(backing, 40, pixels); 24081 } 24082 24083 public int size() { 24084 return 44; 24085 } 24086 } 24087 24088 public static class ToolWindowOptions extends DisposedStruct { 24089 public int showSelectionTool; // If TRUE, the selection tool becomes 24090 // visible. 24091 public int showZoomTool; // If TRUE, the zoom tool becomes visible. 24092 public int showPointTool; // If TRUE, the point tool becomes visible. 24093 public int showLineTool; // If TRUE, the line tool becomes visible. 24094 public int showRectangleTool; // If TRUE, the rectangle tool becomes 24095 // visible. 24096 public int showOvalTool; // If TRUE, the oval tool becomes visible. 24097 public int showPolygonTool; // If TRUE, the polygon tool becomes visible. 24098 public int showClosedFreehandTool; // If TRUE, the closed freehand tool 24099 // becomes visible. 24100 public int showPolyLineTool; // If TRUE, the polyline tool becomes visible. 24101 public int showFreehandTool; // If TRUE, the freehand tool becomes visible. 24102 public int showAnnulusTool; // If TRUE, the annulus becomes visible. 24103 public int showRotatedRectangleTool; // If TRUE, the rotated rectangle tool 24104 // becomes visible. 24105 public int showPanTool; // If TRUE, the pan tool becomes visible. 24106 public int showZoomOutTool; // If TRUE, the zoom out tool becomes visible. 24107 24108 private void init() { 24109 24110 } 24111 24112 public ToolWindowOptions() { 24113 super(68); 24114 init(); 24115 } 24116 24117 public ToolWindowOptions(int showSelectionTool, int showZoomTool, int showPointTool, 24118 int showLineTool, int showRectangleTool, int showOvalTool, int showPolygonTool, 24119 int showClosedFreehandTool, int showPolyLineTool, int showFreehandTool, 24120 int showAnnulusTool, int showRotatedRectangleTool, int showPanTool, int showZoomOutTool) { 24121 super(68); 24122 this.showSelectionTool = showSelectionTool; 24123 this.showZoomTool = showZoomTool; 24124 this.showPointTool = showPointTool; 24125 this.showLineTool = showLineTool; 24126 this.showRectangleTool = showRectangleTool; 24127 this.showOvalTool = showOvalTool; 24128 this.showPolygonTool = showPolygonTool; 24129 this.showClosedFreehandTool = showClosedFreehandTool; 24130 this.showPolyLineTool = showPolyLineTool; 24131 this.showFreehandTool = showFreehandTool; 24132 this.showAnnulusTool = showAnnulusTool; 24133 this.showRotatedRectangleTool = showRotatedRectangleTool; 24134 this.showPanTool = showPanTool; 24135 this.showZoomOutTool = showZoomOutTool; 24136 } 24137 24138 protected ToolWindowOptions(ByteBuffer backing, int offset) { 24139 super(backing, offset, 68); 24140 init(); 24141 } 24142 24143 protected ToolWindowOptions(long nativeObj, boolean owned) { 24144 super(nativeObj, owned, 68); 24145 init(); 24146 } 24147 24148 protected void setBuffer(ByteBuffer backing, int offset) { 24149 super.setBuffer(backing, offset, 68); 24150 } 24151 24152 public void read() { 24153 showSelectionTool = backing.getInt(0); 24154 showZoomTool = backing.getInt(4); 24155 showPointTool = backing.getInt(8); 24156 showLineTool = backing.getInt(12); 24157 showRectangleTool = backing.getInt(16); 24158 showOvalTool = backing.getInt(20); 24159 showPolygonTool = backing.getInt(24); 24160 showClosedFreehandTool = backing.getInt(28); 24161 showPolyLineTool = backing.getInt(32); 24162 showFreehandTool = backing.getInt(36); 24163 showAnnulusTool = backing.getInt(40); 24164 showRotatedRectangleTool = backing.getInt(44); 24165 showPanTool = backing.getInt(48); 24166 showZoomOutTool = backing.getInt(52); 24167 } 24168 24169 public void write() { 24170 backing.putInt(0, showSelectionTool); 24171 backing.putInt(4, showZoomTool); 24172 backing.putInt(8, showPointTool); 24173 backing.putInt(12, showLineTool); 24174 backing.putInt(16, showRectangleTool); 24175 backing.putInt(20, showOvalTool); 24176 backing.putInt(24, showPolygonTool); 24177 backing.putInt(28, showClosedFreehandTool); 24178 backing.putInt(32, showPolyLineTool); 24179 backing.putInt(36, showFreehandTool); 24180 backing.putInt(40, showAnnulusTool); 24181 backing.putInt(44, showRotatedRectangleTool); 24182 backing.putInt(48, showPanTool); 24183 backing.putInt(52, showZoomOutTool); 24184 } 24185 24186 public int size() { 24187 return 68; 24188 } 24189 } 24190 24191 public static class SpokeOptions extends DisposedStruct { 24192 public int threshold; // Specifies the threshold value for the contrast of 24193 // the edge. 24194 public int width; // The number of pixels that the function averages to find 24195 // the contrast at either side of the edge. 24196 public int steepness; // The span, in pixels, of the slope of the edge 24197 // projected along the path specified by the input 24198 // points. 24199 public double subsamplingRatio; // The angle, in degrees, between each 24200 // radial search line in the spoke. 24201 public InterpolationMethod subpixelType; // The method for interpolating. 24202 public int subpixelDivisions; // The number of samples the function obtains 24203 // from a pixel. 24204 24205 private void init() { 24206 24207 } 24208 24209 public SpokeOptions() { 24210 super(32); 24211 init(); 24212 } 24213 24214 public SpokeOptions(int threshold, int width, int steepness, double subsamplingRatio, 24215 InterpolationMethod subpixelType, int subpixelDivisions) { 24216 super(32); 24217 this.threshold = threshold; 24218 this.width = width; 24219 this.steepness = steepness; 24220 this.subsamplingRatio = subsamplingRatio; 24221 this.subpixelType = subpixelType; 24222 this.subpixelDivisions = subpixelDivisions; 24223 } 24224 24225 protected SpokeOptions(ByteBuffer backing, int offset) { 24226 super(backing, offset, 32); 24227 init(); 24228 } 24229 24230 protected SpokeOptions(long nativeObj, boolean owned) { 24231 super(nativeObj, owned, 32); 24232 init(); 24233 } 24234 24235 protected void setBuffer(ByteBuffer backing, int offset) { 24236 super.setBuffer(backing, offset, 32); 24237 } 24238 24239 public void read() { 24240 threshold = backing.getInt(0); 24241 width = backing.getInt(4); 24242 steepness = backing.getInt(8); 24243 subsamplingRatio = backing.getDouble(16); 24244 subpixelType = InterpolationMethod.fromValue(backing.getInt(24)); 24245 subpixelDivisions = backing.getInt(28); 24246 } 24247 24248 public void write() { 24249 backing.putInt(0, threshold); 24250 backing.putInt(4, width); 24251 backing.putInt(8, steepness); 24252 backing.putDouble(16, subsamplingRatio); 24253 if (subpixelType != null) 24254 backing.putInt(24, subpixelType.getValue()); 24255 backing.putInt(28, subpixelDivisions); 24256 } 24257 24258 public int size() { 24259 return 32; 24260 } 24261 } 24262 24263 /** 24264 * Globals 24265 */ 24266 public static final Rect NO_RECT = new Rect(0, 0, 0x7FFFFFFF, 0x7FFFFFFF); 24267 public static final RotatedRect NO_ROTATED_RECT = 24268 new RotatedRect(0, 0, 0x7FFFFFFF, 0x7FFFFFFF, 0); 24269 public static final Point NO_POINT = new Point(-1, -1); 24270 public static final PointFloat NO_POINT_FLOAT = new PointFloat(-1.0, -1.0); 24271 public static final PointFloat NO_OFFSET = new PointFloat(0.0, 0.0); 24272 public static final RGBValue RGB_TRANSPARENT = new RGBValue(0, 0, 0, 1); 24273 public static final RGBValue RGB_RED = new RGBValue(0, 0, 255, 0); 24274 public static final RGBValue RGB_BLUE = new RGBValue(255, 0, 0, 0); 24275 public static final RGBValue RGB_GREEN = new RGBValue(0, 255, 0, 0); 24276 public static final RGBValue RGB_YELLOW = new RGBValue(0, 255, 255, 0); 24277 public static final RGBValue RGB_WHITE = new RGBValue(255, 255, 255, 0); 24278 public static final RGBValue RGB_BLACK = new RGBValue(0, 0, 0, 0); 24279 24280 /** 24281 * Logical functions 24282 */ 24283 24284 public static void imaqAnd(Image dest, Image sourceA, Image sourceB) { 24285 24286 _imaqAnd(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24287 24288 } 24289 24290 private static native void _imaqAnd(long dest, long sourceA, long sourceB); 24291 24292 public static void imaqCompare(Image dest, Image source, Image compareImage, 24293 ComparisonFunction compare) { 24294 24295 _imaqCompare(dest.getAddress(), source.getAddress(), compareImage.getAddress(), 24296 compare.getValue()); 24297 24298 } 24299 24300 private static native void _imaqCompare(long dest, long source, long compareImage, int compare); 24301 24302 public static void imaqLogicalDifference(Image dest, Image sourceA, Image sourceB) { 24303 24304 _imaqLogicalDifference(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24305 24306 } 24307 24308 private static native void _imaqLogicalDifference(long dest, long sourceA, long sourceB); 24309 24310 public static void imaqNand(Image dest, Image sourceA, Image sourceB) { 24311 24312 _imaqNand(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24313 24314 } 24315 24316 private static native void _imaqNand(long dest, long sourceA, long sourceB); 24317 24318 public static void imaqNor(Image dest, Image sourceA, Image sourceB) { 24319 24320 _imaqNor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24321 24322 } 24323 24324 private static native void _imaqNor(long dest, long sourceA, long sourceB); 24325 24326 public static void imaqOr(Image dest, Image sourceA, Image sourceB) { 24327 24328 _imaqOr(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24329 24330 } 24331 24332 private static native void _imaqOr(long dest, long sourceA, long sourceB); 24333 24334 public static void imaqXnor(Image dest, Image sourceA, Image sourceB) { 24335 24336 _imaqXnor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24337 24338 } 24339 24340 private static native void _imaqXnor(long dest, long sourceA, long sourceB); 24341 24342 public static void imaqXor(Image dest, Image sourceA, Image sourceB) { 24343 24344 _imaqXor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24345 24346 } 24347 24348 private static native void _imaqXor(long dest, long sourceA, long sourceB); 24349 24350 /** 24351 * Particle Analysis functions 24352 */ 24353 24354 public static int imaqCountParticles(Image image, int connectivity8) { 24355 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24356 long rv_addr = getByteBufferAddress(rv_buf); 24357 _imaqCountParticles(image.getAddress(), connectivity8, rv_addr + 0); 24358 int numParticles; 24359 numParticles = rv_buf.getInt(0); 24360 return numParticles; 24361 } 24362 24363 private static native void _imaqCountParticles(long image, int connectivity8, long numParticles); 24364 24365 public static double imaqMeasureParticle(Image image, int particleNumber, int calibrated, 24366 MeasurementType measurement) { 24367 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24368 long rv_addr = getByteBufferAddress(rv_buf); 24369 _imaqMeasureParticle(image.getAddress(), particleNumber, calibrated, measurement.getValue(), 24370 rv_addr + 0); 24371 double value; 24372 value = rv_buf.getDouble(0); 24373 return value; 24374 } 24375 24376 private static native void _imaqMeasureParticle(long image, int particleNumber, int calibrated, 24377 int measurement, long value); 24378 24379 public static MeasureParticlesReport imaqMeasureParticles(Image image, 24380 MeasureParticlesCalibrationMode calibrationMode, MeasurementType[] measurements) { 24381 int numMeasurements = measurements.length; 24382 ByteBuffer measurements_buf = null; 24383 measurements_buf = 24384 ByteBuffer.allocateDirect(measurements.length * 4).order(ByteOrder.nativeOrder()); 24385 for (int i = 0, off = 0; i < measurements.length; i++, off += 4) { 24386 if (measurements != null) 24387 measurements_buf.putInt(off, measurements[i].getValue()); 24388 } 24389 long jn_rv = 24390 _imaqMeasureParticles(image.getAddress(), calibrationMode.getValue(), 24391 getByteBufferAddress(measurements_buf), numMeasurements); 24392 24393 return new MeasureParticlesReport(jn_rv, true); 24394 } 24395 24396 private static native long _imaqMeasureParticles(long image, int calibrationMode, 24397 long measurements, int numMeasurements); 24398 24399 public static int imaqParticleFilter4(Image dest, Image source, 24400 ParticleFilterCriteria2[] criteria, ParticleFilterOptions2 options, ROI roi) { 24401 int criteriaCount = criteria.length; 24402 ByteBuffer criteria_buf = null; 24403 criteria_buf = ByteBuffer.allocateDirect(criteria.length * 20).order(ByteOrder.nativeOrder()); 24404 for (int i = 0, off = 0; i < criteria.length; i++, off += 20) { 24405 criteria[i].setBuffer(criteria_buf, off); 24406 criteria[i].write(); 24407 } 24408 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24409 long rv_addr = getByteBufferAddress(rv_buf); 24410 _imaqParticleFilter4(dest.getAddress(), source.getAddress(), 24411 getByteBufferAddress(criteria_buf), criteriaCount, options.getAddress(), roi == null ? 0 24412 : roi.getAddress(), rv_addr + 0); 24413 int numParticles; 24414 numParticles = rv_buf.getInt(0); 24415 return numParticles; 24416 } 24417 24418 private static native void _imaqParticleFilter4(long dest, long source, long criteria, 24419 int criteriaCount, long options, long roi, long numParticles); 24420 24421 /** 24422 * Morphology functions 24423 */ 24424 24425 public static void imaqConvexHull(Image dest, Image source, int connectivity8) { 24426 24427 _imaqConvexHull(dest.getAddress(), source.getAddress(), connectivity8); 24428 24429 } 24430 24431 private static native void _imaqConvexHull(long dest, long source, int connectivity8); 24432 24433 public static void imaqDanielssonDistance(Image dest, Image source) { 24434 24435 _imaqDanielssonDistance(dest.getAddress(), source.getAddress()); 24436 24437 } 24438 24439 private static native void _imaqDanielssonDistance(long dest, long source); 24440 24441 public static void imaqFillHoles(Image dest, Image source, int connectivity8) { 24442 24443 _imaqFillHoles(dest.getAddress(), source.getAddress(), connectivity8); 24444 24445 } 24446 24447 private static native void _imaqFillHoles(long dest, long source, int connectivity8); 24448 24449 public static class FindCirclesResult { 24450 public CircleReport[] array; 24451 private long array_addr; 24452 24453 private FindCirclesResult(ByteBuffer rv_buf, long jn_rv) { 24454 array_addr = jn_rv; 24455 int array_numCircles; 24456 array_numCircles = rv_buf.getInt(0); 24457 array = new CircleReport[array_numCircles]; 24458 if (array_numCircles > 0 && array_addr != 0) { 24459 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCircles * 16); 24460 for (int i = 0, off = 0; i < array_numCircles; i++, off += 16) { 24461 array[i] = new CircleReport(bb, off); 24462 array[i].read(); 24463 } 24464 } 24465 } 24466 24467 @Override 24468 protected void finalize() throws Throwable { 24469 imaqDispose(array_addr); 24470 super.finalize(); 24471 } 24472 } 24473 24474 public static FindCirclesResult imaqFindCircles(Image dest, Image source, float minRadius, 24475 float maxRadius) { 24476 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24477 long rv_addr = getByteBufferAddress(rv_buf); 24478 long jn_rv = 24479 _imaqFindCircles(dest.getAddress(), source.getAddress(), minRadius, maxRadius, rv_addr + 0); 24480 FindCirclesResult rv = new FindCirclesResult(rv_buf, jn_rv); 24481 return rv; 24482 } 24483 24484 private static native long _imaqFindCircles(long dest, long source, float minRadius, 24485 float maxRadius, long numCircles); 24486 24487 public static int imaqLabel2(Image dest, Image source, int connectivity8) { 24488 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24489 long rv_addr = getByteBufferAddress(rv_buf); 24490 _imaqLabel2(dest.getAddress(), source.getAddress(), connectivity8, rv_addr + 0); 24491 int particleCount; 24492 particleCount = rv_buf.getInt(0); 24493 return particleCount; 24494 } 24495 24496 private static native void _imaqLabel2(long dest, long source, int connectivity8, 24497 long particleCount); 24498 24499 public static void imaqMorphology(Image dest, Image source, MorphologyMethod method, 24500 StructuringElement structuringElement) { 24501 24502 _imaqMorphology(dest.getAddress(), source.getAddress(), method.getValue(), 24503 structuringElement == null ? 0 : structuringElement.getAddress()); 24504 24505 } 24506 24507 private static native void _imaqMorphology(long dest, long source, int method, 24508 long structuringElement); 24509 24510 public static void imaqRejectBorder(Image dest, Image source, int connectivity8) { 24511 24512 _imaqRejectBorder(dest.getAddress(), source.getAddress(), connectivity8); 24513 24514 } 24515 24516 private static native void _imaqRejectBorder(long dest, long source, int connectivity8); 24517 24518 public static void imaqSegmentation(Image dest, Image source) { 24519 24520 _imaqSegmentation(dest.getAddress(), source.getAddress()); 24521 24522 } 24523 24524 private static native void _imaqSegmentation(long dest, long source); 24525 24526 public static void imaqSeparation(Image dest, Image source, int erosions, 24527 StructuringElement structuringElement) { 24528 24529 _imaqSeparation(dest.getAddress(), source.getAddress(), erosions, 24530 structuringElement == null ? 0 : structuringElement.getAddress()); 24531 24532 } 24533 24534 private static native void _imaqSeparation(long dest, long source, int erosions, 24535 long structuringElement); 24536 24537 public static void imaqSimpleDistance(Image dest, Image source, 24538 StructuringElement structuringElement) { 24539 24540 _imaqSimpleDistance(dest.getAddress(), source.getAddress(), structuringElement == null ? 0 24541 : structuringElement.getAddress()); 24542 24543 } 24544 24545 private static native void _imaqSimpleDistance(long dest, long source, long structuringElement); 24546 24547 public static void imaqSizeFilter(Image dest, Image source, int connectivity8, int erosions, 24548 SizeType keepSize, StructuringElement structuringElement) { 24549 24550 _imaqSizeFilter(dest.getAddress(), source.getAddress(), connectivity8, erosions, 24551 keepSize.getValue(), structuringElement == null ? 0 : structuringElement.getAddress()); 24552 24553 } 24554 24555 private static native void _imaqSizeFilter(long dest, long source, int connectivity8, 24556 int erosions, int keepSize, long structuringElement); 24557 24558 public static void imaqSkeleton(Image dest, Image source, SkeletonMethod method) { 24559 24560 _imaqSkeleton(dest.getAddress(), source.getAddress(), method.getValue()); 24561 24562 } 24563 24564 private static native void _imaqSkeleton(long dest, long source, int method); 24565 24566 /** 24567 * Acquisition functions 24568 */ 24569 24570 /** 24571 * Arithmetic functions 24572 */ 24573 24574 public static void imaqAbsoluteDifference(Image dest, Image sourceA, Image sourceB) { 24575 24576 _imaqAbsoluteDifference(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24577 24578 } 24579 24580 private static native void _imaqAbsoluteDifference(long dest, long sourceA, long sourceB); 24581 24582 public static void imaqAdd(Image dest, Image sourceA, Image sourceB) { 24583 24584 _imaqAdd(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24585 24586 } 24587 24588 private static native void _imaqAdd(long dest, long sourceA, long sourceB); 24589 24590 public static void imaqAverage(Image dest, Image sourceA, Image sourceB) { 24591 24592 _imaqAverage(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24593 24594 } 24595 24596 private static native void _imaqAverage(long dest, long sourceA, long sourceB); 24597 24598 public static void imaqDivide2(Image dest, Image sourceA, Image sourceB, RoundingMode roundingMode) { 24599 24600 _imaqDivide2(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress(), 24601 roundingMode.getValue()); 24602 24603 } 24604 24605 private static native void _imaqDivide2(long dest, long sourceA, long sourceB, int roundingMode); 24606 24607 public static void imaqMax(Image dest, Image sourceA, Image sourceB) { 24608 24609 _imaqMax(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24610 24611 } 24612 24613 private static native void _imaqMax(long dest, long sourceA, long sourceB); 24614 24615 public static void imaqMin(Image dest, Image sourceA, Image sourceB) { 24616 24617 _imaqMin(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24618 24619 } 24620 24621 private static native void _imaqMin(long dest, long sourceA, long sourceB); 24622 24623 public static void imaqModulo(Image dest, Image sourceA, Image sourceB) { 24624 24625 _imaqModulo(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24626 24627 } 24628 24629 private static native void _imaqModulo(long dest, long sourceA, long sourceB); 24630 24631 public static void imaqMulDiv(Image dest, Image sourceA, Image sourceB, float value) { 24632 24633 _imaqMulDiv(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress(), value); 24634 24635 } 24636 24637 private static native void _imaqMulDiv(long dest, long sourceA, long sourceB, float value); 24638 24639 public static void imaqMultiply(Image dest, Image sourceA, Image sourceB) { 24640 24641 _imaqMultiply(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24642 24643 } 24644 24645 private static native void _imaqMultiply(long dest, long sourceA, long sourceB); 24646 24647 public static void imaqSubtract(Image dest, Image sourceA, Image sourceB) { 24648 24649 _imaqSubtract(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 24650 24651 } 24652 24653 private static native void _imaqSubtract(long dest, long sourceA, long sourceB); 24654 24655 /** 24656 * Caliper functions 24657 */ 24658 24659 public static class CaliperToolResult { 24660 public CaliperReport[] array; 24661 private long array_addr; 24662 24663 private CaliperToolResult(ByteBuffer rv_buf, long jn_rv) { 24664 array_addr = jn_rv; 24665 int array_numEdgePairs; 24666 array_numEdgePairs = rv_buf.getInt(0); 24667 array = new CaliperReport[array_numEdgePairs]; 24668 if (array_numEdgePairs > 0 && array_addr != 0) { 24669 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numEdgePairs * 32); 24670 for (int i = 0, off = 0; i < array_numEdgePairs; i++, off += 32) { 24671 array[i] = new CaliperReport(bb, off); 24672 array[i].read(); 24673 } 24674 } 24675 } 24676 24677 @Override 24678 protected void finalize() throws Throwable { 24679 imaqDispose(array_addr); 24680 super.finalize(); 24681 } 24682 } 24683 24684 public static CaliperToolResult imaqCaliperTool(Image image, Point[] points, 24685 EdgeOptions edgeOptions, CaliperOptions caliperOptions) { 24686 int numPoints = points.length; 24687 ByteBuffer points_buf = null; 24688 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 24689 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 24690 points[i].setBuffer(points_buf, off); 24691 points[i].write(); 24692 } 24693 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24694 long rv_addr = getByteBufferAddress(rv_buf); 24695 long jn_rv = 24696 _imaqCaliperTool(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 24697 edgeOptions.getAddress(), caliperOptions.getAddress(), rv_addr + 0); 24698 CaliperToolResult rv = new CaliperToolResult(rv_buf, jn_rv); 24699 return rv; 24700 } 24701 24702 private static native long _imaqCaliperTool(long image, long points, int numPoints, 24703 long edgeOptions, long caliperOptions, long numEdgePairs); 24704 24705 public static class ConcentricRake2Result { 24706 public EdgeOptions2 edgeOptions; 24707 public ConcentricRakeReport2 val; 24708 24709 private ConcentricRake2Result(ByteBuffer rv_buf) { 24710 edgeOptions = new EdgeOptions2(rv_buf, 0); 24711 edgeOptions.read(); 24712 } 24713 } 24714 24715 public static ConcentricRake2Result imaqConcentricRake2(Image image, ROI roi, 24716 ConcentricRakeDirection direction, EdgeProcess process, int stepSize) { 24717 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24718 long rv_addr = getByteBufferAddress(rv_buf); 24719 long jn_rv = 24720 _imaqConcentricRake2(image.getAddress(), roi.getAddress(), direction.getValue(), 24721 process.getValue(), stepSize, rv_addr + 0); 24722 ConcentricRake2Result rv = new ConcentricRake2Result(rv_buf); 24723 rv.val = new ConcentricRakeReport2(jn_rv, true); 24724 return rv; 24725 } 24726 24727 private static native long _imaqConcentricRake2(long image, long roi, int direction, int process, 24728 int stepSize, long edgeOptions); 24729 24730 public static class DetectExtremesResult { 24731 public ExtremeReport[] array; 24732 private long array_addr; 24733 24734 private DetectExtremesResult(ByteBuffer rv_buf, long jn_rv) { 24735 array_addr = jn_rv; 24736 int array_numExtremes; 24737 array_numExtremes = rv_buf.getInt(0); 24738 array = new ExtremeReport[array_numExtremes]; 24739 if (array_numExtremes > 0 && array_addr != 0) { 24740 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numExtremes * 24); 24741 for (int i = 0, off = 0; i < array_numExtremes; i++, off += 24) { 24742 array[i] = new ExtremeReport(bb, off); 24743 array[i].read(); 24744 } 24745 } 24746 } 24747 24748 @Override 24749 protected void finalize() throws Throwable { 24750 imaqDispose(array_addr); 24751 super.finalize(); 24752 } 24753 } 24754 24755 public static DetectExtremesResult imaqDetectExtremes(double[] pixels, DetectionMode mode, 24756 DetectExtremesOptions options) { 24757 int numPixels = pixels.length; 24758 ByteBuffer pixels_buf = null; 24759 pixels_buf = ByteBuffer.allocateDirect(pixels.length * 8).order(ByteOrder.nativeOrder()); 24760 pixels_buf.asDoubleBuffer().put(pixels).rewind(); 24761 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24762 long rv_addr = getByteBufferAddress(rv_buf); 24763 long jn_rv = 24764 _imaqDetectExtremes(getByteBufferAddress(pixels_buf), numPixels, mode.getValue(), 24765 options.getAddress(), rv_addr + 0); 24766 DetectExtremesResult rv = new DetectExtremesResult(rv_buf, jn_rv); 24767 return rv; 24768 } 24769 24770 private static native long _imaqDetectExtremes(long pixels, int numPixels, int mode, 24771 long options, long numExtremes); 24772 24773 public static double imaqDetectRotation(Image referenceImage, Image testImage, 24774 PointFloat referenceCenter, PointFloat testCenter, int radius, float precision) { 24775 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24776 long rv_addr = getByteBufferAddress(rv_buf); 24777 _imaqDetectRotation(referenceImage.getAddress(), testImage.getAddress(), 24778 referenceCenter.getAddress(), testCenter.getAddress(), radius, precision, rv_addr + 0); 24779 double angle; 24780 angle = rv_buf.getDouble(0); 24781 return angle; 24782 } 24783 24784 private static native void _imaqDetectRotation(long referenceImage, long testImage, 24785 long referenceCenter, long testCenter, int radius, float precision, long angle); 24786 24787 public static class EdgeTool4Result { 24788 public EdgeOptions2 edgeOptions; 24789 public EdgeReport2 val; 24790 24791 private EdgeTool4Result(ByteBuffer rv_buf) { 24792 edgeOptions = new EdgeOptions2(rv_buf, 0); 24793 edgeOptions.read(); 24794 } 24795 } 24796 24797 public static EdgeTool4Result imaqEdgeTool4(Image image, ROI roi, EdgeProcess processType, 24798 int reverseDirection) { 24799 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24800 long rv_addr = getByteBufferAddress(rv_buf); 24801 long jn_rv = 24802 _imaqEdgeTool4(image.getAddress(), roi.getAddress(), processType.getValue(), rv_addr + 0, 24803 reverseDirection); 24804 EdgeTool4Result rv = new EdgeTool4Result(rv_buf); 24805 rv.val = new EdgeReport2(jn_rv, true); 24806 return rv; 24807 } 24808 24809 private static native long _imaqEdgeTool4(long image, long roi, int processType, 24810 long edgeOptions, int reverseDirection); 24811 24812 public static FindEdgeReport imaqFindEdge2(Image image, ROI roi, CoordinateSystem baseSystem, 24813 CoordinateSystem newSystem, FindEdgeOptions2 findEdgeOptions, 24814 StraightEdgeOptions straightEdgeOptions) { 24815 24816 long jn_rv = 24817 _imaqFindEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), 24818 newSystem.getAddress(), findEdgeOptions.getAddress(), straightEdgeOptions.getAddress()); 24819 24820 return new FindEdgeReport(jn_rv, true); 24821 } 24822 24823 private static native long _imaqFindEdge2(long image, long roi, long baseSystem, long newSystem, 24824 long findEdgeOptions, long straightEdgeOptions); 24825 24826 public static class FindTransformRect2Result { 24827 public CoordinateSystem baseSystem; 24828 public CoordinateSystem newSystem; 24829 public AxisReport axisReport; 24830 24831 private FindTransformRect2Result(ByteBuffer rv_buf) { 24832 baseSystem = new CoordinateSystem(rv_buf, 0); 24833 baseSystem.read(); 24834 newSystem = new CoordinateSystem(rv_buf, 8); 24835 newSystem.read(); 24836 axisReport = new AxisReport(rv_buf, 16); 24837 axisReport.read(); 24838 } 24839 } 24840 24841 public static FindTransformRect2Result imaqFindTransformRect2(Image image, ROI roi, 24842 FindTransformMode mode, FindTransformRectOptions2 findTransformOptions, 24843 StraightEdgeOptions straightEdgeOptions) { 24844 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8 + 8).order(ByteOrder.nativeOrder()); 24845 long rv_addr = getByteBufferAddress(rv_buf); 24846 _imaqFindTransformRect2(image.getAddress(), roi.getAddress(), mode.getValue(), rv_addr + 0, 24847 rv_addr + 8, findTransformOptions.getAddress(), straightEdgeOptions.getAddress(), 24848 rv_addr + 16); 24849 FindTransformRect2Result rv = new FindTransformRect2Result(rv_buf); 24850 return rv; 24851 } 24852 24853 private static native void _imaqFindTransformRect2(long image, long roi, int mode, 24854 long baseSystem, long newSystem, long findTransformOptions, long straightEdgeOptions, 24855 long axisReport); 24856 24857 public static class FindTransformRects2Result { 24858 public CoordinateSystem baseSystem; 24859 public CoordinateSystem newSystem; 24860 public AxisReport axisReport; 24861 24862 private FindTransformRects2Result(ByteBuffer rv_buf) { 24863 baseSystem = new CoordinateSystem(rv_buf, 0); 24864 baseSystem.read(); 24865 newSystem = new CoordinateSystem(rv_buf, 8); 24866 newSystem.read(); 24867 axisReport = new AxisReport(rv_buf, 16); 24868 axisReport.read(); 24869 } 24870 } 24871 24872 public static FindTransformRects2Result imaqFindTransformRects2(Image image, ROI primaryROI, 24873 ROI secondaryROI, FindTransformMode mode, FindTransformRectsOptions2 findTransformOptions, 24874 StraightEdgeOptions primaryStraightEdgeOptions, 24875 StraightEdgeOptions secondaryStraightEdgeOptions) { 24876 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8 + 8).order(ByteOrder.nativeOrder()); 24877 long rv_addr = getByteBufferAddress(rv_buf); 24878 _imaqFindTransformRects2(image.getAddress(), primaryROI.getAddress(), 24879 secondaryROI.getAddress(), mode.getValue(), rv_addr + 0, rv_addr + 8, 24880 findTransformOptions.getAddress(), primaryStraightEdgeOptions.getAddress(), 24881 secondaryStraightEdgeOptions.getAddress(), rv_addr + 16); 24882 FindTransformRects2Result rv = new FindTransformRects2Result(rv_buf); 24883 return rv; 24884 } 24885 24886 private static native void _imaqFindTransformRects2(long image, long primaryROI, 24887 long secondaryROI, int mode, long baseSystem, long newSystem, long findTransformOptions, 24888 long primaryStraightEdgeOptions, long secondaryStraightEdgeOptions, long axisReport); 24889 24890 public static float imaqLineGaugeTool2(Image image, Point start, Point end, 24891 LineGaugeMethod method, EdgeOptions edgeOptions, CoordinateTransform2 transform) { 24892 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24893 long rv_addr = getByteBufferAddress(rv_buf); 24894 _imaqLineGaugeTool2(image.getAddress(), start.getAddress(), end.getAddress(), 24895 method.getValue(), edgeOptions.getAddress(), transform.getAddress(), rv_addr + 0); 24896 float distance; 24897 distance = rv_buf.getFloat(0); 24898 return distance; 24899 } 24900 24901 private static native void _imaqLineGaugeTool2(long image, long start, long end, int method, 24902 long edgeOptions, long transform, long distance); 24903 24904 public static class Rake2Result { 24905 public EdgeOptions2 edgeOptions; 24906 public RakeReport2 val; 24907 24908 private Rake2Result(ByteBuffer rv_buf) { 24909 edgeOptions = new EdgeOptions2(rv_buf, 0); 24910 edgeOptions.read(); 24911 } 24912 } 24913 24914 public static Rake2Result imaqRake2(Image image, ROI roi, RakeDirection direction, 24915 EdgeProcess process, int stepSize) { 24916 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24917 long rv_addr = getByteBufferAddress(rv_buf); 24918 long jn_rv = 24919 _imaqRake2(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), 24920 stepSize, rv_addr + 0); 24921 Rake2Result rv = new Rake2Result(rv_buf); 24922 rv.val = new RakeReport2(jn_rv, true); 24923 return rv; 24924 } 24925 24926 private static native long _imaqRake2(long image, long roi, int direction, int process, 24927 int stepSize, long edgeOptions); 24928 24929 public static class SimpleEdgeResult { 24930 public PointFloat[] array; 24931 private long array_addr; 24932 24933 private SimpleEdgeResult(ByteBuffer rv_buf, long jn_rv) { 24934 array_addr = jn_rv; 24935 int array_numEdges; 24936 array_numEdges = rv_buf.getInt(0); 24937 array = new PointFloat[array_numEdges]; 24938 if (array_numEdges > 0 && array_addr != 0) { 24939 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numEdges * 8); 24940 for (int i = 0, off = 0; i < array_numEdges; i++, off += 8) { 24941 array[i] = new PointFloat(bb, off); 24942 array[i].read(); 24943 } 24944 } 24945 } 24946 24947 @Override 24948 protected void finalize() throws Throwable { 24949 imaqDispose(array_addr); 24950 super.finalize(); 24951 } 24952 } 24953 24954 public static SimpleEdgeResult imaqSimpleEdge(Image image, Point[] points, 24955 SimpleEdgeOptions options) { 24956 int numPoints = points.length; 24957 ByteBuffer points_buf = null; 24958 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 24959 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 24960 points[i].setBuffer(points_buf, off); 24961 points[i].write(); 24962 } 24963 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24964 long rv_addr = getByteBufferAddress(rv_buf); 24965 long jn_rv = 24966 _imaqSimpleEdge(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 24967 options.getAddress(), rv_addr + 0); 24968 SimpleEdgeResult rv = new SimpleEdgeResult(rv_buf, jn_rv); 24969 return rv; 24970 } 24971 24972 private static native long _imaqSimpleEdge(long image, long points, int numPoints, long options, 24973 long numEdges); 24974 24975 public static class Spoke2Result { 24976 public EdgeOptions2 edgeOptions; 24977 public SpokeReport2 val; 24978 24979 private Spoke2Result(ByteBuffer rv_buf) { 24980 edgeOptions = new EdgeOptions2(rv_buf, 0); 24981 edgeOptions.read(); 24982 } 24983 } 24984 24985 public static Spoke2Result imaqSpoke2(Image image, ROI roi, SpokeDirection direction, 24986 EdgeProcess process, int stepSize) { 24987 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24988 long rv_addr = getByteBufferAddress(rv_buf); 24989 long jn_rv = 24990 _imaqSpoke2(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), 24991 stepSize, rv_addr + 0); 24992 Spoke2Result rv = new Spoke2Result(rv_buf); 24993 rv.val = new SpokeReport2(jn_rv, true); 24994 return rv; 24995 } 24996 24997 private static native long _imaqSpoke2(long image, long roi, int direction, int process, 24998 int stepSize, long edgeOptions); 24999 25000 public static StraightEdgeReport2 imaqStraightEdge(Image image, ROI roi, 25001 SearchDirection searchDirection, EdgeOptions2 edgeOptions, 25002 StraightEdgeOptions straightEdgeOptions) { 25003 25004 long jn_rv = 25005 _imaqStraightEdge(image.getAddress(), roi.getAddress(), searchDirection.getValue(), 25006 edgeOptions.getAddress(), straightEdgeOptions.getAddress()); 25007 25008 return new StraightEdgeReport2(jn_rv, true); 25009 } 25010 25011 private static native long _imaqStraightEdge(long image, long roi, int searchDirection, 25012 long edgeOptions, long straightEdgeOptions); 25013 25014 public static StraightEdgeReport2 imaqStraightEdge2(Image image, ROI roi, 25015 SearchDirection searchDirection, EdgeOptions2 edgeOptions, 25016 StraightEdgeOptions straightEdgeOptions, int optimizedMode) { 25017 25018 long jn_rv = 25019 _imaqStraightEdge2(image.getAddress(), roi.getAddress(), searchDirection.getValue(), 25020 edgeOptions.getAddress(), straightEdgeOptions.getAddress(), optimizedMode); 25021 25022 return new StraightEdgeReport2(jn_rv, true); 25023 } 25024 25025 private static native long _imaqStraightEdge2(long image, long roi, int searchDirection, 25026 long edgeOptions, long straightEdgeOptions, int optimizedMode); 25027 25028 /** 25029 * Spatial Filters functions 25030 */ 25031 25032 public static void imaqCannyEdgeFilter(Image dest, Image source, CannyOptions options) { 25033 25034 _imaqCannyEdgeFilter(dest.getAddress(), source.getAddress(), 25035 options == null ? 0 : options.getAddress()); 25036 25037 } 25038 25039 private static native void _imaqCannyEdgeFilter(long dest, long source, long options); 25040 25041 public static void imaqCorrelate(Image dest, Image source, Image templateImage, Rect rect) { 25042 25043 _imaqCorrelate(dest.getAddress(), source.getAddress(), templateImage.getAddress(), 25044 rect.getAddress()); 25045 25046 } 25047 25048 private static native void _imaqCorrelate(long dest, long source, long templateImage, long rect); 25049 25050 public static void imaqEdgeFilter(Image dest, Image source, OutlineMethod method, Image mask) { 25051 25052 _imaqEdgeFilter(dest.getAddress(), source.getAddress(), method.getValue(), mask == null ? 0 25053 : mask.getAddress()); 25054 25055 } 25056 25057 private static native void _imaqEdgeFilter(long dest, long source, int method, long mask); 25058 25059 public static void imaqLowPass(Image dest, Image source, int width, int height, float tolerance, 25060 Image mask) { 25061 25062 _imaqLowPass(dest.getAddress(), source.getAddress(), width, height, tolerance, mask == null ? 0 25063 : mask.getAddress()); 25064 25065 } 25066 25067 private static native void _imaqLowPass(long dest, long source, int width, int height, 25068 float tolerance, long mask); 25069 25070 public static void imaqMedianFilter(Image dest, Image source, int width, int height, Image mask) { 25071 25072 _imaqMedianFilter(dest.getAddress(), source.getAddress(), width, height, mask == null ? 0 25073 : mask.getAddress()); 25074 25075 } 25076 25077 private static native void _imaqMedianFilter(long dest, long source, int width, int height, 25078 long mask); 25079 25080 public static void imaqNthOrderFilter(Image dest, Image source, int width, int height, int n, 25081 Image mask) { 25082 25083 _imaqNthOrderFilter(dest.getAddress(), source.getAddress(), width, height, n, mask == null ? 0 25084 : mask.getAddress()); 25085 25086 } 25087 25088 private static native void _imaqNthOrderFilter(long dest, long source, int width, int height, 25089 int n, long mask); 25090 25091 /** 25092 * Drawing functions 25093 */ 25094 25095 public static void imaqDrawLineOnImage(Image dest, Image source, DrawMode mode, Point start, 25096 Point end, float newPixelValue) { 25097 25098 _imaqDrawLineOnImage(dest.getAddress(), source.getAddress(), mode.getValue(), 25099 start.getAddress(), end.getAddress(), newPixelValue); 25100 25101 } 25102 25103 private static native void _imaqDrawLineOnImage(long dest, long source, int mode, long start, 25104 long end, float newPixelValue); 25105 25106 public static void imaqDrawShapeOnImage(Image dest, Image source, Rect rect, DrawMode mode, 25107 ShapeMode shape, float newPixelValue) { 25108 25109 _imaqDrawShapeOnImage(dest.getAddress(), source.getAddress(), rect.getAddress(), 25110 mode.getValue(), shape.getValue(), newPixelValue); 25111 25112 } 25113 25114 private static native void _imaqDrawShapeOnImage(long dest, long source, long rect, int mode, 25115 int shape, float newPixelValue); 25116 25117 /** 25118 * Interlacing functions 25119 */ 25120 25121 public static void imaqInterlaceCombine(Image frame, Image odd, Image even) { 25122 25123 _imaqInterlaceCombine(frame.getAddress(), odd.getAddress(), even.getAddress()); 25124 25125 } 25126 25127 private static native void _imaqInterlaceCombine(long frame, long odd, long even); 25128 25129 public static void imaqInterlaceSeparate(Image frame, Image odd, Image even) { 25130 25131 _imaqInterlaceSeparate(frame.getAddress(), odd == null ? 0 : odd.getAddress(), even == null ? 0 25132 : even.getAddress()); 25133 25134 } 25135 25136 private static native void _imaqInterlaceSeparate(long frame, long odd, long even); 25137 25138 /** 25139 * Image Information functions 25140 */ 25141 25142 public static class EnumerateCustomKeysResult { 25143 public String[] array; 25144 private long array_addr; 25145 25146 private EnumerateCustomKeysResult(ByteBuffer rv_buf, long jn_rv) { 25147 array_addr = jn_rv; 25148 int array_size; 25149 array_size = rv_buf.getInt(0); 25150 array = new String[array_size]; 25151 if (array_size > 0 && array_addr != 0) { 25152 ByteBuffer bb = newDirectByteBuffer(array_addr, array_size * 4); 25153 for (int i = 0, off = 0; i < array_size; i++, off += 4) { 25154 long addr = getPointer(bb, off); 25155 if (addr == 0) 25156 array[i] = null; 25157 else { 25158 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 25159 while (bb2.get() != 0) { 25160 } 25161 byte[] bytes = new byte[bb2.position() - 1]; 25162 bb2.rewind(); 25163 getBytes(bb2, bytes, 0, bytes.length); 25164 try { 25165 array[i] = new String(bytes, "UTF-8"); 25166 } catch (UnsupportedEncodingException e) { 25167 array[i] = ""; 25168 } 25169 } 25170 } 25171 } 25172 } 25173 25174 @Override 25175 protected void finalize() throws Throwable { 25176 imaqDispose(array_addr); 25177 super.finalize(); 25178 } 25179 } 25180 25181 public static EnumerateCustomKeysResult imaqEnumerateCustomKeys(Image image) { 25182 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25183 long rv_addr = getByteBufferAddress(rv_buf); 25184 long jn_rv = _imaqEnumerateCustomKeys(image.getAddress(), rv_addr + 0); 25185 EnumerateCustomKeysResult rv = new EnumerateCustomKeysResult(rv_buf, jn_rv); 25186 return rv; 25187 } 25188 25189 private static native long _imaqEnumerateCustomKeys(long image, long size); 25190 25191 public static int imaqGetBitDepth(Image image) { 25192 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25193 long rv_addr = getByteBufferAddress(rv_buf); 25194 _imaqGetBitDepth(image.getAddress(), rv_addr + 0); 25195 int bitDepth; 25196 bitDepth = rv_buf.getInt(0); 25197 return bitDepth; 25198 } 25199 25200 private static native void _imaqGetBitDepth(long image, long bitDepth); 25201 25202 public static int imaqGetBytesPerPixel(Image image) { 25203 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25204 long rv_addr = getByteBufferAddress(rv_buf); 25205 _imaqGetBytesPerPixel(image.getAddress(), rv_addr + 0); 25206 int byteCount; 25207 byteCount = rv_buf.getInt(0); 25208 return byteCount; 25209 } 25210 25211 private static native void _imaqGetBytesPerPixel(long image, long byteCount); 25212 25213 public static ImageInfo imaqGetImageInfo(Image image) { 25214 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25215 long rv_addr = getByteBufferAddress(rv_buf); 25216 _imaqGetImageInfo(image.getAddress(), rv_addr + 0); 25217 ImageInfo info; 25218 info = new ImageInfo(rv_buf, 0); 25219 info.read(); 25220 return info; 25221 } 25222 25223 private static native void _imaqGetImageInfo(long image, long info); 25224 25225 public static class GetImageSizeResult { 25226 public int width; 25227 public int height; 25228 25229 private GetImageSizeResult(ByteBuffer rv_buf) { 25230 width = rv_buf.getInt(0); 25231 height = rv_buf.getInt(8); 25232 } 25233 } 25234 25235 public static GetImageSizeResult imaqGetImageSize(Image image) { 25236 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 25237 long rv_addr = getByteBufferAddress(rv_buf); 25238 _imaqGetImageSize(image.getAddress(), rv_addr + 0, rv_addr + 8); 25239 GetImageSizeResult rv = new GetImageSizeResult(rv_buf); 25240 return rv; 25241 } 25242 25243 private static native void _imaqGetImageSize(long image, long width, long height); 25244 25245 public static ImageType imaqGetImageType(Image image) { 25246 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25247 long rv_addr = getByteBufferAddress(rv_buf); 25248 _imaqGetImageType(image.getAddress(), rv_addr + 0); 25249 ImageType type; 25250 type = ImageType.fromValue(rv_buf.getInt(0)); 25251 return type; 25252 } 25253 25254 private static native void _imaqGetImageType(long image, long type); 25255 25256 public static Point imaqGetMaskOffset(Image image) { 25257 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25258 long rv_addr = getByteBufferAddress(rv_buf); 25259 _imaqGetMaskOffset(image.getAddress(), rv_addr + 0); 25260 Point offset; 25261 offset = new Point(rv_buf, 0); 25262 offset.read(); 25263 return offset; 25264 } 25265 25266 private static native void _imaqGetMaskOffset(long image, long offset); 25267 25268 public static int imaqGetVisionInfoTypes(Image image) { 25269 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25270 long rv_addr = getByteBufferAddress(rv_buf); 25271 _imaqGetVisionInfoTypes(image.getAddress(), rv_addr + 0); 25272 int present; 25273 present = rv_buf.getInt(0); 25274 return present; 25275 } 25276 25277 private static native void _imaqGetVisionInfoTypes(long image, long present); 25278 25279 public static int imaqIsImageEmpty(Image image) { 25280 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25281 long rv_addr = getByteBufferAddress(rv_buf); 25282 _imaqIsImageEmpty(image.getAddress(), rv_addr + 0); 25283 int empty; 25284 empty = rv_buf.getInt(0); 25285 return empty; 25286 } 25287 25288 private static native void _imaqIsImageEmpty(long image, long empty); 25289 25290 public static RawData imaqReadCustomData(Image image, String key) { 25291 ByteBuffer key_buf = null; 25292 if (key != null) { 25293 byte[] key_bytes; 25294 try { 25295 key_bytes = key.getBytes("UTF-8"); 25296 } catch (UnsupportedEncodingException e) { 25297 key_bytes = new byte[0]; 25298 } 25299 key_buf = ByteBuffer.allocateDirect(key_bytes.length + 1); 25300 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte) 0); 25301 } 25302 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25303 long rv_addr = getByteBufferAddress(rv_buf); 25304 long jn_rv = 25305 _imaqReadCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf), 25306 rv_addr + 0); 25307 int size; 25308 RawData val; 25309 size = rv_buf.getInt(0); 25310 val = new RawData(jn_rv, false, size); 25311 return val; 25312 } 25313 25314 private static native long _imaqReadCustomData(long image, long key, long size); 25315 25316 public static void imaqRemoveCustomData(Image image, String key) { 25317 ByteBuffer key_buf = null; 25318 if (key != null) { 25319 byte[] key_bytes; 25320 try { 25321 key_bytes = key.getBytes("UTF-8"); 25322 } catch (UnsupportedEncodingException e) { 25323 key_bytes = new byte[0]; 25324 } 25325 key_buf = ByteBuffer.allocateDirect(key_bytes.length + 1); 25326 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte) 0); 25327 } 25328 _imaqRemoveCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf)); 25329 25330 } 25331 25332 private static native void _imaqRemoveCustomData(long image, long key); 25333 25334 public static void imaqRemoveVisionInfo2(Image image, int info) { 25335 25336 _imaqRemoveVisionInfo2(image.getAddress(), info); 25337 25338 } 25339 25340 private static native void _imaqRemoveVisionInfo2(long image, int info); 25341 25342 public static void imaqSetBitDepth(Image image, int bitDepth) { 25343 25344 _imaqSetBitDepth(image.getAddress(), bitDepth); 25345 25346 } 25347 25348 private static native void _imaqSetBitDepth(long image, int bitDepth); 25349 25350 public static void imaqSetImageSize(Image image, int width, int height) { 25351 25352 _imaqSetImageSize(image.getAddress(), width, height); 25353 25354 } 25355 25356 private static native void _imaqSetImageSize(long image, int width, int height); 25357 25358 public static void imaqSetMaskOffset(Image image, Point offset) { 25359 25360 _imaqSetMaskOffset(image.getAddress(), offset.getAddress()); 25361 25362 } 25363 25364 private static native void _imaqSetMaskOffset(long image, long offset); 25365 25366 public static void imaqWriteCustomData(Image image, String key, RawData data, int size) { 25367 ByteBuffer key_buf = null; 25368 if (key != null) { 25369 byte[] key_bytes; 25370 try { 25371 key_bytes = key.getBytes("UTF-8"); 25372 } catch (UnsupportedEncodingException e) { 25373 key_bytes = new byte[0]; 25374 } 25375 key_buf = ByteBuffer.allocateDirect(key_bytes.length + 1); 25376 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte) 0); 25377 } 25378 _imaqWriteCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf), 25379 data.getAddress(), size); 25380 25381 } 25382 25383 private static native void _imaqWriteCustomData(long image, long key, long data, int size); 25384 25385 /** 25386 * Display functions 25387 */ 25388 25389 /** 25390 * Image Manipulation functions 25391 */ 25392 25393 public static void imaqCopyRect(Image dest, Image source, Rect rect, Point destLoc) { 25394 25395 _imaqCopyRect(dest.getAddress(), source.getAddress(), rect.getAddress(), destLoc.getAddress()); 25396 25397 } 25398 25399 private static native void _imaqCopyRect(long dest, long source, long rect, long destLoc); 25400 25401 public static void imaqDuplicate(Image dest, Image source) { 25402 25403 _imaqDuplicate(dest.getAddress(), source.getAddress()); 25404 25405 } 25406 25407 private static native void _imaqDuplicate(long dest, long source); 25408 25409 public static RawData imaqFlatten(Image image, FlattenType type, CompressionType compression, 25410 int quality) { 25411 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25412 long rv_addr = getByteBufferAddress(rv_buf); 25413 long jn_rv = 25414 _imaqFlatten(image.getAddress(), type.getValue(), compression.getValue(), quality, 25415 rv_addr + 0); 25416 int size; 25417 RawData val; 25418 size = rv_buf.getInt(0); 25419 val = new RawData(jn_rv, true, size); 25420 return val; 25421 } 25422 25423 private static native long _imaqFlatten(long image, int type, int compression, int quality, 25424 long size); 25425 25426 public static void imaqFlip(Image dest, Image source, FlipAxis axis) { 25427 25428 _imaqFlip(dest.getAddress(), source.getAddress(), axis.getValue()); 25429 25430 } 25431 25432 private static native void _imaqFlip(long dest, long source, int axis); 25433 25434 public static void imaqMask(Image dest, Image source, Image mask) { 25435 25436 _imaqMask(dest.getAddress(), source.getAddress(), mask.getAddress()); 25437 25438 } 25439 25440 private static native void _imaqMask(long dest, long source, long mask); 25441 25442 public static void imaqResample(Image dest, Image source, int newWidth, int newHeight, 25443 InterpolationMethod method, Rect rect) { 25444 25445 _imaqResample(dest.getAddress(), source.getAddress(), newWidth, newHeight, method.getValue(), 25446 rect.getAddress()); 25447 25448 } 25449 25450 private static native void _imaqResample(long dest, long source, int newWidth, int newHeight, 25451 int method, long rect); 25452 25453 public static void imaqScale(Image dest, Image source, int xScale, int yScale, 25454 ScalingMode scaleMode, Rect rect) { 25455 25456 _imaqScale(dest.getAddress(), source.getAddress(), xScale, yScale, scaleMode.getValue(), 25457 rect.getAddress()); 25458 25459 } 25460 25461 private static native void _imaqScale(long dest, long source, int xScale, int yScale, 25462 int scaleMode, long rect); 25463 25464 public static void imaqTranspose(Image dest, Image source) { 25465 25466 _imaqTranspose(dest.getAddress(), source.getAddress()); 25467 25468 } 25469 25470 private static native void _imaqTranspose(long dest, long source); 25471 25472 public static void imaqUnflatten(Image image, RawData data, int size) { 25473 25474 _imaqUnflatten(image.getAddress(), data.getAddress(), size); 25475 25476 } 25477 25478 private static native void _imaqUnflatten(long image, long data, int size); 25479 25480 public static void imaqUnwrapImage(Image dest, Image source, Annulus annulus, 25481 RectOrientation orientation, InterpolationMethod method) { 25482 25483 _imaqUnwrapImage(dest.getAddress(), source.getAddress(), annulus.getAddress(), 25484 orientation.getValue(), method.getValue()); 25485 25486 } 25487 25488 private static native void _imaqUnwrapImage(long dest, long source, long annulus, 25489 int orientation, int method); 25490 25491 public static void imaqView3D(Image dest, Image source, View3DOptions options) { 25492 25493 _imaqView3D(dest.getAddress(), source.getAddress(), options.getAddress()); 25494 25495 } 25496 25497 private static native void _imaqView3D(long dest, long source, long options); 25498 25499 /** 25500 * File I/O functions 25501 */ 25502 25503 public static class GetFileInfoResult { 25504 public CalibrationUnit calibrationUnit; 25505 public float calibrationX; 25506 public float calibrationY; 25507 public int width; 25508 public int height; 25509 public ImageType imageType; 25510 25511 private GetFileInfoResult(ByteBuffer rv_buf) { 25512 calibrationUnit = CalibrationUnit.fromValue(rv_buf.getInt(0)); 25513 calibrationX = rv_buf.getFloat(8); 25514 calibrationY = rv_buf.getFloat(16); 25515 width = rv_buf.getInt(24); 25516 height = rv_buf.getInt(32); 25517 imageType = ImageType.fromValue(rv_buf.getInt(40)); 25518 } 25519 } 25520 25521 public static GetFileInfoResult imaqGetFileInfo(String fileName) { 25522 ByteBuffer fileName_buf = null; 25523 if (fileName != null) { 25524 byte[] fileName_bytes; 25525 try { 25526 fileName_bytes = fileName.getBytes("UTF-8"); 25527 } catch (UnsupportedEncodingException e) { 25528 fileName_bytes = new byte[0]; 25529 } 25530 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25531 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25532 (byte) 0); 25533 } 25534 ByteBuffer rv_buf = 25535 ByteBuffer.allocateDirect(8 + 8 + 8 + 8 + 8 + 8).order(ByteOrder.nativeOrder()); 25536 long rv_addr = getByteBufferAddress(rv_buf); 25537 _imaqGetFileInfo(fileName == null ? 0 : getByteBufferAddress(fileName_buf), rv_addr + 0, 25538 rv_addr + 8, rv_addr + 16, rv_addr + 24, rv_addr + 32, rv_addr + 40); 25539 GetFileInfoResult rv = new GetFileInfoResult(rv_buf); 25540 return rv; 25541 } 25542 25543 private static native void _imaqGetFileInfo(long fileName, long calibrationUnit, 25544 long calibrationX, long calibrationY, long width, long height, long imageType); 25545 25546 public static void imaqReadFile(Image image, String fileName) { 25547 ByteBuffer fileName_buf; 25548 byte[] fileName_bytes; 25549 try { 25550 fileName_bytes = fileName.getBytes("UTF-8"); 25551 } catch (UnsupportedEncodingException e) { 25552 fileName_bytes = new byte[0]; 25553 } 25554 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25555 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25556 (byte) 0); 25557 _imaqReadFile(image.getAddress(), getByteBufferAddress(fileName_buf), 0, 0); 25558 } 25559 25560 private static native void _imaqReadFile(long image, long fileName, long colorTable, 25561 long numColors); 25562 25563 public static class ReadVisionFileResult { 25564 public RGBValue colorTable; 25565 public int numColors; 25566 25567 private ReadVisionFileResult(ByteBuffer rv_buf) { 25568 colorTable = new RGBValue(rv_buf, 0); 25569 colorTable.read(); 25570 numColors = rv_buf.getInt(8); 25571 } 25572 } 25573 25574 public static ReadVisionFileResult imaqReadVisionFile(Image image, String fileName) { 25575 ByteBuffer fileName_buf = null; 25576 if (fileName != null) { 25577 byte[] fileName_bytes; 25578 try { 25579 fileName_bytes = fileName.getBytes("UTF-8"); 25580 } catch (UnsupportedEncodingException e) { 25581 fileName_bytes = new byte[0]; 25582 } 25583 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25584 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25585 (byte) 0); 25586 } 25587 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 25588 long rv_addr = getByteBufferAddress(rv_buf); 25589 _imaqReadVisionFile(image.getAddress(), fileName == null ? 0 25590 : getByteBufferAddress(fileName_buf), rv_addr + 0, rv_addr + 8); 25591 ReadVisionFileResult rv = new ReadVisionFileResult(rv_buf); 25592 return rv; 25593 } 25594 25595 private static native void _imaqReadVisionFile(long image, long fileName, long colorTable, 25596 long numColors); 25597 25598 public static void imaqWriteBMPFile(Image image, String fileName, int compress, 25599 RGBValue colorTable) { 25600 ByteBuffer fileName_buf = null; 25601 if (fileName != null) { 25602 byte[] fileName_bytes; 25603 try { 25604 fileName_bytes = fileName.getBytes("UTF-8"); 25605 } catch (UnsupportedEncodingException e) { 25606 fileName_bytes = new byte[0]; 25607 } 25608 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25609 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25610 (byte) 0); 25611 } 25612 _imaqWriteBMPFile(image.getAddress(), 25613 fileName == null ? 0 : getByteBufferAddress(fileName_buf), compress, colorTable == null ? 0 25614 : colorTable.getAddress()); 25615 25616 } 25617 25618 private static native void _imaqWriteBMPFile(long image, long fileName, int compress, 25619 long colorTable); 25620 25621 public static void imaqWriteFile(Image image, String fileName, RGBValue colorTable) { 25622 ByteBuffer fileName_buf = null; 25623 if (fileName != null) { 25624 byte[] fileName_bytes; 25625 try { 25626 fileName_bytes = fileName.getBytes("UTF-8"); 25627 } catch (UnsupportedEncodingException e) { 25628 fileName_bytes = new byte[0]; 25629 } 25630 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25631 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25632 (byte) 0); 25633 } 25634 _imaqWriteFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), 25635 colorTable == null ? 0 : colorTable.getAddress()); 25636 25637 } 25638 25639 private static native void _imaqWriteFile(long image, long fileName, long colorTable); 25640 25641 public static void imaqWriteJPEGFile(Image image, String fileName, int quality, RawData colorTable) { 25642 ByteBuffer fileName_buf = null; 25643 if (fileName != null) { 25644 byte[] fileName_bytes; 25645 try { 25646 fileName_bytes = fileName.getBytes("UTF-8"); 25647 } catch (UnsupportedEncodingException e) { 25648 fileName_bytes = new byte[0]; 25649 } 25650 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25651 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25652 (byte) 0); 25653 } 25654 _imaqWriteJPEGFile(image.getAddress(), fileName == null ? 0 25655 : getByteBufferAddress(fileName_buf), quality, 25656 colorTable == null ? 0 : colorTable.getAddress()); 25657 25658 } 25659 25660 private static native void _imaqWriteJPEGFile(long image, long fileName, int quality, 25661 long colorTable); 25662 25663 public static void imaqWritePNGFile2(Image image, String fileName, int compressionSpeed, 25664 RGBValue colorTable, int useBitDepth) { 25665 ByteBuffer fileName_buf = null; 25666 if (fileName != null) { 25667 byte[] fileName_bytes; 25668 try { 25669 fileName_bytes = fileName.getBytes("UTF-8"); 25670 } catch (UnsupportedEncodingException e) { 25671 fileName_bytes = new byte[0]; 25672 } 25673 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25674 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25675 (byte) 0); 25676 } 25677 _imaqWritePNGFile2(image.getAddress(), fileName == null ? 0 25678 : getByteBufferAddress(fileName_buf), compressionSpeed, 25679 colorTable == null ? 0 : colorTable.getAddress(), useBitDepth); 25680 25681 } 25682 25683 private static native void _imaqWritePNGFile2(long image, long fileName, int compressionSpeed, 25684 long colorTable, int useBitDepth); 25685 25686 public static void imaqWriteTIFFFile(Image image, String fileName, TIFFFileOptions options, 25687 RGBValue colorTable) { 25688 ByteBuffer fileName_buf = null; 25689 if (fileName != null) { 25690 byte[] fileName_bytes; 25691 try { 25692 fileName_bytes = fileName.getBytes("UTF-8"); 25693 } catch (UnsupportedEncodingException e) { 25694 fileName_bytes = new byte[0]; 25695 } 25696 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25697 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25698 (byte) 0); 25699 } 25700 _imaqWriteTIFFFile(image.getAddress(), fileName == null ? 0 25701 : getByteBufferAddress(fileName_buf), options == null ? 0 : options.getAddress(), 25702 colorTable == null ? 0 : colorTable.getAddress()); 25703 25704 } 25705 25706 private static native void _imaqWriteTIFFFile(long image, long fileName, long options, 25707 long colorTable); 25708 25709 public static void imaqWriteVisionFile(Image image, String fileName, RGBValue colorTable) { 25710 ByteBuffer fileName_buf = null; 25711 if (fileName != null) { 25712 byte[] fileName_bytes; 25713 try { 25714 fileName_bytes = fileName.getBytes("UTF-8"); 25715 } catch (UnsupportedEncodingException e) { 25716 fileName_bytes = new byte[0]; 25717 } 25718 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 25719 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 25720 (byte) 0); 25721 } 25722 _imaqWriteVisionFile(image.getAddress(), fileName == null ? 0 25723 : getByteBufferAddress(fileName_buf), colorTable.getAddress()); 25724 25725 } 25726 25727 private static native void _imaqWriteVisionFile(long image, long fileName, long colorTable); 25728 25729 /** 25730 * Analytic Geometry functions 25731 */ 25732 25733 public static CoordinateSystem imaqBuildCoordinateSystem(Point points, ReferenceMode mode, 25734 AxisOrientation orientation) { 25735 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25736 long rv_addr = getByteBufferAddress(rv_buf); 25737 _imaqBuildCoordinateSystem(points.getAddress(), mode.getValue(), orientation.getValue(), 25738 rv_addr + 0); 25739 CoordinateSystem system; 25740 system = new CoordinateSystem(rv_buf, 0); 25741 system.read(); 25742 return system; 25743 } 25744 25745 private static native void _imaqBuildCoordinateSystem(long points, int mode, int orientation, 25746 long system); 25747 25748 public static BestCircle2 imaqFitCircle2(PointFloat[] points, FitCircleOptions options) { 25749 int numPoints = points.length; 25750 ByteBuffer points_buf = null; 25751 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 25752 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 25753 points[i].setBuffer(points_buf, off); 25754 points[i].write(); 25755 } 25756 long jn_rv = _imaqFitCircle2(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 25757 25758 return new BestCircle2(jn_rv, true); 25759 } 25760 25761 private static native long _imaqFitCircle2(long points, int numPoints, long options); 25762 25763 public static BestEllipse2 imaqFitEllipse2(PointFloat[] points, FitEllipseOptions options) { 25764 int numPoints = points.length; 25765 ByteBuffer points_buf = null; 25766 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 25767 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 25768 points[i].setBuffer(points_buf, off); 25769 points[i].write(); 25770 } 25771 long jn_rv = 25772 _imaqFitEllipse2(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 25773 25774 return new BestEllipse2(jn_rv, true); 25775 } 25776 25777 private static native long _imaqFitEllipse2(long points, int numPoints, long options); 25778 25779 public static BestLine imaqFitLine(PointFloat[] points, FitLineOptions options) { 25780 int numPoints = points.length; 25781 ByteBuffer points_buf = null; 25782 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 25783 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 25784 points[i].setBuffer(points_buf, off); 25785 points[i].write(); 25786 } 25787 long jn_rv = _imaqFitLine(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 25788 25789 return new BestLine(jn_rv, true); 25790 } 25791 25792 private static native long _imaqFitLine(long points, int numPoints, long options); 25793 25794 public static float imaqGetAngle(PointFloat start1, PointFloat end1, PointFloat start2, 25795 PointFloat end2) { 25796 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25797 long rv_addr = getByteBufferAddress(rv_buf); 25798 _imaqGetAngle(start1.getAddress(), end1.getAddress(), start2.getAddress(), end2.getAddress(), 25799 rv_addr + 0); 25800 float angle; 25801 angle = rv_buf.getFloat(0); 25802 return angle; 25803 } 25804 25805 private static native void _imaqGetAngle(long start1, long end1, long start2, long end2, 25806 long angle); 25807 25808 public static class GetBisectingLineResult { 25809 public PointFloat bisectStart; 25810 public PointFloat bisectEnd; 25811 25812 private GetBisectingLineResult(ByteBuffer rv_buf) { 25813 bisectStart = new PointFloat(rv_buf, 0); 25814 bisectStart.read(); 25815 bisectEnd = new PointFloat(rv_buf, 8); 25816 bisectEnd.read(); 25817 } 25818 } 25819 25820 public static GetBisectingLineResult imaqGetBisectingLine(PointFloat start1, PointFloat end1, 25821 PointFloat start2, PointFloat end2) { 25822 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 25823 long rv_addr = getByteBufferAddress(rv_buf); 25824 _imaqGetBisectingLine(start1.getAddress(), end1.getAddress(), start2.getAddress(), 25825 end2.getAddress(), rv_addr + 0, rv_addr + 8); 25826 GetBisectingLineResult rv = new GetBisectingLineResult(rv_buf); 25827 return rv; 25828 } 25829 25830 private static native void _imaqGetBisectingLine(long start1, long end1, long start2, long end2, 25831 long bisectStart, long bisectEnd); 25832 25833 public static float imaqGetDistance(PointFloat point1, PointFloat point2) { 25834 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25835 long rv_addr = getByteBufferAddress(rv_buf); 25836 _imaqGetDistance(point1.getAddress(), point2.getAddress(), rv_addr + 0); 25837 float distance; 25838 distance = rv_buf.getFloat(0); 25839 return distance; 25840 } 25841 25842 private static native void _imaqGetDistance(long point1, long point2, long distance); 25843 25844 public static PointFloat imaqGetIntersection(PointFloat start1, PointFloat end1, 25845 PointFloat start2, PointFloat end2) { 25846 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25847 long rv_addr = getByteBufferAddress(rv_buf); 25848 _imaqGetIntersection(start1.getAddress(), end1.getAddress(), start2.getAddress(), 25849 end2.getAddress(), rv_addr + 0); 25850 PointFloat intersection; 25851 intersection = new PointFloat(rv_buf, 0); 25852 intersection.read(); 25853 return intersection; 25854 } 25855 25856 private static native void _imaqGetIntersection(long start1, long end1, long start2, long end2, 25857 long intersection); 25858 25859 public static class GetMidLineResult { 25860 public PointFloat midLineStart; 25861 public PointFloat midLineEnd; 25862 25863 private GetMidLineResult(ByteBuffer rv_buf) { 25864 midLineStart = new PointFloat(rv_buf, 0); 25865 midLineStart.read(); 25866 midLineEnd = new PointFloat(rv_buf, 8); 25867 midLineEnd.read(); 25868 } 25869 } 25870 25871 public static GetMidLineResult imaqGetMidLine(PointFloat refLineStart, PointFloat refLineEnd, 25872 PointFloat point) { 25873 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 25874 long rv_addr = getByteBufferAddress(rv_buf); 25875 _imaqGetMidLine(refLineStart.getAddress(), refLineEnd.getAddress(), point.getAddress(), 25876 rv_addr + 0, rv_addr + 8); 25877 GetMidLineResult rv = new GetMidLineResult(rv_buf); 25878 return rv; 25879 } 25880 25881 private static native void _imaqGetMidLine(long refLineStart, long refLineEnd, long point, 25882 long midLineStart, long midLineEnd); 25883 25884 public static class GetPerpendicularLineResult { 25885 public PointFloat perpLineStart; 25886 public PointFloat perpLineEnd; 25887 public double distance; 25888 25889 private GetPerpendicularLineResult(ByteBuffer rv_buf) { 25890 perpLineStart = new PointFloat(rv_buf, 0); 25891 perpLineStart.read(); 25892 perpLineEnd = new PointFloat(rv_buf, 8); 25893 perpLineEnd.read(); 25894 distance = rv_buf.getDouble(16); 25895 } 25896 } 25897 25898 public static GetPerpendicularLineResult imaqGetPerpendicularLine(PointFloat refLineStart, 25899 PointFloat refLineEnd, PointFloat point) { 25900 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8 + 8).order(ByteOrder.nativeOrder()); 25901 long rv_addr = getByteBufferAddress(rv_buf); 25902 _imaqGetPerpendicularLine(refLineStart.getAddress(), refLineEnd.getAddress(), 25903 point.getAddress(), rv_addr + 0, rv_addr + 8, rv_addr + 16); 25904 GetPerpendicularLineResult rv = new GetPerpendicularLineResult(rv_buf); 25905 return rv; 25906 } 25907 25908 private static native void _imaqGetPerpendicularLine(long refLineStart, long refLineEnd, 25909 long point, long perpLineStart, long perpLineEnd, long distance); 25910 25911 public static class GetPointsOnContourResult { 25912 public SegmentInfo[] array; 25913 private long array_addr; 25914 25915 private GetPointsOnContourResult(ByteBuffer rv_buf, long jn_rv) { 25916 array_addr = jn_rv; 25917 int array_numSegments; 25918 array_numSegments = rv_buf.getInt(0); 25919 array = new SegmentInfo[array_numSegments]; 25920 if (array_numSegments > 0 && array_addr != 0) { 25921 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numSegments * 24); 25922 for (int i = 0, off = 0; i < array_numSegments; i++, off += 24) { 25923 array[i] = new SegmentInfo(bb, off); 25924 array[i].read(); 25925 } 25926 } 25927 } 25928 25929 @Override 25930 protected void finalize() throws Throwable { 25931 imaqDispose(array_addr); 25932 super.finalize(); 25933 } 25934 } 25935 25936 public static GetPointsOnContourResult imaqGetPointsOnContour(Image image) { 25937 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25938 long rv_addr = getByteBufferAddress(rv_buf); 25939 long jn_rv = _imaqGetPointsOnContour(image.getAddress(), rv_addr + 0); 25940 GetPointsOnContourResult rv = new GetPointsOnContourResult(rv_buf, jn_rv); 25941 return rv; 25942 } 25943 25944 private static native long _imaqGetPointsOnContour(long image, long numSegments); 25945 25946 public static class GetPointsOnLineResult { 25947 public Point[] array; 25948 private long array_addr; 25949 25950 private GetPointsOnLineResult(ByteBuffer rv_buf, long jn_rv) { 25951 array_addr = jn_rv; 25952 int array_numPoints; 25953 array_numPoints = rv_buf.getInt(0); 25954 array = new Point[array_numPoints]; 25955 if (array_numPoints > 0 && array_addr != 0) { 25956 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numPoints * 8); 25957 for (int i = 0, off = 0; i < array_numPoints; i++, off += 8) { 25958 array[i] = new Point(bb, off); 25959 array[i].read(); 25960 } 25961 } 25962 } 25963 25964 @Override 25965 protected void finalize() throws Throwable { 25966 imaqDispose(array_addr); 25967 super.finalize(); 25968 } 25969 } 25970 25971 public static GetPointsOnLineResult imaqGetPointsOnLine(Point start, Point end) { 25972 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25973 long rv_addr = getByteBufferAddress(rv_buf); 25974 long jn_rv = _imaqGetPointsOnLine(start.getAddress(), end.getAddress(), rv_addr + 0); 25975 GetPointsOnLineResult rv = new GetPointsOnLineResult(rv_buf, jn_rv); 25976 return rv; 25977 } 25978 25979 private static native long _imaqGetPointsOnLine(long start, long end, long numPoints); 25980 25981 public static float imaqGetPolygonArea(PointFloat points, int numPoints) { 25982 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25983 long rv_addr = getByteBufferAddress(rv_buf); 25984 _imaqGetPolygonArea(points.getAddress(), numPoints, rv_addr + 0); 25985 float area; 25986 area = rv_buf.getFloat(0); 25987 return area; 25988 } 25989 25990 private static native void _imaqGetPolygonArea(long points, int numPoints, long area); 25991 25992 public static class InterpolatePointsResult { 25993 public float[] array; 25994 private long array_addr; 25995 25996 private InterpolatePointsResult(ByteBuffer rv_buf, long jn_rv) { 25997 array_addr = jn_rv; 25998 int array_interpCount; 25999 array_interpCount = rv_buf.getInt(0); 26000 array = new float[array_interpCount]; 26001 if (array_interpCount > 0 && array_addr != 0) { 26002 newDirectByteBuffer(array_addr, array_interpCount * 4).asFloatBuffer().get(array); 26003 } 26004 } 26005 26006 @Override 26007 protected void finalize() throws Throwable { 26008 imaqDispose(array_addr); 26009 super.finalize(); 26010 } 26011 } 26012 26013 public static InterpolatePointsResult imaqInterpolatePoints(Image image, Point[] points, 26014 InterpolationMethod method, int subpixel) { 26015 int numPoints = points.length; 26016 ByteBuffer points_buf = null; 26017 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 26018 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 26019 points[i].setBuffer(points_buf, off); 26020 points[i].write(); 26021 } 26022 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26023 long rv_addr = getByteBufferAddress(rv_buf); 26024 long jn_rv = 26025 _imaqInterpolatePoints(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 26026 method.getValue(), subpixel, rv_addr + 0); 26027 InterpolatePointsResult rv = new InterpolatePointsResult(rv_buf, jn_rv); 26028 return rv; 26029 } 26030 26031 private static native long _imaqInterpolatePoints(long image, long points, int numPoints, 26032 int method, int subpixel, long interpCount); 26033 26034 /** 26035 * Clipboard functions 26036 */ 26037 26038 /** 26039 * Border functions 26040 */ 26041 26042 public static void imaqFillBorder(Image image, BorderMethod method) { 26043 26044 _imaqFillBorder(image.getAddress(), method.getValue()); 26045 26046 } 26047 26048 private static native void _imaqFillBorder(long image, int method); 26049 26050 public static int imaqGetBorderSize(Image image) { 26051 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26052 long rv_addr = getByteBufferAddress(rv_buf); 26053 _imaqGetBorderSize(image.getAddress(), rv_addr + 0); 26054 int borderSize; 26055 borderSize = rv_buf.getInt(0); 26056 return borderSize; 26057 } 26058 26059 private static native void _imaqGetBorderSize(long image, long borderSize); 26060 26061 public static void imaqSetBorderSize(Image image, int size) { 26062 26063 _imaqSetBorderSize(image.getAddress(), size); 26064 26065 } 26066 26067 private static native void _imaqSetBorderSize(long image, int size); 26068 26069 /** 26070 * Image Management functions 26071 */ 26072 26073 public static void imaqArrayToImage(Image image, RawData array, int numCols, int numRows) { 26074 26075 _imaqArrayToImage(image.getAddress(), array.getAddress(), numCols, numRows); 26076 26077 } 26078 26079 private static native void _imaqArrayToImage(long image, long array, int numCols, int numRows); 26080 26081 public static Image imaqCreateImage(ImageType type, int borderSize) { 26082 26083 long jn_rv = _imaqCreateImage(type.getValue(), borderSize); 26084 26085 return new Image(jn_rv, true); 26086 } 26087 26088 private static native long _imaqCreateImage(int type, int borderSize); 26089 26090 /** 26091 * Color Processing functions 26092 */ 26093 26094 public static void imaqColorBCGTransform(Image dest, Image source, BCGOptions redOptions, 26095 BCGOptions greenOptions, BCGOptions blueOptions, Image mask) { 26096 26097 _imaqColorBCGTransform(dest.getAddress(), source.getAddress(), redOptions == null ? 0 26098 : redOptions.getAddress(), greenOptions == null ? 0 : greenOptions.getAddress(), 26099 blueOptions == null ? 0 : blueOptions.getAddress(), mask == null ? 0 : mask.getAddress()); 26100 26101 } 26102 26103 private static native void _imaqColorBCGTransform(long dest, long source, long redOptions, 26104 long greenOptions, long blueOptions, long mask); 26105 26106 public static void imaqColorEqualize(Image dest, Image source, int colorEqualization) { 26107 26108 _imaqColorEqualize(dest.getAddress(), source.getAddress(), colorEqualization); 26109 26110 } 26111 26112 private static native void _imaqColorEqualize(long dest, long source, int colorEqualization); 26113 26114 public static ColorHistogramReport imaqColorHistogram2(Image image, int numClasses, 26115 ColorMode mode, CIEXYZValue whiteReference, Image mask) { 26116 26117 long jn_rv = 26118 _imaqColorHistogram2(image.getAddress(), numClasses, mode.getValue(), 26119 whiteReference.getAddress(), mask == null ? 0 : mask.getAddress()); 26120 26121 return new ColorHistogramReport(jn_rv, true); 26122 } 26123 26124 private static native long _imaqColorHistogram2(long image, int numClasses, int mode, 26125 long whiteReference, long mask); 26126 26127 public static void imaqColorThreshold(Image dest, Image source, int replaceValue, ColorMode mode, 26128 Range plane1Range, Range plane2Range, Range plane3Range) { 26129 26130 _imaqColorThreshold(dest.getAddress(), source.getAddress(), replaceValue, mode.getValue(), 26131 plane1Range == null ? 0 : plane1Range.getAddress(), 26132 plane2Range == null ? 0 : plane2Range.getAddress(), 26133 plane3Range == null ? 0 : plane3Range.getAddress()); 26134 26135 } 26136 26137 private static native void _imaqColorThreshold(long dest, long source, int replaceValue, 26138 int mode, long plane1Range, long plane2Range, long plane3Range); 26139 26140 public static SupervisedColorSegmentationReport imaqSupervisedColorSegmentation( 26141 ClassifierSession session, Image labelImage, Image srcImage, ROI roi, ROILabel labelIn, 26142 int numLabelIn, int maxDistance, int minIdentificationScore, 26143 ColorSegmenationOptions segmentOptions) { 26144 26145 long jn_rv = 26146 _imaqSupervisedColorSegmentation(session.getAddress(), labelImage.getAddress(), 26147 srcImage.getAddress(), roi.getAddress(), labelIn.getAddress(), numLabelIn, maxDistance, 26148 minIdentificationScore, segmentOptions.getAddress()); 26149 26150 return new SupervisedColorSegmentationReport(jn_rv, true); 26151 } 26152 26153 private static native long _imaqSupervisedColorSegmentation(long session, long labelImage, 26154 long srcImage, long roi, long labelIn, int numLabelIn, int maxDistance, 26155 int minIdentificationScore, long segmentOptions); 26156 26157 public static int imaqGetColorSegmentationMaxDistance(ClassifierSession session, 26158 ColorSegmenationOptions segmentOptions, SegmentationDistanceLevel distLevel) { 26159 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26160 long rv_addr = getByteBufferAddress(rv_buf); 26161 _imaqGetColorSegmentationMaxDistance(session.getAddress(), segmentOptions.getAddress(), 26162 distLevel.getValue(), rv_addr + 0); 26163 int maxDistance; 26164 maxDistance = rv_buf.getInt(0); 26165 return maxDistance; 26166 } 26167 26168 private static native void _imaqGetColorSegmentationMaxDistance(long session, 26169 long segmentOptions, int distLevel, long maxDistance); 26170 26171 /** 26172 * Transform functions 26173 */ 26174 26175 public static void imaqBCGTransform(Image dest, Image source, BCGOptions options, Image mask) { 26176 26177 _imaqBCGTransform(dest.getAddress(), source.getAddress(), options.getAddress(), 26178 mask == null ? 0 : mask.getAddress()); 26179 26180 } 26181 26182 private static native void _imaqBCGTransform(long dest, long source, long options, long mask); 26183 26184 public static void imaqEqualize(Image dest, Image source, float min, float max, Image mask) { 26185 26186 _imaqEqualize(dest.getAddress(), source.getAddress(), min, max, 26187 mask == null ? 0 : mask.getAddress()); 26188 26189 } 26190 26191 private static native void _imaqEqualize(long dest, long source, float min, float max, long mask); 26192 26193 public static void imaqInverse(Image dest, Image source, Image mask) { 26194 26195 _imaqInverse(dest.getAddress(), source.getAddress(), mask == null ? 0 : mask.getAddress()); 26196 26197 } 26198 26199 private static native void _imaqInverse(long dest, long source, long mask); 26200 26201 public static void imaqMathTransform(Image dest, Image source, MathTransformMethod method, 26202 float rangeMin, float rangeMax, float power, Image mask) { 26203 26204 _imaqMathTransform(dest.getAddress(), source.getAddress(), method.getValue(), rangeMin, 26205 rangeMax, power, mask == null ? 0 : mask.getAddress()); 26206 26207 } 26208 26209 private static native void _imaqMathTransform(long dest, long source, int method, float rangeMin, 26210 float rangeMax, float power, long mask); 26211 26212 public static int imaqWatershedTransform(Image dest, Image source, int connectivity8) { 26213 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26214 long rv_addr = getByteBufferAddress(rv_buf); 26215 _imaqWatershedTransform(dest.getAddress(), source.getAddress(), connectivity8, rv_addr + 0); 26216 int zoneCount; 26217 zoneCount = rv_buf.getInt(0); 26218 return zoneCount; 26219 } 26220 26221 private static native void _imaqWatershedTransform(long dest, long source, int connectivity8, 26222 long zoneCount); 26223 26224 /** 26225 * Window Management functions 26226 */ 26227 26228 /** 26229 * Utilities functions 26230 */ 26231 26232 public static int imaqMulticoreOptions(MulticoreOperation operation) { 26233 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26234 long rv_addr = getByteBufferAddress(rv_buf); 26235 _imaqMulticoreOptions(operation.getValue(), rv_addr + 0); 26236 int customNumCores; 26237 customNumCores = rv_buf.getInt(0); 26238 return customNumCores; 26239 } 26240 26241 private static native void _imaqMulticoreOptions(int operation, long customNumCores); 26242 26243 /** 26244 * Tool Window functions 26245 */ 26246 26247 /** 26248 * Meter functions 26249 */ 26250 26251 public static MeterArc imaqGetMeterArc(int lightNeedle, MeterArcMode mode, ROI roi, 26252 PointFloat base, PointFloat start, PointFloat end) { 26253 26254 long jn_rv = 26255 _imaqGetMeterArc(lightNeedle, mode.getValue(), roi.getAddress(), base.getAddress(), 26256 start.getAddress(), end.getAddress()); 26257 26258 return new MeterArc(jn_rv, true); 26259 } 26260 26261 private static native long _imaqGetMeterArc(int lightNeedle, int mode, long roi, long base, 26262 long start, long end); 26263 26264 public static class ReadMeterResult { 26265 public double percentage; 26266 public PointFloat endOfNeedle; 26267 26268 private ReadMeterResult(ByteBuffer rv_buf) { 26269 percentage = rv_buf.getDouble(0); 26270 endOfNeedle = new PointFloat(rv_buf, 8); 26271 endOfNeedle.read(); 26272 } 26273 } 26274 26275 public static ReadMeterResult imaqReadMeter(Image image, MeterArc arcInfo) { 26276 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 26277 long rv_addr = getByteBufferAddress(rv_buf); 26278 _imaqReadMeter(image.getAddress(), arcInfo.getAddress(), rv_addr + 0, rv_addr + 8); 26279 ReadMeterResult rv = new ReadMeterResult(rv_buf); 26280 return rv; 26281 } 26282 26283 private static native void _imaqReadMeter(long image, long arcInfo, long percentage, 26284 long endOfNeedle); 26285 26286 /** 26287 * Calibration functions 26288 */ 26289 26290 public static void imaqCopyCalibrationInfo2(Image dest, Image source, Point offset) { 26291 26292 _imaqCopyCalibrationInfo2(dest.getAddress(), source.getAddress(), offset.getAddress()); 26293 26294 } 26295 26296 private static native void _imaqCopyCalibrationInfo2(long dest, long source, long offset); 26297 26298 public static CalibrationInfo imaqGetCalibrationInfo2(Image image) { 26299 26300 long jn_rv = _imaqGetCalibrationInfo2(image.getAddress()); 26301 26302 return new CalibrationInfo(jn_rv, true); 26303 } 26304 26305 private static native long _imaqGetCalibrationInfo2(long image); 26306 26307 public static CalibrationInfo imaqGetCalibrationInfo3(Image image, int isGetErrorMap) { 26308 26309 long jn_rv = _imaqGetCalibrationInfo3(image.getAddress(), isGetErrorMap); 26310 26311 return new CalibrationInfo(jn_rv, true); 26312 } 26313 26314 private static native long _imaqGetCalibrationInfo3(long image, int isGetErrorMap); 26315 26316 public static float imaqLearnCalibrationGrid(Image image, ROI roi, 26317 LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system, 26318 RangeFloat range) { 26319 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26320 long rv_addr = getByteBufferAddress(rv_buf); 26321 _imaqLearnCalibrationGrid(image.getAddress(), roi.getAddress(), options.getAddress(), 26322 grid.getAddress(), system.getAddress(), range.getAddress(), rv_addr + 0); 26323 float quality; 26324 quality = rv_buf.getFloat(0); 26325 return quality; 26326 } 26327 26328 private static native void _imaqLearnCalibrationGrid(long image, long roi, long options, 26329 long grid, long system, long range, long quality); 26330 26331 public static float imaqLearnCalibrationPoints(Image image, CalibrationPoints points, ROI roi, 26332 LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system) { 26333 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26334 long rv_addr = getByteBufferAddress(rv_buf); 26335 _imaqLearnCalibrationPoints(image.getAddress(), points.getAddress(), roi.getAddress(), 26336 options.getAddress(), grid.getAddress(), system.getAddress(), rv_addr + 0); 26337 float quality; 26338 quality = rv_buf.getFloat(0); 26339 return quality; 26340 } 26341 26342 private static native void _imaqLearnCalibrationPoints(long image, long points, long roi, 26343 long options, long grid, long system, long quality); 26344 26345 public static void imaqSetCoordinateSystem(Image image, CoordinateSystem system) { 26346 26347 _imaqSetCoordinateSystem(image.getAddress(), system.getAddress()); 26348 26349 } 26350 26351 private static native void _imaqSetCoordinateSystem(long image, long system); 26352 26353 public static void imaqSetSimpleCalibration(Image image, ScalingMethod method, int learnTable, 26354 GridDescriptor grid, CoordinateSystem system) { 26355 26356 _imaqSetSimpleCalibration(image.getAddress(), method.getValue(), learnTable, grid.getAddress(), 26357 system.getAddress()); 26358 26359 } 26360 26361 private static native void _imaqSetSimpleCalibration(long image, int method, int learnTable, 26362 long grid, long system); 26363 26364 public static TransformReport imaqTransformPixelToRealWorld(Image image, 26365 PointFloat[] pixelCoordinates) { 26366 int numCoordinates = pixelCoordinates.length; 26367 ByteBuffer pixelCoordinates_buf = null; 26368 pixelCoordinates_buf = 26369 ByteBuffer.allocateDirect(pixelCoordinates.length * 8).order(ByteOrder.nativeOrder()); 26370 for (int i = 0, off = 0; i < pixelCoordinates.length; i++, off += 8) { 26371 pixelCoordinates[i].setBuffer(pixelCoordinates_buf, off); 26372 pixelCoordinates[i].write(); 26373 } 26374 long jn_rv = 26375 _imaqTransformPixelToRealWorld(image.getAddress(), 26376 getByteBufferAddress(pixelCoordinates_buf), numCoordinates); 26377 26378 return new TransformReport(jn_rv, true); 26379 } 26380 26381 private static native long _imaqTransformPixelToRealWorld(long image, long pixelCoordinates, 26382 int numCoordinates); 26383 26384 public static TransformReport imaqTransformRealWorldToPixel(Image image, 26385 PointFloat[] realWorldCoordinates) { 26386 int numCoordinates = realWorldCoordinates.length; 26387 ByteBuffer realWorldCoordinates_buf = null; 26388 realWorldCoordinates_buf = 26389 ByteBuffer.allocateDirect(realWorldCoordinates.length * 8).order(ByteOrder.nativeOrder()); 26390 for (int i = 0, off = 0; i < realWorldCoordinates.length; i++, off += 8) { 26391 realWorldCoordinates[i].setBuffer(realWorldCoordinates_buf, off); 26392 realWorldCoordinates[i].write(); 26393 } 26394 long jn_rv = 26395 _imaqTransformRealWorldToPixel(image.getAddress(), 26396 getByteBufferAddress(realWorldCoordinates_buf), numCoordinates); 26397 26398 return new TransformReport(jn_rv, true); 26399 } 26400 26401 private static native long _imaqTransformRealWorldToPixel(long image, long realWorldCoordinates, 26402 int numCoordinates); 26403 26404 public static void imaqSetSimpleCalibration2(Image image, GridDescriptor gridDescriptor) { 26405 26406 _imaqSetSimpleCalibration2(image.getAddress(), gridDescriptor.getAddress()); 26407 26408 } 26409 26410 private static native void _imaqSetSimpleCalibration2(long image, long gridDescriptor); 26411 26412 public static CoordinateSystem imaqCalibrationSetAxisInfo(Image image) { 26413 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26414 long rv_addr = getByteBufferAddress(rv_buf); 26415 _imaqCalibrationSetAxisInfo(image.getAddress(), rv_addr + 0); 26416 CoordinateSystem axisInfo; 26417 axisInfo = new CoordinateSystem(rv_buf, 0); 26418 axisInfo.read(); 26419 return axisInfo; 26420 } 26421 26422 private static native void _imaqCalibrationSetAxisInfo(long image, long axisInfo); 26423 26424 public static void imaqCalibrationGetThumbnailImage(Image templateImage, Image image, 26425 CalibrationThumbnailType type, int index) { 26426 26427 _imaqCalibrationGetThumbnailImage(templateImage.getAddress(), image.getAddress(), 26428 type.getValue(), index); 26429 26430 } 26431 26432 private static native void _imaqCalibrationGetThumbnailImage(long templateImage, long image, 26433 int type, int index); 26434 26435 public static GetCalibrationInfoReport imaqCalibrationGetCalibrationInfo(Image image, 26436 int isGetErrorMap) { 26437 26438 long jn_rv = _imaqCalibrationGetCalibrationInfo(image.getAddress(), isGetErrorMap); 26439 26440 return new GetCalibrationInfoReport(jn_rv, true); 26441 } 26442 26443 private static native long _imaqCalibrationGetCalibrationInfo(long image, int isGetErrorMap); 26444 26445 public static GetCameraParametersReport imaqCalibrationGetCameraParameters(Image templateImage) { 26446 26447 long jn_rv = _imaqCalibrationGetCameraParameters(templateImage.getAddress()); 26448 26449 return new GetCameraParametersReport(jn_rv, true); 26450 } 26451 26452 private static native long _imaqCalibrationGetCameraParameters(long templateImage); 26453 26454 public static void imaqCalibrationCompactInformation(Image image) { 26455 26456 _imaqCalibrationCompactInformation(image.getAddress()); 26457 26458 } 26459 26460 private static native void _imaqCalibrationCompactInformation(long image); 26461 26462 /** 26463 * Pixel Manipulation functions 26464 */ 26465 26466 public static void imaqExtractColorPlanes(Image image, ColorMode mode, Image plane1, 26467 Image plane2, Image plane3) { 26468 26469 _imaqExtractColorPlanes(image.getAddress(), mode.getValue(), 26470 plane1 == null ? 0 : plane1.getAddress(), plane2 == null ? 0 : plane2.getAddress(), 26471 plane3 == null ? 0 : plane3.getAddress()); 26472 26473 } 26474 26475 private static native void _imaqExtractColorPlanes(long image, int mode, long plane1, 26476 long plane2, long plane3); 26477 26478 public static void imaqExtractComplexPlane(Image dest, Image source, ComplexPlane plane) { 26479 26480 _imaqExtractComplexPlane(dest.getAddress(), source.getAddress(), plane.getValue()); 26481 26482 } 26483 26484 private static native void _imaqExtractComplexPlane(long dest, long source, int plane); 26485 26486 public static void imaqReplaceColorPlanes(Image dest, Image source, ColorMode mode, Image plane1, 26487 Image plane2, Image plane3) { 26488 26489 _imaqReplaceColorPlanes(dest.getAddress(), source.getAddress(), mode.getValue(), 26490 plane1 == null ? 0 : plane1.getAddress(), plane2 == null ? 0 : plane2.getAddress(), 26491 plane3 == null ? 0 : plane3.getAddress()); 26492 26493 } 26494 26495 private static native void _imaqReplaceColorPlanes(long dest, long source, int mode, long plane1, 26496 long plane2, long plane3); 26497 26498 public static void imaqReplaceComplexPlane(Image dest, Image source, Image newValues, 26499 ComplexPlane plane) { 26500 26501 _imaqReplaceComplexPlane(dest.getAddress(), source.getAddress(), newValues.getAddress(), 26502 plane.getValue()); 26503 26504 } 26505 26506 private static native void _imaqReplaceComplexPlane(long dest, long source, long newValues, 26507 int plane); 26508 26509 /** 26510 * Color Matching functions 26511 */ 26512 26513 public static ColorInformation imaqLearnColor(Image image, ROI roi, ColorSensitivity sensitivity, 26514 int saturation) { 26515 26516 long jn_rv = 26517 _imaqLearnColor(image.getAddress(), roi == null ? 0 : roi.getAddress(), 26518 sensitivity.getValue(), saturation); 26519 26520 return new ColorInformation(jn_rv, true); 26521 } 26522 26523 private static native long _imaqLearnColor(long image, long roi, int sensitivity, int saturation); 26524 26525 public static class MatchColorResult { 26526 public int[] array; 26527 private long array_addr; 26528 26529 private MatchColorResult(ByteBuffer rv_buf, long jn_rv) { 26530 array_addr = jn_rv; 26531 int array_numScores; 26532 array_numScores = rv_buf.getInt(0); 26533 array = new int[array_numScores]; 26534 if (array_numScores > 0 && array_addr != 0) { 26535 newDirectByteBuffer(array_addr, array_numScores * 4).asIntBuffer().get(array); 26536 } 26537 } 26538 26539 @Override 26540 protected void finalize() throws Throwable { 26541 imaqDispose(array_addr); 26542 super.finalize(); 26543 } 26544 } 26545 26546 public static MatchColorResult imaqMatchColor(Image image, ColorInformation info, ROI roi) { 26547 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26548 long rv_addr = getByteBufferAddress(rv_buf); 26549 long jn_rv = 26550 _imaqMatchColor(image.getAddress(), info.getAddress(), roi == null ? 0 : roi.getAddress(), 26551 rv_addr + 0); 26552 MatchColorResult rv = new MatchColorResult(rv_buf, jn_rv); 26553 return rv; 26554 } 26555 26556 private static native long _imaqMatchColor(long image, long info, long roi, long numScores); 26557 26558 /** 26559 * Frequency Domain Analysis functions 26560 */ 26561 26562 public static void imaqAttenuate(Image dest, Image source, AttenuateMode highlow) { 26563 26564 _imaqAttenuate(dest.getAddress(), source.getAddress(), highlow.getValue()); 26565 26566 } 26567 26568 private static native void _imaqAttenuate(long dest, long source, int highlow); 26569 26570 public static void imaqConjugate(Image dest, Image source) { 26571 26572 _imaqConjugate(dest.getAddress(), source.getAddress()); 26573 26574 } 26575 26576 private static native void _imaqConjugate(long dest, long source); 26577 26578 public static void imaqFFT(Image dest, Image source) { 26579 26580 _imaqFFT(dest.getAddress(), source.getAddress()); 26581 26582 } 26583 26584 private static native void _imaqFFT(long dest, long source); 26585 26586 public static void imaqFlipFrequencies(Image dest, Image source) { 26587 26588 _imaqFlipFrequencies(dest.getAddress(), source.getAddress()); 26589 26590 } 26591 26592 private static native void _imaqFlipFrequencies(long dest, long source); 26593 26594 public static void imaqInverseFFT(Image dest, Image source) { 26595 26596 _imaqInverseFFT(dest.getAddress(), source.getAddress()); 26597 26598 } 26599 26600 private static native void _imaqInverseFFT(long dest, long source); 26601 26602 public static void imaqTruncate(Image dest, Image source, TruncateMode highlow, float ratioToKeep) { 26603 26604 _imaqTruncate(dest.getAddress(), source.getAddress(), highlow.getValue(), ratioToKeep); 26605 26606 } 26607 26608 private static native void _imaqTruncate(long dest, long source, int highlow, float ratioToKeep); 26609 26610 /** 26611 * Barcode I/O functions 26612 */ 26613 26614 public static AIMGradeReport imaqGradeDataMatrixBarcodeAIM(Image image) { 26615 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26616 long rv_addr = getByteBufferAddress(rv_buf); 26617 _imaqGradeDataMatrixBarcodeAIM(image.getAddress(), rv_addr + 0); 26618 AIMGradeReport report; 26619 report = new AIMGradeReport(rv_buf, 0); 26620 report.read(); 26621 return report; 26622 } 26623 26624 private static native void _imaqGradeDataMatrixBarcodeAIM(long image, long report); 26625 26626 public static BarcodeInfo imaqReadBarcode(Image image, BarcodeType type, ROI roi, int validate) { 26627 26628 long jn_rv = 26629 _imaqReadBarcode(image.getAddress(), type.getValue(), roi == null ? 0 : roi.getAddress(), 26630 validate); 26631 26632 return new BarcodeInfo(jn_rv, true); 26633 } 26634 26635 private static native long _imaqReadBarcode(long image, int type, long roi, int validate); 26636 26637 public static DataMatrixReport imaqReadDataMatrixBarcode2(Image image, ROI roi, 26638 DataMatrixGradingMode prepareForGrading, DataMatrixDescriptionOptions descriptionOptions, 26639 DataMatrixSizeOptions sizeOptions, DataMatrixSearchOptions searchOptions) { 26640 26641 long jn_rv = 26642 _imaqReadDataMatrixBarcode2(image.getAddress(), roi.getAddress(), 26643 prepareForGrading.getValue(), descriptionOptions.getAddress(), 26644 sizeOptions.getAddress(), searchOptions.getAddress()); 26645 26646 return new DataMatrixReport(jn_rv, true); 26647 } 26648 26649 private static native long _imaqReadDataMatrixBarcode2(long image, long roi, 26650 int prepareForGrading, long descriptionOptions, long sizeOptions, long searchOptions); 26651 26652 public static class ReadPDF417BarcodeResult { 26653 public Barcode2DInfo[] array; 26654 private long array_addr; 26655 26656 private ReadPDF417BarcodeResult(ByteBuffer rv_buf, long jn_rv) { 26657 array_addr = jn_rv; 26658 int array_numBarcodes; 26659 array_numBarcodes = rv_buf.getInt(0); 26660 array = new Barcode2DInfo[array_numBarcodes]; 26661 if (array_numBarcodes > 0 && array_addr != 0) { 26662 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numBarcodes * 64); 26663 for (int i = 0, off = 0; i < array_numBarcodes; i++, off += 64) { 26664 array[i] = new Barcode2DInfo(bb, off); 26665 array[i].read(); 26666 } 26667 } 26668 } 26669 26670 @Override 26671 protected void finalize() throws Throwable { 26672 imaqDispose(array_addr); 26673 super.finalize(); 26674 } 26675 } 26676 26677 public static ReadPDF417BarcodeResult imaqReadPDF417Barcode(Image image, ROI roi, 26678 Barcode2DSearchMode searchMode) { 26679 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26680 long rv_addr = getByteBufferAddress(rv_buf); 26681 long jn_rv = 26682 _imaqReadPDF417Barcode(image.getAddress(), roi.getAddress(), searchMode.getValue(), 26683 rv_addr + 0); 26684 ReadPDF417BarcodeResult rv = new ReadPDF417BarcodeResult(rv_buf, jn_rv); 26685 return rv; 26686 } 26687 26688 private static native long _imaqReadPDF417Barcode(long image, long roi, int searchMode, 26689 long numBarcodes); 26690 26691 public static QRCodeReport imaqReadQRCode(Image image, ROI roi, QRGradingMode reserved, 26692 QRCodeDescriptionOptions descriptionOptions, QRCodeSizeOptions sizeOptions, 26693 QRCodeSearchOptions searchOptions) { 26694 26695 long jn_rv = 26696 _imaqReadQRCode(image.getAddress(), roi.getAddress(), reserved.getValue(), 26697 descriptionOptions.getAddress(), sizeOptions.getAddress(), searchOptions.getAddress()); 26698 26699 return new QRCodeReport(jn_rv, true); 26700 } 26701 26702 private static native long _imaqReadQRCode(long image, long roi, int reserved, 26703 long descriptionOptions, long sizeOptions, long searchOptions); 26704 26705 /** 26706 * LCD functions 26707 */ 26708 26709 public static void imaqFindLCDSegments(ROI roi, Image image, LCDOptions options) { 26710 26711 _imaqFindLCDSegments(roi.getAddress(), image.getAddress(), 26712 options == null ? 0 : options.getAddress()); 26713 26714 } 26715 26716 private static native void _imaqFindLCDSegments(long roi, long image, long options); 26717 26718 public static LCDReport imaqReadLCD(Image image, ROI roi, LCDOptions options) { 26719 26720 long jn_rv = 26721 _imaqReadLCD(image.getAddress(), roi.getAddress(), 26722 options == null ? 0 : options.getAddress()); 26723 26724 return new LCDReport(jn_rv, true); 26725 } 26726 26727 private static native long _imaqReadLCD(long image, long roi, long options); 26728 26729 /** 26730 * Shape Matching functions 26731 */ 26732 26733 public static class MatchShapeResult { 26734 public ShapeReport[] array; 26735 private long array_addr; 26736 26737 private MatchShapeResult(ByteBuffer rv_buf, long jn_rv) { 26738 array_addr = jn_rv; 26739 int array_numMatches; 26740 array_numMatches = rv_buf.getInt(0); 26741 array = new ShapeReport[array_numMatches]; 26742 if (array_numMatches > 0 && array_addr != 0) { 26743 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 40); 26744 for (int i = 0, off = 0; i < array_numMatches; i++, off += 40) { 26745 array[i] = new ShapeReport(bb, off); 26746 array[i].read(); 26747 } 26748 } 26749 } 26750 26751 @Override 26752 protected void finalize() throws Throwable { 26753 imaqDispose(array_addr); 26754 super.finalize(); 26755 } 26756 } 26757 26758 public static MatchShapeResult imaqMatchShape(Image dest, Image source, Image templateImage, 26759 int scaleInvariant, int connectivity8, double tolerance) { 26760 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26761 long rv_addr = getByteBufferAddress(rv_buf); 26762 long jn_rv = 26763 _imaqMatchShape(dest.getAddress(), source.getAddress(), templateImage.getAddress(), 26764 scaleInvariant, connectivity8, tolerance, rv_addr + 0); 26765 MatchShapeResult rv = new MatchShapeResult(rv_buf, jn_rv); 26766 return rv; 26767 } 26768 26769 private static native long _imaqMatchShape(long dest, long source, long templateImage, 26770 int scaleInvariant, int connectivity8, double tolerance, long numMatches); 26771 26772 /** 26773 * Contours functions 26774 */ 26775 26776 public static int imaqAddAnnulusContour(ROI roi, Annulus annulus) { 26777 26778 int jn_rv = _imaqAddAnnulusContour(roi.getAddress(), annulus.getAddress()); 26779 26780 return jn_rv; 26781 } 26782 26783 private static native int _imaqAddAnnulusContour(long roi, long annulus); 26784 26785 public static int imaqAddClosedContour(ROI roi, Point[] points) { 26786 int numPoints = points.length; 26787 ByteBuffer points_buf = null; 26788 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 26789 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 26790 points[i].setBuffer(points_buf, off); 26791 points[i].write(); 26792 } 26793 int jn_rv = 26794 _imaqAddClosedContour(roi.getAddress(), getByteBufferAddress(points_buf), numPoints); 26795 26796 return jn_rv; 26797 } 26798 26799 private static native int _imaqAddClosedContour(long roi, long points, int numPoints); 26800 26801 public static int imaqAddLineContour(ROI roi, Point start, Point end) { 26802 26803 int jn_rv = _imaqAddLineContour(roi.getAddress(), start.getAddress(), end.getAddress()); 26804 26805 return jn_rv; 26806 } 26807 26808 private static native int _imaqAddLineContour(long roi, long start, long end); 26809 26810 public static int imaqAddOpenContour(ROI roi, Point[] points) { 26811 int numPoints = points.length; 26812 ByteBuffer points_buf = null; 26813 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 26814 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 26815 points[i].setBuffer(points_buf, off); 26816 points[i].write(); 26817 } 26818 int jn_rv = _imaqAddOpenContour(roi.getAddress(), getByteBufferAddress(points_buf), numPoints); 26819 26820 return jn_rv; 26821 } 26822 26823 private static native int _imaqAddOpenContour(long roi, long points, int numPoints); 26824 26825 public static int imaqAddOvalContour(ROI roi, Rect boundingBox) { 26826 26827 int jn_rv = _imaqAddOvalContour(roi.getAddress(), boundingBox.getAddress()); 26828 26829 return jn_rv; 26830 } 26831 26832 private static native int _imaqAddOvalContour(long roi, long boundingBox); 26833 26834 public static int imaqAddPointContour(ROI roi, Point point) { 26835 26836 int jn_rv = _imaqAddPointContour(roi.getAddress(), point.getAddress()); 26837 26838 return jn_rv; 26839 } 26840 26841 private static native int _imaqAddPointContour(long roi, long point); 26842 26843 public static int imaqAddRectContour(ROI roi, Rect rect) { 26844 26845 int jn_rv = _imaqAddRectContour(roi.getAddress(), rect.getAddress()); 26846 26847 return jn_rv; 26848 } 26849 26850 private static native int _imaqAddRectContour(long roi, long rect); 26851 26852 public static int imaqAddRotatedRectContour2(ROI roi, RotatedRect rect) { 26853 26854 int jn_rv = _imaqAddRotatedRectContour2(roi.getAddress(), rect.getAddress()); 26855 26856 return jn_rv; 26857 } 26858 26859 private static native int _imaqAddRotatedRectContour2(long roi, long rect); 26860 26861 public static int imaqCopyContour(ROI destRoi, ROI sourceRoi, int id) { 26862 26863 int jn_rv = _imaqCopyContour(destRoi.getAddress(), sourceRoi.getAddress(), id); 26864 26865 return jn_rv; 26866 } 26867 26868 private static native int _imaqCopyContour(long destRoi, long sourceRoi, int id); 26869 26870 public static int imaqGetContour(ROI roi, int index) { 26871 26872 int jn_rv = _imaqGetContour(roi.getAddress(), index); 26873 26874 return jn_rv; 26875 } 26876 26877 private static native int _imaqGetContour(long roi, int index); 26878 26879 public static RGBValue imaqGetContourColor(ROI roi, int id) { 26880 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26881 long rv_addr = getByteBufferAddress(rv_buf); 26882 _imaqGetContourColor(roi.getAddress(), id, rv_addr + 0); 26883 RGBValue contourColor; 26884 contourColor = new RGBValue(rv_buf, 0); 26885 contourColor.read(); 26886 return contourColor; 26887 } 26888 26889 private static native void _imaqGetContourColor(long roi, int id, long contourColor); 26890 26891 public static void imaqGetContourCount(ROI roi) { 26892 26893 _imaqGetContourCount(roi.getAddress()); 26894 26895 } 26896 26897 private static native void _imaqGetContourCount(long roi); 26898 26899 public static ContourInfo2 imaqGetContourInfo2(ROI roi, int id) { 26900 26901 long jn_rv = _imaqGetContourInfo2(roi.getAddress(), id); 26902 26903 return new ContourInfo2(jn_rv, true); 26904 } 26905 26906 private static native long _imaqGetContourInfo2(long roi, int id); 26907 26908 public static void imaqMoveContour(ROI roi, int id, int deltaX, int deltaY) { 26909 26910 _imaqMoveContour(roi.getAddress(), id, deltaX, deltaY); 26911 26912 } 26913 26914 private static native void _imaqMoveContour(long roi, int id, int deltaX, int deltaY); 26915 26916 public static void imaqRemoveContour(ROI roi, int id) { 26917 26918 _imaqRemoveContour(roi.getAddress(), id); 26919 26920 } 26921 26922 private static native void _imaqRemoveContour(long roi, int id); 26923 26924 public static void imaqSetContourColor(ROI roi, int id, RGBValue color) { 26925 26926 _imaqSetContourColor(roi.getAddress(), id, color.getAddress()); 26927 26928 } 26929 26930 private static native void _imaqSetContourColor(long roi, int id, long color); 26931 26932 /** 26933 * Regions of Interest functions 26934 */ 26935 26936 public static ROI imaqCreateROI() { 26937 26938 long jn_rv = _imaqCreateROI(); 26939 26940 return new ROI(jn_rv, true); 26941 } 26942 26943 private static native long _imaqCreateROI(); 26944 26945 public static Rect imaqGetROIBoundingBox(ROI roi) { 26946 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26947 long rv_addr = getByteBufferAddress(rv_buf); 26948 _imaqGetROIBoundingBox(roi.getAddress(), rv_addr + 0); 26949 Rect boundingBox; 26950 boundingBox = new Rect(rv_buf, 0); 26951 boundingBox.read(); 26952 return boundingBox; 26953 } 26954 26955 private static native void _imaqGetROIBoundingBox(long roi, long boundingBox); 26956 26957 public static RGBValue imaqGetROIColor(ROI roi) { 26958 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26959 long rv_addr = getByteBufferAddress(rv_buf); 26960 _imaqGetROIColor(roi.getAddress(), rv_addr + 0); 26961 RGBValue roiColor; 26962 roiColor = new RGBValue(rv_buf, 0); 26963 roiColor.read(); 26964 return roiColor; 26965 } 26966 26967 private static native void _imaqGetROIColor(long roi, long roiColor); 26968 26969 public static void imaqSetROIColor(ROI roi, RGBValue color) { 26970 26971 _imaqSetROIColor(roi.getAddress(), color.getAddress()); 26972 26973 } 26974 26975 private static native void _imaqSetROIColor(long roi, long color); 26976 26977 /** 26978 * Image Analysis functions 26979 */ 26980 26981 public static PointFloat imaqCentroid(Image image, Image mask) { 26982 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 26983 long rv_addr = getByteBufferAddress(rv_buf); 26984 _imaqCentroid(image.getAddress(), rv_addr + 0, mask.getAddress()); 26985 PointFloat centroid; 26986 centroid = new PointFloat(rv_buf, 0); 26987 centroid.read(); 26988 return centroid; 26989 } 26990 26991 private static native void _imaqCentroid(long image, long centroid, long mask); 26992 26993 public static class ExtractCurvesResult { 26994 public Curve[] array; 26995 private long array_addr; 26996 26997 private ExtractCurvesResult(ByteBuffer rv_buf, long jn_rv) { 26998 array_addr = jn_rv; 26999 int array_numCurves; 27000 array_numCurves = rv_buf.getInt(0); 27001 array = new Curve[array_numCurves]; 27002 if (array_numCurves > 0 && array_addr != 0) { 27003 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCurves * 48); 27004 for (int i = 0, off = 0; i < array_numCurves; i++, off += 48) { 27005 array[i] = new Curve(bb, off); 27006 array[i].read(); 27007 } 27008 } 27009 } 27010 27011 @Override 27012 protected void finalize() throws Throwable { 27013 imaqDispose(array_addr); 27014 super.finalize(); 27015 } 27016 } 27017 27018 public static ExtractCurvesResult imaqExtractCurves(Image image, ROI roi, 27019 CurveOptions curveOptions) { 27020 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27021 long rv_addr = getByteBufferAddress(rv_buf); 27022 long jn_rv = 27023 _imaqExtractCurves(image.getAddress(), roi.getAddress(), curveOptions.getAddress(), 27024 rv_addr + 0); 27025 ExtractCurvesResult rv = new ExtractCurvesResult(rv_buf, jn_rv); 27026 return rv; 27027 } 27028 27029 private static native long _imaqExtractCurves(long image, long roi, long curveOptions, 27030 long numCurves); 27031 27032 public static HistogramReport imaqHistogram(Image image, int numClasses, float min, float max, 27033 Image mask) { 27034 27035 long jn_rv = 27036 _imaqHistogram(image.getAddress(), numClasses, min, max, 27037 mask == null ? 0 : mask.getAddress()); 27038 27039 return new HistogramReport(jn_rv, true); 27040 } 27041 27042 private static native long _imaqHistogram(long image, int numClasses, float min, float max, 27043 long mask); 27044 27045 public static LinearAverages imaqLinearAverages2(Image image, LinearAveragesMode mode, Rect rect) { 27046 27047 long jn_rv = _imaqLinearAverages2(image.getAddress(), mode.getValue(), rect.getAddress()); 27048 27049 return new LinearAverages(jn_rv, true); 27050 } 27051 27052 private static native long _imaqLinearAverages2(long image, int mode, long rect); 27053 27054 public static LineProfile imaqLineProfile(Image image, Point start, Point end) { 27055 27056 long jn_rv = _imaqLineProfile(image.getAddress(), start.getAddress(), end.getAddress()); 27057 27058 return new LineProfile(jn_rv, true); 27059 } 27060 27061 private static native long _imaqLineProfile(long image, long start, long end); 27062 27063 public static QuantifyReport imaqQuantify(Image image, Image mask) { 27064 27065 long jn_rv = _imaqQuantify(image.getAddress(), mask == null ? 0 : mask.getAddress()); 27066 27067 return new QuantifyReport(jn_rv, true); 27068 } 27069 27070 private static native long _imaqQuantify(long image, long mask); 27071 27072 /** 27073 * Threshold functions 27074 */ 27075 27076 public static ThresholdData imaqAutoThreshold2(Image dest, Image source, int numClasses, 27077 ThresholdMethod method, Image mask) { 27078 27079 long jn_rv = 27080 _imaqAutoThreshold2(dest.getAddress(), source.getAddress(), numClasses, method.getValue(), 27081 mask.getAddress()); 27082 27083 return new ThresholdData(jn_rv, true); 27084 } 27085 27086 private static native long _imaqAutoThreshold2(long dest, long source, int numClasses, 27087 int method, long mask); 27088 27089 public static void imaqLocalThreshold(Image dest, Image source, int windowWidth, 27090 int windowHeight, LocalThresholdMethod method, double deviationWeight, ObjectType type, 27091 float replaceValue) { 27092 27093 _imaqLocalThreshold(dest.getAddress(), source.getAddress(), windowWidth, windowHeight, 27094 method.getValue(), deviationWeight, type.getValue(), replaceValue); 27095 27096 } 27097 27098 private static native void _imaqLocalThreshold(long dest, long source, int windowWidth, 27099 int windowHeight, int method, double deviationWeight, int type, float replaceValue); 27100 27101 public static void imaqMagicWand(Image dest, Image source, Point coord, float tolerance, 27102 int connectivity8, float replaceValue) { 27103 27104 _imaqMagicWand(dest.getAddress(), source.getAddress(), coord.getAddress(), tolerance, 27105 connectivity8, replaceValue); 27106 27107 } 27108 27109 private static native void _imaqMagicWand(long dest, long source, long coord, float tolerance, 27110 int connectivity8, float replaceValue); 27111 27112 public static void imaqMultithreshold(Image dest, Image source, ThresholdData[] ranges) { 27113 int numRanges = ranges.length; 27114 ByteBuffer ranges_buf = null; 27115 ranges_buf = ByteBuffer.allocateDirect(ranges.length * 16).order(ByteOrder.nativeOrder()); 27116 for (int i = 0, off = 0; i < ranges.length; i++, off += 16) { 27117 ranges[i].setBuffer(ranges_buf, off); 27118 ranges[i].write(); 27119 } 27120 _imaqMultithreshold(dest.getAddress(), source.getAddress(), getByteBufferAddress(ranges_buf), 27121 numRanges); 27122 27123 } 27124 27125 private static native void _imaqMultithreshold(long dest, long source, long ranges, int numRanges); 27126 27127 public static void imaqThreshold(Image dest, Image source, float rangeMin, float rangeMax, 27128 int useNewValue, float newValue) { 27129 27130 _imaqThreshold(dest.getAddress(), source.getAddress(), rangeMin, rangeMax, useNewValue, 27131 newValue); 27132 27133 } 27134 27135 private static native void _imaqThreshold(long dest, long source, float rangeMin, float rangeMax, 27136 int useNewValue, float newValue); 27137 27138 /** 27139 * Memory Management functions 27140 */ 27141 27142 /** 27143 * Pattern Matching functions 27144 */ 27145 27146 public static class DetectCirclesResult { 27147 public CircleMatch[] array; 27148 private long array_addr; 27149 27150 private DetectCirclesResult(ByteBuffer rv_buf, long jn_rv) { 27151 array_addr = jn_rv; 27152 int array_numMatchesReturned; 27153 array_numMatchesReturned = rv_buf.getInt(0); 27154 array = new CircleMatch[array_numMatchesReturned]; 27155 if (array_numMatchesReturned > 0 && array_addr != 0) { 27156 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned * 24); 27157 for (int i = 0, off = 0; i < array_numMatchesReturned; i++, off += 24) { 27158 array[i] = new CircleMatch(bb, off); 27159 array[i].read(); 27160 } 27161 } 27162 } 27163 27164 @Override 27165 protected void finalize() throws Throwable { 27166 imaqDispose(array_addr); 27167 super.finalize(); 27168 } 27169 } 27170 27171 public static DetectCirclesResult imaqDetectCircles(Image image, 27172 CircleDescriptor circleDescriptor, CurveOptions curveOptions, 27173 ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 27174 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27175 long rv_addr = getByteBufferAddress(rv_buf); 27176 long jn_rv = 27177 _imaqDetectCircles(image.getAddress(), circleDescriptor.getAddress(), 27178 curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), 27179 rv_addr + 0); 27180 DetectCirclesResult rv = new DetectCirclesResult(rv_buf, jn_rv); 27181 return rv; 27182 } 27183 27184 private static native long _imaqDetectCircles(long image, long circleDescriptor, 27185 long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 27186 27187 public static class DetectEllipsesResult { 27188 public EllipseMatch[] array; 27189 private long array_addr; 27190 27191 private DetectEllipsesResult(ByteBuffer rv_buf, long jn_rv) { 27192 array_addr = jn_rv; 27193 int array_numMatchesReturned; 27194 array_numMatchesReturned = rv_buf.getInt(0); 27195 array = new EllipseMatch[array_numMatchesReturned]; 27196 if (array_numMatchesReturned > 0 && array_addr != 0) { 27197 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned * 40); 27198 for (int i = 0, off = 0; i < array_numMatchesReturned; i++, off += 40) { 27199 array[i] = new EllipseMatch(bb, off); 27200 array[i].read(); 27201 } 27202 } 27203 } 27204 27205 @Override 27206 protected void finalize() throws Throwable { 27207 imaqDispose(array_addr); 27208 super.finalize(); 27209 } 27210 } 27211 27212 public static DetectEllipsesResult imaqDetectEllipses(Image image, 27213 EllipseDescriptor ellipseDescriptor, CurveOptions curveOptions, 27214 ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 27215 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27216 long rv_addr = getByteBufferAddress(rv_buf); 27217 long jn_rv = 27218 _imaqDetectEllipses(image.getAddress(), ellipseDescriptor.getAddress(), 27219 curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), 27220 rv_addr + 0); 27221 DetectEllipsesResult rv = new DetectEllipsesResult(rv_buf, jn_rv); 27222 return rv; 27223 } 27224 27225 private static native long _imaqDetectEllipses(long image, long ellipseDescriptor, 27226 long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 27227 27228 public static class DetectLinesResult { 27229 public LineMatch[] array; 27230 private long array_addr; 27231 27232 private DetectLinesResult(ByteBuffer rv_buf, long jn_rv) { 27233 array_addr = jn_rv; 27234 int array_numMatchesReturned; 27235 array_numMatchesReturned = rv_buf.getInt(0); 27236 array = new LineMatch[array_numMatchesReturned]; 27237 if (array_numMatchesReturned > 0 && array_addr != 0) { 27238 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned * 40); 27239 for (int i = 0, off = 0; i < array_numMatchesReturned; i++, off += 40) { 27240 array[i] = new LineMatch(bb, off); 27241 array[i].read(); 27242 } 27243 } 27244 } 27245 27246 @Override 27247 protected void finalize() throws Throwable { 27248 imaqDispose(array_addr); 27249 super.finalize(); 27250 } 27251 } 27252 27253 public static DetectLinesResult imaqDetectLines(Image image, LineDescriptor lineDescriptor, 27254 CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 27255 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27256 long rv_addr = getByteBufferAddress(rv_buf); 27257 long jn_rv = 27258 _imaqDetectLines(image.getAddress(), lineDescriptor.getAddress(), 27259 curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), 27260 rv_addr + 0); 27261 DetectLinesResult rv = new DetectLinesResult(rv_buf, jn_rv); 27262 return rv; 27263 } 27264 27265 private static native long _imaqDetectLines(long image, long lineDescriptor, long curveOptions, 27266 long shapeDetectionOptions, long roi, long numMatchesReturned); 27267 27268 public static class DetectRectanglesResult { 27269 public RectangleMatch[] array; 27270 private long array_addr; 27271 27272 private DetectRectanglesResult(ByteBuffer rv_buf, long jn_rv) { 27273 array_addr = jn_rv; 27274 int array_numMatchesReturned; 27275 array_numMatchesReturned = rv_buf.getInt(0); 27276 array = new RectangleMatch[array_numMatchesReturned]; 27277 if (array_numMatchesReturned > 0 && array_addr != 0) { 27278 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned * 64); 27279 for (int i = 0, off = 0; i < array_numMatchesReturned; i++, off += 64) { 27280 array[i] = new RectangleMatch(bb, off); 27281 array[i].read(); 27282 } 27283 } 27284 } 27285 27286 @Override 27287 protected void finalize() throws Throwable { 27288 imaqDispose(array_addr); 27289 super.finalize(); 27290 } 27291 } 27292 27293 public static DetectRectanglesResult imaqDetectRectangles(Image image, 27294 RectangleDescriptor rectangleDescriptor, CurveOptions curveOptions, 27295 ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 27296 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27297 long rv_addr = getByteBufferAddress(rv_buf); 27298 long jn_rv = 27299 _imaqDetectRectangles(image.getAddress(), rectangleDescriptor.getAddress(), 27300 curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), 27301 rv_addr + 0); 27302 DetectRectanglesResult rv = new DetectRectanglesResult(rv_buf, jn_rv); 27303 return rv; 27304 } 27305 27306 private static native long _imaqDetectRectangles(long image, long rectangleDescriptor, 27307 long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 27308 27309 public static class GetGeometricFeaturesFromCurvesResult { 27310 public FeatureData[] array; 27311 private long array_addr; 27312 27313 private GetGeometricFeaturesFromCurvesResult(ByteBuffer rv_buf, long jn_rv) { 27314 array_addr = jn_rv; 27315 int array_numFeatures; 27316 array_numFeatures = rv_buf.getInt(0); 27317 array = new FeatureData[array_numFeatures]; 27318 if (array_numFeatures > 0 && array_addr != 0) { 27319 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numFeatures * 16); 27320 for (int i = 0, off = 0; i < array_numFeatures; i++, off += 16) { 27321 array[i] = new FeatureData(bb, off); 27322 array[i].read(); 27323 } 27324 } 27325 } 27326 27327 @Override 27328 protected void finalize() throws Throwable { 27329 imaqDispose(array_addr); 27330 super.finalize(); 27331 } 27332 } 27333 27334 public static GetGeometricFeaturesFromCurvesResult imaqGetGeometricFeaturesFromCurves( 27335 Curve[] curves, FeatureType[] featureTypes) { 27336 int numCurves = curves.length; 27337 ByteBuffer curves_buf = null; 27338 curves_buf = ByteBuffer.allocateDirect(curves.length * 48).order(ByteOrder.nativeOrder()); 27339 for (int i = 0, off = 0; i < curves.length; i++, off += 48) { 27340 curves[i].setBuffer(curves_buf, off); 27341 curves[i].write(); 27342 } 27343 int numFeatureTypes = featureTypes.length; 27344 ByteBuffer featureTypes_buf = null; 27345 featureTypes_buf = 27346 ByteBuffer.allocateDirect(featureTypes.length * 4).order(ByteOrder.nativeOrder()); 27347 for (int i = 0, off = 0; i < featureTypes.length; i++, off += 4) { 27348 if (featureTypes != null) 27349 featureTypes_buf.putInt(off, featureTypes[i].getValue()); 27350 } 27351 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27352 long rv_addr = getByteBufferAddress(rv_buf); 27353 long jn_rv = 27354 _imaqGetGeometricFeaturesFromCurves(getByteBufferAddress(curves_buf), numCurves, 27355 getByteBufferAddress(featureTypes_buf), numFeatureTypes, rv_addr + 0); 27356 GetGeometricFeaturesFromCurvesResult rv = 27357 new GetGeometricFeaturesFromCurvesResult(rv_buf, jn_rv); 27358 return rv; 27359 } 27360 27361 private static native long _imaqGetGeometricFeaturesFromCurves(long curves, int numCurves, 27362 long featureTypes, int numFeatureTypes, long numFeatures); 27363 27364 public static class GetGeometricTemplateFeatureInfoResult { 27365 public FeatureData[] array; 27366 private long array_addr; 27367 27368 private GetGeometricTemplateFeatureInfoResult(ByteBuffer rv_buf, long jn_rv) { 27369 array_addr = jn_rv; 27370 int array_numFeatures; 27371 array_numFeatures = rv_buf.getInt(0); 27372 array = new FeatureData[array_numFeatures]; 27373 if (array_numFeatures > 0 && array_addr != 0) { 27374 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numFeatures * 16); 27375 for (int i = 0, off = 0; i < array_numFeatures; i++, off += 16) { 27376 array[i] = new FeatureData(bb, off); 27377 array[i].read(); 27378 } 27379 } 27380 } 27381 27382 @Override 27383 protected void finalize() throws Throwable { 27384 imaqDispose(array_addr); 27385 super.finalize(); 27386 } 27387 } 27388 27389 public static GetGeometricTemplateFeatureInfoResult imaqGetGeometricTemplateFeatureInfo( 27390 Image pattern) { 27391 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27392 long rv_addr = getByteBufferAddress(rv_buf); 27393 long jn_rv = _imaqGetGeometricTemplateFeatureInfo(pattern.getAddress(), rv_addr + 0); 27394 GetGeometricTemplateFeatureInfoResult rv = 27395 new GetGeometricTemplateFeatureInfoResult(rv_buf, jn_rv); 27396 return rv; 27397 } 27398 27399 private static native long _imaqGetGeometricTemplateFeatureInfo(long pattern, long numFeatures); 27400 27401 public static void imaqLearnColorPattern(Image image, LearnColorPatternOptions options) { 27402 27403 _imaqLearnColorPattern(image.getAddress(), options.getAddress()); 27404 27405 } 27406 27407 private static native void _imaqLearnColorPattern(long image, long options); 27408 27409 public static void imaqLearnGeometricPattern(Image image, PointFloat originOffset, 27410 CurveOptions curveOptions, LearnGeometricPatternAdvancedOptions advancedLearnOptions, 27411 Image mask) { 27412 27413 _imaqLearnGeometricPattern(image.getAddress(), originOffset.getAddress(), 27414 curveOptions.getAddress(), advancedLearnOptions.getAddress(), mask.getAddress()); 27415 27416 } 27417 27418 private static native void _imaqLearnGeometricPattern(long image, long originOffset, 27419 long curveOptions, long advancedLearnOptions, long mask); 27420 27421 public static LearnPatternAdvancedOptions imaqLearnPattern3(Image image, 27422 LearningMode learningMode, Image mask) { 27423 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27424 long rv_addr = getByteBufferAddress(rv_buf); 27425 _imaqLearnPattern3(image.getAddress(), learningMode.getValue(), rv_addr + 0, mask.getAddress()); 27426 LearnPatternAdvancedOptions advancedOptions; 27427 advancedOptions = new LearnPatternAdvancedOptions(rv_buf, 0); 27428 advancedOptions.read(); 27429 return advancedOptions; 27430 } 27431 27432 private static native void _imaqLearnPattern3(long image, int learningMode, long advancedOptions, 27433 long mask); 27434 27435 public static class MatchColorPatternResult { 27436 public PatternMatch[] array; 27437 private long array_addr; 27438 27439 private MatchColorPatternResult(ByteBuffer rv_buf, long jn_rv) { 27440 array_addr = jn_rv; 27441 int array_numMatches; 27442 array_numMatches = rv_buf.getInt(0); 27443 array = new PatternMatch[array_numMatches]; 27444 if (array_numMatches > 0 && array_addr != 0) { 27445 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 52); 27446 for (int i = 0, off = 0; i < array_numMatches; i++, off += 52) { 27447 array[i] = new PatternMatch(bb, off); 27448 array[i].read(); 27449 } 27450 } 27451 } 27452 27453 @Override 27454 protected void finalize() throws Throwable { 27455 imaqDispose(array_addr); 27456 super.finalize(); 27457 } 27458 } 27459 27460 public static MatchColorPatternResult imaqMatchColorPattern(Image image, Image pattern, 27461 MatchColorPatternOptions options, Rect searchRect) { 27462 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27463 long rv_addr = getByteBufferAddress(rv_buf); 27464 long jn_rv = 27465 _imaqMatchColorPattern(image.getAddress(), pattern.getAddress(), options.getAddress(), 27466 searchRect.getAddress(), rv_addr + 0); 27467 MatchColorPatternResult rv = new MatchColorPatternResult(rv_buf, jn_rv); 27468 return rv; 27469 } 27470 27471 private static native long _imaqMatchColorPattern(long image, long pattern, long options, 27472 long searchRect, long numMatches); 27473 27474 public static class MatchGeometricPattern2Result { 27475 public GeometricPatternMatch2[] array; 27476 private long array_addr; 27477 27478 private MatchGeometricPattern2Result(ByteBuffer rv_buf, long jn_rv) { 27479 array_addr = jn_rv; 27480 int array_numMatches; 27481 array_numMatches = rv_buf.getInt(0); 27482 array = new GeometricPatternMatch2[array_numMatches]; 27483 if (array_numMatches > 0 && array_addr != 0) { 27484 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 380); 27485 for (int i = 0, off = 0; i < array_numMatches; i++, off += 380) { 27486 array[i] = new GeometricPatternMatch2(bb, off); 27487 array[i].read(); 27488 } 27489 } 27490 } 27491 27492 @Override 27493 protected void finalize() throws Throwable { 27494 imaqDispose(array_addr); 27495 super.finalize(); 27496 } 27497 } 27498 27499 public static MatchGeometricPattern2Result imaqMatchGeometricPattern2(Image image, Image pattern, 27500 CurveOptions curveOptions, MatchGeometricPatternOptions matchOptions, 27501 MatchGeometricPatternAdvancedOptions2 advancedMatchOptions, ROI roi) { 27502 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27503 long rv_addr = getByteBufferAddress(rv_buf); 27504 long jn_rv = 27505 _imaqMatchGeometricPattern2(image.getAddress(), pattern.getAddress(), 27506 curveOptions.getAddress(), matchOptions.getAddress(), 27507 advancedMatchOptions.getAddress(), roi.getAddress(), rv_addr + 0); 27508 MatchGeometricPattern2Result rv = new MatchGeometricPattern2Result(rv_buf, jn_rv); 27509 return rv; 27510 } 27511 27512 private static native long _imaqMatchGeometricPattern2(long image, long pattern, 27513 long curveOptions, long matchOptions, long advancedMatchOptions, long roi, long numMatches); 27514 27515 public static class MatchMultipleGeometricPatternsResult { 27516 public GeometricPatternMatch2[] array; 27517 private long array_addr; 27518 27519 private MatchMultipleGeometricPatternsResult(ByteBuffer rv_buf, long jn_rv) { 27520 array_addr = jn_rv; 27521 int array_numMatches; 27522 array_numMatches = rv_buf.getInt(0); 27523 array = new GeometricPatternMatch2[array_numMatches]; 27524 if (array_numMatches > 0 && array_addr != 0) { 27525 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 380); 27526 for (int i = 0, off = 0; i < array_numMatches; i++, off += 380) { 27527 array[i] = new GeometricPatternMatch2(bb, off); 27528 array[i].read(); 27529 } 27530 } 27531 } 27532 27533 @Override 27534 protected void finalize() throws Throwable { 27535 imaqDispose(array_addr); 27536 super.finalize(); 27537 } 27538 } 27539 27540 public static MatchMultipleGeometricPatternsResult imaqMatchMultipleGeometricPatterns( 27541 Image image, MultipleGeometricPattern multiplePattern, ROI roi) { 27542 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27543 long rv_addr = getByteBufferAddress(rv_buf); 27544 long jn_rv = 27545 _imaqMatchMultipleGeometricPatterns(image.getAddress(), multiplePattern.getAddress(), 27546 roi.getAddress(), rv_addr + 0); 27547 MatchMultipleGeometricPatternsResult rv = 27548 new MatchMultipleGeometricPatternsResult(rv_buf, jn_rv); 27549 return rv; 27550 } 27551 27552 private static native long _imaqMatchMultipleGeometricPatterns(long image, long multiplePattern, 27553 long roi, long numMatches); 27554 27555 public static MultipleGeometricPattern imaqReadMultipleGeometricPatternFile(String fileName, 27556 String description) { 27557 ByteBuffer fileName_buf = null; 27558 if (fileName != null) { 27559 byte[] fileName_bytes; 27560 try { 27561 fileName_bytes = fileName.getBytes("UTF-8"); 27562 } catch (UnsupportedEncodingException e) { 27563 fileName_bytes = new byte[0]; 27564 } 27565 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 27566 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 27567 (byte) 0); 27568 } 27569 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 27570 if (description != null) { 27571 byte[] bytes; 27572 try { 27573 bytes = description.getBytes("UTF-8"); 27574 } catch (UnsupportedEncodingException e) { 27575 bytes = new byte[0]; 27576 } 27577 putBytes(description_buf, bytes, 0, bytes.length); 27578 for (int i = bytes.length; i < 256; i++) 27579 description_buf.put(i, (byte) 0); // fill with zero 27580 } 27581 long jn_rv = 27582 _imaqReadMultipleGeometricPatternFile(fileName == null ? 0 27583 : getByteBufferAddress(fileName_buf), description == null ? 0 27584 : getByteBufferAddress(description_buf)); 27585 27586 return new MultipleGeometricPattern(jn_rv, true); 27587 } 27588 27589 private static native long _imaqReadMultipleGeometricPatternFile(long fileName, long description); 27590 27591 public static class RefineMatchesResult { 27592 public MatchPatternOptions options; 27593 public MatchPatternAdvancedOptions advancedOptions; 27594 public PatternMatch[] array; 27595 private long array_addr; 27596 27597 private RefineMatchesResult(ByteBuffer rv_buf, long jn_rv) { 27598 array_addr = jn_rv; 27599 options = new MatchPatternOptions(rv_buf, 0); 27600 options.read(); 27601 advancedOptions = new MatchPatternAdvancedOptions(rv_buf, 8); 27602 advancedOptions.read(); 27603 int array_numCandidatesOut; 27604 array_numCandidatesOut = rv_buf.getInt(16); 27605 array = new PatternMatch[array_numCandidatesOut]; 27606 if (array_numCandidatesOut > 0 && array_addr != 0) { 27607 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCandidatesOut * 52); 27608 for (int i = 0, off = 0; i < array_numCandidatesOut; i++, off += 52) { 27609 array[i] = new PatternMatch(bb, off); 27610 array[i].read(); 27611 } 27612 } 27613 } 27614 27615 @Override 27616 protected void finalize() throws Throwable { 27617 imaqDispose(array_addr); 27618 super.finalize(); 27619 } 27620 } 27621 27622 public static RefineMatchesResult imaqRefineMatches(Image image, Image pattern, 27623 PatternMatch[] candidatesIn) { 27624 int numCandidatesIn = candidatesIn.length; 27625 ByteBuffer candidatesIn_buf = null; 27626 candidatesIn_buf = 27627 ByteBuffer.allocateDirect(candidatesIn.length * 52).order(ByteOrder.nativeOrder()); 27628 for (int i = 0, off = 0; i < candidatesIn.length; i++, off += 52) { 27629 candidatesIn[i].setBuffer(candidatesIn_buf, off); 27630 candidatesIn[i].write(); 27631 } 27632 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8 + 8).order(ByteOrder.nativeOrder()); 27633 long rv_addr = getByteBufferAddress(rv_buf); 27634 long jn_rv = 27635 _imaqRefineMatches(image.getAddress(), pattern.getAddress(), 27636 getByteBufferAddress(candidatesIn_buf), numCandidatesIn, rv_addr + 0, rv_addr + 8, 27637 rv_addr + 16); 27638 RefineMatchesResult rv = new RefineMatchesResult(rv_buf, jn_rv); 27639 return rv; 27640 } 27641 27642 private static native long _imaqRefineMatches(long image, long pattern, long candidatesIn, 27643 int numCandidatesIn, long options, long advancedOptions, long numCandidatesOut); 27644 27645 public static void imaqSetMultipleGeometricPatternsOptions( 27646 MultipleGeometricPattern multiplePattern, String label, CurveOptions curveOptions, 27647 MatchGeometricPatternOptions matchOptions, 27648 MatchGeometricPatternAdvancedOptions2 advancedMatchOptions) { 27649 ByteBuffer label_buf = null; 27650 if (label != null) { 27651 byte[] label_bytes; 27652 try { 27653 label_bytes = label.getBytes("UTF-8"); 27654 } catch (UnsupportedEncodingException e) { 27655 label_bytes = new byte[0]; 27656 } 27657 label_buf = ByteBuffer.allocateDirect(label_bytes.length + 1); 27658 putBytes(label_buf, label_bytes, 0, label_bytes.length).put(label_bytes.length, (byte) 0); 27659 } 27660 _imaqSetMultipleGeometricPatternsOptions(multiplePattern.getAddress(), label == null ? 0 27661 : getByteBufferAddress(label_buf), curveOptions.getAddress(), matchOptions.getAddress(), 27662 advancedMatchOptions.getAddress()); 27663 27664 } 27665 27666 private static native void _imaqSetMultipleGeometricPatternsOptions(long multiplePattern, 27667 long label, long curveOptions, long matchOptions, long advancedMatchOptions); 27668 27669 public static void imaqWriteMultipleGeometricPatternFile( 27670 MultipleGeometricPattern multiplePattern, String fileName, String description) { 27671 ByteBuffer fileName_buf = null; 27672 if (fileName != null) { 27673 byte[] fileName_bytes; 27674 try { 27675 fileName_bytes = fileName.getBytes("UTF-8"); 27676 } catch (UnsupportedEncodingException e) { 27677 fileName_bytes = new byte[0]; 27678 } 27679 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 27680 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 27681 (byte) 0); 27682 } 27683 ByteBuffer description_buf = null; 27684 if (description != null) { 27685 byte[] description_bytes; 27686 try { 27687 description_bytes = description.getBytes("UTF-8"); 27688 } catch (UnsupportedEncodingException e) { 27689 description_bytes = new byte[0]; 27690 } 27691 description_buf = ByteBuffer.allocateDirect(description_bytes.length + 1); 27692 putBytes(description_buf, description_bytes, 0, description_bytes.length).put( 27693 description_bytes.length, (byte) 0); 27694 } 27695 _imaqWriteMultipleGeometricPatternFile(multiplePattern.getAddress(), fileName == null ? 0 27696 : getByteBufferAddress(fileName_buf), description == null ? 0 27697 : getByteBufferAddress(description_buf)); 27698 27699 } 27700 27701 private static native void _imaqWriteMultipleGeometricPatternFile(long multiplePattern, 27702 long fileName, long description); 27703 27704 public static class MatchGeometricPattern3Result { 27705 public GeometricPatternMatch3[] array; 27706 private long array_addr; 27707 27708 private MatchGeometricPattern3Result(ByteBuffer rv_buf, long jn_rv) { 27709 array_addr = jn_rv; 27710 int array_numMatches; 27711 array_numMatches = rv_buf.getInt(0); 27712 array = new GeometricPatternMatch3[array_numMatches]; 27713 if (array_numMatches > 0 && array_addr != 0) { 27714 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 116); 27715 for (int i = 0, off = 0; i < array_numMatches; i++, off += 116) { 27716 array[i] = new GeometricPatternMatch3(bb, off); 27717 array[i].read(); 27718 } 27719 } 27720 } 27721 27722 @Override 27723 protected void finalize() throws Throwable { 27724 imaqDispose(array_addr); 27725 super.finalize(); 27726 } 27727 } 27728 27729 public static MatchGeometricPattern3Result imaqMatchGeometricPattern3(Image image, Image pattern, 27730 CurveOptions curveOptions, MatchGeometricPatternOptions matchOptions, 27731 MatchGeometricPatternAdvancedOptions3 advancedMatchOptions, ROI roi) { 27732 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27733 long rv_addr = getByteBufferAddress(rv_buf); 27734 long jn_rv = 27735 _imaqMatchGeometricPattern3(image.getAddress(), pattern.getAddress(), 27736 curveOptions.getAddress(), matchOptions.getAddress(), 27737 advancedMatchOptions.getAddress(), roi.getAddress(), rv_addr + 0); 27738 MatchGeometricPattern3Result rv = new MatchGeometricPattern3Result(rv_buf, jn_rv); 27739 return rv; 27740 } 27741 27742 private static native long _imaqMatchGeometricPattern3(long image, long pattern, 27743 long curveOptions, long matchOptions, long advancedMatchOptions, long roi, long numMatches); 27744 27745 public static void imaqLearnGeometricPattern2(Image image, PointFloat originOffset, 27746 double angleOffset, CurveOptions curveOptions, 27747 LearnGeometricPatternAdvancedOptions2 advancedLearnOptions, Image mask) { 27748 27749 _imaqLearnGeometricPattern2(image.getAddress(), originOffset.getAddress(), angleOffset, 27750 curveOptions.getAddress(), advancedLearnOptions.getAddress(), mask.getAddress()); 27751 27752 } 27753 27754 private static native void _imaqLearnGeometricPattern2(long image, long originOffset, 27755 double angleOffset, long curveOptions, long advancedLearnOptions, long mask); 27756 27757 public static class MatchPattern3Result { 27758 public PatternMatch[] array; 27759 private long array_addr; 27760 27761 private MatchPattern3Result(ByteBuffer rv_buf, long jn_rv) { 27762 array_addr = jn_rv; 27763 int array_numMatches; 27764 array_numMatches = rv_buf.getInt(0); 27765 array = new PatternMatch[array_numMatches]; 27766 if (array_numMatches > 0 && array_addr != 0) { 27767 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 52); 27768 for (int i = 0, off = 0; i < array_numMatches; i++, off += 52) { 27769 array[i] = new PatternMatch(bb, off); 27770 array[i].read(); 27771 } 27772 } 27773 } 27774 27775 @Override 27776 protected void finalize() throws Throwable { 27777 imaqDispose(array_addr); 27778 super.finalize(); 27779 } 27780 } 27781 27782 public static MatchPattern3Result imaqMatchPattern3(Image image, Image pattern, 27783 MatchPatternOptions options, MatchPatternAdvancedOptions advancedOptions, ROI roi) { 27784 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27785 long rv_addr = getByteBufferAddress(rv_buf); 27786 long jn_rv = 27787 _imaqMatchPattern3(image.getAddress(), pattern.getAddress(), 27788 options == null ? 0 : options.getAddress(), advancedOptions.getAddress(), 27789 roi.getAddress(), rv_addr + 0); 27790 MatchPattern3Result rv = new MatchPattern3Result(rv_buf, jn_rv); 27791 return rv; 27792 } 27793 27794 private static native long _imaqMatchPattern3(long image, long pattern, long options, 27795 long advancedOptions, long roi, long numMatches); 27796 27797 /** 27798 * Overlay functions 27799 */ 27800 27801 public static void imaqClearOverlay(Image image, String group) { 27802 ByteBuffer group_buf = null; 27803 if (group != null) { 27804 byte[] group_bytes; 27805 try { 27806 group_bytes = group.getBytes("UTF-8"); 27807 } catch (UnsupportedEncodingException e) { 27808 group_bytes = new byte[0]; 27809 } 27810 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27811 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27812 } 27813 _imaqClearOverlay(image.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 27814 27815 } 27816 27817 private static native void _imaqClearOverlay(long image, long group); 27818 27819 public static void imaqCopyOverlay(Image dest, Image source, String group) { 27820 ByteBuffer group_buf = null; 27821 if (group != null) { 27822 byte[] group_bytes; 27823 try { 27824 group_bytes = group.getBytes("UTF-8"); 27825 } catch (UnsupportedEncodingException e) { 27826 group_bytes = new byte[0]; 27827 } 27828 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27829 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27830 } 27831 _imaqCopyOverlay(dest.getAddress(), source.getAddress(), group == null ? 0 27832 : getByteBufferAddress(group_buf)); 27833 27834 } 27835 27836 private static native void _imaqCopyOverlay(long dest, long source, long group); 27837 27838 public static TransformBehaviors imaqGetOverlayProperties(Image image, String group) { 27839 ByteBuffer group_buf = null; 27840 if (group != null) { 27841 byte[] group_bytes; 27842 try { 27843 group_bytes = group.getBytes("UTF-8"); 27844 } catch (UnsupportedEncodingException e) { 27845 group_bytes = new byte[0]; 27846 } 27847 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27848 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27849 } 27850 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 27851 long rv_addr = getByteBufferAddress(rv_buf); 27852 _imaqGetOverlayProperties(image.getAddress(), group == null ? 0 27853 : getByteBufferAddress(group_buf), rv_addr + 0); 27854 TransformBehaviors transformBehaviors; 27855 transformBehaviors = new TransformBehaviors(rv_buf, 0); 27856 transformBehaviors.read(); 27857 return transformBehaviors; 27858 } 27859 27860 private static native void _imaqGetOverlayProperties(long image, long group, 27861 long transformBehaviors); 27862 27863 public static void imaqMergeOverlay(Image dest, Image source, RGBValue[] palette, String group) { 27864 int numColors = palette.length; 27865 ByteBuffer palette_buf = null; 27866 palette_buf = ByteBuffer.allocateDirect(palette.length * 4).order(ByteOrder.nativeOrder()); 27867 for (int i = 0, off = 0; i < palette.length; i++, off += 4) { 27868 palette[i].setBuffer(palette_buf, off); 27869 palette[i].write(); 27870 } 27871 ByteBuffer group_buf = null; 27872 if (group != null) { 27873 byte[] group_bytes; 27874 try { 27875 group_bytes = group.getBytes("UTF-8"); 27876 } catch (UnsupportedEncodingException e) { 27877 group_bytes = new byte[0]; 27878 } 27879 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27880 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27881 } 27882 _imaqMergeOverlay(dest.getAddress(), source.getAddress(), getByteBufferAddress(palette_buf), 27883 numColors, group == null ? 0 : getByteBufferAddress(group_buf)); 27884 27885 } 27886 27887 private static native void _imaqMergeOverlay(long dest, long source, long palette, int numColors, 27888 long group); 27889 27890 public static void imaqOverlayArc(Image image, ArcInfo arc, RGBValue color, DrawMode drawMode, 27891 String group) { 27892 ByteBuffer group_buf = null; 27893 if (group != null) { 27894 byte[] group_bytes; 27895 try { 27896 group_bytes = group.getBytes("UTF-8"); 27897 } catch (UnsupportedEncodingException e) { 27898 group_bytes = new byte[0]; 27899 } 27900 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27901 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27902 } 27903 _imaqOverlayArc(image.getAddress(), arc.getAddress(), color.getAddress(), drawMode.getValue(), 27904 group == null ? 0 : getByteBufferAddress(group_buf)); 27905 27906 } 27907 27908 private static native void _imaqOverlayArc(long image, long arc, long color, int drawMode, 27909 long group); 27910 27911 public static void imaqOverlayBitmap(Image image, Point destLoc, RGBValue bitmap, int numCols, 27912 int numRows, String group) { 27913 ByteBuffer group_buf = null; 27914 if (group != null) { 27915 byte[] group_bytes; 27916 try { 27917 group_bytes = group.getBytes("UTF-8"); 27918 } catch (UnsupportedEncodingException e) { 27919 group_bytes = new byte[0]; 27920 } 27921 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27922 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27923 } 27924 _imaqOverlayBitmap(image.getAddress(), destLoc.getAddress(), bitmap.getAddress(), numCols, 27925 numRows, group == null ? 0 : getByteBufferAddress(group_buf)); 27926 27927 } 27928 27929 private static native void _imaqOverlayBitmap(long image, long destLoc, long bitmap, int numCols, 27930 int numRows, long group); 27931 27932 public static void imaqOverlayClosedContour(Image image, Point[] points, RGBValue color, 27933 DrawMode drawMode, String group) { 27934 int numPoints = points.length; 27935 ByteBuffer points_buf = null; 27936 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 27937 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 27938 points[i].setBuffer(points_buf, off); 27939 points[i].write(); 27940 } 27941 ByteBuffer group_buf = null; 27942 if (group != null) { 27943 byte[] group_bytes; 27944 try { 27945 group_bytes = group.getBytes("UTF-8"); 27946 } catch (UnsupportedEncodingException e) { 27947 group_bytes = new byte[0]; 27948 } 27949 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27950 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27951 } 27952 _imaqOverlayClosedContour(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 27953 color.getAddress(), drawMode.getValue(), group == null ? 0 27954 : getByteBufferAddress(group_buf)); 27955 27956 } 27957 27958 private static native void _imaqOverlayClosedContour(long image, long points, int numPoints, 27959 long color, int drawMode, long group); 27960 27961 public static void imaqOverlayLine(Image image, Point start, Point end, RGBValue color, 27962 String group) { 27963 ByteBuffer group_buf = null; 27964 if (group != null) { 27965 byte[] group_bytes; 27966 try { 27967 group_bytes = group.getBytes("UTF-8"); 27968 } catch (UnsupportedEncodingException e) { 27969 group_bytes = new byte[0]; 27970 } 27971 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 27972 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 27973 } 27974 _imaqOverlayLine(image.getAddress(), start.getAddress(), end.getAddress(), color.getAddress(), 27975 group == null ? 0 : getByteBufferAddress(group_buf)); 27976 27977 } 27978 27979 private static native void _imaqOverlayLine(long image, long start, long end, long color, 27980 long group); 27981 27982 public static void imaqOverlayOpenContour(Image image, Point[] points, RGBValue color, 27983 String group) { 27984 int numPoints = points.length; 27985 ByteBuffer points_buf = null; 27986 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 27987 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 27988 points[i].setBuffer(points_buf, off); 27989 points[i].write(); 27990 } 27991 ByteBuffer group_buf = null; 27992 if (group != null) { 27993 byte[] group_bytes; 27994 try { 27995 group_bytes = group.getBytes("UTF-8"); 27996 } catch (UnsupportedEncodingException e) { 27997 group_bytes = new byte[0]; 27998 } 27999 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28000 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28001 } 28002 _imaqOverlayOpenContour(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 28003 color.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 28004 28005 } 28006 28007 private static native void _imaqOverlayOpenContour(long image, long points, int numPoints, 28008 long color, long group); 28009 28010 public static byte imaqOverlayOval(Image image, Rect boundingBox, RGBValue color, 28011 DrawMode drawMode) { 28012 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28013 long rv_addr = getByteBufferAddress(rv_buf); 28014 _imaqOverlayOval(image.getAddress(), boundingBox.getAddress(), color.getAddress(), 28015 drawMode.getValue(), rv_addr + 0); 28016 byte group; 28017 group = rv_buf.get(0); 28018 return group; 28019 } 28020 28021 private static native void _imaqOverlayOval(long image, long boundingBox, long color, 28022 int drawMode, long group); 28023 28024 public static void imaqOverlayPoints(Image image, Point[] points, RGBValue[] colors, 28025 PointSymbol symbol, UserPointSymbol userSymbol, String group) { 28026 int numPoints = points.length; 28027 ByteBuffer points_buf = null; 28028 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 28029 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 28030 points[i].setBuffer(points_buf, off); 28031 points[i].write(); 28032 } 28033 int numColors = colors.length; 28034 ByteBuffer colors_buf = null; 28035 colors_buf = ByteBuffer.allocateDirect(colors.length * 4).order(ByteOrder.nativeOrder()); 28036 for (int i = 0, off = 0; i < colors.length; i++, off += 4) { 28037 colors[i].setBuffer(colors_buf, off); 28038 colors[i].write(); 28039 } 28040 ByteBuffer group_buf = null; 28041 if (group != null) { 28042 byte[] group_bytes; 28043 try { 28044 group_bytes = group.getBytes("UTF-8"); 28045 } catch (UnsupportedEncodingException e) { 28046 group_bytes = new byte[0]; 28047 } 28048 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28049 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28050 } 28051 _imaqOverlayPoints(image.getAddress(), getByteBufferAddress(points_buf), numPoints, 28052 getByteBufferAddress(colors_buf), numColors, symbol.getValue(), userSymbol.getAddress(), 28053 group == null ? 0 : getByteBufferAddress(group_buf)); 28054 28055 } 28056 28057 private static native void _imaqOverlayPoints(long image, long points, int numPoints, 28058 long colors, int numColors, int symbol, long userSymbol, long group); 28059 28060 public static void imaqOverlayRect(Image image, Rect rect, RGBValue color, DrawMode drawMode, 28061 String group) { 28062 ByteBuffer group_buf = null; 28063 if (group != null) { 28064 byte[] group_bytes; 28065 try { 28066 group_bytes = group.getBytes("UTF-8"); 28067 } catch (UnsupportedEncodingException e) { 28068 group_bytes = new byte[0]; 28069 } 28070 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28071 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28072 } 28073 _imaqOverlayRect(image.getAddress(), rect.getAddress(), color.getAddress(), 28074 drawMode.getValue(), group == null ? 0 : getByteBufferAddress(group_buf)); 28075 28076 } 28077 28078 private static native void _imaqOverlayRect(long image, long rect, long color, int drawMode, 28079 long group); 28080 28081 public static void imaqOverlayROI(Image image, ROI roi, PointSymbol symbol, 28082 UserPointSymbol userSymbol, String group) { 28083 ByteBuffer group_buf = null; 28084 if (group != null) { 28085 byte[] group_bytes; 28086 try { 28087 group_bytes = group.getBytes("UTF-8"); 28088 } catch (UnsupportedEncodingException e) { 28089 group_bytes = new byte[0]; 28090 } 28091 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28092 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28093 } 28094 _imaqOverlayROI(image.getAddress(), roi.getAddress(), symbol.getValue(), 28095 userSymbol.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 28096 28097 } 28098 28099 private static native void _imaqOverlayROI(long image, long roi, int symbol, long userSymbol, 28100 long group); 28101 28102 public static void imaqOverlayText(Image image, Point origin, String text, RGBValue color, 28103 OverlayTextOptions options, String group) { 28104 ByteBuffer text_buf = null; 28105 if (text != null) { 28106 byte[] text_bytes; 28107 try { 28108 text_bytes = text.getBytes("UTF-8"); 28109 } catch (UnsupportedEncodingException e) { 28110 text_bytes = new byte[0]; 28111 } 28112 text_buf = ByteBuffer.allocateDirect(text_bytes.length + 1); 28113 putBytes(text_buf, text_bytes, 0, text_bytes.length).put(text_bytes.length, (byte) 0); 28114 } 28115 ByteBuffer group_buf = null; 28116 if (group != null) { 28117 byte[] group_bytes; 28118 try { 28119 group_bytes = group.getBytes("UTF-8"); 28120 } catch (UnsupportedEncodingException e) { 28121 group_bytes = new byte[0]; 28122 } 28123 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28124 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28125 } 28126 _imaqOverlayText(image.getAddress(), origin.getAddress(), text == null ? 0 28127 : getByteBufferAddress(text_buf), color.getAddress(), options.getAddress(), 28128 group == null ? 0 : getByteBufferAddress(group_buf)); 28129 28130 } 28131 28132 private static native void _imaqOverlayText(long image, long origin, long text, long color, 28133 long options, long group); 28134 28135 public static TransformBehaviors imaqSetOverlayProperties(Image image, String group) { 28136 ByteBuffer group_buf = null; 28137 if (group != null) { 28138 byte[] group_bytes; 28139 try { 28140 group_bytes = group.getBytes("UTF-8"); 28141 } catch (UnsupportedEncodingException e) { 28142 group_bytes = new byte[0]; 28143 } 28144 group_buf = ByteBuffer.allocateDirect(group_bytes.length + 1); 28145 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte) 0); 28146 } 28147 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28148 long rv_addr = getByteBufferAddress(rv_buf); 28149 _imaqSetOverlayProperties(image.getAddress(), group == null ? 0 28150 : getByteBufferAddress(group_buf), rv_addr + 0); 28151 TransformBehaviors transformBehaviors; 28152 transformBehaviors = new TransformBehaviors(rv_buf, 0); 28153 transformBehaviors.read(); 28154 return transformBehaviors; 28155 } 28156 28157 private static native void _imaqSetOverlayProperties(long image, long group, 28158 long transformBehaviors); 28159 28160 /** 28161 * OCR functions 28162 */ 28163 28164 public static CharSet imaqCreateCharSet() { 28165 28166 long jn_rv = _imaqCreateCharSet(); 28167 28168 return new CharSet(jn_rv, true); 28169 } 28170 28171 private static native long _imaqCreateCharSet(); 28172 28173 public static void imaqDeleteChar(CharSet set, int index) { 28174 28175 _imaqDeleteChar(set.getAddress(), index); 28176 28177 } 28178 28179 private static native void _imaqDeleteChar(long set, int index); 28180 28181 public static void imaqGetCharCount(CharSet set) { 28182 28183 _imaqGetCharCount(set.getAddress()); 28184 28185 } 28186 28187 private static native void _imaqGetCharCount(long set); 28188 28189 public static CharInfo2 imaqGetCharInfo2(CharSet set, int index) { 28190 28191 long jn_rv = _imaqGetCharInfo2(set.getAddress(), index); 28192 28193 return new CharInfo2(jn_rv, true); 28194 } 28195 28196 private static native long _imaqGetCharInfo2(long set, int index); 28197 28198 public static class ReadOCRFileResult { 28199 public ReadTextOptions readOptions; 28200 public OCRProcessingOptions processingOptions; 28201 public OCRSpacingOptions spacingOptions; 28202 28203 private ReadOCRFileResult(ByteBuffer rv_buf) { 28204 readOptions = new ReadTextOptions(rv_buf, 0); 28205 readOptions.read(); 28206 processingOptions = new OCRProcessingOptions(rv_buf, 8); 28207 processingOptions.read(); 28208 spacingOptions = new OCRSpacingOptions(rv_buf, 16); 28209 spacingOptions.read(); 28210 } 28211 } 28212 28213 public static ReadOCRFileResult imaqReadOCRFile(String fileName, CharSet set, 28214 String setDescription) { 28215 ByteBuffer fileName_buf = null; 28216 if (fileName != null) { 28217 byte[] fileName_bytes; 28218 try { 28219 fileName_bytes = fileName.getBytes("UTF-8"); 28220 } catch (UnsupportedEncodingException e) { 28221 fileName_bytes = new byte[0]; 28222 } 28223 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 28224 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 28225 (byte) 0); 28226 } 28227 ByteBuffer setDescription_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 28228 if (setDescription != null) { 28229 byte[] bytes; 28230 try { 28231 bytes = setDescription.getBytes("UTF-8"); 28232 } catch (UnsupportedEncodingException e) { 28233 bytes = new byte[0]; 28234 } 28235 putBytes(setDescription_buf, bytes, 0, bytes.length); 28236 for (int i = bytes.length; i < 256; i++) 28237 setDescription_buf.put(i, (byte) 0); // fill with zero 28238 } 28239 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8 + 8).order(ByteOrder.nativeOrder()); 28240 long rv_addr = getByteBufferAddress(rv_buf); 28241 _imaqReadOCRFile(fileName == null ? 0 : getByteBufferAddress(fileName_buf), set.getAddress(), 28242 setDescription == null ? 0 : getByteBufferAddress(setDescription_buf), rv_addr + 0, 28243 rv_addr + 8, rv_addr + 16); 28244 ReadOCRFileResult rv = new ReadOCRFileResult(rv_buf); 28245 return rv; 28246 } 28247 28248 private static native void _imaqReadOCRFile(long fileName, long set, long setDescription, 28249 long readOptions, long processingOptions, long spacingOptions); 28250 28251 public static ReadTextReport3 imaqReadText3(Image image, CharSet set, ROI roi, 28252 ReadTextOptions readOptions, OCRProcessingOptions processingOptions, 28253 OCRSpacingOptions spacingOptions) { 28254 28255 long jn_rv = 28256 _imaqReadText3(image.getAddress(), set.getAddress(), roi.getAddress(), 28257 readOptions.getAddress(), processingOptions.getAddress(), spacingOptions.getAddress()); 28258 28259 return new ReadTextReport3(jn_rv, true); 28260 } 28261 28262 private static native long _imaqReadText3(long image, long set, long roi, long readOptions, 28263 long processingOptions, long spacingOptions); 28264 28265 public static void imaqRenameChar(CharSet set, int index, String newCharValue) { 28266 ByteBuffer newCharValue_buf = null; 28267 if (newCharValue != null) { 28268 byte[] newCharValue_bytes; 28269 try { 28270 newCharValue_bytes = newCharValue.getBytes("UTF-8"); 28271 } catch (UnsupportedEncodingException e) { 28272 newCharValue_bytes = new byte[0]; 28273 } 28274 newCharValue_buf = ByteBuffer.allocateDirect(newCharValue_bytes.length + 1); 28275 putBytes(newCharValue_buf, newCharValue_bytes, 0, newCharValue_bytes.length).put( 28276 newCharValue_bytes.length, (byte) 0); 28277 } 28278 _imaqRenameChar(set.getAddress(), index, newCharValue == null ? 0 28279 : getByteBufferAddress(newCharValue_buf)); 28280 28281 } 28282 28283 private static native void _imaqRenameChar(long set, int index, long newCharValue); 28284 28285 public static void imaqSetReferenceChar(CharSet set, int index, int isReferenceChar) { 28286 28287 _imaqSetReferenceChar(set.getAddress(), index, isReferenceChar); 28288 28289 } 28290 28291 private static native void _imaqSetReferenceChar(long set, int index, int isReferenceChar); 28292 28293 public static void imaqTrainChars(Image image, CharSet set, int index, String charValue, ROI roi, 28294 OCRProcessingOptions processingOptions, OCRSpacingOptions spacingOptions) { 28295 ByteBuffer charValue_buf = null; 28296 if (charValue != null) { 28297 byte[] charValue_bytes; 28298 try { 28299 charValue_bytes = charValue.getBytes("UTF-8"); 28300 } catch (UnsupportedEncodingException e) { 28301 charValue_bytes = new byte[0]; 28302 } 28303 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length + 1); 28304 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put( 28305 charValue_bytes.length, (byte) 0); 28306 } 28307 _imaqTrainChars(image.getAddress(), set.getAddress(), index, charValue == null ? 0 28308 : getByteBufferAddress(charValue_buf), roi.getAddress(), processingOptions.getAddress(), 28309 spacingOptions.getAddress()); 28310 28311 } 28312 28313 private static native void _imaqTrainChars(long image, long set, int index, long charValue, 28314 long roi, long processingOptions, long spacingOptions); 28315 28316 public static class VerifyTextResult { 28317 public int[] array; 28318 private long array_addr; 28319 28320 private VerifyTextResult(ByteBuffer rv_buf, long jn_rv) { 28321 array_addr = jn_rv; 28322 int array_numScores; 28323 array_numScores = rv_buf.getInt(0); 28324 array = new int[array_numScores]; 28325 if (array_numScores > 0 && array_addr != 0) { 28326 newDirectByteBuffer(array_addr, array_numScores * 4).asIntBuffer().get(array); 28327 } 28328 } 28329 28330 @Override 28331 protected void finalize() throws Throwable { 28332 imaqDispose(array_addr); 28333 super.finalize(); 28334 } 28335 } 28336 28337 public static VerifyTextResult imaqVerifyText(Image image, CharSet set, String expectedString, 28338 ROI roi) { 28339 ByteBuffer expectedString_buf = null; 28340 if (expectedString != null) { 28341 byte[] expectedString_bytes; 28342 try { 28343 expectedString_bytes = expectedString.getBytes("UTF-8"); 28344 } catch (UnsupportedEncodingException e) { 28345 expectedString_bytes = new byte[0]; 28346 } 28347 expectedString_buf = ByteBuffer.allocateDirect(expectedString_bytes.length + 1); 28348 putBytes(expectedString_buf, expectedString_bytes, 0, expectedString_bytes.length).put( 28349 expectedString_bytes.length, (byte) 0); 28350 } 28351 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28352 long rv_addr = getByteBufferAddress(rv_buf); 28353 long jn_rv = 28354 _imaqVerifyText(image.getAddress(), set.getAddress(), expectedString == null ? 0 28355 : getByteBufferAddress(expectedString_buf), roi.getAddress(), rv_addr + 0); 28356 VerifyTextResult rv = new VerifyTextResult(rv_buf, jn_rv); 28357 return rv; 28358 } 28359 28360 private static native long _imaqVerifyText(long image, long set, long expectedString, long roi, 28361 long numScores); 28362 28363 public static void imaqWriteOCRFile(String fileName, CharSet set, String setDescription, 28364 ReadTextOptions readOptions, OCRProcessingOptions processingOptions, 28365 OCRSpacingOptions spacingOptions) { 28366 ByteBuffer fileName_buf = null; 28367 if (fileName != null) { 28368 byte[] fileName_bytes; 28369 try { 28370 fileName_bytes = fileName.getBytes("UTF-8"); 28371 } catch (UnsupportedEncodingException e) { 28372 fileName_bytes = new byte[0]; 28373 } 28374 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 28375 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 28376 (byte) 0); 28377 } 28378 ByteBuffer setDescription_buf = null; 28379 if (setDescription != null) { 28380 byte[] setDescription_bytes; 28381 try { 28382 setDescription_bytes = setDescription.getBytes("UTF-8"); 28383 } catch (UnsupportedEncodingException e) { 28384 setDescription_bytes = new byte[0]; 28385 } 28386 setDescription_buf = ByteBuffer.allocateDirect(setDescription_bytes.length + 1); 28387 putBytes(setDescription_buf, setDescription_bytes, 0, setDescription_bytes.length).put( 28388 setDescription_bytes.length, (byte) 0); 28389 } 28390 _imaqWriteOCRFile(fileName == null ? 0 : getByteBufferAddress(fileName_buf), set.getAddress(), 28391 setDescription == null ? 0 : getByteBufferAddress(setDescription_buf), 28392 readOptions.getAddress(), processingOptions.getAddress(), spacingOptions.getAddress()); 28393 28394 } 28395 28396 private static native void _imaqWriteOCRFile(long fileName, long set, long setDescription, 28397 long readOptions, long processingOptions, long spacingOptions); 28398 28399 /** 28400 * Geometric Matching functions 28401 */ 28402 28403 public static class ExtractContourResult { 28404 public CurveParameters curveParams; 28405 public ExtractContourReport val; 28406 28407 private ExtractContourResult(ByteBuffer rv_buf) { 28408 curveParams = new CurveParameters(rv_buf, 0); 28409 curveParams.read(); 28410 } 28411 } 28412 28413 public static ExtractContourResult imaqExtractContour(Image image, ROI roi, 28414 ExtractContourDirection direction, ConnectionConstraint connectionConstraintParams, 28415 int numOfConstraints, ExtractContourSelection selection, Image contourImage) { 28416 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28417 long rv_addr = getByteBufferAddress(rv_buf); 28418 long jn_rv = 28419 _imaqExtractContour(image.getAddress(), roi.getAddress(), direction.getValue(), 28420 rv_addr + 0, connectionConstraintParams.getAddress(), numOfConstraints, 28421 selection.getValue(), contourImage.getAddress()); 28422 ExtractContourResult rv = new ExtractContourResult(rv_buf); 28423 rv.val = new ExtractContourReport(jn_rv, true); 28424 return rv; 28425 } 28426 28427 private static native long _imaqExtractContour(long image, long roi, int direction, 28428 long curveParams, long connectionConstraintParams, int numOfConstraints, int selection, 28429 long contourImage); 28430 28431 public static void imaqContourOverlay(Image image, Image contourImage, 28432 ContourOverlaySettings pointsSettings, ContourOverlaySettings eqnSettings, String groupName) { 28433 ByteBuffer groupName_buf = null; 28434 if (groupName != null) { 28435 byte[] groupName_bytes; 28436 try { 28437 groupName_bytes = groupName.getBytes("UTF-8"); 28438 } catch (UnsupportedEncodingException e) { 28439 groupName_bytes = new byte[0]; 28440 } 28441 groupName_buf = ByteBuffer.allocateDirect(groupName_bytes.length + 1); 28442 putBytes(groupName_buf, groupName_bytes, 0, groupName_bytes.length).put( 28443 groupName_bytes.length, (byte) 0); 28444 } 28445 _imaqContourOverlay(image.getAddress(), contourImage.getAddress(), pointsSettings.getAddress(), 28446 eqnSettings.getAddress(), groupName == null ? 0 : getByteBufferAddress(groupName_buf)); 28447 28448 } 28449 28450 private static native void _imaqContourOverlay(long image, long contourImage, 28451 long pointsSettings, long eqnSettings, long groupName); 28452 28453 public static ContourComputeCurvatureReport imaqContourComputeCurvature(Image contourImage, 28454 int kernel) { 28455 28456 long jn_rv = _imaqContourComputeCurvature(contourImage.getAddress(), kernel); 28457 28458 return new ContourComputeCurvatureReport(jn_rv, true); 28459 } 28460 28461 private static native long _imaqContourComputeCurvature(long contourImage, int kernel); 28462 28463 public static CurvatureAnalysisReport imaqContourClassifyCurvature(Image contourImage, 28464 int kernel, RangeLabel[] curvatureClasses) { 28465 int numCurvatureClasses = curvatureClasses.length; 28466 ByteBuffer curvatureClasses_buf = null; 28467 curvatureClasses_buf = 28468 ByteBuffer.allocateDirect(curvatureClasses.length * 24).order(ByteOrder.nativeOrder()); 28469 for (int i = 0, off = 0; i < curvatureClasses.length; i++, off += 24) { 28470 curvatureClasses[i].setBuffer(curvatureClasses_buf, off); 28471 curvatureClasses[i].write(); 28472 } 28473 long jn_rv = 28474 _imaqContourClassifyCurvature(contourImage.getAddress(), kernel, 28475 getByteBufferAddress(curvatureClasses_buf), numCurvatureClasses); 28476 28477 return new CurvatureAnalysisReport(jn_rv, true); 28478 } 28479 28480 private static native long _imaqContourClassifyCurvature(long contourImage, int kernel, 28481 long curvatureClasses, int numCurvatureClasses); 28482 28483 public static ComputeDistancesReport imaqContourComputeDistances(Image targetImage, 28484 Image templateImage, SetupMatchPatternData matchSetupData, int smoothingKernel) { 28485 28486 long jn_rv = 28487 _imaqContourComputeDistances(targetImage.getAddress(), templateImage.getAddress(), 28488 matchSetupData.getAddress(), smoothingKernel); 28489 28490 return new ComputeDistancesReport(jn_rv, true); 28491 } 28492 28493 private static native long _imaqContourComputeDistances(long targetImage, long templateImage, 28494 long matchSetupData, int smoothingKernel); 28495 28496 public static ClassifyDistancesReport imaqContourClassifyDistances(Image targetImage, 28497 Image templateImage, SetupMatchPatternData matchSetupData, int smoothingKernel, 28498 RangeLabel[] distanceRanges) { 28499 int numDistanceRanges = distanceRanges.length; 28500 ByteBuffer distanceRanges_buf = null; 28501 distanceRanges_buf = 28502 ByteBuffer.allocateDirect(distanceRanges.length * 24).order(ByteOrder.nativeOrder()); 28503 for (int i = 0, off = 0; i < distanceRanges.length; i++, off += 24) { 28504 distanceRanges[i].setBuffer(distanceRanges_buf, off); 28505 distanceRanges[i].write(); 28506 } 28507 long jn_rv = 28508 _imaqContourClassifyDistances(targetImage.getAddress(), templateImage.getAddress(), 28509 matchSetupData.getAddress(), smoothingKernel, getByteBufferAddress(distanceRanges_buf), 28510 numDistanceRanges); 28511 28512 return new ClassifyDistancesReport(jn_rv, true); 28513 } 28514 28515 private static native long _imaqContourClassifyDistances(long targetImage, long templateImage, 28516 long matchSetupData, int smoothingKernel, long distanceRanges, int numDistanceRanges); 28517 28518 public static ContourInfoReport imaqContourInfo(Image contourImage) { 28519 28520 long jn_rv = _imaqContourInfo(contourImage.getAddress()); 28521 28522 return new ContourInfoReport(jn_rv, true); 28523 } 28524 28525 private static native long _imaqContourInfo(long contourImage); 28526 28527 public static class ContourSetupMatchPatternResult { 28528 public MatchMode matchMode; 28529 public CurveParameters curveParams; 28530 public SetupMatchPatternData val; 28531 28532 private ContourSetupMatchPatternResult(ByteBuffer rv_buf) { 28533 matchMode = new MatchMode(rv_buf, 0); 28534 matchMode.read(); 28535 curveParams = new CurveParameters(rv_buf, 8); 28536 curveParams.read(); 28537 } 28538 } 28539 28540 public static ContourSetupMatchPatternResult imaqContourSetupMatchPattern( 28541 int enableSubPixelAccuracy, int useLearnCurveParameters, RangeSettingDouble[] rangeSettings) { 28542 int numRangeSettings = rangeSettings.length; 28543 ByteBuffer rangeSettings_buf = null; 28544 rangeSettings_buf = 28545 ByteBuffer.allocateDirect(rangeSettings.length * 24).order(ByteOrder.nativeOrder()); 28546 for (int i = 0, off = 0; i < rangeSettings.length; i++, off += 24) { 28547 rangeSettings[i].setBuffer(rangeSettings_buf, off); 28548 rangeSettings[i].write(); 28549 } 28550 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 28551 long rv_addr = getByteBufferAddress(rv_buf); 28552 long jn_rv = 28553 _imaqContourSetupMatchPattern(rv_addr + 0, enableSubPixelAccuracy, rv_addr + 8, 28554 useLearnCurveParameters, getByteBufferAddress(rangeSettings_buf), numRangeSettings); 28555 ContourSetupMatchPatternResult rv = new ContourSetupMatchPatternResult(rv_buf); 28556 rv.val = new SetupMatchPatternData(jn_rv, true); 28557 return rv; 28558 } 28559 28560 private static native long _imaqContourSetupMatchPattern(long matchMode, 28561 int enableSubPixelAccuracy, long curveParams, int useLearnCurveParameters, 28562 long rangeSettings, int numRangeSettings); 28563 28564 public static SetupMatchPatternData imaqContourAdvancedSetupMatchPattern( 28565 GeometricAdvancedSetupDataOption[] geometricOptions) { 28566 int numGeometricOptions = geometricOptions.length; 28567 ByteBuffer geometricOptions_buf = null; 28568 geometricOptions_buf = 28569 ByteBuffer.allocateDirect(geometricOptions.length * 16).order(ByteOrder.nativeOrder()); 28570 for (int i = 0, off = 0; i < geometricOptions.length; i++, off += 16) { 28571 geometricOptions[i].setBuffer(geometricOptions_buf, off); 28572 geometricOptions[i].write(); 28573 } 28574 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28575 long rv_addr = getByteBufferAddress(rv_buf); 28576 _imaqContourAdvancedSetupMatchPattern(rv_addr + 0, getByteBufferAddress(geometricOptions_buf), 28577 numGeometricOptions); 28578 SetupMatchPatternData matchSetupData; 28579 matchSetupData = new SetupMatchPatternData(rv_buf, 0); 28580 matchSetupData.read(); 28581 return matchSetupData; 28582 } 28583 28584 private static native void _imaqContourAdvancedSetupMatchPattern(long matchSetupData, 28585 long geometricOptions, int numGeometricOptions); 28586 28587 public static ContourFitLineReport imaqContourFitLine(Image image, double pixelRadius) { 28588 28589 long jn_rv = _imaqContourFitLine(image.getAddress(), pixelRadius); 28590 28591 return new ContourFitLineReport(jn_rv, true); 28592 } 28593 28594 private static native long _imaqContourFitLine(long image, double pixelRadius); 28595 28596 public static PartialCircle imaqContourFitCircle(Image image, double pixelRadius, 28597 int rejectOutliers) { 28598 28599 long jn_rv = _imaqContourFitCircle(image.getAddress(), pixelRadius, rejectOutliers); 28600 28601 return new PartialCircle(jn_rv, true); 28602 } 28603 28604 private static native long _imaqContourFitCircle(long image, double pixelRadius, 28605 int rejectOutliers); 28606 28607 public static PartialEllipse imaqContourFitEllipse(Image image, double pixelRadius, 28608 int rejectOutliers) { 28609 28610 long jn_rv = _imaqContourFitEllipse(image.getAddress(), pixelRadius, rejectOutliers); 28611 28612 return new PartialEllipse(jn_rv, true); 28613 } 28614 28615 private static native long _imaqContourFitEllipse(long image, double pixelRadius, 28616 int rejectOutliers); 28617 28618 public static ContourFitSplineReport imaqContourFitSpline(Image image, int degree, 28619 int numberOfControlPoints) { 28620 28621 long jn_rv = _imaqContourFitSpline(image.getAddress(), degree, numberOfControlPoints); 28622 28623 return new ContourFitSplineReport(jn_rv, true); 28624 } 28625 28626 private static native long _imaqContourFitSpline(long image, int degree, int numberOfControlPoints); 28627 28628 public static ContourFitPolynomialReport imaqContourFitPolynomial(Image image, int order) { 28629 28630 long jn_rv = _imaqContourFitPolynomial(image.getAddress(), order); 28631 28632 return new ContourFitPolynomialReport(jn_rv, true); 28633 } 28634 28635 private static native long _imaqContourFitPolynomial(long image, int order); 28636 28637 /** 28638 * Edge Detection functions 28639 */ 28640 28641 public static FindCircularEdgeReport imaqFindCircularEdge2(Image image, ROI roi, 28642 CoordinateSystem baseSystem, CoordinateSystem newSystem, FindCircularEdgeOptions edgeOptions, 28643 CircleFitOptions circleFitOptions) { 28644 28645 long jn_rv = 28646 _imaqFindCircularEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), 28647 newSystem.getAddress(), edgeOptions.getAddress(), circleFitOptions.getAddress()); 28648 28649 return new FindCircularEdgeReport(jn_rv, true); 28650 } 28651 28652 private static native long _imaqFindCircularEdge2(long image, long roi, long baseSystem, 28653 long newSystem, long edgeOptions, long circleFitOptions); 28654 28655 public static FindConcentricEdgeReport imaqFindConcentricEdge2(Image image, ROI roi, 28656 CoordinateSystem baseSystem, CoordinateSystem newSystem, 28657 FindConcentricEdgeOptions edgeOptions, ConcentricEdgeFitOptions concentricEdgeFitOptions) { 28658 28659 long jn_rv = 28660 _imaqFindConcentricEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), 28661 newSystem.getAddress(), edgeOptions.getAddress(), concentricEdgeFitOptions.getAddress()); 28662 28663 return new FindConcentricEdgeReport(jn_rv, true); 28664 } 28665 28666 private static native long _imaqFindConcentricEdge2(long image, long roi, long baseSystem, 28667 long newSystem, long edgeOptions, long concentricEdgeFitOptions); 28668 28669 /** 28670 * Morphology Reconstruction functions 28671 */ 28672 28673 public static void imaqGrayMorphologyReconstruct(Image dstImage, Image srcImage, 28674 Image markerImage, PointFloat[] points, MorphologyReconstructOperation operation, 28675 StructuringElement structuringElement, ROI roi) { 28676 int numOfPoints = points.length; 28677 ByteBuffer points_buf = null; 28678 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 28679 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 28680 points[i].setBuffer(points_buf, off); 28681 points[i].write(); 28682 } 28683 _imaqGrayMorphologyReconstruct(dstImage.getAddress(), srcImage.getAddress(), 28684 markerImage.getAddress(), getByteBufferAddress(points_buf), numOfPoints, 28685 operation.getValue(), structuringElement.getAddress(), roi.getAddress()); 28686 28687 } 28688 28689 private static native void _imaqGrayMorphologyReconstruct(long dstImage, long srcImage, 28690 long markerImage, long points, int numOfPoints, int operation, long structuringElement, 28691 long roi); 28692 28693 public static void imaqMorphologyReconstruct(Image dstImage, Image srcImage, Image markerImage, 28694 PointFloat[] points, MorphologyReconstructOperation operation, Connectivity connectivity, 28695 ROI roi) { 28696 int numOfPoints = points.length; 28697 ByteBuffer points_buf = null; 28698 points_buf = ByteBuffer.allocateDirect(points.length * 8).order(ByteOrder.nativeOrder()); 28699 for (int i = 0, off = 0; i < points.length; i++, off += 8) { 28700 points[i].setBuffer(points_buf, off); 28701 points[i].write(); 28702 } 28703 _imaqMorphologyReconstruct(dstImage.getAddress(), srcImage.getAddress(), 28704 markerImage.getAddress(), getByteBufferAddress(points_buf), numOfPoints, 28705 operation.getValue(), connectivity.getValue(), roi.getAddress()); 28706 28707 } 28708 28709 private static native void _imaqMorphologyReconstruct(long dstImage, long srcImage, 28710 long markerImage, long points, int numOfPoints, int operation, int connectivity, long roi); 28711 28712 /** 28713 * Texture functions 28714 */ 28715 28716 public static void imaqDetectTextureDefect(ClassifierSession session, Image destImage, 28717 Image srcImage, ROI roi, int initialStepSize, int finalStepSize, short defectPixelValue, 28718 double minClassificationScore) { 28719 28720 _imaqDetectTextureDefect(session.getAddress(), destImage.getAddress(), srcImage.getAddress(), 28721 roi.getAddress(), initialStepSize, finalStepSize, defectPixelValue, minClassificationScore); 28722 28723 } 28724 28725 private static native void _imaqDetectTextureDefect(long session, long destImage, long srcImage, 28726 long roi, int initialStepSize, int finalStepSize, short defectPixelValue, 28727 double minClassificationScore); 28728 28729 /** 28730 * Regions of Interest Manipulation functions 28731 */ 28732 28733 public static class MaskToROIResult { 28734 public int withinLimit; 28735 public ROI val; 28736 28737 private MaskToROIResult(ByteBuffer rv_buf) { 28738 withinLimit = rv_buf.getInt(0); 28739 } 28740 } 28741 28742 public static MaskToROIResult imaqMaskToROI(Image mask) { 28743 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28744 long rv_addr = getByteBufferAddress(rv_buf); 28745 long jn_rv = _imaqMaskToROI(mask.getAddress(), rv_addr + 0); 28746 MaskToROIResult rv = new MaskToROIResult(rv_buf); 28747 rv.val = new ROI(jn_rv, true); 28748 return rv; 28749 } 28750 28751 private static native long _imaqMaskToROI(long mask, long withinLimit); 28752 28753 public static ROIProfile imaqROIProfile(Image image, ROI roi) { 28754 28755 long jn_rv = _imaqROIProfile(image.getAddress(), roi.getAddress()); 28756 28757 return new ROIProfile(jn_rv, true); 28758 } 28759 28760 private static native long _imaqROIProfile(long image, long roi); 28761 28762 public static int imaqROIToMask(Image mask, ROI roi, int fillValue, Image imageModel) { 28763 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28764 long rv_addr = getByteBufferAddress(rv_buf); 28765 _imaqROIToMask(mask.getAddress(), roi.getAddress(), fillValue, imageModel == null ? 0 28766 : imageModel.getAddress(), rv_addr + 0); 28767 int inSpace; 28768 inSpace = rv_buf.getInt(0); 28769 return inSpace; 28770 } 28771 28772 private static native void _imaqROIToMask(long mask, long roi, int fillValue, long imageModel, 28773 long inSpace); 28774 28775 public static void imaqTransformROI2(ROI roi, CoordinateSystem baseSystem, 28776 CoordinateSystem newSystem) { 28777 28778 _imaqTransformROI2(roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress()); 28779 28780 } 28781 28782 private static native void _imaqTransformROI2(long roi, long baseSystem, long newSystem); 28783 28784 public static LabelToROIReport imaqLabelToROI(Image image, int[] labelsIn, int maxNumVectors, 28785 int isExternelEdges) { 28786 int numLabelsIn = labelsIn.length; 28787 ByteBuffer labelsIn_buf = null; 28788 labelsIn_buf = ByteBuffer.allocateDirect(labelsIn.length * 4).order(ByteOrder.nativeOrder()); 28789 labelsIn_buf.asIntBuffer().put(labelsIn).rewind(); 28790 long jn_rv = 28791 _imaqLabelToROI(image.getAddress(), getByteBufferAddress(labelsIn_buf), numLabelsIn, 28792 maxNumVectors, isExternelEdges); 28793 28794 return new LabelToROIReport(jn_rv, true); 28795 } 28796 28797 private static native long _imaqLabelToROI(long image, long labelsIn, int numLabelsIn, 28798 int maxNumVectors, int isExternelEdges); 28799 28800 /** 28801 * Morphology functions 28802 */ 28803 28804 public static void imaqGrayMorphology(Image dest, Image source, MorphologyMethod method, 28805 StructuringElement structuringElement) { 28806 28807 _imaqGrayMorphology(dest.getAddress(), source.getAddress(), method.getValue(), 28808 structuringElement == null ? 0 : structuringElement.getAddress()); 28809 28810 } 28811 28812 private static native void _imaqGrayMorphology(long dest, long source, int method, 28813 long structuringElement); 28814 28815 /** 28816 * Classification functions 28817 */ 28818 28819 public static void imaqAddClassifierSample(Image image, ClassifierSession session, ROI roi, 28820 String sampleClass, double[] featureVector) { 28821 ByteBuffer sampleClass_buf = null; 28822 if (sampleClass != null) { 28823 byte[] sampleClass_bytes; 28824 try { 28825 sampleClass_bytes = sampleClass.getBytes("UTF-8"); 28826 } catch (UnsupportedEncodingException e) { 28827 sampleClass_bytes = new byte[0]; 28828 } 28829 sampleClass_buf = ByteBuffer.allocateDirect(sampleClass_bytes.length + 1); 28830 putBytes(sampleClass_buf, sampleClass_bytes, 0, sampleClass_bytes.length).put( 28831 sampleClass_bytes.length, (byte) 0); 28832 } 28833 int vectorSize = featureVector.length; 28834 ByteBuffer featureVector_buf = null; 28835 featureVector_buf = 28836 ByteBuffer.allocateDirect(featureVector.length * 8).order(ByteOrder.nativeOrder()); 28837 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 28838 _imaqAddClassifierSample(image.getAddress(), session.getAddress(), roi.getAddress(), 28839 sampleClass == null ? 0 : getByteBufferAddress(sampleClass_buf), 28840 getByteBufferAddress(featureVector_buf), vectorSize); 28841 28842 } 28843 28844 private static native void _imaqAddClassifierSample(long image, long session, long roi, 28845 long sampleClass, long featureVector, int vectorSize); 28846 28847 public static ClassifierReportAdvanced imaqAdvanceClassify(Image image, 28848 ClassifierSession session, ROI roi, double[] featureVector) { 28849 int vectorSize = featureVector.length; 28850 ByteBuffer featureVector_buf = null; 28851 featureVector_buf = 28852 ByteBuffer.allocateDirect(featureVector.length * 8).order(ByteOrder.nativeOrder()); 28853 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 28854 long jn_rv = 28855 _imaqAdvanceClassify(image.getAddress(), session.getAddress(), roi.getAddress(), 28856 getByteBufferAddress(featureVector_buf), vectorSize); 28857 28858 return new ClassifierReportAdvanced(jn_rv, true); 28859 } 28860 28861 private static native long _imaqAdvanceClassify(long image, long session, long roi, 28862 long featureVector, int vectorSize); 28863 28864 public static ClassifierReport imaqClassify(Image image, ClassifierSession session, ROI roi, 28865 double[] featureVector) { 28866 int vectorSize = featureVector.length; 28867 ByteBuffer featureVector_buf = null; 28868 featureVector_buf = 28869 ByteBuffer.allocateDirect(featureVector.length * 8).order(ByteOrder.nativeOrder()); 28870 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 28871 long jn_rv = 28872 _imaqClassify(image.getAddress(), session.getAddress(), roi.getAddress(), 28873 getByteBufferAddress(featureVector_buf), vectorSize); 28874 28875 return new ClassifierReport(jn_rv, true); 28876 } 28877 28878 private static native long _imaqClassify(long image, long session, long roi, long featureVector, 28879 int vectorSize); 28880 28881 public static ClassifierSession imaqCreateClassifier(ClassifierType type) { 28882 28883 long jn_rv = _imaqCreateClassifier(type.getValue()); 28884 28885 return new ClassifierSession(jn_rv, true); 28886 } 28887 28888 private static native long _imaqCreateClassifier(int type); 28889 28890 public static void imaqDeleteClassifierSample(ClassifierSession session, int index) { 28891 28892 _imaqDeleteClassifierSample(session.getAddress(), index); 28893 28894 } 28895 28896 private static native void _imaqDeleteClassifierSample(long session, int index); 28897 28898 public static ClassifierAccuracyReport imaqGetClassifierAccuracy(ClassifierSession session) { 28899 28900 long jn_rv = _imaqGetClassifierAccuracy(session.getAddress()); 28901 28902 return new ClassifierAccuracyReport(jn_rv, true); 28903 } 28904 28905 private static native long _imaqGetClassifierAccuracy(long session); 28906 28907 public static class GetClassifierSampleInfoResult { 28908 public int numSamples; 28909 public ClassifierSampleInfo val; 28910 28911 private GetClassifierSampleInfoResult(ByteBuffer rv_buf) { 28912 numSamples = rv_buf.getInt(0); 28913 } 28914 } 28915 28916 public static GetClassifierSampleInfoResult imaqGetClassifierSampleInfo( 28917 ClassifierSession session, int index) { 28918 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28919 long rv_addr = getByteBufferAddress(rv_buf); 28920 long jn_rv = _imaqGetClassifierSampleInfo(session.getAddress(), index, rv_addr + 0); 28921 GetClassifierSampleInfoResult rv = new GetClassifierSampleInfoResult(rv_buf); 28922 rv.val = new ClassifierSampleInfo(jn_rv, true); 28923 return rv; 28924 } 28925 28926 private static native long _imaqGetClassifierSampleInfo(long session, int index, long numSamples); 28927 28928 public static ColorOptions imaqGetColorClassifierOptions(ClassifierSession session) { 28929 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28930 long rv_addr = getByteBufferAddress(rv_buf); 28931 _imaqGetColorClassifierOptions(session.getAddress(), rv_addr + 0); 28932 ColorOptions options; 28933 options = new ColorOptions(rv_buf, 0); 28934 options.read(); 28935 return options; 28936 } 28937 28938 private static native void _imaqGetColorClassifierOptions(long session, long options); 28939 28940 public static NearestNeighborOptions imaqGetNearestNeighborOptions(ClassifierSession session) { 28941 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 28942 long rv_addr = getByteBufferAddress(rv_buf); 28943 _imaqGetNearestNeighborOptions(session.getAddress(), rv_addr + 0); 28944 NearestNeighborOptions options; 28945 options = new NearestNeighborOptions(rv_buf, 0); 28946 options.read(); 28947 return options; 28948 } 28949 28950 private static native void _imaqGetNearestNeighborOptions(long session, long options); 28951 28952 public static class GetParticleClassifierOptions2Result { 28953 public ParticleClassifierPreprocessingOptions2 preprocessingOptions; 28954 public ParticleClassifierOptions options; 28955 28956 private GetParticleClassifierOptions2Result(ByteBuffer rv_buf) { 28957 preprocessingOptions = new ParticleClassifierPreprocessingOptions2(rv_buf, 0); 28958 preprocessingOptions.read(); 28959 options = new ParticleClassifierOptions(rv_buf, 8); 28960 options.read(); 28961 } 28962 } 28963 28964 public static GetParticleClassifierOptions2Result imaqGetParticleClassifierOptions2( 28965 ClassifierSession session) { 28966 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 28967 long rv_addr = getByteBufferAddress(rv_buf); 28968 _imaqGetParticleClassifierOptions2(session.getAddress(), rv_addr + 0, rv_addr + 8); 28969 GetParticleClassifierOptions2Result rv = new GetParticleClassifierOptions2Result(rv_buf); 28970 return rv; 28971 } 28972 28973 private static native void _imaqGetParticleClassifierOptions2(long session, 28974 long preprocessingOptions, long options); 28975 28976 public static class ReadClassifierFileResult { 28977 public ClassifierType type; 28978 public ClassifierEngineType engine; 28979 public ClassifierSession val; 28980 28981 private ReadClassifierFileResult(ByteBuffer rv_buf) { 28982 type = ClassifierType.fromValue(rv_buf.getInt(0)); 28983 engine = ClassifierEngineType.fromValue(rv_buf.getInt(8)); 28984 } 28985 } 28986 28987 public static ReadClassifierFileResult imaqReadClassifierFile(ClassifierSession session, 28988 String fileName, ReadClassifierFileMode mode, String description) { 28989 ByteBuffer fileName_buf = null; 28990 if (fileName != null) { 28991 byte[] fileName_bytes; 28992 try { 28993 fileName_bytes = fileName.getBytes("UTF-8"); 28994 } catch (UnsupportedEncodingException e) { 28995 fileName_bytes = new byte[0]; 28996 } 28997 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 28998 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 28999 (byte) 0); 29000 } 29001 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 29002 if (description != null) { 29003 byte[] bytes; 29004 try { 29005 bytes = description.getBytes("UTF-8"); 29006 } catch (UnsupportedEncodingException e) { 29007 bytes = new byte[0]; 29008 } 29009 putBytes(description_buf, bytes, 0, bytes.length); 29010 for (int i = bytes.length; i < 256; i++) 29011 description_buf.put(i, (byte) 0); // fill with zero 29012 } 29013 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 29014 long rv_addr = getByteBufferAddress(rv_buf); 29015 long jn_rv = 29016 _imaqReadClassifierFile(session.getAddress(), fileName == null ? 0 29017 : getByteBufferAddress(fileName_buf), mode.getValue(), rv_addr + 0, rv_addr + 8, 29018 description == null ? 0 : getByteBufferAddress(description_buf)); 29019 ReadClassifierFileResult rv = new ReadClassifierFileResult(rv_buf); 29020 rv.val = new ClassifierSession(jn_rv, true); 29021 return rv; 29022 } 29023 29024 private static native long _imaqReadClassifierFile(long session, long fileName, int mode, 29025 long type, long engine, long description); 29026 29027 public static void imaqRelabelClassifierSample(ClassifierSession session, int index, 29028 String newClass) { 29029 ByteBuffer newClass_buf = null; 29030 if (newClass != null) { 29031 byte[] newClass_bytes; 29032 try { 29033 newClass_bytes = newClass.getBytes("UTF-8"); 29034 } catch (UnsupportedEncodingException e) { 29035 newClass_bytes = new byte[0]; 29036 } 29037 newClass_buf = ByteBuffer.allocateDirect(newClass_bytes.length + 1); 29038 putBytes(newClass_buf, newClass_bytes, 0, newClass_bytes.length).put(newClass_bytes.length, 29039 (byte) 0); 29040 } 29041 _imaqRelabelClassifierSample(session.getAddress(), index, newClass == null ? 0 29042 : getByteBufferAddress(newClass_buf)); 29043 29044 } 29045 29046 private static native void _imaqRelabelClassifierSample(long session, int index, long newClass); 29047 29048 public static void imaqSetParticleClassifierOptions2(ClassifierSession session, 29049 ParticleClassifierPreprocessingOptions2 preprocessingOptions, 29050 ParticleClassifierOptions options) { 29051 29052 _imaqSetParticleClassifierOptions2(session.getAddress(), preprocessingOptions.getAddress(), 29053 options.getAddress()); 29054 29055 } 29056 29057 private static native void _imaqSetParticleClassifierOptions2(long session, 29058 long preprocessingOptions, long options); 29059 29060 public static void imaqSetColorClassifierOptions(ClassifierSession session, ColorOptions options) { 29061 29062 _imaqSetColorClassifierOptions(session.getAddress(), options.getAddress()); 29063 29064 } 29065 29066 private static native void _imaqSetColorClassifierOptions(long session, long options); 29067 29068 public static NearestNeighborTrainingReport imaqTrainNearestNeighborClassifier( 29069 ClassifierSession session, NearestNeighborOptions options) { 29070 29071 long jn_rv = _imaqTrainNearestNeighborClassifier(session.getAddress(), options.getAddress()); 29072 29073 return new NearestNeighborTrainingReport(jn_rv, true); 29074 } 29075 29076 private static native long _imaqTrainNearestNeighborClassifier(long session, long options); 29077 29078 public static void imaqWriteClassifierFile(ClassifierSession session, String fileName, 29079 WriteClassifierFileMode mode, String description) { 29080 ByteBuffer fileName_buf = null; 29081 if (fileName != null) { 29082 byte[] fileName_bytes; 29083 try { 29084 fileName_bytes = fileName.getBytes("UTF-8"); 29085 } catch (UnsupportedEncodingException e) { 29086 fileName_bytes = new byte[0]; 29087 } 29088 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length + 1); 29089 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, 29090 (byte) 0); 29091 } 29092 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 29093 if (description != null) { 29094 byte[] bytes; 29095 try { 29096 bytes = description.getBytes("UTF-8"); 29097 } catch (UnsupportedEncodingException e) { 29098 bytes = new byte[0]; 29099 } 29100 putBytes(description_buf, bytes, 0, bytes.length); 29101 for (int i = bytes.length; i < 256; i++) 29102 description_buf.put(i, (byte) 0); // fill with zero 29103 } 29104 _imaqWriteClassifierFile(session.getAddress(), fileName == null ? 0 29105 : getByteBufferAddress(fileName_buf), mode.getValue(), description == null ? 0 29106 : getByteBufferAddress(description_buf)); 29107 29108 } 29109 29110 private static native void _imaqWriteClassifierFile(long session, long fileName, int mode, 29111 long description); 29112 29113 /** 29114 * Measure Distances functions 29115 */ 29116 29117 public static ClampMax2Report imaqClampMax2(Image image, ROI roi, CoordinateSystem baseSystem, 29118 CoordinateSystem newSystem, CurveOptions curveSettings, ClampSettings clampSettings, 29119 ClampOverlaySettings clampOverlaySettings) { 29120 29121 long jn_rv = 29122 _imaqClampMax2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), 29123 newSystem.getAddress(), curveSettings.getAddress(), clampSettings.getAddress(), 29124 clampOverlaySettings.getAddress()); 29125 29126 return new ClampMax2Report(jn_rv, true); 29127 } 29128 29129 private static native long _imaqClampMax2(long image, long roi, long baseSystem, long newSystem, 29130 long curveSettings, long clampSettings, long clampOverlaySettings); 29131 29132 /** 29133 * Inspection functions 29134 */ 29135 29136 public static void imaqCompareGoldenTemplate(Image image, Image goldenTemplate, 29137 Image brightDefects, Image darkDefects, InspectionAlignment alignment, 29138 InspectionOptions options) { 29139 29140 _imaqCompareGoldenTemplate(image.getAddress(), goldenTemplate.getAddress(), 29141 brightDefects.getAddress(), darkDefects.getAddress(), alignment.getAddress(), 29142 options.getAddress()); 29143 29144 } 29145 29146 private static native void _imaqCompareGoldenTemplate(long image, long goldenTemplate, 29147 long brightDefects, long darkDefects, long alignment, long options); 29148 29149 public static void imaqLearnGoldenTemplate(Image goldenTemplate, PointFloat originOffset, 29150 Image mask) { 29151 29152 _imaqLearnGoldenTemplate(goldenTemplate.getAddress(), originOffset.getAddress(), 29153 mask.getAddress()); 29154 29155 } 29156 29157 private static native void _imaqLearnGoldenTemplate(long goldenTemplate, long originOffset, 29158 long mask); 29159 29160 /** 29161 * Obsolete functions 29162 */ 29163 29164 public static class GetParticleClassifierOptionsResult { 29165 public ParticleClassifierPreprocessingOptions preprocessingOptions; 29166 public ParticleClassifierOptions options; 29167 29168 private GetParticleClassifierOptionsResult(ByteBuffer rv_buf) { 29169 preprocessingOptions = new ParticleClassifierPreprocessingOptions(rv_buf, 0); 29170 preprocessingOptions.read(); 29171 options = new ParticleClassifierOptions(rv_buf, 8); 29172 options.read(); 29173 } 29174 } 29175 29176 public static GetParticleClassifierOptionsResult imaqGetParticleClassifierOptions( 29177 ClassifierSession session) { 29178 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 29179 long rv_addr = getByteBufferAddress(rv_buf); 29180 _imaqGetParticleClassifierOptions(session.getAddress(), rv_addr + 0, rv_addr + 8); 29181 GetParticleClassifierOptionsResult rv = new GetParticleClassifierOptionsResult(rv_buf); 29182 return rv; 29183 } 29184 29185 private static native void _imaqGetParticleClassifierOptions(long session, 29186 long preprocessingOptions, long options); 29187 29188 public static int imaqParticleFilter3(Image dest, Image source, ParticleFilterCriteria2 criteria, 29189 int criteriaCount, ParticleFilterOptions options, ROI roi) { 29190 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 29191 long rv_addr = getByteBufferAddress(rv_buf); 29192 _imaqParticleFilter3(dest.getAddress(), source.getAddress(), criteria.getAddress(), 29193 criteriaCount, options.getAddress(), roi.getAddress(), rv_addr + 0); 29194 int numParticles; 29195 numParticles = rv_buf.getInt(0); 29196 return numParticles; 29197 } 29198 29199 private static native void _imaqParticleFilter3(long dest, long source, long criteria, 29200 int criteriaCount, long options, long roi, long numParticles); 29201 29202 public static LearnPatternAdvancedOptions imaqLearnPattern2(Image image, LearningMode learningMode) { 29203 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 29204 long rv_addr = getByteBufferAddress(rv_buf); 29205 _imaqLearnPattern2(image.getAddress(), learningMode.getValue(), rv_addr + 0); 29206 LearnPatternAdvancedOptions advancedOptions; 29207 advancedOptions = new LearnPatternAdvancedOptions(rv_buf, 0); 29208 advancedOptions.read(); 29209 return advancedOptions; 29210 } 29211 29212 private static native void _imaqLearnPattern2(long image, int learningMode, long advancedOptions); 29213 29214 public static void imaqDivide(Image dest, Image sourceA, Image sourceB) { 29215 29216 _imaqDivide(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 29217 29218 } 29219 29220 private static native void _imaqDivide(long dest, long sourceA, long sourceB); 29221 29222 public static EdgeReport2 imaqEdgeTool3(Image image, ROI roi, EdgeProcess processType, 29223 EdgeOptions2 edgeOptions) { 29224 29225 long jn_rv = 29226 _imaqEdgeTool3(image.getAddress(), roi.getAddress(), processType.getValue(), 29227 edgeOptions.getAddress()); 29228 29229 return new EdgeReport2(jn_rv, true); 29230 } 29231 29232 private static native long _imaqEdgeTool3(long image, long roi, int processType, long edgeOptions); 29233 29234 public static ConcentricRakeReport imaqConcentricRake(Image image, ROI roi, 29235 ConcentricRakeDirection direction, EdgeProcess process, RakeOptions options) { 29236 29237 long jn_rv = 29238 _imaqConcentricRake(image.getAddress(), roi.getAddress(), direction.getValue(), 29239 process.getValue(), options.getAddress()); 29240 29241 return new ConcentricRakeReport(jn_rv, true); 29242 } 29243 29244 private static native long _imaqConcentricRake(long image, long roi, int direction, int process, 29245 long options); 29246 29247 public static SpokeReport imaqSpoke(Image image, ROI roi, SpokeDirection direction, 29248 EdgeProcess process, SpokeOptions options) { 29249 29250 long jn_rv = 29251 _imaqSpoke(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), 29252 options.getAddress()); 29253 29254 return new SpokeReport(jn_rv, true); 29255 } 29256 29257 private static native long _imaqSpoke(long image, long roi, int direction, int process, 29258 long options); 29259 29260 public static class MatchPattern2Result { 29261 public PatternMatch[] array; 29262 private long array_addr; 29263 29264 private MatchPattern2Result(ByteBuffer rv_buf, long jn_rv) { 29265 array_addr = jn_rv; 29266 int array_numMatches; 29267 array_numMatches = rv_buf.getInt(0); 29268 array = new PatternMatch[array_numMatches]; 29269 if (array_numMatches > 0 && array_addr != 0) { 29270 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches * 52); 29271 for (int i = 0, off = 0; i < array_numMatches; i++, off += 52) { 29272 array[i] = new PatternMatch(bb, off); 29273 array[i].read(); 29274 } 29275 } 29276 } 29277 29278 @Override 29279 protected void finalize() throws Throwable { 29280 imaqDispose(array_addr); 29281 super.finalize(); 29282 } 29283 } 29284 29285 public static MatchPattern2Result imaqMatchPattern2(Image image, Image pattern, 29286 MatchPatternOptions options, MatchPatternAdvancedOptions advancedOptions, Rect searchRect) { 29287 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 29288 long rv_addr = getByteBufferAddress(rv_buf); 29289 long jn_rv = 29290 _imaqMatchPattern2(image.getAddress(), pattern.getAddress(), 29291 options == null ? 0 : options.getAddress(), advancedOptions.getAddress(), 29292 searchRect.getAddress(), rv_addr + 0); 29293 MatchPattern2Result rv = new MatchPattern2Result(rv_buf, jn_rv); 29294 return rv; 29295 } 29296 29297 private static native long _imaqMatchPattern2(long image, long pattern, long options, 29298 long advancedOptions, long searchRect, long numMatches); 29299 29300 public static void imaqSetParticleClassifierOptions(ClassifierSession session, 29301 ParticleClassifierPreprocessingOptions preprocessingOptions, ParticleClassifierOptions options) { 29302 29303 _imaqSetParticleClassifierOptions(session.getAddress(), preprocessingOptions.getAddress(), 29304 options.getAddress()); 29305 29306 } 29307 29308 private static native void _imaqSetParticleClassifierOptions(long session, 29309 long preprocessingOptions, long options); 29310 29311 public static RakeReport imaqRake(Image image, ROI roi, RakeDirection direction, 29312 EdgeProcess process, RakeOptions options) { 29313 29314 long jn_rv = 29315 _imaqRake(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), 29316 options.getAddress()); 29317 29318 return new RakeReport(jn_rv, true); 29319 } 29320 29321 private static native long _imaqRake(long image, long roi, int direction, int process, 29322 long options); 29323 29324 public static void Priv_ReadJPEGString_C(Image image, byte[] string) { 29325 int stringLength = string.length; 29326 ByteBuffer string_buf = null; 29327 string_buf = ByteBuffer.allocateDirect(string.length); 29328 putBytes(string_buf, string, 0, string.length); 29329 _Priv_ReadJPEGString_C(image.getAddress(), getByteBufferAddress(string_buf), stringLength); 29330 29331 } 29332 29333 private static native void _Priv_ReadJPEGString_C(long image, long string, int stringLength); 29334 29335 /** 29336 * Purpose : Include file for NI-IMAQdx library support. 29337 */ 29338 public static final int IMAQDX_MAX_API_STRING_LENGTH = 512; 29339 29340 /** 29341 * Bus Type Enumeration 29342 */ 29343 29344 public static enum IMAQdxBusType { 29345 BusTypeFireWire(0x31333934), BusTypeEthernet(0x69707634), BusTypeSimulator(0x2073696D), BusTypeDirectShow( 29346 0x64736877), BusTypeIP(0x4950636D), BusTypeSmartCam2(0x53436132), BusTypeUSB3Vision( 29347 0x55534233), BusTypeUVC(0x55564320), BusTypeGuard(0xFFFFFFFF), ; 29348 private final int value; 29349 29350 private IMAQdxBusType(int value) { 29351 this.value = value; 29352 } 29353 29354 public static IMAQdxBusType fromValue(int val) { 29355 for (IMAQdxBusType v : values()) { 29356 if (v.value == val) 29357 return v; 29358 } 29359 return null; 29360 } 29361 29362 public int getValue() { 29363 return value; 29364 } 29365 } 29366 29367 /** 29368 * Camera Control Mode Enumeration 29369 */ 29370 29371 public static enum IMAQdxCameraControlMode { 29372 CameraControlModeController(0), CameraControlModeListener(1), CameraControlModeGuard(0xFFFFFFFF), ; 29373 private final int value; 29374 29375 private IMAQdxCameraControlMode(int value) { 29376 this.value = value; 29377 } 29378 29379 public static IMAQdxCameraControlMode fromValue(int val) { 29380 for (IMAQdxCameraControlMode v : values()) { 29381 if (v.value == val) 29382 return v; 29383 } 29384 return null; 29385 } 29386 29387 public int getValue() { 29388 return value; 29389 } 29390 } 29391 29392 /** 29393 * Buffer Number Mode Enumeration 29394 */ 29395 29396 public static enum IMAQdxBufferNumberMode { 29397 BufferNumberModeNext(0), BufferNumberModeLast(1), BufferNumberModeBufferNumber(2), BufferNumberModeGuard( 29398 0xFFFFFFFF), ; 29399 private final int value; 29400 29401 private IMAQdxBufferNumberMode(int value) { 29402 this.value = value; 29403 } 29404 29405 public static IMAQdxBufferNumberMode fromValue(int val) { 29406 for (IMAQdxBufferNumberMode v : values()) { 29407 if (v.value == val) 29408 return v; 29409 } 29410 return null; 29411 } 29412 29413 public int getValue() { 29414 return value; 29415 } 29416 } 29417 29418 /** 29419 * Plug n Play Event Enumeration 29420 */ 29421 29422 public static enum IMAQdxPnpEvent { 29423 PnpEventCameraAttached(0), PnpEventCameraDetached(1), PnpEventBusReset(2), PnpEventGuard( 29424 0xFFFFFFFF), ; 29425 private final int value; 29426 29427 private IMAQdxPnpEvent(int value) { 29428 this.value = value; 29429 } 29430 29431 public static IMAQdxPnpEvent fromValue(int val) { 29432 for (IMAQdxPnpEvent v : values()) { 29433 if (v.value == val) 29434 return v; 29435 } 29436 return null; 29437 } 29438 29439 public int getValue() { 29440 return value; 29441 } 29442 } 29443 29444 /** 29445 * Bayer Pattern Enumeration 29446 */ 29447 29448 public static enum IMAQdxBayerPattern { 29449 BayerPatternNone(0), BayerPatternGB(1), BayerPatternGR(2), BayerPatternBG(3), BayerPatternRG(4), BayerPatternHardware( 29450 5), BayerPatternGuard(0xFFFFFFFF), ; 29451 private final int value; 29452 29453 private IMAQdxBayerPattern(int value) { 29454 this.value = value; 29455 } 29456 29457 public static IMAQdxBayerPattern fromValue(int val) { 29458 for (IMAQdxBayerPattern v : values()) { 29459 if (v.value == val) 29460 return v; 29461 } 29462 return null; 29463 } 29464 29465 public int getValue() { 29466 return value; 29467 } 29468 } 29469 29470 /** 29471 * Bayer Decode Algorithm Enumeration 29472 */ 29473 29474 public static enum IMAQdxBayerAlgorithm { 29475 BayerAlgorithmBilinear(0), BayerAlgorithmVNG(1), BayerAlgorithmGuard(0xFFFFFFFF), ; 29476 private final int value; 29477 29478 private IMAQdxBayerAlgorithm(int value) { 29479 this.value = value; 29480 } 29481 29482 public static IMAQdxBayerAlgorithm fromValue(int val) { 29483 for (IMAQdxBayerAlgorithm v : values()) { 29484 if (v.value == val) 29485 return v; 29486 } 29487 return null; 29488 } 29489 29490 public int getValue() { 29491 return value; 29492 } 29493 } 29494 29495 /** 29496 * Output Image Types -- Values match Vision Development Module image types 29497 */ 29498 29499 public static enum IMAQdxOutputImageType { 29500 OutputImageTypeU8(0), OutputImageTypeI16(1), OutputImageTypeU16(7), OutputImageTypeRGB32(4), OutputImageTypeRGB64( 29501 6), OutputImageTypeAuto(0x7FFFFFFF), OutputImageTypeGuard(0xFFFFFFFF), ; 29502 private final int value; 29503 29504 private IMAQdxOutputImageType(int value) { 29505 this.value = value; 29506 } 29507 29508 public static IMAQdxOutputImageType fromValue(int val) { 29509 for (IMAQdxOutputImageType v : values()) { 29510 if (v.value == val) 29511 return v; 29512 } 29513 return null; 29514 } 29515 29516 public int getValue() { 29517 return value; 29518 } 29519 } 29520 29521 /** 29522 * Controller Destination Mode Enumeration 29523 */ 29524 29525 public static enum IMAQdxDestinationMode { 29526 DestinationModeUnicast(0), DestinationModeBroadcast(1), DestinationModeMulticast(2), DestinationModeGuard( 29527 0xFFFFFFFF), ; 29528 private final int value; 29529 29530 private IMAQdxDestinationMode(int value) { 29531 this.value = value; 29532 } 29533 29534 public static IMAQdxDestinationMode fromValue(int val) { 29535 for (IMAQdxDestinationMode v : values()) { 29536 if (v.value == val) 29537 return v; 29538 } 29539 return null; 29540 } 29541 29542 public int getValue() { 29543 return value; 29544 } 29545 } 29546 29547 /** 29548 * Attribute Type Enumeration 29549 */ 29550 29551 public static enum IMAQdxAttributeType { 29552 AttributeTypeU32(0), AttributeTypeI64(1), AttributeTypeF64(2), AttributeTypeString(3), AttributeTypeEnum( 29553 4), AttributeTypeBool(5), AttributeTypeCommand(6), AttributeTypeBlob(7), AttributeTypeGuard( 29554 0xFFFFFFFF), ; 29555 private final int value; 29556 29557 private IMAQdxAttributeType(int value) { 29558 this.value = value; 29559 } 29560 29561 public static IMAQdxAttributeType fromValue(int val) { 29562 for (IMAQdxAttributeType v : values()) { 29563 if (v.value == val) 29564 return v; 29565 } 29566 return null; 29567 } 29568 29569 public int getValue() { 29570 return value; 29571 } 29572 } 29573 29574 /** 29575 * Value Type Enumeration 29576 */ 29577 29578 public static enum IMAQdxValueType { 29579 ValueTypeU32(0), ValueTypeI64(1), ValueTypeF64(2), ValueTypeString(3), ValueTypeEnumItem(4), ValueTypeBool( 29580 5), ValueTypeDisposableString(6), ValueTypeGuard(0xFFFFFFFF), ; 29581 private final int value; 29582 29583 private IMAQdxValueType(int value) { 29584 this.value = value; 29585 } 29586 29587 public static IMAQdxValueType fromValue(int val) { 29588 for (IMAQdxValueType v : values()) { 29589 if (v.value == val) 29590 return v; 29591 } 29592 return null; 29593 } 29594 29595 public int getValue() { 29596 return value; 29597 } 29598 } 29599 29600 /** 29601 * Interface File Flags Enumeration 29602 */ 29603 29604 public static enum IMAQdxInterfaceFileFlags { 29605 InterfaceFileFlagsConnected(0x1), InterfaceFileFlagsDirty(0x2), InterfaceFileFlagsGuard( 29606 0xFFFFFFFF), ; 29607 private final int value; 29608 29609 private IMAQdxInterfaceFileFlags(int value) { 29610 this.value = value; 29611 } 29612 29613 public static IMAQdxInterfaceFileFlags fromValue(int val) { 29614 for (IMAQdxInterfaceFileFlags v : values()) { 29615 if (v.value == val) 29616 return v; 29617 } 29618 return null; 29619 } 29620 29621 public int getValue() { 29622 return value; 29623 } 29624 } 29625 29626 /** 29627 * Overwrite Mode Enumeration 29628 */ 29629 29630 public static enum IMAQdxOverwriteMode { 29631 OverwriteModeGetOldest(0x0), OverwriteModeFail(0x2), OverwriteModeGetNewest(0x3), OverwriteModeGuard( 29632 0xFFFFFFFF), ; 29633 private final int value; 29634 29635 private IMAQdxOverwriteMode(int value) { 29636 this.value = value; 29637 } 29638 29639 public static IMAQdxOverwriteMode fromValue(int val) { 29640 for (IMAQdxOverwriteMode v : values()) { 29641 if (v.value == val) 29642 return v; 29643 } 29644 return null; 29645 } 29646 29647 public int getValue() { 29648 return value; 29649 } 29650 } 29651 29652 /** 29653 * Incomplete Buffer Mode Enumeration 29654 */ 29655 29656 public static enum IMAQdxIncompleteBufferMode { 29657 IncompleteBufferModeIgnore(0), IncompleteBufferModeFail(1), IncompleteBufferModeGuard( 29658 0xFFFFFFFF), ; 29659 private final int value; 29660 29661 private IMAQdxIncompleteBufferMode(int value) { 29662 this.value = value; 29663 } 29664 29665 public static IMAQdxIncompleteBufferMode fromValue(int val) { 29666 for (IMAQdxIncompleteBufferMode v : values()) { 29667 if (v.value == val) 29668 return v; 29669 } 29670 return null; 29671 } 29672 29673 public int getValue() { 29674 return value; 29675 } 29676 } 29677 29678 /** 29679 * Lost Packet Mode Enumeration 29680 */ 29681 29682 public static enum IMAQdxLostPacketMode { 29683 LostPacketModeIgnore(0), LostPacketModeFail(1), LostPacketModeGuard(0xFFFFFFFF), ; 29684 private final int value; 29685 29686 private IMAQdxLostPacketMode(int value) { 29687 this.value = value; 29688 } 29689 29690 public static IMAQdxLostPacketMode fromValue(int val) { 29691 for (IMAQdxLostPacketMode v : values()) { 29692 if (v.value == val) 29693 return v; 29694 } 29695 return null; 29696 } 29697 29698 public int getValue() { 29699 return value; 29700 } 29701 } 29702 29703 /** 29704 * Attribute Visibility Enumeration 29705 */ 29706 29707 public static enum IMAQdxAttributeVisibility { 29708 AttributeVisibilitySimple(0x00001000), AttributeVisibilityIntermediate(0x00002000), AttributeVisibilityAdvanced( 29709 0x00004000), AttributeVisibilityGuard(0xFFFFFFFF), ; 29710 private final int value; 29711 29712 private IMAQdxAttributeVisibility(int value) { 29713 this.value = value; 29714 } 29715 29716 public static IMAQdxAttributeVisibility fromValue(int val) { 29717 for (IMAQdxAttributeVisibility v : values()) { 29718 if (v.value == val) 29719 return v; 29720 } 29721 return null; 29722 } 29723 29724 public int getValue() { 29725 return value; 29726 } 29727 } 29728 29729 /** 29730 * Stream Channel Mode Enumeration 29731 */ 29732 29733 public static enum IMAQdxStreamChannelMode { 29734 StreamChannelModeAutomatic(0), StreamChannelModeManual(1), StreamChannelModeGuard(0xFFFFFFFF), ; 29735 private final int value; 29736 29737 private IMAQdxStreamChannelMode(int value) { 29738 this.value = value; 29739 } 29740 29741 public static IMAQdxStreamChannelMode fromValue(int val) { 29742 for (IMAQdxStreamChannelMode v : values()) { 29743 if (v.value == val) 29744 return v; 29745 } 29746 return null; 29747 } 29748 29749 public int getValue() { 29750 return value; 29751 } 29752 } 29753 29754 /** 29755 * Pixel Signedness Enumeration 29756 */ 29757 29758 public static enum IMAQdxPixelSignedness { 29759 PixelSignednessUnsigned(0), PixelSignednessSigned(1), PixelSignednessHardware(2), PixelSignednessGuard( 29760 0xFFFFFFFF), ; 29761 private final int value; 29762 29763 private IMAQdxPixelSignedness(int value) { 29764 this.value = value; 29765 } 29766 29767 public static IMAQdxPixelSignedness fromValue(int val) { 29768 for (IMAQdxPixelSignedness v : values()) { 29769 if (v.value == val) 29770 return v; 29771 } 29772 return null; 29773 } 29774 29775 public int getValue() { 29776 return value; 29777 } 29778 } 29779 29780 /** 29781 * USB Connection Speed Enumeration 29782 */ 29783 29784 public static enum IMAQdxUSBConnectionSpeed { 29785 USBConnectionSpeedLow(1), USBConnectionSpeedFull(2), USBConnectionSpeedHigh(4), USBConnectionSpeedSuper( 29786 8), USBConnectionSpeedGuard(0xFFFFFFFF), ; 29787 private final int value; 29788 29789 private IMAQdxUSBConnectionSpeed(int value) { 29790 this.value = value; 29791 } 29792 29793 public static IMAQdxUSBConnectionSpeed fromValue(int val) { 29794 for (IMAQdxUSBConnectionSpeed v : values()) { 29795 if (v.value == val) 29796 return v; 29797 } 29798 return null; 29799 } 29800 29801 public int getValue() { 29802 return value; 29803 } 29804 } 29805 29806 /** 29807 * CVI Structures 29808 */ 29809 29810 /** 29811 * Camera Information Structure 29812 */ 29813 29814 public static class IMAQdxCameraInformation extends DisposedStruct { 29815 public int Type; 29816 public int Version; 29817 public int Flags; 29818 public int SerialNumberHi; 29819 public int SerialNumberLo; 29820 public IMAQdxBusType BusType; 29821 public String InterfaceName; 29822 public String VendorName; 29823 public String ModelName; 29824 public String CameraFileName; 29825 public String CameraAttributeURL; 29826 29827 private void init() { 29828 29829 } 29830 29831 public IMAQdxCameraInformation() { 29832 super(2584); 29833 init(); 29834 } 29835 29836 public IMAQdxCameraInformation(int Type, int Version, int Flags, int SerialNumberHi, 29837 int SerialNumberLo, IMAQdxBusType BusType, String InterfaceName, String VendorName, 29838 String ModelName, String CameraFileName, String CameraAttributeURL) { 29839 super(2584); 29840 this.Type = Type; 29841 this.Version = Version; 29842 this.Flags = Flags; 29843 this.SerialNumberHi = SerialNumberHi; 29844 this.SerialNumberLo = SerialNumberLo; 29845 this.BusType = BusType; 29846 this.InterfaceName = InterfaceName; 29847 this.VendorName = VendorName; 29848 this.ModelName = ModelName; 29849 this.CameraFileName = CameraFileName; 29850 this.CameraAttributeURL = CameraAttributeURL; 29851 } 29852 29853 protected IMAQdxCameraInformation(ByteBuffer backing, int offset) { 29854 super(backing, offset, 2584); 29855 init(); 29856 } 29857 29858 protected IMAQdxCameraInformation(long nativeObj, boolean owned) { 29859 super(nativeObj, owned, 2584); 29860 init(); 29861 } 29862 29863 protected void setBuffer(ByteBuffer backing, int offset) { 29864 super.setBuffer(backing, offset, 2584); 29865 } 29866 29867 public void read() { 29868 Type = backing.getInt(0); 29869 Version = backing.getInt(4); 29870 Flags = backing.getInt(8); 29871 SerialNumberHi = backing.getInt(12); 29872 SerialNumberLo = backing.getInt(16); 29873 BusType = IMAQdxBusType.fromValue(backing.getInt(20)); 29874 { 29875 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 29876 getBytes(backing, bytes, 24, IMAQDX_MAX_API_STRING_LENGTH); 29877 int len; 29878 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 29879 } 29880 try { 29881 InterfaceName = new String(bytes, 0, len, "UTF-8"); 29882 } catch (UnsupportedEncodingException e) { 29883 InterfaceName = ""; 29884 } 29885 } 29886 { 29887 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 29888 getBytes(backing, bytes, 536, IMAQDX_MAX_API_STRING_LENGTH); 29889 int len; 29890 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 29891 } 29892 try { 29893 VendorName = new String(bytes, 0, len, "UTF-8"); 29894 } catch (UnsupportedEncodingException e) { 29895 VendorName = ""; 29896 } 29897 } 29898 { 29899 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 29900 getBytes(backing, bytes, 1048, IMAQDX_MAX_API_STRING_LENGTH); 29901 int len; 29902 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 29903 } 29904 try { 29905 ModelName = new String(bytes, 0, len, "UTF-8"); 29906 } catch (UnsupportedEncodingException e) { 29907 ModelName = ""; 29908 } 29909 } 29910 { 29911 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 29912 getBytes(backing, bytes, 1560, IMAQDX_MAX_API_STRING_LENGTH); 29913 int len; 29914 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 29915 } 29916 try { 29917 CameraFileName = new String(bytes, 0, len, "UTF-8"); 29918 } catch (UnsupportedEncodingException e) { 29919 CameraFileName = ""; 29920 } 29921 } 29922 { 29923 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 29924 getBytes(backing, bytes, 2072, IMAQDX_MAX_API_STRING_LENGTH); 29925 int len; 29926 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 29927 } 29928 try { 29929 CameraAttributeURL = new String(bytes, 0, len, "UTF-8"); 29930 } catch (UnsupportedEncodingException e) { 29931 CameraAttributeURL = ""; 29932 } 29933 } 29934 } 29935 29936 public void write() { 29937 backing.putInt(0, Type); 29938 backing.putInt(4, Version); 29939 backing.putInt(8, Flags); 29940 backing.putInt(12, SerialNumberHi); 29941 backing.putInt(16, SerialNumberLo); 29942 if (BusType != null) 29943 backing.putInt(20, BusType.getValue()); 29944 if (InterfaceName != null) { 29945 byte[] bytes; 29946 try { 29947 bytes = InterfaceName.getBytes("UTF-8"); 29948 } catch (UnsupportedEncodingException e) { 29949 bytes = new byte[0]; 29950 } 29951 putBytes(backing, bytes, 24, bytes.length); 29952 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 29953 backing.put(i, (byte) 0); // fill with zero 29954 } 29955 if (VendorName != null) { 29956 byte[] bytes; 29957 try { 29958 bytes = VendorName.getBytes("UTF-8"); 29959 } catch (UnsupportedEncodingException e) { 29960 bytes = new byte[0]; 29961 } 29962 putBytes(backing, bytes, 536, bytes.length); 29963 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 29964 backing.put(i, (byte) 0); // fill with zero 29965 } 29966 if (ModelName != null) { 29967 byte[] bytes; 29968 try { 29969 bytes = ModelName.getBytes("UTF-8"); 29970 } catch (UnsupportedEncodingException e) { 29971 bytes = new byte[0]; 29972 } 29973 putBytes(backing, bytes, 1048, bytes.length); 29974 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 29975 backing.put(i, (byte) 0); // fill with zero 29976 } 29977 if (CameraFileName != null) { 29978 byte[] bytes; 29979 try { 29980 bytes = CameraFileName.getBytes("UTF-8"); 29981 } catch (UnsupportedEncodingException e) { 29982 bytes = new byte[0]; 29983 } 29984 putBytes(backing, bytes, 1560, bytes.length); 29985 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 29986 backing.put(i, (byte) 0); // fill with zero 29987 } 29988 if (CameraAttributeURL != null) { 29989 byte[] bytes; 29990 try { 29991 bytes = CameraAttributeURL.getBytes("UTF-8"); 29992 } catch (UnsupportedEncodingException e) { 29993 bytes = new byte[0]; 29994 } 29995 putBytes(backing, bytes, 2072, bytes.length); 29996 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 29997 backing.put(i, (byte) 0); // fill with zero 29998 } 29999 } 30000 30001 public int size() { 30002 return 2584; 30003 } 30004 } 30005 30006 /** 30007 * Camera File Structure 30008 */ 30009 30010 public static class IMAQdxCameraFile extends DisposedStruct { 30011 public int Type; 30012 public int Version; 30013 public String FileName; 30014 30015 private void init() { 30016 30017 } 30018 30019 public IMAQdxCameraFile() { 30020 super(520); 30021 init(); 30022 } 30023 30024 public IMAQdxCameraFile(int Type, int Version, String FileName) { 30025 super(520); 30026 this.Type = Type; 30027 this.Version = Version; 30028 this.FileName = FileName; 30029 } 30030 30031 protected IMAQdxCameraFile(ByteBuffer backing, int offset) { 30032 super(backing, offset, 520); 30033 init(); 30034 } 30035 30036 protected IMAQdxCameraFile(long nativeObj, boolean owned) { 30037 super(nativeObj, owned, 520); 30038 init(); 30039 } 30040 30041 protected void setBuffer(ByteBuffer backing, int offset) { 30042 super.setBuffer(backing, offset, 520); 30043 } 30044 30045 public void read() { 30046 Type = backing.getInt(0); 30047 Version = backing.getInt(4); 30048 { 30049 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 30050 getBytes(backing, bytes, 8, IMAQDX_MAX_API_STRING_LENGTH); 30051 int len; 30052 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 30053 } 30054 try { 30055 FileName = new String(bytes, 0, len, "UTF-8"); 30056 } catch (UnsupportedEncodingException e) { 30057 FileName = ""; 30058 } 30059 } 30060 } 30061 30062 public void write() { 30063 backing.putInt(0, Type); 30064 backing.putInt(4, Version); 30065 if (FileName != null) { 30066 byte[] bytes; 30067 try { 30068 bytes = FileName.getBytes("UTF-8"); 30069 } catch (UnsupportedEncodingException e) { 30070 bytes = new byte[0]; 30071 } 30072 putBytes(backing, bytes, 8, bytes.length); 30073 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 30074 backing.put(i, (byte) 0); // fill with zero 30075 } 30076 } 30077 30078 public int size() { 30079 return 520; 30080 } 30081 } 30082 30083 /** 30084 * Attribute Information Structure 30085 */ 30086 30087 public static class IMAQdxAttributeInformation extends DisposedStruct { 30088 public IMAQdxAttributeType Type; 30089 public int Readable; 30090 public int Writable; 30091 public String Name; 30092 30093 private void init() { 30094 30095 } 30096 30097 public IMAQdxAttributeInformation() { 30098 super(524); 30099 init(); 30100 } 30101 30102 public IMAQdxAttributeInformation(IMAQdxAttributeType Type, int Readable, int Writable, 30103 String Name) { 30104 super(524); 30105 this.Type = Type; 30106 this.Readable = Readable; 30107 this.Writable = Writable; 30108 this.Name = Name; 30109 } 30110 30111 protected IMAQdxAttributeInformation(ByteBuffer backing, int offset) { 30112 super(backing, offset, 524); 30113 init(); 30114 } 30115 30116 protected IMAQdxAttributeInformation(long nativeObj, boolean owned) { 30117 super(nativeObj, owned, 524); 30118 init(); 30119 } 30120 30121 protected void setBuffer(ByteBuffer backing, int offset) { 30122 super.setBuffer(backing, offset, 524); 30123 } 30124 30125 public void read() { 30126 Type = IMAQdxAttributeType.fromValue(backing.getInt(0)); 30127 Readable = backing.getInt(4); 30128 Writable = backing.getInt(8); 30129 { 30130 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 30131 getBytes(backing, bytes, 12, IMAQDX_MAX_API_STRING_LENGTH); 30132 int len; 30133 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 30134 } 30135 try { 30136 Name = new String(bytes, 0, len, "UTF-8"); 30137 } catch (UnsupportedEncodingException e) { 30138 Name = ""; 30139 } 30140 } 30141 } 30142 30143 public void write() { 30144 if (Type != null) 30145 backing.putInt(0, Type.getValue()); 30146 backing.putInt(4, Readable); 30147 backing.putInt(8, Writable); 30148 if (Name != null) { 30149 byte[] bytes; 30150 try { 30151 bytes = Name.getBytes("UTF-8"); 30152 } catch (UnsupportedEncodingException e) { 30153 bytes = new byte[0]; 30154 } 30155 putBytes(backing, bytes, 12, bytes.length); 30156 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 30157 backing.put(i, (byte) 0); // fill with zero 30158 } 30159 } 30160 30161 public int size() { 30162 return 524; 30163 } 30164 } 30165 30166 /** 30167 * Enumeration Item Structure 30168 */ 30169 30170 public static class IMAQdxEnumItem extends DisposedStruct { 30171 public int Value; 30172 public int Reserved; 30173 public String Name; 30174 30175 private void init() { 30176 30177 } 30178 30179 public IMAQdxEnumItem() { 30180 super(520); 30181 init(); 30182 } 30183 30184 public IMAQdxEnumItem(int Value, int Reserved, String Name) { 30185 super(520); 30186 this.Value = Value; 30187 this.Reserved = Reserved; 30188 this.Name = Name; 30189 } 30190 30191 protected IMAQdxEnumItem(ByteBuffer backing, int offset) { 30192 super(backing, offset, 520); 30193 init(); 30194 } 30195 30196 protected IMAQdxEnumItem(long nativeObj, boolean owned) { 30197 super(nativeObj, owned, 520); 30198 init(); 30199 } 30200 30201 protected void setBuffer(ByteBuffer backing, int offset) { 30202 super.setBuffer(backing, offset, 520); 30203 } 30204 30205 public void read() { 30206 Value = backing.getInt(0); 30207 Reserved = backing.getInt(4); 30208 { 30209 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 30210 getBytes(backing, bytes, 8, IMAQDX_MAX_API_STRING_LENGTH); 30211 int len; 30212 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 30213 } 30214 try { 30215 Name = new String(bytes, 0, len, "UTF-8"); 30216 } catch (UnsupportedEncodingException e) { 30217 Name = ""; 30218 } 30219 } 30220 } 30221 30222 public void write() { 30223 backing.putInt(0, Value); 30224 backing.putInt(4, Reserved); 30225 if (Name != null) { 30226 byte[] bytes; 30227 try { 30228 bytes = Name.getBytes("UTF-8"); 30229 } catch (UnsupportedEncodingException e) { 30230 bytes = new byte[0]; 30231 } 30232 putBytes(backing, bytes, 8, bytes.length); 30233 for (int i = bytes.length; i < IMAQDX_MAX_API_STRING_LENGTH; i++) 30234 backing.put(i, (byte) 0); // fill with zero 30235 } 30236 } 30237 30238 public int size() { 30239 return 520; 30240 } 30241 } 30242 30243 /** 30244 * Camera Information Structure 30245 */ 30246 30247 /** 30248 * Attributes 30249 */ 30250 30251 /** 30252 * Functions 30253 */ 30254 30255 public static void IMAQdxSnap(int id, Image image) { 30256 30257 _IMAQdxSnap(id, image.getAddress()); 30258 30259 } 30260 30261 private static native void _IMAQdxSnap(int id, long image); 30262 30263 public static void IMAQdxConfigureGrab(int id) { 30264 30265 _IMAQdxConfigureGrab(id); 30266 30267 } 30268 30269 private static native void _IMAQdxConfigureGrab(int id); 30270 30271 public static int IMAQdxGrab(int id, Image image, int waitForNextBuffer) { 30272 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30273 long rv_addr = getByteBufferAddress(rv_buf); 30274 _IMAQdxGrab(id, image.getAddress(), waitForNextBuffer, rv_addr + 0); 30275 int actualBufferNumber; 30276 actualBufferNumber = rv_buf.getInt(0); 30277 return actualBufferNumber; 30278 } 30279 30280 private static native void _IMAQdxGrab(int id, long image, int waitForNextBuffer, 30281 long actualBufferNumber); 30282 30283 public static void IMAQdxDiscoverEthernetCameras(String address, int timeout) { 30284 ByteBuffer address_buf = null; 30285 if (address != null) { 30286 byte[] address_bytes; 30287 try { 30288 address_bytes = address.getBytes("UTF-8"); 30289 } catch (UnsupportedEncodingException e) { 30290 address_bytes = new byte[0]; 30291 } 30292 address_buf = ByteBuffer.allocateDirect(address_bytes.length + 1); 30293 putBytes(address_buf, address_bytes, 0, address_bytes.length).put(address_bytes.length, 30294 (byte) 0); 30295 } 30296 _IMAQdxDiscoverEthernetCameras(address == null ? 0 : getByteBufferAddress(address_buf), timeout); 30297 30298 } 30299 30300 private static native void _IMAQdxDiscoverEthernetCameras(long address, int timeout); 30301 30302 public static void IMAQdxResetCamera(String name, int resetAll) { 30303 ByteBuffer name_buf = null; 30304 if (name != null) { 30305 byte[] name_bytes; 30306 try { 30307 name_bytes = name.getBytes("UTF-8"); 30308 } catch (UnsupportedEncodingException e) { 30309 name_bytes = new byte[0]; 30310 } 30311 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30312 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30313 } 30314 _IMAQdxResetCamera(name == null ? 0 : getByteBufferAddress(name_buf), resetAll); 30315 30316 } 30317 30318 private static native void _IMAQdxResetCamera(long name, int resetAll); 30319 30320 public static int IMAQdxOpenCamera(String name, IMAQdxCameraControlMode mode) { 30321 ByteBuffer name_buf = null; 30322 if (name != null) { 30323 byte[] name_bytes; 30324 try { 30325 name_bytes = name.getBytes("UTF-8"); 30326 } catch (UnsupportedEncodingException e) { 30327 name_bytes = new byte[0]; 30328 } 30329 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30330 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30331 } 30332 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30333 long rv_addr = getByteBufferAddress(rv_buf); 30334 _IMAQdxOpenCamera(name == null ? 0 : getByteBufferAddress(name_buf), mode.getValue(), 30335 rv_addr + 0); 30336 int id; 30337 id = rv_buf.getInt(0); 30338 return id; 30339 } 30340 30341 private static native void _IMAQdxOpenCamera(long name, int mode, long id); 30342 30343 public static void IMAQdxCloseCamera(int id) { 30344 30345 _IMAQdxCloseCamera(id); 30346 30347 } 30348 30349 private static native void _IMAQdxCloseCamera(int id); 30350 30351 public static void IMAQdxConfigureAcquisition(int id, int continuous, int bufferCount) { 30352 30353 _IMAQdxConfigureAcquisition(id, continuous, bufferCount); 30354 30355 } 30356 30357 private static native void _IMAQdxConfigureAcquisition(int id, int continuous, int bufferCount); 30358 30359 public static void IMAQdxStartAcquisition(int id) { 30360 30361 _IMAQdxStartAcquisition(id); 30362 30363 } 30364 30365 private static native void _IMAQdxStartAcquisition(int id); 30366 30367 public static int IMAQdxGetImage(int id, Image image, IMAQdxBufferNumberMode mode, 30368 int desiredBufferNumber) { 30369 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30370 long rv_addr = getByteBufferAddress(rv_buf); 30371 _IMAQdxGetImage(id, image.getAddress(), mode.getValue(), desiredBufferNumber, rv_addr + 0); 30372 int actualBufferNumber; 30373 actualBufferNumber = rv_buf.getInt(0); 30374 return actualBufferNumber; 30375 } 30376 30377 private static native void _IMAQdxGetImage(int id, long image, int mode, int desiredBufferNumber, 30378 long actualBufferNumber); 30379 30380 public static int IMAQdxGetImageData(int id, ByteBuffer buffer, IMAQdxBufferNumberMode mode, 30381 int desiredBufferNumber) { 30382 long buffer_addr = getByteBufferAddress(buffer); 30383 int buffer_size = buffer.capacity(); 30384 return _IMAQdxGetImageData(id, buffer_addr, buffer_size, mode.getValue(), desiredBufferNumber); 30385 } 30386 30387 private static native int _IMAQdxGetImageData(int id, long buffer, int bufferSize, int mode, 30388 int desiredBufferNumber); 30389 30390 public static void IMAQdxStopAcquisition(int id) { 30391 30392 _IMAQdxStopAcquisition(id); 30393 30394 } 30395 30396 private static native void _IMAQdxStopAcquisition(int id); 30397 30398 public static void IMAQdxUnconfigureAcquisition(int id) { 30399 30400 _IMAQdxUnconfigureAcquisition(id); 30401 30402 } 30403 30404 private static native void _IMAQdxUnconfigureAcquisition(int id); 30405 30406 public static class dxEnumerateVideoModesResult { 30407 public IMAQdxEnumItem[] videoModeArray; 30408 public int currentMode; 30409 private ByteBuffer videoModeArray_buf; 30410 30411 private dxEnumerateVideoModesResult(ByteBuffer rv_buf, ByteBuffer videoModeArray_buf) { 30412 this.videoModeArray_buf = videoModeArray_buf; 30413 int count = rv_buf.getInt(0); 30414 videoModeArray = new IMAQdxEnumItem[count]; 30415 for (int i = 0, off = 0; i < count; i++, off += 520) { 30416 videoModeArray[i] = new IMAQdxEnumItem(videoModeArray_buf, off); 30417 videoModeArray[i].read(); 30418 } 30419 currentMode = rv_buf.getInt(8); 30420 } 30421 } 30422 30423 public static dxEnumerateVideoModesResult IMAQdxEnumerateVideoModes(int id) { 30424 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8 + 8).order(ByteOrder.nativeOrder()); 30425 long rv_addr = getByteBufferAddress(rv_buf); 30426 _IMAQdxEnumerateVideoModes(id, 0, rv_addr + 0, rv_addr + 8); 30427 int count = rv_buf.getInt(0); 30428 ByteBuffer videoModeArray_buf = 30429 ByteBuffer.allocateDirect(count * 520).order(ByteOrder.nativeOrder()); 30430 _IMAQdxEnumerateVideoModes(id, getByteBufferAddress(videoModeArray_buf), rv_addr + 0, 30431 rv_addr + 8); 30432 dxEnumerateVideoModesResult rv = new dxEnumerateVideoModesResult(rv_buf, videoModeArray_buf); 30433 return rv; 30434 } 30435 30436 private static native void _IMAQdxEnumerateVideoModes(int id, long videoModeArray, long count, 30437 long currentMode); 30438 30439 public static IMAQdxAttributeType IMAQdxGetAttributeType(int id, String name) { 30440 ByteBuffer name_buf = null; 30441 if (name != null) { 30442 byte[] name_bytes; 30443 try { 30444 name_bytes = name.getBytes("UTF-8"); 30445 } catch (UnsupportedEncodingException e) { 30446 name_bytes = new byte[0]; 30447 } 30448 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30449 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30450 } 30451 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30452 long rv_addr = getByteBufferAddress(rv_buf); 30453 _IMAQdxGetAttributeType(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30454 IMAQdxAttributeType type; 30455 type = IMAQdxAttributeType.fromValue(rv_buf.getInt(0)); 30456 return type; 30457 } 30458 30459 private static native void _IMAQdxGetAttributeType(int id, long name, long type); 30460 30461 public static int IMAQdxIsAttributeReadable(int id, String name) { 30462 ByteBuffer name_buf = null; 30463 if (name != null) { 30464 byte[] name_bytes; 30465 try { 30466 name_bytes = name.getBytes("UTF-8"); 30467 } catch (UnsupportedEncodingException e) { 30468 name_bytes = new byte[0]; 30469 } 30470 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30471 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30472 } 30473 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30474 long rv_addr = getByteBufferAddress(rv_buf); 30475 _IMAQdxIsAttributeReadable(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30476 int readable; 30477 readable = rv_buf.getInt(0); 30478 return readable; 30479 } 30480 30481 private static native void _IMAQdxIsAttributeReadable(int id, long name, long readable); 30482 30483 public static int IMAQdxIsAttributeWritable(int id, String name) { 30484 ByteBuffer name_buf = null; 30485 if (name != null) { 30486 byte[] name_bytes; 30487 try { 30488 name_bytes = name.getBytes("UTF-8"); 30489 } catch (UnsupportedEncodingException e) { 30490 name_bytes = new byte[0]; 30491 } 30492 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30493 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30494 } 30495 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30496 long rv_addr = getByteBufferAddress(rv_buf); 30497 _IMAQdxIsAttributeWritable(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30498 int writable; 30499 writable = rv_buf.getInt(0); 30500 return writable; 30501 } 30502 30503 private static native void _IMAQdxIsAttributeWritable(int id, long name, long writable); 30504 30505 public static void IMAQdxWriteRegister(int id, int offset, int value) { 30506 30507 _IMAQdxWriteRegister(id, offset, value); 30508 30509 } 30510 30511 private static native void _IMAQdxWriteRegister(int id, int offset, int value); 30512 30513 public static int IMAQdxReadRegister(int id, int offset) { 30514 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30515 long rv_addr = getByteBufferAddress(rv_buf); 30516 _IMAQdxReadRegister(id, offset, rv_addr + 0); 30517 int value; 30518 value = rv_buf.getInt(0); 30519 return value; 30520 } 30521 30522 private static native void _IMAQdxReadRegister(int id, int offset, long value); 30523 30524 public static void IMAQdxWriteAttributes(int id, String filename) { 30525 ByteBuffer filename_buf = null; 30526 if (filename != null) { 30527 byte[] filename_bytes; 30528 try { 30529 filename_bytes = filename.getBytes("UTF-8"); 30530 } catch (UnsupportedEncodingException e) { 30531 filename_bytes = new byte[0]; 30532 } 30533 filename_buf = ByteBuffer.allocateDirect(filename_bytes.length + 1); 30534 putBytes(filename_buf, filename_bytes, 0, filename_bytes.length).put(filename_bytes.length, 30535 (byte) 0); 30536 } 30537 _IMAQdxWriteAttributes(id, filename == null ? 0 : getByteBufferAddress(filename_buf)); 30538 30539 } 30540 30541 private static native void _IMAQdxWriteAttributes(int id, long filename); 30542 30543 public static void IMAQdxReadAttributes(int id, String filename) { 30544 ByteBuffer filename_buf = null; 30545 if (filename != null) { 30546 byte[] filename_bytes; 30547 try { 30548 filename_bytes = filename.getBytes("UTF-8"); 30549 } catch (UnsupportedEncodingException e) { 30550 filename_bytes = new byte[0]; 30551 } 30552 filename_buf = ByteBuffer.allocateDirect(filename_bytes.length + 1); 30553 putBytes(filename_buf, filename_bytes, 0, filename_bytes.length).put(filename_bytes.length, 30554 (byte) 0); 30555 } 30556 _IMAQdxReadAttributes(id, filename == null ? 0 : getByteBufferAddress(filename_buf)); 30557 30558 } 30559 30560 private static native void _IMAQdxReadAttributes(int id, long filename); 30561 30562 public static void IMAQdxResetEthernetCameraAddress(String name, String address, String subnet, 30563 String gateway, int timeout) { 30564 ByteBuffer name_buf = null; 30565 if (name != null) { 30566 byte[] name_bytes; 30567 try { 30568 name_bytes = name.getBytes("UTF-8"); 30569 } catch (UnsupportedEncodingException e) { 30570 name_bytes = new byte[0]; 30571 } 30572 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30573 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30574 } 30575 ByteBuffer address_buf = null; 30576 if (address != null) { 30577 byte[] address_bytes; 30578 try { 30579 address_bytes = address.getBytes("UTF-8"); 30580 } catch (UnsupportedEncodingException e) { 30581 address_bytes = new byte[0]; 30582 } 30583 address_buf = ByteBuffer.allocateDirect(address_bytes.length + 1); 30584 putBytes(address_buf, address_bytes, 0, address_bytes.length).put(address_bytes.length, 30585 (byte) 0); 30586 } 30587 ByteBuffer subnet_buf = null; 30588 if (subnet != null) { 30589 byte[] subnet_bytes; 30590 try { 30591 subnet_bytes = subnet.getBytes("UTF-8"); 30592 } catch (UnsupportedEncodingException e) { 30593 subnet_bytes = new byte[0]; 30594 } 30595 subnet_buf = ByteBuffer.allocateDirect(subnet_bytes.length + 1); 30596 putBytes(subnet_buf, subnet_bytes, 0, subnet_bytes.length).put(subnet_bytes.length, (byte) 0); 30597 } 30598 ByteBuffer gateway_buf = null; 30599 if (gateway != null) { 30600 byte[] gateway_bytes; 30601 try { 30602 gateway_bytes = gateway.getBytes("UTF-8"); 30603 } catch (UnsupportedEncodingException e) { 30604 gateway_bytes = new byte[0]; 30605 } 30606 gateway_buf = ByteBuffer.allocateDirect(gateway_bytes.length + 1); 30607 putBytes(gateway_buf, gateway_bytes, 0, gateway_bytes.length).put(gateway_bytes.length, 30608 (byte) 0); 30609 } 30610 _IMAQdxResetEthernetCameraAddress(name == null ? 0 : getByteBufferAddress(name_buf), 30611 address == null ? 0 : getByteBufferAddress(address_buf), subnet == null ? 0 30612 : getByteBufferAddress(subnet_buf), gateway == null ? 0 30613 : getByteBufferAddress(gateway_buf), timeout); 30614 30615 } 30616 30617 private static native void _IMAQdxResetEthernetCameraAddress(long name, long address, 30618 long subnet, long gateway, int timeout); 30619 30620 public static IMAQdxAttributeVisibility IMAQdxGetAttributeVisibility(int id, String name) { 30621 ByteBuffer name_buf = null; 30622 if (name != null) { 30623 byte[] name_bytes; 30624 try { 30625 name_bytes = name.getBytes("UTF-8"); 30626 } catch (UnsupportedEncodingException e) { 30627 name_bytes = new byte[0]; 30628 } 30629 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30630 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30631 } 30632 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30633 long rv_addr = getByteBufferAddress(rv_buf); 30634 _IMAQdxGetAttributeVisibility(id, name == null ? 0 : getByteBufferAddress(name_buf), 30635 rv_addr + 0); 30636 IMAQdxAttributeVisibility visibility; 30637 visibility = IMAQdxAttributeVisibility.fromValue(rv_buf.getInt(0)); 30638 return visibility; 30639 } 30640 30641 private static native void _IMAQdxGetAttributeVisibility(int id, long name, long visibility); 30642 30643 public static int IMAQdxGetAttributeU32(int id, String name) { 30644 ByteBuffer name_buf = null; 30645 if (name != null) { 30646 byte[] name_bytes; 30647 try { 30648 name_bytes = name.getBytes("UTF-8"); 30649 } catch (UnsupportedEncodingException e) { 30650 name_bytes = new byte[0]; 30651 } 30652 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30653 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30654 } 30655 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30656 long rv_addr = getByteBufferAddress(rv_buf); 30657 _IMAQdxGetAttributeU32(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30658 int value; 30659 value = rv_buf.getInt(0); 30660 return value; 30661 } 30662 30663 private static native void _IMAQdxGetAttributeU32(int id, long name, long value); 30664 30665 public static long IMAQdxGetAttributeI64(int id, String name) { 30666 ByteBuffer name_buf = null; 30667 if (name != null) { 30668 byte[] name_bytes; 30669 try { 30670 name_bytes = name.getBytes("UTF-8"); 30671 } catch (UnsupportedEncodingException e) { 30672 name_bytes = new byte[0]; 30673 } 30674 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30675 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30676 } 30677 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30678 long rv_addr = getByteBufferAddress(rv_buf); 30679 _IMAQdxGetAttributeI64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30680 long value; 30681 value = rv_buf.getLong(0); 30682 return value; 30683 } 30684 30685 private static native void _IMAQdxGetAttributeI64(int id, long name, long value); 30686 30687 public static double IMAQdxGetAttributeF64(int id, String name) { 30688 ByteBuffer name_buf = null; 30689 if (name != null) { 30690 byte[] name_bytes; 30691 try { 30692 name_bytes = name.getBytes("UTF-8"); 30693 } catch (UnsupportedEncodingException e) { 30694 name_bytes = new byte[0]; 30695 } 30696 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30697 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30698 } 30699 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30700 long rv_addr = getByteBufferAddress(rv_buf); 30701 _IMAQdxGetAttributeF64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30702 double value; 30703 value = rv_buf.getDouble(0); 30704 return value; 30705 } 30706 30707 private static native void _IMAQdxGetAttributeF64(int id, long name, long value); 30708 30709 public static String IMAQdxGetAttributeString(int id, String name) { 30710 ByteBuffer name_buf = null; 30711 if (name != null) { 30712 byte[] name_bytes; 30713 try { 30714 name_bytes = name.getBytes("UTF-8"); 30715 } catch (UnsupportedEncodingException e) { 30716 name_bytes = new byte[0]; 30717 } 30718 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30719 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30720 } 30721 ByteBuffer rv_buf = 30722 ByteBuffer.allocateDirect(IMAQDX_MAX_API_STRING_LENGTH).order(ByteOrder.nativeOrder()); 30723 long rv_addr = getByteBufferAddress(rv_buf); 30724 _IMAQdxGetAttributeString(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30725 String value; 30726 { 30727 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 30728 getBytes(rv_buf, bytes, 0, IMAQDX_MAX_API_STRING_LENGTH); 30729 int len; 30730 for (len = 0; len < bytes.length && bytes[len] != 0; len++) { 30731 } 30732 try { 30733 value = new String(bytes, 0, len, "UTF-8"); 30734 } catch (UnsupportedEncodingException e) { 30735 value = ""; 30736 } 30737 } 30738 return value; 30739 } 30740 30741 private static native void _IMAQdxGetAttributeString(int id, long name, long value); 30742 30743 public static IMAQdxEnumItem IMAQdxGetAttributeEnum(int id, String name) { 30744 ByteBuffer name_buf = null; 30745 if (name != null) { 30746 byte[] name_bytes; 30747 try { 30748 name_bytes = name.getBytes("UTF-8"); 30749 } catch (UnsupportedEncodingException e) { 30750 name_bytes = new byte[0]; 30751 } 30752 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30753 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30754 } 30755 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30756 long rv_addr = getByteBufferAddress(rv_buf); 30757 _IMAQdxGetAttributeEnum(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30758 IMAQdxEnumItem value; 30759 value = new IMAQdxEnumItem(rv_buf, 0); 30760 value.read(); 30761 return value; 30762 } 30763 30764 private static native void _IMAQdxGetAttributeEnum(int id, long name, long value); 30765 30766 public static int IMAQdxGetAttributeBool(int id, String name) { 30767 ByteBuffer name_buf = null; 30768 if (name != null) { 30769 byte[] name_bytes; 30770 try { 30771 name_bytes = name.getBytes("UTF-8"); 30772 } catch (UnsupportedEncodingException e) { 30773 name_bytes = new byte[0]; 30774 } 30775 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30776 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30777 } 30778 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30779 long rv_addr = getByteBufferAddress(rv_buf); 30780 _IMAQdxGetAttributeBool(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr + 0); 30781 int value; 30782 value = rv_buf.getInt(0); 30783 return value; 30784 } 30785 30786 private static native void _IMAQdxGetAttributeBool(int id, long name, long value); 30787 30788 public static int IMAQdxGetAttributeMinimumU32(int id, String name) { 30789 ByteBuffer name_buf = null; 30790 if (name != null) { 30791 byte[] name_bytes; 30792 try { 30793 name_bytes = name.getBytes("UTF-8"); 30794 } catch (UnsupportedEncodingException e) { 30795 name_bytes = new byte[0]; 30796 } 30797 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30798 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30799 } 30800 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30801 long rv_addr = getByteBufferAddress(rv_buf); 30802 _IMAQdxGetAttributeMinimumU32(id, name == null ? 0 : getByteBufferAddress(name_buf), 30803 rv_addr + 0); 30804 int value; 30805 value = rv_buf.getInt(0); 30806 return value; 30807 } 30808 30809 private static native void _IMAQdxGetAttributeMinimumU32(int id, long name, long value); 30810 30811 public static long IMAQdxGetAttributeMinimumI64(int id, String name) { 30812 ByteBuffer name_buf = null; 30813 if (name != null) { 30814 byte[] name_bytes; 30815 try { 30816 name_bytes = name.getBytes("UTF-8"); 30817 } catch (UnsupportedEncodingException e) { 30818 name_bytes = new byte[0]; 30819 } 30820 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30821 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30822 } 30823 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30824 long rv_addr = getByteBufferAddress(rv_buf); 30825 _IMAQdxGetAttributeMinimumI64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30826 rv_addr + 0); 30827 long value; 30828 value = rv_buf.getLong(0); 30829 return value; 30830 } 30831 30832 private static native void _IMAQdxGetAttributeMinimumI64(int id, long name, long value); 30833 30834 public static double IMAQdxGetAttributeMinimumF64(int id, String name) { 30835 ByteBuffer name_buf = null; 30836 if (name != null) { 30837 byte[] name_bytes; 30838 try { 30839 name_bytes = name.getBytes("UTF-8"); 30840 } catch (UnsupportedEncodingException e) { 30841 name_bytes = new byte[0]; 30842 } 30843 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30844 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30845 } 30846 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30847 long rv_addr = getByteBufferAddress(rv_buf); 30848 _IMAQdxGetAttributeMinimumF64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30849 rv_addr + 0); 30850 double value; 30851 value = rv_buf.getDouble(0); 30852 return value; 30853 } 30854 30855 private static native void _IMAQdxGetAttributeMinimumF64(int id, long name, long value); 30856 30857 public static int IMAQdxGetAttributeMaximumU32(int id, String name) { 30858 ByteBuffer name_buf = null; 30859 if (name != null) { 30860 byte[] name_bytes; 30861 try { 30862 name_bytes = name.getBytes("UTF-8"); 30863 } catch (UnsupportedEncodingException e) { 30864 name_bytes = new byte[0]; 30865 } 30866 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30867 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30868 } 30869 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30870 long rv_addr = getByteBufferAddress(rv_buf); 30871 _IMAQdxGetAttributeMaximumU32(id, name == null ? 0 : getByteBufferAddress(name_buf), 30872 rv_addr + 0); 30873 int value; 30874 value = rv_buf.getInt(0); 30875 return value; 30876 } 30877 30878 private static native void _IMAQdxGetAttributeMaximumU32(int id, long name, long value); 30879 30880 public static long IMAQdxGetAttributeMaximumI64(int id, String name) { 30881 ByteBuffer name_buf = null; 30882 if (name != null) { 30883 byte[] name_bytes; 30884 try { 30885 name_bytes = name.getBytes("UTF-8"); 30886 } catch (UnsupportedEncodingException e) { 30887 name_bytes = new byte[0]; 30888 } 30889 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30890 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30891 } 30892 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30893 long rv_addr = getByteBufferAddress(rv_buf); 30894 _IMAQdxGetAttributeMaximumI64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30895 rv_addr + 0); 30896 long value; 30897 value = rv_buf.getLong(0); 30898 return value; 30899 } 30900 30901 private static native void _IMAQdxGetAttributeMaximumI64(int id, long name, long value); 30902 30903 public static double IMAQdxGetAttributeMaximumF64(int id, String name) { 30904 ByteBuffer name_buf = null; 30905 if (name != null) { 30906 byte[] name_bytes; 30907 try { 30908 name_bytes = name.getBytes("UTF-8"); 30909 } catch (UnsupportedEncodingException e) { 30910 name_bytes = new byte[0]; 30911 } 30912 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30913 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30914 } 30915 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30916 long rv_addr = getByteBufferAddress(rv_buf); 30917 _IMAQdxGetAttributeMaximumF64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30918 rv_addr + 0); 30919 double value; 30920 value = rv_buf.getDouble(0); 30921 return value; 30922 } 30923 30924 private static native void _IMAQdxGetAttributeMaximumF64(int id, long name, long value); 30925 30926 public static int IMAQdxGetAttributeIncrementU32(int id, String name) { 30927 ByteBuffer name_buf = null; 30928 if (name != null) { 30929 byte[] name_bytes; 30930 try { 30931 name_bytes = name.getBytes("UTF-8"); 30932 } catch (UnsupportedEncodingException e) { 30933 name_bytes = new byte[0]; 30934 } 30935 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30936 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30937 } 30938 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30939 long rv_addr = getByteBufferAddress(rv_buf); 30940 _IMAQdxGetAttributeIncrementU32(id, name == null ? 0 : getByteBufferAddress(name_buf), 30941 rv_addr + 0); 30942 int value; 30943 value = rv_buf.getInt(0); 30944 return value; 30945 } 30946 30947 private static native void _IMAQdxGetAttributeIncrementU32(int id, long name, long value); 30948 30949 public static long IMAQdxGetAttributeIncrementI64(int id, String name) { 30950 ByteBuffer name_buf = null; 30951 if (name != null) { 30952 byte[] name_bytes; 30953 try { 30954 name_bytes = name.getBytes("UTF-8"); 30955 } catch (UnsupportedEncodingException e) { 30956 name_bytes = new byte[0]; 30957 } 30958 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30959 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30960 } 30961 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30962 long rv_addr = getByteBufferAddress(rv_buf); 30963 _IMAQdxGetAttributeIncrementI64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30964 rv_addr + 0); 30965 long value; 30966 value = rv_buf.getLong(0); 30967 return value; 30968 } 30969 30970 private static native void _IMAQdxGetAttributeIncrementI64(int id, long name, long value); 30971 30972 public static double IMAQdxGetAttributeIncrementF64(int id, String name) { 30973 ByteBuffer name_buf = null; 30974 if (name != null) { 30975 byte[] name_bytes; 30976 try { 30977 name_bytes = name.getBytes("UTF-8"); 30978 } catch (UnsupportedEncodingException e) { 30979 name_bytes = new byte[0]; 30980 } 30981 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 30982 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 30983 } 30984 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 30985 long rv_addr = getByteBufferAddress(rv_buf); 30986 _IMAQdxGetAttributeIncrementF64(id, name == null ? 0 : getByteBufferAddress(name_buf), 30987 rv_addr + 0); 30988 double value; 30989 value = rv_buf.getDouble(0); 30990 return value; 30991 } 30992 30993 private static native void _IMAQdxGetAttributeIncrementF64(int id, long name, long value); 30994 30995 public static void IMAQdxSetAttributeU32(int id, String name, int value) { 30996 ByteBuffer name_buf = null; 30997 if (name != null) { 30998 byte[] name_bytes; 30999 try { 31000 name_bytes = name.getBytes("UTF-8"); 31001 } catch (UnsupportedEncodingException e) { 31002 name_bytes = new byte[0]; 31003 } 31004 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31005 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31006 } 31007 _IMAQdxSetAttributeU32(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 31008 31009 } 31010 31011 private static native void _IMAQdxSetAttributeU32(int id, long name, int value); 31012 31013 public static void IMAQdxSetAttributeI64(int id, String name, long value) { 31014 ByteBuffer name_buf = null; 31015 if (name != null) { 31016 byte[] name_bytes; 31017 try { 31018 name_bytes = name.getBytes("UTF-8"); 31019 } catch (UnsupportedEncodingException e) { 31020 name_bytes = new byte[0]; 31021 } 31022 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31023 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31024 } 31025 _IMAQdxSetAttributeI64(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 31026 31027 } 31028 31029 private static native void _IMAQdxSetAttributeI64(int id, long name, long value); 31030 31031 public static void IMAQdxSetAttributeF64(int id, String name, double value) { 31032 ByteBuffer name_buf = null; 31033 if (name != null) { 31034 byte[] name_bytes; 31035 try { 31036 name_bytes = name.getBytes("UTF-8"); 31037 } catch (UnsupportedEncodingException e) { 31038 name_bytes = new byte[0]; 31039 } 31040 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31041 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31042 } 31043 _IMAQdxSetAttributeF64(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 31044 31045 } 31046 31047 private static native void _IMAQdxSetAttributeF64(int id, long name, double value); 31048 31049 public static void IMAQdxSetAttributeString(int id, String name, String value) { 31050 ByteBuffer name_buf = null; 31051 if (name != null) { 31052 byte[] name_bytes; 31053 try { 31054 name_bytes = name.getBytes("UTF-8"); 31055 } catch (UnsupportedEncodingException e) { 31056 name_bytes = new byte[0]; 31057 } 31058 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31059 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31060 } 31061 ByteBuffer value_buf = null; 31062 if (value != null) { 31063 byte[] value_bytes; 31064 try { 31065 value_bytes = value.getBytes("UTF-8"); 31066 } catch (UnsupportedEncodingException e) { 31067 value_bytes = new byte[0]; 31068 } 31069 value_buf = ByteBuffer.allocateDirect(value_bytes.length + 1); 31070 putBytes(value_buf, value_bytes, 0, value_bytes.length).put(value_bytes.length, (byte) 0); 31071 } 31072 _IMAQdxSetAttributeString(id, name == null ? 0 : getByteBufferAddress(name_buf), 31073 value == null ? 0 : getByteBufferAddress(value_buf)); 31074 31075 } 31076 31077 private static native void _IMAQdxSetAttributeString(int id, long name, long value); 31078 31079 public static void IMAQdxSetAttributeEnum(int id, String name, IMAQdxEnumItem value) { 31080 ByteBuffer name_buf = null; 31081 if (name != null) { 31082 byte[] name_bytes; 31083 try { 31084 name_bytes = name.getBytes("UTF-8"); 31085 } catch (UnsupportedEncodingException e) { 31086 name_bytes = new byte[0]; 31087 } 31088 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31089 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31090 } 31091 _IMAQdxSetAttributeEnum(id, name == null ? 0 : getByteBufferAddress(name_buf), 31092 value.getAddress()); 31093 31094 } 31095 31096 private static native void _IMAQdxSetAttributeEnum(int id, long name, long value); 31097 31098 public static void IMAQdxSetAttributeBool(int id, String name, int value) { 31099 ByteBuffer name_buf = null; 31100 if (name != null) { 31101 byte[] name_bytes; 31102 try { 31103 name_bytes = name.getBytes("UTF-8"); 31104 } catch (UnsupportedEncodingException e) { 31105 name_bytes = new byte[0]; 31106 } 31107 name_buf = ByteBuffer.allocateDirect(name_bytes.length + 1); 31108 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte) 0); 31109 } 31110 _IMAQdxSetAttributeBool(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 31111 31112 } 31113 31114 private static native void _IMAQdxSetAttributeBool(int id, long name, int value); 31115}