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 = Class.forName("java.nio.DirectByteBuffer").getDeclaredConstructor(cArg); 028 constructDirectByteBuffer.setAccessible(true); 029 030 bufferAddressField = Buffer.class.getDeclaredField("address"); 031 bufferAddressField.setAccessible(true); 032 } catch (ReflectiveOperationException e) { 033 throw new ExceptionInInitializerError(e); 034 } 035 } 036 037 private static ByteBuffer newDirectByteBuffer(long addr, int cap) { 038 try { 039 return ((ByteBuffer)(constructDirectByteBuffer.newInstance(addr, cap))).order(ByteOrder.nativeOrder()); 040 } catch (ReflectiveOperationException e) { 041 throw new ExceptionInInitializerError(e); 042 } 043 } 044 045 private static long getByteBufferAddress(ByteBuffer bb) { 046 try { 047 return bufferAddressField.getLong(bb); 048 } catch (IllegalAccessException e) { 049 return 0; 050 } 051 } 052 053 public static ByteBuffer sliceByteBuffer(ByteBuffer bb, int offset, int size) { 054 int pos = bb.position(); 055 int lim = bb.limit(); 056 bb.position(offset); 057 bb.limit(offset+size); 058 ByteBuffer new_bb = bb.slice().order(ByteOrder.nativeOrder()); 059 bb.position(pos); 060 bb.limit(lim); 061 return new_bb; 062 } 063 064 public static ByteBuffer getBytes(ByteBuffer bb, byte[] dst, int offset, int size) { 065 int pos = bb.position(); 066 bb.position(offset); 067 bb.get(dst, 0, size); 068 bb.position(pos); 069 return bb; 070 } 071 072 public static ByteBuffer putBytes(ByteBuffer bb, byte[] src, int offset, int size) { 073 int pos = bb.position(); 074 bb.position(offset); 075 bb.put(src, 0, size); 076 bb.position(pos); 077 return bb; 078 } 079 080 private static abstract class DisposedStruct { 081 protected ByteBuffer backing; 082 private boolean owned; 083 protected DisposedStruct(int size) { 084 backing = ByteBuffer.allocateDirect(size); 085 backing.order(ByteOrder.nativeOrder()); 086 owned = false; 087 } 088 protected DisposedStruct(ByteBuffer backing, int offset, int size) { 089 this.backing = sliceByteBuffer(backing, offset, size); 090 owned = false; 091 } 092 private DisposedStruct(long nativeObj, boolean owned, int size) { 093 backing = newDirectByteBuffer(nativeObj, size); 094 this.owned = owned; 095 } 096 public void free() { 097 if (owned) { 098 imaqDispose(getByteBufferAddress(backing)); 099 owned = false; 100 backing = null; 101 } 102 } 103 @Override 104 protected void finalize() throws Throwable { 105 if (owned) 106 imaqDispose(getByteBufferAddress(backing)); 107 super.finalize(); 108 } 109 public long getAddress() { 110 if (backing == null) 111 return 0; 112 write(); 113 return getByteBufferAddress(backing); 114 } 115 protected void setBuffer(ByteBuffer backing, int offset, int size) { 116 this.backing = sliceByteBuffer(backing, offset, size); 117 } 118 119 abstract public void read(); 120 abstract public void write(); 121 abstract public int size(); 122 } 123 124 private static abstract class OpaqueStruct { 125 private long nativeObj; 126 private boolean owned; 127 protected OpaqueStruct() { 128 nativeObj = 0; 129 owned = false; 130 } 131 protected OpaqueStruct(long nativeObj, boolean owned) { 132 this.nativeObj = nativeObj; 133 this.owned = owned; 134 } 135 public void free() { 136 if (owned && nativeObj != 0) { 137 imaqDispose(nativeObj); 138 owned = false; 139 nativeObj = 0; 140 } 141 } 142 @Override 143 protected void finalize() throws Throwable { 144 if (owned && nativeObj != 0) 145 imaqDispose(nativeObj); 146 super.finalize(); 147 } 148 public long getAddress() { 149 return nativeObj; 150 } 151 } 152 153 public static class RawData { 154 private ByteBuffer buf; 155 private boolean owned; 156 public RawData() { 157 owned = false; 158 } 159 public RawData(ByteBuffer buf) { 160 this.buf = buf; 161 owned = false; 162 } 163 private RawData(long nativeObj, boolean owned, int size) { 164 buf = newDirectByteBuffer(nativeObj, size); 165 this.owned = owned; 166 } 167 public void free() { 168 if (owned) { 169 imaqDispose(getByteBufferAddress(buf)); 170 owned = false; 171 buf = null; 172 } 173 } 174 @Override 175 protected void finalize() throws Throwable { 176 if (owned) 177 imaqDispose(getByteBufferAddress(buf)); 178 super.finalize(); 179 } 180 public long getAddress() { 181 if (buf == null) 182 return 0; 183 return getByteBufferAddress(buf); 184 } 185 public ByteBuffer getBuffer() { 186 return buf; 187 } 188 public void setBuffer(ByteBuffer buf) { 189 if (owned) 190 free(); 191 this.buf = buf; 192 } 193 } 194 195 private static long getPointer(ByteBuffer bb, int offset) { 196 return (long)bb.getInt(offset); 197 } 198 private static void putPointer(ByteBuffer bb, int offset, long address) { 199 bb.putInt(offset, (int)address); 200 } 201 private static void putPointer(ByteBuffer bb, int offset, ByteBuffer buf) { 202 if (buf == null) 203 bb.putInt(offset, 0); 204 else 205 bb.putInt(offset, (int)getByteBufferAddress(buf)); 206 } 207 private static void putPointer(ByteBuffer bb, int offset, DisposedStruct struct) { 208 if (struct == null) 209 bb.putInt(offset, 0); 210 else 211 bb.putInt(offset, (int)struct.getAddress()); 212 } 213 private static void putPointer(ByteBuffer bb, int offset, OpaqueStruct struct) { 214 if (struct == null) 215 bb.putInt(offset, 0); 216 else 217 bb.putInt(offset, (int)struct.getAddress()); 218 } 219 220 /** 221 * Opaque Structures 222 */ 223 224 public static class CharSet extends OpaqueStruct { 225 private CharSet() {} 226 private CharSet(long nativeObj, boolean owned) { 227 super(nativeObj, owned); 228 } 229 } 230 231 public static class ClassifierSession extends OpaqueStruct { 232 private ClassifierSession() {} 233 private ClassifierSession(long nativeObj, boolean owned) { 234 super(nativeObj, owned); 235 } 236 } 237 238 public static class Image extends OpaqueStruct { 239 private Image() {} 240 private Image(long nativeObj, boolean owned) { 241 super(nativeObj, owned); 242 } 243 } 244 245 public static class MultipleGeometricPattern extends OpaqueStruct { 246 private MultipleGeometricPattern() {} 247 private MultipleGeometricPattern(long nativeObj, boolean owned) { 248 super(nativeObj, owned); 249 } 250 } 251 252 public static class Overlay extends OpaqueStruct { 253 private Overlay() {} 254 private Overlay(long nativeObj, boolean owned) { 255 super(nativeObj, owned); 256 } 257 } 258 259 public static class ROI extends OpaqueStruct { 260 private ROI() {} 261 private ROI(long nativeObj, boolean owned) { 262 super(nativeObj, owned); 263 } 264 } 265 266 /** 267 * Manifest Constants 268 */ 269 public static final boolean DEFAULT_SHOW_COORDINATES = true; 270 public static final int DEFAULT_MAX_ICONS_PER_LINE = 4; 271 public static final boolean DEFAULT_BMP_COMPRESS = false; 272 public static final int DEFAULT_PNG_QUALITY = 750; 273 public static final int DEFAULT_JPEG_QUALITY = 750; 274 public static final int ALL_CONTOURS = -1; 275 public static final int ALL_WINDOWS = -1; 276 public static final int SHIFT = 1; 277 public static final int ALT = 2; 278 public static final int CTRL = 4; 279 public static final int CAPS_LOCK = 8; 280 public static final int MODAL_DIALOG = -1; 281 public static final int USE_DEFAULT_QUALITY = -1; 282 public static final int ALL_SAMPLES = -1; 283 public static final int ALL_OBJECTS = -1; 284 public static final int ALL_CHARACTERS = -1; 285 286 /** 287 * Predefined Valid Characters 288 */ 289 public static final byte[] ANY_CHARACTER = { 0 }; 290 public static final byte[] ALPHABETIC = { 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0 }; 291 public static final byte[] ALPHANUMERIC = { 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0 }; 292 public static final byte[] UPPERCASE_LETTERS = { 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0 }; 293 public static final byte[] LOWERCASE_LETTERS = { 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0 }; 294 public static final byte[] DECIMAL_DIGITS = { 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0 }; 295 public static final byte[] HEXADECIMAL_DIGITS = { 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46,0x61,0x62,0x63,0x64,0x65,0x66,0 }; 296 public static final byte[] PATTERN = { 0x5c,0x78,0x46,0x46,0 }; 297 public static final byte[] FORCE_SPACE = { 0x20,0 }; 298 299 /** 300 * Enumerated Types 301 */ 302 303 public static enum PointSymbol { 304 POINT_AS_PIXEL(0), // A single pixel represents a point in the overlay. 305 POINT_AS_CROSS(1), // A cross represents a point in the overlay. 306 POINT_USER_DEFINED(2), // The pattern supplied by the user represents a point in the overlay. 307 ; 308 private final int value; 309 private PointSymbol(int value) { 310 this.value = value; 311 } 312 public static PointSymbol fromValue(int val) { 313 try { 314 return values()[val]; 315 } catch (ArrayIndexOutOfBoundsException e) { 316 return null; 317 } 318 } 319 public int getValue() { 320 return value; 321 } 322 } 323 324 public static enum MeasurementValue { 325 AREA(0), // Surface area of the particle in pixels. 326 AREA_CALIBRATED(1), // Surface area of the particle in calibrated units. 327 NUM_HOLES(2), // Number of holes in the particle. 328 AREA_OF_HOLES(3), // Surface area of the holes in calibrated units. 329 TOTAL_AREA(4), // Total surface area (holes and particle) in calibrated units. 330 IMAGE_AREA(5), // Surface area of the entire image in calibrated units. 331 PARTICLE_TO_IMAGE(6), // Ratio, expressed as a percentage, of the surface area of a particle in relation to the total area of the particle. 332 PARTICLE_TO_TOTAL(7), // Ratio, expressed as a percentage, of the surface area of a particle in relation to the total area of the particle. 333 CENTER_MASS_X(8), // X-coordinate of the center of mass. 334 CENTER_MASS_Y(9), // Y-coordinate of the center of mass. 335 LEFT_COLUMN(10), // Left edge of the bounding rectangle. 336 TOP_ROW(11), // Top edge of the bounding rectangle. 337 RIGHT_COLUMN(12), // Right edge of the bounding rectangle. 338 BOTTOM_ROW(13), // Bottom edge of bounding rectangle. 339 WIDTH(14), // Width of bounding rectangle in calibrated units. 340 HEIGHT(15), // Height of bounding rectangle in calibrated units. 341 MAX_SEGMENT_LENGTH(16), // Length of longest horizontal line segment. 342 MAX_SEGMENT_LEFT_COLUMN(17), // Leftmost x-coordinate of longest horizontal line segment. 343 MAX_SEGMENT_TOP_ROW(18), // Y-coordinate of longest horizontal line segment. 344 PERIMETER(19), // Outer perimeter of the particle. 345 PERIMETER_OF_HOLES(20), // Perimeter of all holes within the particle. 346 SIGMA_X(21), // Sum of the particle pixels on the x-axis. 347 SIGMA_Y(22), // Sum of the particle pixels on the y-axis. 348 SIGMA_XX(23), // Sum of the particle pixels on the x-axis squared. 349 SIGMA_YY(24), // Sum of the particle pixels on the y-axis squared. 350 SIGMA_XY(25), // Sum of the particle pixels on the x-axis and y-axis. 351 PROJ_X(26), // Projection corrected in X. 352 PROJ_Y(27), // Projection corrected in Y. 353 INERTIA_XX(28), // Inertia matrix coefficient in XX. 354 INERTIA_YY(29), // Inertia matrix coefficient in YY. 355 INERTIA_XY(30), // Inertia matrix coefficient in XY. 356 MEAN_H(31), // Mean length of horizontal segments. 357 MEAN_V(32), // Mean length of vertical segments. 358 MAX_INTERCEPT(33), // Length of longest segment of the convex hull. 359 MEAN_INTERCEPT(34), // Mean length of the chords in an object perpendicular to its max intercept. 360 ORIENTATION(35), // The orientation based on the inertia of the pixels in the particle. 361 EQUIV_ELLIPSE_MINOR(36), // Total length of the axis of the ellipse having the same area as the particle and a major axis equal to half the max intercept. 362 ELLIPSE_MAJOR(37), // Total length of major axis having the same area and perimeter as the particle in calibrated units. 363 ELLIPSE_MINOR(38), // Total length of minor axis having the same area and perimeter as the particle in calibrated units. 364 ELLIPSE_RATIO(39), // Fraction of major axis to minor axis. 365 RECT_LONG_SIDE(40), // Length of the long side of a rectangle having the same area and perimeter as the particle in calibrated units. 366 RECT_SHORT_SIDE(41), // Length of the short side of a rectangle having the same area and perimeter as the particle in calibrated units. 367 RECT_RATIO(42), // Ratio of rectangle long side to rectangle short side. 368 ELONGATION(43), // Max intercept/mean perpendicular intercept. 369 COMPACTNESS(44), // Particle area/(height x width). 370 HEYWOOD(45), // Particle perimeter/perimeter of the circle having the same area as the particle. 371 TYPE_FACTOR(46), // A complex factor relating the surface area to the moment of inertia. 372 HYDRAULIC(47), // Particle area/particle perimeter. 373 WADDLE_DISK(48), // Diameter of the disk having the same area as the particle in user units. 374 DIAGONAL(49), // Diagonal of an equivalent rectangle in user units. 375 ; 376 private final int value; 377 private MeasurementValue(int value) { 378 this.value = value; 379 } 380 public static MeasurementValue fromValue(int val) { 381 try { 382 return values()[val]; 383 } catch (ArrayIndexOutOfBoundsException e) { 384 return null; 385 } 386 } 387 public int getValue() { 388 return value; 389 } 390 } 391 392 public static enum ScalingMode { 393 SCALE_LARGER(0), // The function duplicates pixels to make the image larger. 394 SCALE_SMALLER(1), // The function subsamples pixels to make the image smaller. 395 ; 396 private final int value; 397 private ScalingMode(int value) { 398 this.value = value; 399 } 400 public static ScalingMode fromValue(int val) { 401 try { 402 return values()[val]; 403 } catch (ArrayIndexOutOfBoundsException e) { 404 return null; 405 } 406 } 407 public int getValue() { 408 return value; 409 } 410 } 411 412 public static enum ScalingMethod { 413 SCALE_TO_PRESERVE_AREA(0), // Correction functions scale the image such that the features in the corrected image have the same area as the features in the input image. 414 SCALE_TO_FIT(1), // Correction functions scale the image such that the corrected image is the same size as the input image. 415 ; 416 private final int value; 417 private ScalingMethod(int value) { 418 this.value = value; 419 } 420 public static ScalingMethod fromValue(int val) { 421 try { 422 return values()[val]; 423 } catch (ArrayIndexOutOfBoundsException e) { 424 return null; 425 } 426 } 427 public int getValue() { 428 return value; 429 } 430 } 431 432 public static enum ReferenceMode { 433 COORD_X_Y(0), // This method requires three elements in the points array. 434 COORD_ORIGIN_X(1), // This method requires two elements in the points array. 435 ; 436 private final int value; 437 private ReferenceMode(int value) { 438 this.value = value; 439 } 440 public static ReferenceMode fromValue(int val) { 441 try { 442 return values()[val]; 443 } catch (ArrayIndexOutOfBoundsException e) { 444 return null; 445 } 446 } 447 public int getValue() { 448 return value; 449 } 450 } 451 452 public static enum RectOrientation { 453 BASE_INSIDE(0), // Specifies that the base of the rectangular image lies along the inside edge of the annulus. 454 BASE_OUTSIDE(1), // Specifies that the base of the rectangular image lies along the outside edge of the annulus. 455 ; 456 private final int value; 457 private RectOrientation(int value) { 458 this.value = value; 459 } 460 public static RectOrientation fromValue(int val) { 461 try { 462 return values()[val]; 463 } catch (ArrayIndexOutOfBoundsException e) { 464 return null; 465 } 466 } 467 public int getValue() { 468 return value; 469 } 470 } 471 472 public static enum ShapeMode { 473 SHAPE_RECT(1), // The function draws a rectangle. 474 SHAPE_OVAL(2), // The function draws an oval. 475 ; 476 private final int value; 477 private ShapeMode(int value) { 478 this.value = value; 479 } 480 public static ShapeMode fromValue(int val) { 481 for (ShapeMode v : values()) { 482 if (v.value == val) 483 return v; 484 } 485 return null; 486 } 487 public int getValue() { 488 return value; 489 } 490 } 491 492 public static enum PolarityType { 493 EDGE_RISING(1), // The edge is a rising edge. 494 EDGE_FALLING(-1), // The edge is a falling edge. 495 ; 496 private final int value; 497 private PolarityType(int value) { 498 this.value = value; 499 } 500 public static PolarityType fromValue(int val) { 501 for (PolarityType v : values()) { 502 if (v.value == val) 503 return v; 504 } 505 return null; 506 } 507 public int getValue() { 508 return value; 509 } 510 } 511 512 public static enum SizeType { 513 KEEP_LARGE(0), // The function keeps large particles remaining after the erosion. 514 KEEP_SMALL(1), // The function keeps small particles eliminated by the erosion. 515 ; 516 private final int value; 517 private SizeType(int value) { 518 this.value = value; 519 } 520 public static SizeType fromValue(int val) { 521 try { 522 return values()[val]; 523 } catch (ArrayIndexOutOfBoundsException e) { 524 return null; 525 } 526 } 527 public int getValue() { 528 return value; 529 } 530 } 531 532 public static enum Plane3D { 533 C3D_REAL(0), // The function shows the real part of complex images. 534 C3D_IMAGINARY(1), // The function shows the imaginary part of complex images. 535 C3D_MAGNITUDE(2), // The function shows the magnitude part of complex images. 536 C3D_PHASE(3), // The function shows the phase part of complex images. 537 ; 538 private final int value; 539 private Plane3D(int value) { 540 this.value = value; 541 } 542 public static Plane3D fromValue(int val) { 543 try { 544 return values()[val]; 545 } catch (ArrayIndexOutOfBoundsException e) { 546 return null; 547 } 548 } 549 public int getValue() { 550 return value; 551 } 552 } 553 554 public static enum PhotometricMode { 555 WHITE_IS_ZERO(0), // The function interprets zero-value pixels as white. 556 BLACK_IS_ZERO(1), // The function interprets zero-value pixels as black. 557 ; 558 private final int value; 559 private PhotometricMode(int value) { 560 this.value = value; 561 } 562 public static PhotometricMode fromValue(int val) { 563 try { 564 return values()[val]; 565 } catch (ArrayIndexOutOfBoundsException e) { 566 return null; 567 } 568 } 569 public int getValue() { 570 return value; 571 } 572 } 573 574 public static enum ParticleInfoMode { 575 BASIC_INFO(0), // The function returns only the following elements of each report: area, calibratedArea, boundingRect. 576 ALL_INFO(1), // The function returns all the information about each particle. 577 ; 578 private final int value; 579 private ParticleInfoMode(int value) { 580 this.value = value; 581 } 582 public static ParticleInfoMode fromValue(int val) { 583 try { 584 return values()[val]; 585 } catch (ArrayIndexOutOfBoundsException e) { 586 return null; 587 } 588 } 589 public int getValue() { 590 return value; 591 } 592 } 593 594 public static enum OutlineMethod { 595 EDGE_DIFFERENCE(0), // The function uses a method that produces continuous contours by highlighting each pixel where an intensity variation occurs between itself and its three upper-left neighbors. 596 EDGE_GRADIENT(1), // The function uses a method that outlines contours where an intensity variation occurs along the vertical axis. 597 EDGE_PREWITT(2), // The function uses a method that extracts the outer contours of objects. 598 EDGE_ROBERTS(3), // The function uses a method that outlines the contours that highlight pixels where an intensity variation occurs along the diagonal axes. 599 EDGE_SIGMA(4), // The function uses a method that outlines contours and details by setting pixels to the mean value found in their neighborhood, if their deviation from this value is not significant. 600 EDGE_SOBEL(5), // The function uses a method that extracts the outer contours of objects. 601 ; 602 private final int value; 603 private OutlineMethod(int value) { 604 this.value = value; 605 } 606 public static OutlineMethod fromValue(int val) { 607 try { 608 return values()[val]; 609 } catch (ArrayIndexOutOfBoundsException e) { 610 return null; 611 } 612 } 613 public int getValue() { 614 return value; 615 } 616 } 617 618 public static enum MorphologyMethod { 619 AUTOM(0), // The function uses a transformation that generates simpler particles that contain fewer details. 620 CLOSE(1), // The function uses a transformation that fills tiny holes and smooths boundaries. 621 DILATE(2), // The function uses a transformation that eliminates tiny holes isolated in particles and expands the contour of the particles according to the template defined by the structuring element. 622 ERODE(3), // The function uses a transformation that eliminates pixels isolated in the background and erodes the contour of particles according to the template defined by the structuring element. 623 GRADIENT(4), // The function uses a transformation that leaves only the pixels that would be added by the dilation process or eliminated by the erosion process. 624 GRADIENTOUT(5), // The function uses a transformation that leaves only the pixels that would be added by the dilation process. 625 GRADIENTIN(6), // The function uses a transformation that leaves only the pixels that would be eliminated by the erosion process. 626 HITMISS(7), // The function uses a transformation that extracts each pixel located in a neighborhood exactly matching the template defined by the structuring element. 627 OPEN(8), // The function uses a transformation that removes small particles and smooths boundaries. 628 PCLOSE(9), // The function uses a transformation that fills tiny holes and smooths the inner contour of particles according to the template defined by the structuring element. 629 POPEN(10), // The function uses a transformation that removes small particles and smooths the contour of particles according to the template defined by the structuring element. 630 THICK(11), // The function uses a transformation that adds to an image those pixels located in a neighborhood that matches a template specified by the structuring element. 631 THIN(12), // The function uses a transformation that eliminates pixels that are located in a neighborhood matching a template specified by the structuring element. 632 ; 633 private final int value; 634 private MorphologyMethod(int value) { 635 this.value = value; 636 } 637 public static MorphologyMethod fromValue(int val) { 638 try { 639 return values()[val]; 640 } catch (ArrayIndexOutOfBoundsException e) { 641 return null; 642 } 643 } 644 public int getValue() { 645 return value; 646 } 647 } 648 649 public static enum MeterArcMode { 650 METER_ARC_ROI(0), // The function uses the roi parameter and ignores the base, start, and end parameters. 651 METER_ARC_POINTS(1), // The function uses the base,start, and end parameters and ignores the roi parameter. 652 ; 653 private final int value; 654 private MeterArcMode(int value) { 655 this.value = value; 656 } 657 public static MeterArcMode fromValue(int val) { 658 try { 659 return values()[val]; 660 } catch (ArrayIndexOutOfBoundsException e) { 661 return null; 662 } 663 } 664 public int getValue() { 665 return value; 666 } 667 } 668 669 public static enum RakeDirection { 670 LEFT_TO_RIGHT(0), // The function searches from the left side of the search area to the right side of the search area. 671 RIGHT_TO_LEFT(1), // The function searches from the right side of the search area to the left side of the search area. 672 TOP_TO_BOTTOM(2), // The function searches from the top side of the search area to the bottom side of the search area. 673 BOTTOM_TO_TOP(3), // The function searches from the bottom side of the search area to the top side of the search area. 674 ; 675 private final int value; 676 private RakeDirection(int value) { 677 this.value = value; 678 } 679 public static RakeDirection fromValue(int val) { 680 try { 681 return values()[val]; 682 } catch (ArrayIndexOutOfBoundsException e) { 683 return null; 684 } 685 } 686 public int getValue() { 687 return value; 688 } 689 } 690 691 public static enum TruncateMode { 692 TRUNCATE_LOW(0), // The function truncates low frequencies. 693 TRUNCATE_HIGH(1), // The function truncates high frequencies. 694 ; 695 private final int value; 696 private TruncateMode(int value) { 697 this.value = value; 698 } 699 public static TruncateMode fromValue(int val) { 700 try { 701 return values()[val]; 702 } catch (ArrayIndexOutOfBoundsException e) { 703 return null; 704 } 705 } 706 public int getValue() { 707 return value; 708 } 709 } 710 711 public static enum AttenuateMode { 712 ATTENUATE_LOW(0), // The function attenuates low frequencies. 713 ATTENUATE_HIGH(1), // The function attenuates high frequencies. 714 ; 715 private final int value; 716 private AttenuateMode(int value) { 717 this.value = value; 718 } 719 public static AttenuateMode fromValue(int val) { 720 try { 721 return values()[val]; 722 } catch (ArrayIndexOutOfBoundsException e) { 723 return null; 724 } 725 } 726 public int getValue() { 727 return value; 728 } 729 } 730 731 public static enum WindowThreadPolicy { 732 CALLING_THREAD(0), // Using this policy, NI Vision creates windows in the thread that makes the first display function call for a given window number. 733 SEPARATE_THREAD(1), // Using this policy, NI Vision creates windows in a separate thread and processes messages for the windows automatically. 734 ; 735 private final int value; 736 private WindowThreadPolicy(int value) { 737 this.value = value; 738 } 739 public static WindowThreadPolicy fromValue(int val) { 740 try { 741 return values()[val]; 742 } catch (ArrayIndexOutOfBoundsException e) { 743 return null; 744 } 745 } 746 public int getValue() { 747 return value; 748 } 749 } 750 751 public static enum WindowOptions { 752 WIND_RESIZABLE(1), // When present, the user may resize the window interactively. 753 WIND_TITLEBAR(2), // When present, the title bar on the window is visible. 754 WIND_CLOSEABLE(4), // When present, the close box is available. 755 WIND_TOPMOST(8), // When present, the window is always on top. 756 ; 757 private final int value; 758 private WindowOptions(int value) { 759 this.value = value; 760 } 761 public static WindowOptions fromValue(int val) { 762 for (WindowOptions v : values()) { 763 if (v.value == val) 764 return v; 765 } 766 return null; 767 } 768 public int getValue() { 769 return value; 770 } 771 } 772 773 public static enum WindowEventType { 774 NO_EVENT(0), // No event occurred since the last call to imaqGetLastEvent(). 775 CLICK_EVENT(1), // The user clicked on a window. 776 DRAW_EVENT(2), // The user drew an ROI in a window. 777 MOVE_EVENT(3), // The user moved a window. 778 SIZE_EVENT(4), // The user sized a window. 779 SCROLL_EVENT(5), // The user scrolled a window. 780 ACTIVATE_EVENT(6), // The user activated a window. 781 CLOSE_EVENT(7), // The user closed a window. 782 DOUBLE_CLICK_EVENT(8), // The user double-clicked in a window. 783 ; 784 private final int value; 785 private WindowEventType(int value) { 786 this.value = value; 787 } 788 public static WindowEventType fromValue(int val) { 789 try { 790 return values()[val]; 791 } catch (ArrayIndexOutOfBoundsException e) { 792 return null; 793 } 794 } 795 public int getValue() { 796 return value; 797 } 798 } 799 800 public static enum VisionInfoType { 801 ANY_VISION_INFO(0), // The function checks if any extra vision information is associated with the image. 802 PATTERN_MATCHING_INFO(1), // The function checks if any pattern matching template information is associated with the image. 803 CALIBRATION_INFO(2), // The function checks if any calibration information is associated with the image. 804 OVERLAY_INFO(3), // The function checks if any overlay information is associated with the image. 805 ; 806 private final int value; 807 private VisionInfoType(int value) { 808 this.value = value; 809 } 810 public static VisionInfoType fromValue(int val) { 811 try { 812 return values()[val]; 813 } catch (ArrayIndexOutOfBoundsException e) { 814 return null; 815 } 816 } 817 public int getValue() { 818 return value; 819 } 820 } 821 822 public static enum SearchStrategy { 823 CONSERVATIVE(1), // Instructs the pattern matching algorithm to use the largest possible amount of information from the image at the expense of slowing down the speed of the algorithm. 824 BALANCED(2), // Instructs the pattern matching algorithm to balance the amount of information from the image it uses with the speed of the algorithm. 825 AGGRESSIVE(3), // Instructs the pattern matching algorithm to use a lower amount of information from the image, which allows the algorithm to run quickly but at the expense of accuracy. 826 VERY_AGGRESSIVE(4), // Instructs the pattern matching algorithm to use the smallest possible amount of information from the image, which allows the algorithm to run at the highest speed possible but at the expense of accuracy. 827 ; 828 private final int value; 829 private SearchStrategy(int value) { 830 this.value = value; 831 } 832 public static SearchStrategy fromValue(int val) { 833 for (SearchStrategy v : values()) { 834 if (v.value == val) 835 return v; 836 } 837 return null; 838 } 839 public int getValue() { 840 return value; 841 } 842 } 843 844 public static enum TwoEdgePolarityType { 845 NONE(0), // The function ignores the polarity of the edges. 846 RISING_FALLING(1), // The polarity of the first edge is rising (dark to light) and the polarity of the second edge is falling (light to dark). 847 FALLING_RISING(2), // The polarity of the first edge is falling (light to dark) and the polarity of the second edge is rising (dark to light). 848 RISING_RISING(3), // The polarity of the first edge is rising (dark to light) and the polarity of the second edge is rising (dark to light). 849 FALLING_FALLING(4), // The polarity of the first edge is falling (light to dark) and the polarity of the second edge is falling (light to dark). 850 ; 851 private final int value; 852 private TwoEdgePolarityType(int value) { 853 this.value = value; 854 } 855 public static TwoEdgePolarityType fromValue(int val) { 856 try { 857 return values()[val]; 858 } catch (ArrayIndexOutOfBoundsException e) { 859 return null; 860 } 861 } 862 public int getValue() { 863 return value; 864 } 865 } 866 867 public static enum ObjectType { 868 BRIGHT_OBJECTS(0), // The function detects bright objects. 869 DARK_OBJECTS(1), // The function detects dark objects. 870 ; 871 private final int value; 872 private ObjectType(int value) { 873 this.value = value; 874 } 875 public static ObjectType fromValue(int val) { 876 try { 877 return values()[val]; 878 } catch (ArrayIndexOutOfBoundsException e) { 879 return null; 880 } 881 } 882 public int getValue() { 883 return value; 884 } 885 } 886 887 public static enum Tool { 888 NO_TOOL(-1), // No tool is in the selected state. 889 SELECTION_TOOL(0), // The selection tool selects an existing ROI in an image. 890 POINT_TOOL(1), // The point tool draws a point on the image. 891 LINE_TOOL(2), // The line tool draws a line on the image. 892 RECTANGLE_TOOL(3), // The rectangle tool draws a rectangle on the image. 893 OVAL_TOOL(4), // The oval tool draws an oval on the image. 894 POLYGON_TOOL(5), // The polygon tool draws a polygon on the image. 895 CLOSED_FREEHAND_TOOL(6), // The closed freehand tool draws closed freehand shapes on the image. 896 ANNULUS_TOOL(7), // The annulus tool draws annuluses on the image. 897 ZOOM_TOOL(8), // The zoom tool controls the zoom of an image. 898 PAN_TOOL(9), // The pan tool shifts the view of the image. 899 POLYLINE_TOOL(10), // The polyline tool draws a series of connected straight lines on the image. 900 FREEHAND_TOOL(11), // The freehand tool draws freehand lines on the image. 901 ROTATED_RECT_TOOL(12), // The rotated rectangle tool draws rotated rectangles on the image. 902 ZOOM_OUT_TOOL(13), // The zoom out tool controls the zoom of an image. 903 ; 904 private final int value; 905 private Tool(int value) { 906 this.value = value; 907 } 908 public static Tool fromValue(int val) { 909 for (Tool v : values()) { 910 if (v.value == val) 911 return v; 912 } 913 return null; 914 } 915 public int getValue() { 916 return value; 917 } 918 } 919 920 public static enum TIFFCompressionType { 921 NO_COMPRESSION(0), // The function does not compress the TIFF file. 922 JPEG(1), // The function uses the JPEG compression algorithm to compress the TIFF file. 923 RUN_LENGTH(2), // The function uses a run length compression algorithm to compress the TIFF file. 924 ZIP(3), // The function uses the ZIP compression algorithm to compress the TIFF file. 925 ; 926 private final int value; 927 private TIFFCompressionType(int value) { 928 this.value = value; 929 } 930 public static TIFFCompressionType fromValue(int val) { 931 try { 932 return values()[val]; 933 } catch (ArrayIndexOutOfBoundsException e) { 934 return null; 935 } 936 } 937 public int getValue() { 938 return value; 939 } 940 } 941 942 public static enum ThresholdMethod { 943 THRESH_CLUSTERING(0), // The function uses a method that sorts the histogram of the image within a discrete number of classes corresponding to the number of phases perceived in an image. 944 THRESH_ENTROPY(1), // The function uses a method that is best for detecting particles that are present in minuscule proportions on the image. 945 THRESH_METRIC(2), // The function uses a method that is well-suited for images in which classes are not too disproportionate. 946 THRESH_MOMENTS(3), // The function uses a method that is suited for images that have poor contrast. 947 THRESH_INTERCLASS(4), // The function uses a method that is well-suited for images in which classes have well separated pixel value distributions. 948 ; 949 private final int value; 950 private ThresholdMethod(int value) { 951 this.value = value; 952 } 953 public static ThresholdMethod fromValue(int val) { 954 try { 955 return values()[val]; 956 } catch (ArrayIndexOutOfBoundsException e) { 957 return null; 958 } 959 } 960 public int getValue() { 961 return value; 962 } 963 } 964 965 public static enum TextAlignment { 966 LEFT(0), // Left aligns the text at the reference point. 967 CENTER(1), // Centers the text around the reference point. 968 RIGHT(2), // Right aligns the text at the reference point. 969 ; 970 private final int value; 971 private TextAlignment(int value) { 972 this.value = value; 973 } 974 public static TextAlignment fromValue(int val) { 975 try { 976 return values()[val]; 977 } catch (ArrayIndexOutOfBoundsException e) { 978 return null; 979 } 980 } 981 public int getValue() { 982 return value; 983 } 984 } 985 986 public static enum SpokeDirection { 987 OUTSIDE_TO_INSIDE(0), // The function searches from the outside of the search area to the inside of the search area. 988 INSIDE_TO_OUTSIDE(1), // The function searches from the inside of the search area to the outside of the search area. 989 ; 990 private final int value; 991 private SpokeDirection(int value) { 992 this.value = value; 993 } 994 public static SpokeDirection fromValue(int val) { 995 try { 996 return values()[val]; 997 } catch (ArrayIndexOutOfBoundsException e) { 998 return null; 999 } 1000 } 1001 public int getValue() { 1002 return value; 1003 } 1004 } 1005 1006 public static enum SkeletonMethod { 1007 SKELETON_L(0), // Uses an L-shaped structuring element in the skeleton function. 1008 SKELETON_M(1), // Uses an M-shaped structuring element in the skeleton function. 1009 SKELETON_INVERSE(2), // Uses an L-shaped structuring element on an inverse of the image in the skeleton function. 1010 ; 1011 private final int value; 1012 private SkeletonMethod(int value) { 1013 this.value = value; 1014 } 1015 public static SkeletonMethod fromValue(int val) { 1016 try { 1017 return values()[val]; 1018 } catch (ArrayIndexOutOfBoundsException e) { 1019 return null; 1020 } 1021 } 1022 public int getValue() { 1023 return value; 1024 } 1025 } 1026 1027 public static enum VerticalTextAlignment { 1028 BOTTOM(0), // Aligns the bottom of the text at the reference point. 1029 TOP(1), // Aligns the top of the text at the reference point. 1030 BASELINE(2), // Aligns the baseline of the text at the reference point. 1031 ; 1032 private final int value; 1033 private VerticalTextAlignment(int value) { 1034 this.value = value; 1035 } 1036 public static VerticalTextAlignment fromValue(int val) { 1037 try { 1038 return values()[val]; 1039 } catch (ArrayIndexOutOfBoundsException e) { 1040 return null; 1041 } 1042 } 1043 public int getValue() { 1044 return value; 1045 } 1046 } 1047 1048 public static enum CalibrationROI { 1049 FULL_IMAGE(0), // The correction function corrects the whole image, regardless of the user-defined or calibration-defined ROIs. 1050 CALIBRATION_ROI(1), // The correction function corrects the area defined by the calibration ROI. 1051 USER_ROI(2), // The correction function corrects the area defined by the user-defined ROI. 1052 CALIBRATION_AND_USER_ROI(3), // The correction function corrects the area defined by the intersection of the user-defined ROI and the calibration ROI. 1053 CALIBRATION_OR_USER_ROI(4), // The correction function corrects the area defined by the union of the user-defined ROI and the calibration ROI. 1054 ; 1055 private final int value; 1056 private CalibrationROI(int value) { 1057 this.value = value; 1058 } 1059 public static CalibrationROI fromValue(int val) { 1060 try { 1061 return values()[val]; 1062 } catch (ArrayIndexOutOfBoundsException e) { 1063 return null; 1064 } 1065 } 1066 public int getValue() { 1067 return value; 1068 } 1069 } 1070 1071 public static enum ContourType { 1072 EMPTY_CONTOUR(0), // The contour is empty. 1073 POINT(1), // The contour represents a point. 1074 LINE(2), // The contour represents a line. 1075 RECT(3), // The contour represents a rectangle. 1076 OVAL(4), // The contour represents an oval. 1077 CLOSED_CONTOUR(5), // The contour represents a series of connected points where the last point connects to the first. 1078 OPEN_CONTOUR(6), // The contour represents a series of connected points where the last point does not connect to the first. 1079 ANNULUS(7), // The contour represents an annulus. 1080 ROTATED_RECT(8), // The contour represents a rotated rectangle. 1081 ; 1082 private final int value; 1083 private ContourType(int value) { 1084 this.value = value; 1085 } 1086 public static ContourType fromValue(int val) { 1087 try { 1088 return values()[val]; 1089 } catch (ArrayIndexOutOfBoundsException e) { 1090 return null; 1091 } 1092 } 1093 public int getValue() { 1094 return value; 1095 } 1096 } 1097 1098 public static enum MathTransformMethod { 1099 TRANSFORM_LINEAR(0), // The function uses linear remapping. 1100 TRANSFORM_LOG(1), // The function uses logarithmic remapping. 1101 TRANSFORM_EXP(2), // The function uses exponential remapping. 1102 TRANSFORM_SQR(3), // The function uses square remapping. 1103 TRANSFORM_SQRT(4), // The function uses square root remapping. 1104 TRANSFORM_POWX(5), // The function uses power X remapping. 1105 TRANSFORM_POW1X(6), // The function uses power 1/X remapping. 1106 ; 1107 private final int value; 1108 private MathTransformMethod(int value) { 1109 this.value = value; 1110 } 1111 public static MathTransformMethod fromValue(int val) { 1112 try { 1113 return values()[val]; 1114 } catch (ArrayIndexOutOfBoundsException e) { 1115 return null; 1116 } 1117 } 1118 public int getValue() { 1119 return value; 1120 } 1121 } 1122 1123 public static enum ComplexPlane { 1124 REAL(0), // The function operates on the real plane of the complex image. 1125 IMAGINARY(1), // The function operates on the imaginary plane of the complex image. 1126 MAGNITUDE(2), // The function operates on the magnitude plane of the complex image. 1127 PHASE(3), // The function operates on the phase plane of the complex image. 1128 ; 1129 private final int value; 1130 private ComplexPlane(int value) { 1131 this.value = value; 1132 } 1133 public static ComplexPlane fromValue(int val) { 1134 try { 1135 return values()[val]; 1136 } catch (ArrayIndexOutOfBoundsException e) { 1137 return null; 1138 } 1139 } 1140 public int getValue() { 1141 return value; 1142 } 1143 } 1144 1145 public static enum PaletteType { 1146 PALETTE_GRAY(0), // The function uses a palette that has a gradual gray-level variation from black to white. 1147 PALETTE_BINARY(1), // The function uses a palette of 16 cycles of 16 different colors that is useful with binary images. 1148 PALETTE_GRADIENT(2), // The function uses a palette that has a gradation from red to white with a prominent range of light blue in the upper value range. 1149 PALETTE_RAINBOW(3), // The function uses a palette that has a gradation from blue to red with a prominent range of greens in the middle value range. 1150 PALETTE_TEMPERATURE(4), // The function uses a palette that has a gradation from light brown to dark brown. 1151 PALETTE_USER(5), // The function uses a palette defined by the user. 1152 ; 1153 private final int value; 1154 private PaletteType(int value) { 1155 this.value = value; 1156 } 1157 public static PaletteType fromValue(int val) { 1158 try { 1159 return values()[val]; 1160 } catch (ArrayIndexOutOfBoundsException e) { 1161 return null; 1162 } 1163 } 1164 public int getValue() { 1165 return value; 1166 } 1167 } 1168 1169 public static enum ColorSensitivity { 1170 SENSITIVITY_LOW(0), // Instructs the algorithm to divide the hue plane into a low number of sectors, allowing for simple color analysis. 1171 SENSITIVITY_MED(1), // Instructs the algorithm to divide the hue plane into a medium number of sectors, allowing for color analysis that balances sensitivity and complexity. 1172 SENSITIVITY_HIGH(2), // Instructs the algorithm to divide the hue plane into a high number of sectors, allowing for complex, sensitive color analysis. 1173 ; 1174 private final int value; 1175 private ColorSensitivity(int value) { 1176 this.value = value; 1177 } 1178 public static ColorSensitivity fromValue(int val) { 1179 try { 1180 return values()[val]; 1181 } catch (ArrayIndexOutOfBoundsException e) { 1182 return null; 1183 } 1184 } 1185 public int getValue() { 1186 return value; 1187 } 1188 } 1189 1190 public static enum ColorMode { 1191 RGB(0), // The function operates in the RGB (Red, Blue, Green) color space. 1192 HSL(1), // The function operates in the HSL (Hue, Saturation, Luminance) color space. 1193 HSV(2), // The function operates in the HSV (Hue, Saturation, Value) color space. 1194 HSI(3), // The function operates in the HSI (Hue, Saturation, Intensity) color space. 1195 CIE(4), // The function operates in the CIE L*a*b* color space. 1196 CIEXYZ(5), // The function operates in the CIE XYZ color space. 1197 ; 1198 private final int value; 1199 private ColorMode(int value) { 1200 this.value = value; 1201 } 1202 public static ColorMode fromValue(int val) { 1203 try { 1204 return values()[val]; 1205 } catch (ArrayIndexOutOfBoundsException e) { 1206 return null; 1207 } 1208 } 1209 public int getValue() { 1210 return value; 1211 } 1212 } 1213 1214 public static enum DetectionMode { 1215 DETECT_PEAKS(0), // The function detects peaks. 1216 DETECT_VALLEYS(1), // The function detects valleys. 1217 ; 1218 private final int value; 1219 private DetectionMode(int value) { 1220 this.value = value; 1221 } 1222 public static DetectionMode fromValue(int val) { 1223 try { 1224 return values()[val]; 1225 } catch (ArrayIndexOutOfBoundsException e) { 1226 return null; 1227 } 1228 } 1229 public int getValue() { 1230 return value; 1231 } 1232 } 1233 1234 public static enum CalibrationUnit { 1235 UNDEFINED(0), // The image does not have a defined unit of measurement. 1236 ANGSTROM(1), // The unit of measure for the image is angstroms. 1237 MICROMETER(2), // The unit of measure for the image is micrometers. 1238 MILLIMETER(3), // The unit of measure for the image is millimeters. 1239 CENTIMETER(4), // The unit of measure for the image is centimeters. 1240 METER(5), // The unit of measure for the image is meters. 1241 KILOMETER(6), // The unit of measure for the image is kilometers. 1242 MICROINCH(7), // The unit of measure for the image is microinches. 1243 INCH(8), // The unit of measure for the image is inches. 1244 FOOT(9), // The unit of measure for the image is feet. 1245 NAUTICMILE(10), // The unit of measure for the image is nautical miles. 1246 GROUNDMILE(11), // The unit of measure for the image is ground miles. 1247 STEP(12), // The unit of measure for the image is steps. 1248 ; 1249 private final int value; 1250 private CalibrationUnit(int value) { 1251 this.value = value; 1252 } 1253 public static CalibrationUnit fromValue(int val) { 1254 try { 1255 return values()[val]; 1256 } catch (ArrayIndexOutOfBoundsException e) { 1257 return null; 1258 } 1259 } 1260 public int getValue() { 1261 return value; 1262 } 1263 } 1264 1265 public static enum ConcentricRakeDirection { 1266 COUNTER_CLOCKWISE(0), // The function searches the search area in a counter-clockwise direction. 1267 CLOCKWISE(1), // The function searches the search area in a clockwise direction. 1268 ; 1269 private final int value; 1270 private ConcentricRakeDirection(int value) { 1271 this.value = value; 1272 } 1273 public static ConcentricRakeDirection fromValue(int val) { 1274 try { 1275 return values()[val]; 1276 } catch (ArrayIndexOutOfBoundsException e) { 1277 return null; 1278 } 1279 } 1280 public int getValue() { 1281 return value; 1282 } 1283 } 1284 1285 public static enum CalibrationMode { 1286 PERSPECTIVE(0), // Functions correct for distortion caused by the camera's perspective. 1287 NONLINEAR(1), // Functions correct for distortion caused by the camera's lens. 1288 SIMPLE_CALIBRATION(2), // Functions do not correct for distortion. 1289 CORRECTED_IMAGE(3), // The image is already corrected. 1290 ; 1291 private final int value; 1292 private CalibrationMode(int value) { 1293 this.value = value; 1294 } 1295 public static CalibrationMode fromValue(int val) { 1296 try { 1297 return values()[val]; 1298 } catch (ArrayIndexOutOfBoundsException e) { 1299 return null; 1300 } 1301 } 1302 public int getValue() { 1303 return value; 1304 } 1305 } 1306 1307 public static enum BrowserLocation { 1308 INSERT_FIRST_FREE(0), // Inserts the thumbnail in the first available cell. 1309 INSERT_END(1), // Inserts the thumbnail after the last occupied cell. 1310 ; 1311 private final int value; 1312 private BrowserLocation(int value) { 1313 this.value = value; 1314 } 1315 public static BrowserLocation fromValue(int val) { 1316 try { 1317 return values()[val]; 1318 } catch (ArrayIndexOutOfBoundsException e) { 1319 return null; 1320 } 1321 } 1322 public int getValue() { 1323 return value; 1324 } 1325 } 1326 1327 public static enum BrowserFrameStyle { 1328 RAISED_FRAME(0), // Each thumbnail has a raised frame. 1329 BEVELLED_FRAME(1), // Each thumbnail has a beveled frame. 1330 OUTLINE_FRAME(2), // Each thumbnail has an outlined frame. 1331 HIDDEN_FRAME(3), // Each thumbnail has a hidden frame. 1332 STEP_FRAME(4), // Each thumbnail has a stepped frame. 1333 RAISED_OUTLINE_FRAME(5), // Each thumbnail has a raised, outlined frame. 1334 ; 1335 private final int value; 1336 private BrowserFrameStyle(int value) { 1337 this.value = value; 1338 } 1339 public static BrowserFrameStyle fromValue(int val) { 1340 try { 1341 return values()[val]; 1342 } catch (ArrayIndexOutOfBoundsException e) { 1343 return null; 1344 } 1345 } 1346 public int getValue() { 1347 return value; 1348 } 1349 } 1350 1351 public static enum BorderMethod { 1352 BORDER_MIRROR(0), // Symmetrically copies pixel values from the image into the border. 1353 BORDER_COPY(1), // Copies the value of the pixel closest to the edge of the image into the border. 1354 BORDER_CLEAR(2), // Sets all pixels in the border to 0. 1355 ; 1356 private final int value; 1357 private BorderMethod(int value) { 1358 this.value = value; 1359 } 1360 public static BorderMethod fromValue(int val) { 1361 try { 1362 return values()[val]; 1363 } catch (ArrayIndexOutOfBoundsException e) { 1364 return null; 1365 } 1366 } 1367 public int getValue() { 1368 return value; 1369 } 1370 } 1371 1372 public static enum BarcodeType { 1373 INVALID(-1), // The barcode is not of a type known by NI Vision. 1374 CODABAR(1), // The barcode is of type Codabar. 1375 CODE39(2), // The barcode is of type Code 39. 1376 CODE93(4), // The barcode is of type Code 93. 1377 CODE128(8), // The barcode is of type Code 128. 1378 EAN8(16), // The barcode is of type EAN 8. 1379 EAN13(32), // The barcode is of type EAN 13. 1380 I2_OF_5(64), // The barcode is of type Code 25. 1381 MSI(128), // The barcode is of type MSI code. 1382 UPCA(256), // The barcode is of type UPC A. 1383 PHARMACODE(512), // The barcode is of type Pharmacode. 1384 RSS_LIMITED(1024), // The barcode is of type RSS Limited. 1385 ; 1386 private final int value; 1387 private BarcodeType(int value) { 1388 this.value = value; 1389 } 1390 public static BarcodeType fromValue(int val) { 1391 for (BarcodeType v : values()) { 1392 if (v.value == val) 1393 return v; 1394 } 1395 return null; 1396 } 1397 public int getValue() { 1398 return value; 1399 } 1400 } 1401 1402 public static enum AxisOrientation { 1403 DIRECT(0), // The y-axis direction corresponds to the y-axis direction of the Cartesian coordinate system. 1404 INDIRECT(1), // The y-axis direction corresponds to the y-axis direction of an image. 1405 ; 1406 private final int value; 1407 private AxisOrientation(int value) { 1408 this.value = value; 1409 } 1410 public static AxisOrientation fromValue(int val) { 1411 try { 1412 return values()[val]; 1413 } catch (ArrayIndexOutOfBoundsException e) { 1414 return null; 1415 } 1416 } 1417 public int getValue() { 1418 return value; 1419 } 1420 } 1421 1422 public static enum ColorIgnoreMode { 1423 IGNORE_NONE(0), // Specifies that the function does not ignore any pixels. 1424 IGNORE_BLACK(1), // Specifies that the function ignores black pixels. 1425 IGNORE_WHITE(2), // Specifies that the function ignores white pixels. 1426 IGNORE_BLACK_AND_WHITE(3), // Specifies that the function ignores black pixels and white pixels. 1427 ; 1428 private final int value; 1429 private ColorIgnoreMode(int value) { 1430 this.value = value; 1431 } 1432 public static ColorIgnoreMode fromValue(int val) { 1433 try { 1434 return values()[val]; 1435 } catch (ArrayIndexOutOfBoundsException e) { 1436 return null; 1437 } 1438 } 1439 public int getValue() { 1440 return value; 1441 } 1442 } 1443 1444 public static enum LevelType { 1445 ABSOLUTE(0), // The function evaluates the threshold and hysteresis values as absolute values. 1446 RELATIVE(1), // The function evaluates the threshold and hysteresis values relative to the dynamic range of the given path. 1447 ; 1448 private final int value; 1449 private LevelType(int value) { 1450 this.value = value; 1451 } 1452 public static LevelType fromValue(int val) { 1453 try { 1454 return values()[val]; 1455 } catch (ArrayIndexOutOfBoundsException e) { 1456 return null; 1457 } 1458 } 1459 public int getValue() { 1460 return value; 1461 } 1462 } 1463 1464 public static enum MatchingMode { 1465 MATCH_SHIFT_INVARIANT(1), // Searches for occurrences of the template image anywhere in the searchRect, assuming that the pattern is not rotated more than plus or minus 4 degrees. 1466 MATCH_ROTATION_INVARIANT(2), // Searches for occurrences of the pattern in the image with no restriction on the rotation of the pattern. 1467 ; 1468 private final int value; 1469 private MatchingMode(int value) { 1470 this.value = value; 1471 } 1472 public static MatchingMode fromValue(int val) { 1473 for (MatchingMode v : values()) { 1474 if (v.value == val) 1475 return v; 1476 } 1477 return null; 1478 } 1479 public int getValue() { 1480 return value; 1481 } 1482 } 1483 1484 public static enum MappingMethod { 1485 FULL_DYNAMIC(0), // (Obsolete) When the image bit depth is 0, the function maps the full dynamic range of the 16-bit image to an 8-bit scale. 1486 DOWNSHIFT(1), // (Obsolete) When the image bit depth is 0, the function shifts the 16-bit image pixels to the right the number of times specified by the shiftCount element of the DisplayMapping structure. 1487 RANGE(2), // (Obsolete) When the image bit depth is 0, the function maps the pixel values in the range specified by the minimumValue and maximumValue elements of the DisplayMapping structure to an 8-bit scale. 1488 C90_PCT_DYNAMIC(3), // (Obsolete) When the image bit depth to 0, the function maps the dynamic range containing the middle 90 percent of the cumulated histogram of the image to an 8-bit (256 grayscale values) scale. 1489 PERCENT_RANGE(4), // (Obsolete) When the image bit depth is 0, the function maps the pixel values in the relative percentage range (0 to 100) of the cumulated histogram specified by minimumValue and maximumValue to an 8-bit scale. 1490 DEFAULT_MAPPING(10), // If the bit depth is 0, the function maps the 16-bit image to 8 bits by following the IMAQ_FULL_DYNAMIC_ALWAYS behavior; otherwise, the function shifts the image data to the right according to the IMAQ_MOST_SIGNIFICANT behavior. 1491 MOST_SIGNIFICANT(11), // The function shifts the 16-bit image pixels to the right until the 8 most significant bits of the image data are remaining. 1492 FULL_DYNAMIC_ALWAYS(12), // The function maps the full dynamic range of the 16-bit image to an 8-bit scale. 1493 DOWNSHIFT_ALWAYS(13), // The function shifts the 16-bit image pixels to the right the number of times specified by the shiftCount element of the DisplayMapping structure. 1494 RANGE_ALWAYS(14), // The function maps the pixel values in the range specified by the minimumValue and maximumValue elements of the DisplayMapping structure to an 8-bit scale. 1495 C90_PCT_DYNAMIC_ALWAYS(15), // The function maps the dynamic range containing the middle 90 percent of the cumulated histogram of the image to an 8-bit (256 grayscale values) scale. 1496 PERCENT_RANGE_ALWAYS(16), // The function maps the pixel values in the relative percentage range (0 to 100) of the cumulated histogram specified by minimumValue and maximumValue to an 8-bit scale. 1497 ; 1498 private final int value; 1499 private MappingMethod(int value) { 1500 this.value = value; 1501 } 1502 public static MappingMethod fromValue(int val) { 1503 for (MappingMethod v : values()) { 1504 if (v.value == val) 1505 return v; 1506 } 1507 return null; 1508 } 1509 public int getValue() { 1510 return value; 1511 } 1512 } 1513 1514 public static enum ComparisonFunction { 1515 CLEAR_LESS(0), // The comparison is true if the source pixel value is less than the comparison image pixel value. 1516 CLEAR_LESS_OR_EQUAL(1), // The comparison is true if the source pixel value is less than or equal to the comparison image pixel value. 1517 CLEAR_EQUAL(2), // The comparison is true if the source pixel value is equal to the comparison image pixel value. 1518 CLEAR_GREATER_OR_EQUAL(3), // The comparison is true if the source pixel value is greater than or equal to the comparison image pixel value. 1519 CLEAR_GREATER(4), // The comparison is true if the source pixel value is greater than the comparison image pixel value. 1520 ; 1521 private final int value; 1522 private ComparisonFunction(int value) { 1523 this.value = value; 1524 } 1525 public static ComparisonFunction fromValue(int val) { 1526 try { 1527 return values()[val]; 1528 } catch (ArrayIndexOutOfBoundsException e) { 1529 return null; 1530 } 1531 } 1532 public int getValue() { 1533 return value; 1534 } 1535 } 1536 1537 public static enum LineGaugeMethod { 1538 EDGE_TO_EDGE(0), // Measures from the first edge on the line to the last edge on the line. 1539 EDGE_TO_POINT(1), // Measures from the first edge on the line to the end point of the line. 1540 POINT_TO_EDGE(2), // Measures from the start point of the line to the first edge on the line. 1541 POINT_TO_POINT(3), // Measures from the start point of the line to the end point of the line. 1542 ; 1543 private final int value; 1544 private LineGaugeMethod(int value) { 1545 this.value = value; 1546 } 1547 public static LineGaugeMethod fromValue(int val) { 1548 try { 1549 return values()[val]; 1550 } catch (ArrayIndexOutOfBoundsException e) { 1551 return null; 1552 } 1553 } 1554 public int getValue() { 1555 return value; 1556 } 1557 } 1558 1559 public static enum Direction3D { 1560 C3D_NW(0), // The viewing angle for the 3D image is from the northwest. 1561 C3D_SW(1), // The viewing angle for the 3D image is from the southwest. 1562 C3D_SE(2), // The viewing angle for the 3D image is from the southeast. 1563 C3D_NE(3), // The viewing angle for the 3D image is from the northeast. 1564 ; 1565 private final int value; 1566 private Direction3D(int value) { 1567 this.value = value; 1568 } 1569 public static Direction3D fromValue(int val) { 1570 try { 1571 return values()[val]; 1572 } catch (ArrayIndexOutOfBoundsException e) { 1573 return null; 1574 } 1575 } 1576 public int getValue() { 1577 return value; 1578 } 1579 } 1580 1581 public static enum LearningMode { 1582 LEARN_ALL(0), // The function extracts information for shift- and rotation-invariant matching. 1583 LEARN_SHIFT_INFORMATION(1), // The function extracts information for shift-invariant matching. 1584 LEARN_ROTATION_INFORMATION(2), // The function extracts information for rotation-invariant matching. 1585 ; 1586 private final int value; 1587 private LearningMode(int value) { 1588 this.value = value; 1589 } 1590 public static LearningMode fromValue(int val) { 1591 try { 1592 return values()[val]; 1593 } catch (ArrayIndexOutOfBoundsException e) { 1594 return null; 1595 } 1596 } 1597 public int getValue() { 1598 return value; 1599 } 1600 } 1601 1602 public static enum KernelFamily { 1603 GRADIENT_FAMILY(0), // The kernel is in the gradient family. 1604 LAPLACIAN_FAMILY(1), // The kernel is in the Laplacian family. 1605 SMOOTHING_FAMILY(2), // The kernel is in the smoothing family. 1606 GAUSSIAN_FAMILY(3), // The kernel is in the Gaussian family. 1607 ; 1608 private final int value; 1609 private KernelFamily(int value) { 1610 this.value = value; 1611 } 1612 public static KernelFamily fromValue(int val) { 1613 try { 1614 return values()[val]; 1615 } catch (ArrayIndexOutOfBoundsException e) { 1616 return null; 1617 } 1618 } 1619 public int getValue() { 1620 return value; 1621 } 1622 } 1623 1624 public static enum InterpolationMethod { 1625 ZERO_ORDER(0), // The function uses an interpolation method that interpolates new pixel values using the nearest valid neighboring pixel. 1626 BILINEAR(1), // The function uses an interpolation method that interpolates new pixel values using a bidirectional average of the neighboring pixels. 1627 QUADRATIC(2), // The function uses an interpolation method that interpolates new pixel values using a quadratic approximating polynomial. 1628 CUBIC_SPLINE(3), // The function uses an interpolation method that interpolates new pixel values by fitting them to a cubic spline curve, where the curve is based on known pixel values from the image. 1629 BILINEAR_FIXED(4), // The function uses an interpolation method that interpolates new pixel values using a bidirectional average of the neighboring pixels. 1630 ; 1631 private final int value; 1632 private InterpolationMethod(int value) { 1633 this.value = value; 1634 } 1635 public static InterpolationMethod fromValue(int val) { 1636 try { 1637 return values()[val]; 1638 } catch (ArrayIndexOutOfBoundsException e) { 1639 return null; 1640 } 1641 } 1642 public int getValue() { 1643 return value; 1644 } 1645 } 1646 1647 public static enum ImageType { 1648 IMAGE_U8(0), // The image type is 8-bit unsigned integer grayscale. 1649 IMAGE_U16(7), // The image type is 16-bit unsigned integer grayscale. 1650 IMAGE_I16(1), // The image type is 16-bit signed integer grayscale. 1651 IMAGE_SGL(2), // The image type is 32-bit floating-point grayscale. 1652 IMAGE_COMPLEX(3), // The image type is complex. 1653 IMAGE_RGB(4), // The image type is RGB color. 1654 IMAGE_HSL(5), // The image type is HSL color. 1655 IMAGE_RGB_U64(6), // The image type is 64-bit unsigned RGB color. 1656 ; 1657 private final int value; 1658 private ImageType(int value) { 1659 this.value = value; 1660 } 1661 public static ImageType fromValue(int val) { 1662 for (ImageType v : values()) { 1663 if (v.value == val) 1664 return v; 1665 } 1666 return null; 1667 } 1668 public int getValue() { 1669 return value; 1670 } 1671 } 1672 1673 public static enum ImageFeatureMode { 1674 COLOR_AND_SHAPE_FEATURES(0), // Instructs the function to use the color and the shape features of the color pattern. 1675 COLOR_FEATURES(1), // Instructs the function to use the color features of the color pattern. 1676 SHAPE_FEATURES(2), // Instructs the function to use the shape features of the color pattern. 1677 ; 1678 private final int value; 1679 private ImageFeatureMode(int value) { 1680 this.value = value; 1681 } 1682 public static ImageFeatureMode fromValue(int val) { 1683 try { 1684 return values()[val]; 1685 } catch (ArrayIndexOutOfBoundsException e) { 1686 return null; 1687 } 1688 } 1689 public int getValue() { 1690 return value; 1691 } 1692 } 1693 1694 public static enum FontColor { 1695 WHITE(0), // Draws text in white. 1696 BLACK(1), // Draws text in black. 1697 INVERT(2), // Inverts the text pixels. 1698 BLACK_ON_WHITE(3), // Draws text in black with a white background. 1699 WHITE_ON_BLACK(4), // Draws text in white with a black background. 1700 ; 1701 private final int value; 1702 private FontColor(int value) { 1703 this.value = value; 1704 } 1705 public static FontColor fromValue(int val) { 1706 try { 1707 return values()[val]; 1708 } catch (ArrayIndexOutOfBoundsException e) { 1709 return null; 1710 } 1711 } 1712 public int getValue() { 1713 return value; 1714 } 1715 } 1716 1717 public static enum FlipAxis { 1718 HORIZONTAL_AXIS(0), // Flips the image over the central horizontal axis. 1719 VERTICAL_AXIS(1), // Flips the image over the central vertical axis. 1720 CENTER_AXIS(2), // Flips the image over both the central vertical and horizontal axes. 1721 DIAG_L_TO_R_AXIS(3), // Flips the image over an axis from the upper left corner to lower right corner. 1722 DIAG_R_TO_L_AXIS(4), // Flips the image over an axis from the upper right corner to lower left corner. 1723 ; 1724 private final int value; 1725 private FlipAxis(int value) { 1726 this.value = value; 1727 } 1728 public static FlipAxis fromValue(int val) { 1729 try { 1730 return values()[val]; 1731 } catch (ArrayIndexOutOfBoundsException e) { 1732 return null; 1733 } 1734 } 1735 public int getValue() { 1736 return value; 1737 } 1738 } 1739 1740 public static enum EdgeProcess { 1741 FIRST(0), // The function looks for the first edge. 1742 FIRST_AND_LAST(1), // The function looks for the first and last edge. 1743 ALL(2), // The function looks for all edges. 1744 BEST(3), // The function looks for the best edge. 1745 ; 1746 private final int value; 1747 private EdgeProcess(int value) { 1748 this.value = value; 1749 } 1750 public static EdgeProcess fromValue(int val) { 1751 try { 1752 return values()[val]; 1753 } catch (ArrayIndexOutOfBoundsException e) { 1754 return null; 1755 } 1756 } 1757 public int getValue() { 1758 return value; 1759 } 1760 } 1761 1762 public static enum DrawMode { 1763 DRAW_VALUE(0), // Draws the boundary of the object with the specified pixel value. 1764 DRAW_INVERT(2), // Inverts the pixel values of the boundary of the object. 1765 PAINT_VALUE(1), // Fills the object with the given pixel value. 1766 PAINT_INVERT(3), // Inverts the pixel values of the object. 1767 HIGHLIGHT_VALUE(4), // The function fills the object by highlighting the enclosed pixels with the color of the object. 1768 ; 1769 private final int value; 1770 private DrawMode(int value) { 1771 this.value = value; 1772 } 1773 public static DrawMode fromValue(int val) { 1774 for (DrawMode v : values()) { 1775 if (v.value == val) 1776 return v; 1777 } 1778 return null; 1779 } 1780 public int getValue() { 1781 return value; 1782 } 1783 } 1784 1785 public static enum NearestNeighborMetric { 1786 METRIC_MAXIMUM(0), // The maximum metric. 1787 METRIC_SUM(1), // The sum metric. 1788 METRIC_EUCLIDEAN(2), // The Euclidean metric. 1789 ; 1790 private final int value; 1791 private NearestNeighborMetric(int value) { 1792 this.value = value; 1793 } 1794 public static NearestNeighborMetric fromValue(int val) { 1795 try { 1796 return values()[val]; 1797 } catch (ArrayIndexOutOfBoundsException e) { 1798 return null; 1799 } 1800 } 1801 public int getValue() { 1802 return value; 1803 } 1804 } 1805 1806 public static enum ReadResolution { 1807 LOW_RESOLUTION(0), // Configures NI Vision to use low resolution during the read process. 1808 MEDIUM_RESOLUTION(1), // Configures NI Vision to use medium resolution during the read process. 1809 HIGH_RESOLUTION(2), // Configures NI Vision to use high resolution during the read process. 1810 ; 1811 private final int value; 1812 private ReadResolution(int value) { 1813 this.value = value; 1814 } 1815 public static ReadResolution fromValue(int val) { 1816 try { 1817 return values()[val]; 1818 } catch (ArrayIndexOutOfBoundsException e) { 1819 return null; 1820 } 1821 } 1822 public int getValue() { 1823 return value; 1824 } 1825 } 1826 1827 public static enum ThresholdMode { 1828 FIXED_RANGE(0), // Performs thresholding using the values you provide in the lowThreshold and highThreshold elements of OCRProcessingOptions. 1829 COMPUTED_UNIFORM(1), // Calculates a single threshold value for the entire ROI. 1830 COMPUTED_LINEAR(2), // Calculates a value on the left side of the ROI, calculates a value on the right side of the ROI, and linearly fills the middle values from left to right. 1831 COMPUTED_NONLINEAR(3), // Divides the ROI into the number of blocks specified by the blockCount element of OCRProcessingOptions and calculates a threshold value for each block. 1832 ; 1833 private final int value; 1834 private ThresholdMode(int value) { 1835 this.value = value; 1836 } 1837 public static ThresholdMode fromValue(int val) { 1838 try { 1839 return values()[val]; 1840 } catch (ArrayIndexOutOfBoundsException e) { 1841 return null; 1842 } 1843 } 1844 public int getValue() { 1845 return value; 1846 } 1847 } 1848 1849 public static enum ReadStrategy { 1850 READ_AGGRESSIVE(0), // Configures NI Vision to perform fewer checks when analyzing objects to determine if they match trained characters. 1851 READ_CONSERVATIVE(1), // Configures NI Vision to perform more checks to determine if an object matches a trained character. 1852 ; 1853 private final int value; 1854 private ReadStrategy(int value) { 1855 this.value = value; 1856 } 1857 public static ReadStrategy fromValue(int val) { 1858 try { 1859 return values()[val]; 1860 } catch (ArrayIndexOutOfBoundsException e) { 1861 return null; 1862 } 1863 } 1864 public int getValue() { 1865 return value; 1866 } 1867 } 1868 1869 public static enum MeasurementType { 1870 MT_CENTER_OF_MASS_X(0), // X-coordinate of the point representing the average position of the total particle mass, assuming every point in the particle has a constant density. 1871 MT_CENTER_OF_MASS_Y(1), // Y-coordinate of the point representing the average position of the total particle mass, assuming every point in the particle has a constant density. 1872 MT_FIRST_PIXEL_X(2), // X-coordinate of the highest, leftmost particle pixel. 1873 MT_FIRST_PIXEL_Y(3), // Y-coordinate of the highest, leftmost particle pixel. 1874 MT_BOUNDING_RECT_LEFT(4), // X-coordinate of the leftmost particle point. 1875 MT_BOUNDING_RECT_TOP(5), // Y-coordinate of highest particle point. 1876 MT_BOUNDING_RECT_RIGHT(6), // X-coordinate of the rightmost particle point. 1877 MT_BOUNDING_RECT_BOTTOM(7), // Y-coordinate of the lowest particle point. 1878 MT_MAX_FERET_DIAMETER_START_X(8), // X-coordinate of the start of the line segment connecting the two perimeter points that are the furthest apart. 1879 MT_MAX_FERET_DIAMETER_START_Y(9), // Y-coordinate of the start of the line segment connecting the two perimeter points that are the furthest apart. 1880 MT_MAX_FERET_DIAMETER_END_X(10), // X-coordinate of the end of the line segment connecting the two perimeter points that are the furthest apart. 1881 MT_MAX_FERET_DIAMETER_END_Y(11), // Y-coordinate of the end of the line segment connecting the two perimeter points that are the furthest apart. 1882 MT_MAX_HORIZ_SEGMENT_LENGTH_LEFT(12), // X-coordinate of the leftmost pixel in the longest row of contiguous pixels in the particle. 1883 MT_MAX_HORIZ_SEGMENT_LENGTH_RIGHT(13), // X-coordinate of the rightmost pixel in the longest row of contiguous pixels in the particle. 1884 MT_MAX_HORIZ_SEGMENT_LENGTH_ROW(14), // Y-coordinate of all of the pixels in the longest row of contiguous pixels in the particle. 1885 MT_BOUNDING_RECT_WIDTH(16), // Distance between the x-coordinate of the leftmost particle point and the x-coordinate of the rightmost particle point. 1886 MT_BOUNDING_RECT_HEIGHT(17), // Distance between the y-coordinate of highest particle point and the y-coordinate of the lowest particle point. 1887 MT_BOUNDING_RECT_DIAGONAL(18), // Distance between opposite corners of the bounding rectangle. 1888 MT_PERIMETER(19), // Length of the outer boundary of the particle. 1889 MT_CONVEX_HULL_PERIMETER(20), // Perimeter of the smallest convex polygon containing all points in the particle. 1890 MT_HOLES_PERIMETER(21), // Sum of the perimeters of each hole in the particle. 1891 MT_MAX_FERET_DIAMETER(22), // Distance between the start and end of the line segment connecting the two perimeter points that are the furthest apart. 1892 MT_EQUIVALENT_ELLIPSE_MAJOR_AXIS(23), // Length of the major axis of the ellipse with the same perimeter and area as the particle. 1893 MT_EQUIVALENT_ELLIPSE_MINOR_AXIS(24), // Length of the minor axis of the ellipse with the same perimeter and area as the particle. 1894 MT_EQUIVALENT_ELLIPSE_MINOR_AXIS_FERET(25), // Length of the minor axis of the ellipse with the same area as the particle, and Major Axis equal in length to the Max Feret Diameter. 1895 MT_EQUIVALENT_RECT_LONG_SIDE(26), // Longest side of the rectangle with the same perimeter and area as the particle. 1896 MT_EQUIVALENT_RECT_SHORT_SIDE(27), // Shortest side of the rectangle with the same perimeter and area as the particle. 1897 MT_EQUIVALENT_RECT_DIAGONAL(28), // Distance between opposite corners of the rectangle with the same perimeter and area as the particle. 1898 MT_EQUIVALENT_RECT_SHORT_SIDE_FERET(29), // Shortest side of the rectangle with the same area as the particle, and longest side equal in length to the Max Feret Diameter. 1899 MT_AVERAGE_HORIZ_SEGMENT_LENGTH(30), // Average length of a horizontal segment in the particle. 1900 MT_AVERAGE_VERT_SEGMENT_LENGTH(31), // Average length of a vertical segment in the particle. 1901 MT_HYDRAULIC_RADIUS(32), // The particle area divided by the particle perimeter. 1902 MT_WADDEL_DISK_DIAMETER(33), // Diameter of a disk with the same area as the particle. 1903 MT_AREA(35), // Area of the particle. 1904 MT_HOLES_AREA(36), // Sum of the areas of each hole in the particle. 1905 MT_PARTICLE_AND_HOLES_AREA(37), // Area of a particle that completely covers the image. 1906 MT_CONVEX_HULL_AREA(38), // Area of the smallest convex polygon containing all points in the particle. 1907 MT_IMAGE_AREA(39), // Area of the image. 1908 MT_NUMBER_OF_HOLES(41), // Number of holes in the particle. 1909 MT_NUMBER_OF_HORIZ_SEGMENTS(42), // Number of horizontal segments in the particle. 1910 MT_NUMBER_OF_VERT_SEGMENTS(43), // Number of vertical segments in the particle. 1911 MT_ORIENTATION(45), // The angle of the line that passes through the particle Center of Mass about which the particle has the lowest moment of inertia. 1912 MT_MAX_FERET_DIAMETER_ORIENTATION(46), // The angle of the line segment connecting the two perimeter points that are the furthest apart. 1913 MT_AREA_BY_IMAGE_AREA(48), // Percentage of the particle Area covering the Image Area. 1914 MT_AREA_BY_PARTICLE_AND_HOLES_AREA(49), // Percentage of the particle Area in relation to its Particle and Holes Area. 1915 MT_RATIO_OF_EQUIVALENT_ELLIPSE_AXES(50), // Equivalent Ellipse Major Axis divided by Equivalent Ellipse Minor Axis. 1916 MT_RATIO_OF_EQUIVALENT_RECT_SIDES(51), // Equivalent Rect Long Side divided by Equivalent Rect Short Side. 1917 MT_ELONGATION_FACTOR(53), // Max Feret Diameter divided by Equivalent Rect Short Side (Feret). 1918 MT_COMPACTNESS_FACTOR(54), // Area divided by the product of Bounding Rect Width and Bounding Rect Height. 1919 MT_HEYWOOD_CIRCULARITY_FACTOR(55), // Perimeter divided by the circumference of a circle with the same area. 1920 MT_TYPE_FACTOR(56), // Factor relating area to moment of inertia. 1921 MT_SUM_X(58), // The sum of all x-coordinates in the particle. 1922 MT_SUM_Y(59), // The sum of all y-coordinates in the particle. 1923 MT_SUM_XX(60), // The sum of all x-coordinates squared in the particle. 1924 MT_SUM_XY(61), // The sum of all x-coordinates times y-coordinates in the particle. 1925 MT_SUM_YY(62), // The sum of all y-coordinates squared in the particle. 1926 MT_SUM_XXX(63), // The sum of all x-coordinates cubed in the particle. 1927 MT_SUM_XXY(64), // The sum of all x-coordinates squared times y-coordinates in the particle. 1928 MT_SUM_XYY(65), // The sum of all x-coordinates times y-coordinates squared in the particle. 1929 MT_SUM_YYY(66), // The sum of all y-coordinates cubed in the particle. 1930 MT_MOMENT_OF_INERTIA_XX(68), // The moment of inertia in the x-direction twice. 1931 MT_MOMENT_OF_INERTIA_XY(69), // The moment of inertia in the x and y directions. 1932 MT_MOMENT_OF_INERTIA_YY(70), // The moment of inertia in the y-direction twice. 1933 MT_MOMENT_OF_INERTIA_XXX(71), // The moment of inertia in the x-direction three times. 1934 MT_MOMENT_OF_INERTIA_XXY(72), // The moment of inertia in the x-direction twice and the y-direction once. 1935 MT_MOMENT_OF_INERTIA_XYY(73), // The moment of inertia in the x-direction once and the y-direction twice. 1936 MT_MOMENT_OF_INERTIA_YYY(74), // The moment of inertia in the y-direction three times. 1937 MT_NORM_MOMENT_OF_INERTIA_XX(75), // The normalized moment of inertia in the x-direction twice. 1938 MT_NORM_MOMENT_OF_INERTIA_XY(76), // The normalized moment of inertia in the x- and y-directions. 1939 MT_NORM_MOMENT_OF_INERTIA_YY(77), // The normalized moment of inertia in the y-direction twice. 1940 MT_NORM_MOMENT_OF_INERTIA_XXX(78), // The normalized moment of inertia in the x-direction three times. 1941 MT_NORM_MOMENT_OF_INERTIA_XXY(79), // The normalized moment of inertia in the x-direction twice and the y-direction once. 1942 MT_NORM_MOMENT_OF_INERTIA_XYY(80), // The normalized moment of inertia in the x-direction once and the y-direction twice. 1943 MT_NORM_MOMENT_OF_INERTIA_YYY(81), // The normalized moment of inertia in the y-direction three times. 1944 MT_HU_MOMENT_1(82), // The first Hu moment. 1945 MT_HU_MOMENT_2(83), // The second Hu moment. 1946 MT_HU_MOMENT_3(84), // The third Hu moment. 1947 MT_HU_MOMENT_4(85), // The fourth Hu moment. 1948 MT_HU_MOMENT_5(86), // The fifth Hu moment. 1949 MT_HU_MOMENT_6(87), // The sixth Hu moment. 1950 MT_HU_MOMENT_7(88), // The seventh Hu moment. 1951 ; 1952 private final int value; 1953 private MeasurementType(int value) { 1954 this.value = value; 1955 } 1956 public static MeasurementType fromValue(int val) { 1957 for (MeasurementType v : values()) { 1958 if (v.value == val) 1959 return v; 1960 } 1961 return null; 1962 } 1963 public int getValue() { 1964 return value; 1965 } 1966 } 1967 1968 public static enum GeometricMatchingMode { 1969 GEOMETRIC_MATCH_SHIFT_INVARIANT(0), // Searches for occurrences of the pattern in the image, assuming that the pattern is not rotated more than plus or minus 5 degrees. 1970 GEOMETRIC_MATCH_ROTATION_INVARIANT(1), // Searches for occurrences of the pattern in the image with reduced restriction on the rotation of the pattern. 1971 GEOMETRIC_MATCH_SCALE_INVARIANT(2), // Searches for occurrences of the pattern in the image with reduced restriction on the size of the pattern. 1972 GEOMETRIC_MATCH_OCCLUSION_INVARIANT(4), // Searches for occurrences of the pattern in the image, allowing for a specified percentage of the pattern to be occluded. 1973 ; 1974 private final int value; 1975 private GeometricMatchingMode(int value) { 1976 this.value = value; 1977 } 1978 public static GeometricMatchingMode fromValue(int val) { 1979 for (GeometricMatchingMode v : values()) { 1980 if (v.value == val) 1981 return v; 1982 } 1983 return null; 1984 } 1985 public int getValue() { 1986 return value; 1987 } 1988 } 1989 1990 public static enum ButtonLabel { 1991 BUTTON_OK(0), // The label "OK". 1992 BUTTON_SAVE(1), // The label "Save". 1993 BUTTON_SELECT(2), // The label "Select". 1994 BUTTON_LOAD(3), // The label "Load". 1995 ; 1996 private final int value; 1997 private ButtonLabel(int value) { 1998 this.value = value; 1999 } 2000 public static ButtonLabel fromValue(int val) { 2001 try { 2002 return values()[val]; 2003 } catch (ArrayIndexOutOfBoundsException e) { 2004 return null; 2005 } 2006 } 2007 public int getValue() { 2008 return value; 2009 } 2010 } 2011 2012 public static enum NearestNeighborMethod { 2013 MINIMUM_MEAN_DISTANCE(0), // The minimum mean distance method. 2014 K_NEAREST_NEIGHBOR(1), // The k-nearest neighbor method. 2015 NEAREST_PROTOTYPE(2), // The nearest prototype method. 2016 ; 2017 private final int value; 2018 private NearestNeighborMethod(int value) { 2019 this.value = value; 2020 } 2021 public static NearestNeighborMethod fromValue(int val) { 2022 try { 2023 return values()[val]; 2024 } catch (ArrayIndexOutOfBoundsException e) { 2025 return null; 2026 } 2027 } 2028 public int getValue() { 2029 return value; 2030 } 2031 } 2032 2033 public static enum QRMirrorMode { 2034 QR_MIRROR_MODE_AUTO_DETECT(-2), // The function should determine if the QR code is mirrored. 2035 QR_MIRROR_MODE_MIRRORED(1), // The function should expect the QR code to appear mirrored. 2036 QR_MIRROR_MODE_NORMAL(0), // The function should expect the QR code to appear normal. 2037 ; 2038 private final int value; 2039 private QRMirrorMode(int value) { 2040 this.value = value; 2041 } 2042 public static QRMirrorMode fromValue(int val) { 2043 for (QRMirrorMode v : values()) { 2044 if (v.value == val) 2045 return v; 2046 } 2047 return null; 2048 } 2049 public int getValue() { 2050 return value; 2051 } 2052 } 2053 2054 public static enum ColumnProcessingMode { 2055 AVERAGE_COLUMNS(0), // Averages the data extracted for edge detection. 2056 MEDIAN_COLUMNS(1), // Takes the median of the data extracted for edge detection. 2057 ; 2058 private final int value; 2059 private ColumnProcessingMode(int value) { 2060 this.value = value; 2061 } 2062 public static ColumnProcessingMode fromValue(int val) { 2063 try { 2064 return values()[val]; 2065 } catch (ArrayIndexOutOfBoundsException e) { 2066 return null; 2067 } 2068 } 2069 public int getValue() { 2070 return value; 2071 } 2072 } 2073 2074 public static enum FindReferenceDirection { 2075 LEFT_TO_RIGHT_DIRECT(0), // Searches from the left side of the search area to the right side of the search area for a direct axis. 2076 LEFT_TO_RIGHT_INDIRECT(1), // Searches from the left side of the search area to the right side of the search area for an indirect axis. 2077 TOP_TO_BOTTOM_DIRECT(2), // Searches from the top of the search area to the bottom of the search area for a direct axis. 2078 TOP_TO_BOTTOM_INDIRECT(3), // Searches from the top of the search area to the bottom of the search area for an indirect axis. 2079 RIGHT_TO_LEFT_DIRECT(4), // Searches from the right side of the search area to the left side of the search area for a direct axis. 2080 RIGHT_TO_LEFT_INDIRECT(5), // Searches from the right side of the search area to the left side of the search area for an indirect axis. 2081 BOTTOM_TO_TOP_DIRECT(6), // Searches from the bottom of the search area to the top of the search area for a direct axis. 2082 BOTTOM_TO_TOP_INDIRECT(7), // Searches from the bottom of the search area to the top of the search area for an indirect axis. 2083 ; 2084 private final int value; 2085 private FindReferenceDirection(int value) { 2086 this.value = value; 2087 } 2088 public static FindReferenceDirection fromValue(int val) { 2089 try { 2090 return values()[val]; 2091 } catch (ArrayIndexOutOfBoundsException e) { 2092 return null; 2093 } 2094 } 2095 public int getValue() { 2096 return value; 2097 } 2098 } 2099 2100 public static enum MulticoreOperation { 2101 GET_CORES(0), // The number of processor cores NI Vision is currently using. 2102 SET_CORES(1), // The number of processor cores for NI Vision to use. 2103 USE_MAX_AVAILABLE(2), // Use the maximum number of available processor cores. 2104 ; 2105 private final int value; 2106 private MulticoreOperation(int value) { 2107 this.value = value; 2108 } 2109 public static MulticoreOperation fromValue(int val) { 2110 try { 2111 return values()[val]; 2112 } catch (ArrayIndexOutOfBoundsException e) { 2113 return null; 2114 } 2115 } 2116 public int getValue() { 2117 return value; 2118 } 2119 } 2120 2121 public static enum GroupBehavior { 2122 GROUP_CLEAR(0), // Sets the behavior of the overlay group to clear the current settings when an image is transformed. 2123 GROUP_KEEP(1), // Sets the behavior of the overlay group to keep the current settings when an image is transformed. 2124 GROUP_TRANSFORM(2), // Sets the behavior of the overlay group to transform with the image. 2125 ; 2126 private final int value; 2127 private GroupBehavior(int value) { 2128 this.value = value; 2129 } 2130 public static GroupBehavior fromValue(int val) { 2131 try { 2132 return values()[val]; 2133 } catch (ArrayIndexOutOfBoundsException e) { 2134 return null; 2135 } 2136 } 2137 public int getValue() { 2138 return value; 2139 } 2140 } 2141 2142 public static enum QRDimensions { 2143 QR_DIMENSIONS_AUTO_DETECT(0), // The function will automatically determine the dimensions of the QR code. 2144 QR_DIMENSIONS_11x11(11), // Specifies the dimensions of the QR code as 11 x 11. 2145 QR_DIMENSIONS_13x13(13), // Specifies the dimensions of the QR code as 13 x 13. 2146 QR_DIMENSIONS_15x15(15), // Specifies the dimensions of the QR code as 15 x 15. 2147 QR_DIMENSIONS_17x17(17), // Specifies the dimensions of the QR code as 17 x 17. 2148 QR_DIMENSIONS_21x21(21), // Specifies the dimensions of the QR code as 21 x 21. 2149 QR_DIMENSIONS_25x25(25), // Specifies the dimensions of the QR code as 25 x 25. 2150 QR_DIMENSIONS_29x29(29), // Specifies the dimensions of the QR code as 29 x 29. 2151 QR_DIMENSIONS_33x33(33), // Specifies the dimensions of the QR code as 33 x 33. 2152 QR_DIMENSIONS_37x37(37), // Specifies the dimensions of the QR code as 37 x 37. 2153 QR_DIMENSIONS_41x41(41), // Specifies the dimensions of the QR code as 41 x 41. 2154 QR_DIMENSIONS_45x45(45), // Specifies the dimensions of the QR code as 45 x 45. 2155 QR_DIMENSIONS_49x49(49), // Specifies the dimensions of the QR code as 49 x 49. 2156 QR_DIMENSIONS_53x53(53), // Specifies the dimensions of the QR code as 53 x 53. 2157 QR_DIMENSIONS_57x57(57), // Specifies the dimensions of the QR code as 57 x 57. 2158 QR_DIMENSIONS_61x61(61), // Specifies the dimensions of the QR code as 61 x 61. 2159 QR_DIMENSIONS_65x65(65), // Specifies the dimensions of the QR code as 65 x 65. 2160 QR_DIMENSIONS_69x69(69), // Specifies the dimensions of the QR code as 69 x 69. 2161 QR_DIMENSIONS_73x73(73), // Specifies the dimensions of the QR code as 73 x 73. 2162 QR_DIMENSIONS_77x77(77), // Specifies the dimensions of the QR code as 77 x 77. 2163 QR_DIMENSIONS_81x81(81), // Specifies the dimensions of the QR code as 81 x 81. 2164 QR_DIMENSIONS_85x85(85), // Specifies the dimensions of the QR code as 85 x 85. 2165 QR_DIMENSIONS_89x89(89), // Specifies the dimensions of the QR code as 89 x 89. 2166 QR_DIMENSIONS_93x93(93), // Specifies the dimensions of the QR code as 93 x 93. 2167 QR_DIMENSIONS_97x97(97), // Specifies the dimensions of the QR code as 97 x 97. 2168 QR_DIMENSIONS_101x101(101), // Specifies the dimensions of the QR code as 101 x 101. 2169 QR_DIMENSIONS_105x105(105), // Specifies the dimensions of the QR code as 105 x 105. 2170 QR_DIMENSIONS_109x109(109), // Specifies the dimensions of the QR code as 109 x 109. 2171 QR_DIMENSIONS_113x113(113), // Specifies the dimensions of the QR code as 113 x 113. 2172 QR_DIMENSIONS_117x117(117), // Specifies the dimensions of the QR code as 117 x 117. 2173 QR_DIMENSIONS_121x121(121), // Specifies the dimensions of the QR code as 121 x 121. 2174 QR_DIMENSIONS_125x125(125), // Specifies the dimensions of the QR code as 125 x 125. 2175 QR_DIMENSIONS_129x129(129), // Specifies the dimensions of the QR code as 129 x 129. 2176 QR_DIMENSIONS_133x133(133), // Specifies the dimensions of the QR code as 133 x 133. 2177 QR_DIMENSIONS_137x137(137), // Specifies the dimensions of the QR code as 137 x 137. 2178 QR_DIMENSIONS_141x141(141), // Specifies the dimensions of the QR code as 141 x 141. 2179 QR_DIMENSIONS_145x145(145), // Specifies the dimensions of the QR code as 145 x 145. 2180 QR_DIMENSIONS_149x149(149), // Specifies the dimensions of the QR code as 149 x 149. 2181 QR_DIMENSIONS_153x153(153), // Specifies the dimensions of the QR code as 153 x 153. 2182 QR_DIMENSIONS_157x157(157), // Specifies the dimensions of the QR code as 157 x 1537. 2183 QR_DIMENSIONS_161x161(161), // Specifies the dimensions of the QR code as 161 x 161. 2184 QR_DIMENSIONS_165x165(165), // Specifies the dimensions of the QR code as 165 x 165. 2185 QR_DIMENSIONS_169x169(169), // Specifies the dimensions of the QR code as 169 x 169. 2186 QR_DIMENSIONS_173x173(173), // Specifies the dimensions of the QR code as 173 x 173. 2187 QR_DIMENSIONS_177x177(177), // Specifies the dimensions of the QR code as 177 x 177. 2188 ; 2189 private final int value; 2190 private QRDimensions(int value) { 2191 this.value = value; 2192 } 2193 public static QRDimensions fromValue(int val) { 2194 for (QRDimensions v : values()) { 2195 if (v.value == val) 2196 return v; 2197 } 2198 return null; 2199 } 2200 public int getValue() { 2201 return value; 2202 } 2203 } 2204 2205 public static enum QRCellFilterMode { 2206 QR_CELL_FILTER_MODE_AUTO_DETECT(-2), // The function will try all filter modes and uses the one that decodes the QR code within the fewest iterations and utilizing the least amount of error correction. 2207 QR_CELL_FILTER_MODE_AVERAGE(0), // The function sets the pixel value for the cell to the average of the sampled pixels. 2208 QR_CELL_FILTER_MODE_MEDIAN(1), // The function sets the pixel value for the cell to the median of the sampled pixels. 2209 QR_CELL_FILTER_MODE_CENTRAL_AVERAGE(2), // The function sets the pixel value for the cell to the average of the pixels in the center of the cell sample. 2210 QR_CELL_FILTER_MODE_HIGH_AVERAGE(3), // The function sets the pixel value for the cell to the average value of the half of the sampled pixels with the highest pixel values. 2211 QR_CELL_FILTER_MODE_LOW_AVERAGE(4), // The function sets the pixel value for the cell to the average value of the half of the sampled pixels with the lowest pixel values. 2212 QR_CELL_FILTER_MODE_VERY_HIGH_AVERAGE(5), // The function sets the pixel value for the cell to the average value of the ninth of the sampled pixels with the highest pixel values. 2213 QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE(6), // The function sets the pixel value for the cell to the average value of the ninth of the sampled pixels with the lowest pixel values. 2214 QR_CELL_FILTER_MODE_ALL(8), // The function tries each filter mode, starting with IMAQ_QR_CELL_FILTER_MODE_AVERAGE and ending with IMAQ_QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE, stopping once a filter mode decodes correctly. 2215 ; 2216 private final int value; 2217 private QRCellFilterMode(int value) { 2218 this.value = value; 2219 } 2220 public static QRCellFilterMode fromValue(int val) { 2221 for (QRCellFilterMode v : values()) { 2222 if (v.value == val) 2223 return v; 2224 } 2225 return null; 2226 } 2227 public int getValue() { 2228 return value; 2229 } 2230 } 2231 2232 public static enum RoundingMode { 2233 ROUNDING_MODE_OPTIMIZE(0), // Rounds the result of a division using the best available method. 2234 ROUNDING_MODE_TRUNCATE(1), // Truncates the result of a division. 2235 ; 2236 private final int value; 2237 private RoundingMode(int value) { 2238 this.value = value; 2239 } 2240 public static RoundingMode fromValue(int val) { 2241 try { 2242 return values()[val]; 2243 } catch (ArrayIndexOutOfBoundsException e) { 2244 return null; 2245 } 2246 } 2247 public int getValue() { 2248 return value; 2249 } 2250 } 2251 2252 public static enum QRDemodulationMode { 2253 QR_DEMODULATION_MODE_AUTO_DETECT(-2), // The function will try each demodulation mode and use the one which decodes the QR code within the fewest iterations and utilizing the least amount of error correction. 2254 QR_DEMODULATION_MODE_HISTOGRAM(0), // The function uses a histogram of all of the QR cells to calculate a threshold. 2255 QR_DEMODULATION_MODE_LOCAL_CONTRAST(1), // The function examines each of the cell's neighbors to determine if the cell is on or off. 2256 QR_DEMODULATION_MODE_COMBINED(2), // The function uses the histogram of the QR code to calculate a threshold. 2257 QR_DEMODULATION_MODE_ALL(3), // The function tries IMAQ_QR_DEMODULATION_MODE_HISTOGRAM, then IMAQ_QR_DEMODULATION_MODE_LOCAL_CONTRAST and then IMAQ_QR_DEMODULATION_MODE_COMBINED, stopping once one mode is successful. 2258 ; 2259 private final int value; 2260 private QRDemodulationMode(int value) { 2261 this.value = value; 2262 } 2263 public static QRDemodulationMode fromValue(int val) { 2264 for (QRDemodulationMode v : values()) { 2265 if (v.value == val) 2266 return v; 2267 } 2268 return null; 2269 } 2270 public int getValue() { 2271 return value; 2272 } 2273 } 2274 2275 public static enum ContrastMode { 2276 ORIGINAL_CONTRAST(0), // Instructs the geometric matching algorithm to find matches with the same contrast as the template. 2277 REVERSED_CONTRAST(1), // Instructs the geometric matching algorithm to find matches with the inverted contrast of the template. 2278 BOTH_CONTRASTS(2), // Instructs the geometric matching algorithm to find matches with the same and inverted contrast of the template. 2279 ; 2280 private final int value; 2281 private ContrastMode(int value) { 2282 this.value = value; 2283 } 2284 public static ContrastMode fromValue(int val) { 2285 try { 2286 return values()[val]; 2287 } catch (ArrayIndexOutOfBoundsException e) { 2288 return null; 2289 } 2290 } 2291 public int getValue() { 2292 return value; 2293 } 2294 } 2295 2296 public static enum QRPolarities { 2297 QR_POLARITY_AUTO_DETECT(-2), // The function should determine the polarity of the QR code. 2298 QR_POLARITY_BLACK_ON_WHITE(0), // The function should search for a QR code with dark data on a bright background. 2299 QR_POLARITY_WHITE_ON_BLACK(1), // The function should search for a QR code with bright data on a dark background. 2300 ; 2301 private final int value; 2302 private QRPolarities(int value) { 2303 this.value = value; 2304 } 2305 public static QRPolarities fromValue(int val) { 2306 for (QRPolarities v : values()) { 2307 if (v.value == val) 2308 return v; 2309 } 2310 return null; 2311 } 2312 public int getValue() { 2313 return value; 2314 } 2315 } 2316 2317 public static enum QRRotationMode { 2318 QR_ROTATION_MODE_UNLIMITED(0), // The function allows for unlimited rotation. 2319 QR_ROTATION_MODE_0_DEGREES(1), // The function allows for ??? 5 degrees of rotation. 2320 QR_ROTATION_MODE_90_DEGREES(2), // The function allows for between 85 and 95 degrees of rotation. 2321 QR_ROTATION_MODE_180_DEGREES(3), // The function allows for between 175 and 185 degrees of rotation. 2322 QR_ROTATION_MODE_270_DEGREES(4), // The function allows for between 265 and 275 degrees of rotation. 2323 ; 2324 private final int value; 2325 private QRRotationMode(int value) { 2326 this.value = value; 2327 } 2328 public static QRRotationMode fromValue(int val) { 2329 try { 2330 return values()[val]; 2331 } catch (ArrayIndexOutOfBoundsException e) { 2332 return null; 2333 } 2334 } 2335 public int getValue() { 2336 return value; 2337 } 2338 } 2339 2340 public static enum QRGradingMode { 2341 QR_NO_GRADING(0), // The function does not make any preparatory calculations. 2342 ; 2343 private final int value; 2344 private QRGradingMode(int value) { 2345 this.value = value; 2346 } 2347 public static QRGradingMode fromValue(int val) { 2348 try { 2349 return values()[val]; 2350 } catch (ArrayIndexOutOfBoundsException e) { 2351 return null; 2352 } 2353 } 2354 public int getValue() { 2355 return value; 2356 } 2357 } 2358 2359 public static enum StraightEdgeSearchMode { 2360 USE_FIRST_RAKE_EDGES(0), // Fits a straight edge on the first points detected using a rake. 2361 USE_BEST_RAKE_EDGES(1), // Fits a straight edge on the best points detected using a rake. 2362 USE_BEST_HOUGH_LINE(2), // Finds the strongest straight edge using all points detected on a rake. 2363 USE_FIRST_PROJECTION_EDGE(3), // Uses the location of the first projected edge as the straight edge. 2364 USE_BEST_PROJECTION_EDGE(4), // Finds the strongest projected edge location to determine the straight edge. 2365 ; 2366 private final int value; 2367 private StraightEdgeSearchMode(int value) { 2368 this.value = value; 2369 } 2370 public static StraightEdgeSearchMode fromValue(int val) { 2371 try { 2372 return values()[val]; 2373 } catch (ArrayIndexOutOfBoundsException e) { 2374 return null; 2375 } 2376 } 2377 public int getValue() { 2378 return value; 2379 } 2380 } 2381 2382 public static enum SearchDirection { 2383 SEARCH_DIRECTION_LEFT_TO_RIGHT(0), // Searches from the left side of the search area to the right side of the search area. 2384 SEARCH_DIRECTION_RIGHT_TO_LEFT(1), // Searches from the right side of the search area to the left side of the search area. 2385 SEARCH_DIRECTION_TOP_TO_BOTTOM(2), // Searches from the top side of the search area to the bottom side of the search area. 2386 SEARCH_DIRECTION_BOTTOM_TO_TOP(3), // Searches from the bottom side of the search area to the top side of the search area. 2387 ; 2388 private final int value; 2389 private SearchDirection(int value) { 2390 this.value = value; 2391 } 2392 public static SearchDirection fromValue(int val) { 2393 try { 2394 return values()[val]; 2395 } catch (ArrayIndexOutOfBoundsException e) { 2396 return null; 2397 } 2398 } 2399 public int getValue() { 2400 return value; 2401 } 2402 } 2403 2404 public static enum QRStreamMode { 2405 QR_MODE_NUMERIC(0), // Specifies that the data was encoded using numeric mode. 2406 QR_MODE_ALPHANUMERIC(1), // Specifies that the data was encoded using alpha-numeric mode. 2407 QR_MODE_RAW_BYTE(2), // Specifies that the data was not encoded but is only raw binary bytes, or encoded in JIS-8. 2408 QR_MODE_EAN128_TOKEN(3), // Specifies that the data has a special meaning represented by the application ID. 2409 QR_MODE_EAN128_DATA(4), // Specifies that the data has a special meaning represented by the application ID. 2410 QR_MODE_ECI(5), // Specifies that the data was meant to be read using the language represented in the language ID. 2411 QR_MODE_KANJI(6), // Specifies that the data was encoded in Shift-JIS16 Japanese. 2412 ; 2413 private final int value; 2414 private QRStreamMode(int value) { 2415 this.value = value; 2416 } 2417 public static QRStreamMode fromValue(int val) { 2418 try { 2419 return values()[val]; 2420 } catch (ArrayIndexOutOfBoundsException e) { 2421 return null; 2422 } 2423 } 2424 public int getValue() { 2425 return value; 2426 } 2427 } 2428 2429 public static enum ParticleClassifierType { 2430 PARTICLE_LARGEST(0), // Use only the largest particle in the image. 2431 PARTICLE_ALL(1), // Use all particles in the image. 2432 ; 2433 private final int value; 2434 private ParticleClassifierType(int value) { 2435 this.value = value; 2436 } 2437 public static ParticleClassifierType fromValue(int val) { 2438 try { 2439 return values()[val]; 2440 } catch (ArrayIndexOutOfBoundsException e) { 2441 return null; 2442 } 2443 } 2444 public int getValue() { 2445 return value; 2446 } 2447 } 2448 2449 public static enum QRCellSampleSize { 2450 QR_CELL_SAMPLE_SIZE_AUTO_DETECT(-2), // The function will try each sample size and use the one which decodes the QR code within the fewest iterations and utilizing the least amount of error correction. 2451 QR_CELL_SAMPLE_SIZE1X1(1), // The function will use a 1x1 sized sample from each cell. 2452 QR_CELL_SAMPLE_SIZE2X2(2), // The function will use a 2x2 sized sample from each cell. 2453 QR_CELL_SAMPLE_SIZE3X3(3), // The function will use a 3x3 sized sample from each cell. 2454 QR_CELL_SAMPLE_SIZE4X4(4), // The function will use a 4x4 sized sample from each cell. 2455 QR_CELL_SAMPLE_SIZE5X5(5), // The function will use a 5x5 sized sample from each cell. 2456 QR_CELL_SAMPLE_SIZE6X6(6), // The function will use a 6x6 sized sample from each cell. 2457 QR_CELL_SAMPLE_SIZE7X7(7), // The function will use a 7x7 sized sample from each cell. 2458 ; 2459 private final int value; 2460 private QRCellSampleSize(int value) { 2461 this.value = value; 2462 } 2463 public static QRCellSampleSize fromValue(int val) { 2464 for (QRCellSampleSize v : values()) { 2465 if (v.value == val) 2466 return v; 2467 } 2468 return null; 2469 } 2470 public int getValue() { 2471 return value; 2472 } 2473 } 2474 2475 public static enum RakeProcessType { 2476 GET_FIRST_EDGES(0), 2477 GET_FIRST_AND_LAST_EDGES(1), 2478 GET_ALL_EDGES(2), 2479 GET_BEST_EDGES(3), 2480 ; 2481 private final int value; 2482 private RakeProcessType(int value) { 2483 this.value = value; 2484 } 2485 public static RakeProcessType fromValue(int val) { 2486 try { 2487 return values()[val]; 2488 } catch (ArrayIndexOutOfBoundsException e) { 2489 return null; 2490 } 2491 } 2492 public int getValue() { 2493 return value; 2494 } 2495 } 2496 2497 public static enum GeometricSetupDataItem { 2498 CURVE_EXTRACTION_MODE(0), // Specifies how the function identifies curves in the image. 2499 CURVE_EDGE_THRSHOLD(1), // Specifies the minimum contrast an edge pixel must have for it to be considered part of a curve. 2500 CURVE_EDGE_FILTER(2), // Specifies the width of the edge filter that the function uses to identify curves in the image. 2501 MINIMUM_CURVE_LENGTH(3), // Specifies the length, in pixels, of the smallest curve that you want the function to identify. 2502 CURVE_ROW_SEARCH_STEP_SIZE(4), // Specifies the distance, in the y direction, between the image rows that the algorithm inspects for curve seed points. 2503 CURVE_COL_SEARCH_STEP_SIZE(5), // Specifies the distance, in the x direction, between the image columns that the algorithm inspects for curve seed points. 2504 CURVE_MAX_END_POINT_GAP(6), // Specifies the maximum gap, in pixels, between the endpoints of a curve that the function identifies as a closed curve. 2505 EXTRACT_CLOSED_CURVES(7), // Specifies whether to identify only closed curves in the image. 2506 ENABLE_SUBPIXEL_CURVE_EXTRACTION(8), // The function ignores this option. 2507 ENABLE_CORRELATION_SCORE(9), // Specifies that the function should calculate the Correlation Score and return it for each match result. 2508 ENABLE_SUBPIXEL_ACCURACY(10), // Determines whether to return the match results with subpixel accuracy. 2509 SUBPIXEL_ITERATIONS(11), // Specifies the maximum number of incremental improvements used to refine matches using subpixel information. 2510 SUBPIXEL_TOLERANCE(12), // Specifies the maximum amount of change, in pixels, between consecutive incremental improvements in the match position before the function stops refining the match position. 2511 INITIAL_MATCH_LIST_LENGTH(13), // Specifies the maximum size of the match list. 2512 ENABLE_TARGET_TEMPLATE_CURVESCORE(14), // Specifies whether the function should calculate the match curve to template curve score and return it for each match result. 2513 MINIMUM_MATCH_SEPARATION_DISTANCE(15), // Specifies the minimum separation distance, in pixels, between the origins of two matches that have unique positions. 2514 MINIMUM_MATCH_SEPARATION_ANGLE(16), // Specifies the minimum angular difference, in degrees, between two matches that have unique angles. 2515 MINIMUM_MATCH_SEPARATION_SCALE(17), // Specifies the minimum difference in scale, expressed as a percentage, between two matches that have unique scales. 2516 MAXIMUM_MATCH_OVERLAP(18), // Specifies whether you want the algorithm to spend less time accurately estimating the location of a match. 2517 ENABLE_COARSE_RESULT(19), // Specifies whether you want the algorithm to spend less time accurately estimating the location of a match. 2518 ENABLE_CALIBRATION_SUPPORT(20), // Specifies whether or not the algorithm treat the inspection image as a calibrated image. 2519 ENABLE_CONTRAST_REVERSAL(21), // Specifies the contrast of the matches to search for. 2520 SEARCH_STRATEGY(22), // Specifies the aggressiveness of the strategy used to find matches in the image. 2521 REFINEMENT_MATCH_FACTOR(23), // Specifies the factor applied to the number of matches requested to determine how many matches are refined in the pyramid stage. 2522 SUBPIXEL_MATCH_FACTOR(24), // Specifies the factor applied to the number for matches requested to determine how many matches are used for the final (subpixel) stage. 2523 MAX_REFINEMENT_ITERATIONS(25), // Specifies maximum refinement iteration. 2524 ; 2525 private final int value; 2526 private GeometricSetupDataItem(int value) { 2527 this.value = value; 2528 } 2529 public static GeometricSetupDataItem fromValue(int val) { 2530 try { 2531 return values()[val]; 2532 } catch (ArrayIndexOutOfBoundsException e) { 2533 return null; 2534 } 2535 } 2536 public int getValue() { 2537 return value; 2538 } 2539 } 2540 2541 public static enum DistortionModel { 2542 POLYNOMIAL_MODEL(0), // Polynomial model. 2543 DIVISION_MODEL(1), // Division Model. 2544 NO_DISTORTION_MODEL(-1), // Not a distortion model. 2545 ; 2546 private final int value; 2547 private DistortionModel(int value) { 2548 this.value = value; 2549 } 2550 public static DistortionModel fromValue(int val) { 2551 for (DistortionModel v : values()) { 2552 if (v.value == val) 2553 return v; 2554 } 2555 return null; 2556 } 2557 public int getValue() { 2558 return value; 2559 } 2560 } 2561 2562 public static enum CalibrationThumbnailType { 2563 CAMARA_MODEL_TYPE(0), // Camara model thumbnail type. 2564 PERSPECTIVE_TYPE(1), // Perspective thumbnail type. 2565 MICRO_PLANE_TYPE(2), // Micro Plane thumbnail type. 2566 ; 2567 private final int value; 2568 private CalibrationThumbnailType(int value) { 2569 this.value = value; 2570 } 2571 public static CalibrationThumbnailType fromValue(int val) { 2572 try { 2573 return values()[val]; 2574 } catch (ArrayIndexOutOfBoundsException e) { 2575 return null; 2576 } 2577 } 2578 public int getValue() { 2579 return value; 2580 } 2581 } 2582 2583 public static enum SettingType { 2584 ROTATION_ANGLE_RANGE(0), // Set a range for this option to specify the angles at which you expect the Function to find template matches in the inspection image. 2585 SCALE_RANGE(1), // Set a range for this option to specify the sizes at which you expect the Function to find template matches in the inspection image. 2586 OCCLUSION_RANGE(2), // Set a range for this option to specify the amount of occlusion you expect for a match in the inspection image. 2587 ; 2588 private final int value; 2589 private SettingType(int value) { 2590 this.value = value; 2591 } 2592 public static SettingType fromValue(int val) { 2593 try { 2594 return values()[val]; 2595 } catch (ArrayIndexOutOfBoundsException e) { 2596 return null; 2597 } 2598 } 2599 public int getValue() { 2600 return value; 2601 } 2602 } 2603 2604 public static enum SegmentationDistanceLevel { 2605 SEGMENTATION_LEVEL_CONSERVATIVE(0), // Uses extensive criteria to determine the Maximum Distance. 2606 SEGMENTATION_LEVEL_AGGRESSIVE(1), // Uses few criteria to determine the Maximum Distance. 2607 ; 2608 private final int value; 2609 private SegmentationDistanceLevel(int value) { 2610 this.value = value; 2611 } 2612 public static SegmentationDistanceLevel fromValue(int val) { 2613 try { 2614 return values()[val]; 2615 } catch (ArrayIndexOutOfBoundsException e) { 2616 return null; 2617 } 2618 } 2619 public int getValue() { 2620 return value; 2621 } 2622 } 2623 2624 public static enum ExtractContourSelection { 2625 CLOSEST(0), // Selects the curve closest to the ROI. 2626 LONGEST(1), // Selects the longest curve. 2627 STRONGEST(2), // Selects the curve with the highest edge strength averaged from each point on the curve. 2628 ; 2629 private final int value; 2630 private ExtractContourSelection(int value) { 2631 this.value = value; 2632 } 2633 public static ExtractContourSelection fromValue(int val) { 2634 try { 2635 return values()[val]; 2636 } catch (ArrayIndexOutOfBoundsException e) { 2637 return null; 2638 } 2639 } 2640 public int getValue() { 2641 return value; 2642 } 2643 } 2644 2645 public static enum FindTransformMode { 2646 FIND_REFERENCE(0), // Update both parts of the coordinate system. 2647 UPDATE_TRANSFORM(1), // Update only the new reference system. 2648 ; 2649 private final int value; 2650 private FindTransformMode(int value) { 2651 this.value = value; 2652 } 2653 public static FindTransformMode fromValue(int val) { 2654 try { 2655 return values()[val]; 2656 } catch (ArrayIndexOutOfBoundsException e) { 2657 return null; 2658 } 2659 } 2660 public int getValue() { 2661 return value; 2662 } 2663 } 2664 2665 public static enum ExtractContourDirection { 2666 RECT_LEFT_RIGHT(0), // Searches the ROI from left to right. 2667 RECT_RIGHT_LEFT(1), // Searches the ROI from right to left. 2668 RECT_TOP_BOTTOM(2), // Searches the ROI from top to bottom. 2669 RECT_BOTTOM_TOP(3), // Searches the ROI from bottom to top. 2670 ANNULUS_INNER_OUTER(4), // Searches the ROI from the inner radius to the outer radius. 2671 ANNULUS_OUTER_INNER(5), // Searches the ROI from the outer radius to the inner radius. 2672 ANNULUS_START_STOP(6), // Searches the ROI from start angle to end angle. 2673 ANNULUS_STOP_START(7), // Searches the ROI from end angle to start angle. 2674 ; 2675 private final int value; 2676 private ExtractContourDirection(int value) { 2677 this.value = value; 2678 } 2679 public static ExtractContourDirection fromValue(int val) { 2680 try { 2681 return values()[val]; 2682 } catch (ArrayIndexOutOfBoundsException e) { 2683 return null; 2684 } 2685 } 2686 public int getValue() { 2687 return value; 2688 } 2689 } 2690 2691 public static enum EdgePolaritySearchMode { 2692 SEARCH_FOR_ALL_EDGES(0), // Searches for all edges. 2693 SEARCH_FOR_RISING_EDGES(1), // Searches for rising edges only. 2694 SEARCH_FOR_FALLING_EDGES(2), // Searches for falling edges only. 2695 ; 2696 private final int value; 2697 private EdgePolaritySearchMode(int value) { 2698 this.value = value; 2699 } 2700 public static EdgePolaritySearchMode fromValue(int val) { 2701 try { 2702 return values()[val]; 2703 } catch (ArrayIndexOutOfBoundsException e) { 2704 return null; 2705 } 2706 } 2707 public int getValue() { 2708 return value; 2709 } 2710 } 2711 2712 public static enum Connectivity { 2713 FOUR_CONNECTED(0), // Morphological reconstruction is performed in connectivity mode 4. 2714 EIGHT_CONNECTED(1), // Morphological reconstruction is performed in connectivity mode 8. 2715 ; 2716 private final int value; 2717 private Connectivity(int value) { 2718 this.value = value; 2719 } 2720 public static Connectivity fromValue(int val) { 2721 try { 2722 return values()[val]; 2723 } catch (ArrayIndexOutOfBoundsException e) { 2724 return null; 2725 } 2726 } 2727 public int getValue() { 2728 return value; 2729 } 2730 } 2731 2732 public static enum MorphologyReconstructOperation { 2733 DILATE_RECONSTRUCT(0), // Performs Reconstruction by dilation. 2734 ERODE_RECONSTRUCT(1), // Performs Reconstruction by erosion. 2735 ; 2736 private final int value; 2737 private MorphologyReconstructOperation(int value) { 2738 this.value = value; 2739 } 2740 public static MorphologyReconstructOperation fromValue(int val) { 2741 try { 2742 return values()[val]; 2743 } catch (ArrayIndexOutOfBoundsException e) { 2744 return null; 2745 } 2746 } 2747 public int getValue() { 2748 return value; 2749 } 2750 } 2751 2752 public static enum WaveletType { 2753 DB02(0), 2754 DB03(1), 2755 DB04(2), // Specifies the Wavelet Type as DB02. 2756 DB05(3), 2757 DB06(4), 2758 DB07(5), 2759 DB08(6), 2760 DB09(7), 2761 DB10(8), 2762 DB11(9), 2763 DB12(10), 2764 DB13(11), 2765 DB14(12), 2766 HAAR(13), 2767 BIOR1_3(14), 2768 BIOR1_5(15), 2769 BIOR2_2(16), 2770 BIOR2_4(17), 2771 BIOR2_6(18), 2772 BIOR2_8(19), 2773 BIOR3_1(20), 2774 BIOR3_3(21), 2775 BIOR3_5(22), 2776 BIOR3_7(23), 2777 BIOR3_9(24), 2778 BIOR4_4(25), 2779 COIF1(26), 2780 COIF2(27), 2781 COIF3(28), 2782 COIF4(29), 2783 COIF5(30), 2784 SYM2(31), 2785 SYM3(32), 2786 SYM4(33), 2787 SYM5(34), 2788 SYM6(35), 2789 SYM7(36), 2790 SYM8(37), 2791 BIOR5_5(38), 2792 BIOR6_8(39), 2793 ; 2794 private final int value; 2795 private WaveletType(int value) { 2796 this.value = value; 2797 } 2798 public static WaveletType fromValue(int val) { 2799 try { 2800 return values()[val]; 2801 } catch (ArrayIndexOutOfBoundsException e) { 2802 return null; 2803 } 2804 } 2805 public int getValue() { 2806 return value; 2807 } 2808 } 2809 2810 public static enum ParticleClassifierThresholdType { 2811 THRESHOLD_MANUAL(0), // The classifier performs a manual threshold on the image during preprocessing. 2812 THRESHOLD_AUTO(1), // The classifier performs an auto threshold on the image during preprocessing. 2813 THRESHOLD_LOCAL(2), // The classifier performs a local threshold on the image during preprocessing. 2814 ; 2815 private final int value; 2816 private ParticleClassifierThresholdType(int value) { 2817 this.value = value; 2818 } 2819 public static ParticleClassifierThresholdType fromValue(int val) { 2820 try { 2821 return values()[val]; 2822 } catch (ArrayIndexOutOfBoundsException e) { 2823 return null; 2824 } 2825 } 2826 public int getValue() { 2827 return value; 2828 } 2829 } 2830 2831 public static enum MeasureParticlesCalibrationMode { 2832 CALIBRATION_MODE_PIXEL(0), // The function takes only pixel measurements on the particles in the image. 2833 CALIBRATION_MODE_CALIBRATED(1), // The function takes only calibrated measurements on the particles in the image. 2834 CALIBRATION_MODE_BOTH(2), // The function takes both pixel and calibrated measurements on the particles in the image. 2835 ; 2836 private final int value; 2837 private MeasureParticlesCalibrationMode(int value) { 2838 this.value = value; 2839 } 2840 public static MeasureParticlesCalibrationMode fromValue(int val) { 2841 try { 2842 return values()[val]; 2843 } catch (ArrayIndexOutOfBoundsException e) { 2844 return null; 2845 } 2846 } 2847 public int getValue() { 2848 return value; 2849 } 2850 } 2851 2852 public static enum GeometricMatchingSearchStrategy { 2853 GEOMETRIC_MATCHING_CONSERVATIVE(0), // Instructs the pattern matching algorithm to use the largest possible amount of information from the image at the expense of slowing down the speed of the algorithm. 2854 GEOMETRIC_MATCHING_BALANCED(1), // Instructs the pattern matching algorithm to balance the amount of information from the image it uses with the speed of the algorithm. 2855 GEOMETRIC_MATCHING_AGGRESSIVE(2), // Instructs the pattern matching algorithm to use a lower amount of information from the image, which allows the algorithm to run quickly but at the expense of accuracy. 2856 ; 2857 private final int value; 2858 private GeometricMatchingSearchStrategy(int value) { 2859 this.value = value; 2860 } 2861 public static GeometricMatchingSearchStrategy fromValue(int val) { 2862 try { 2863 return values()[val]; 2864 } catch (ArrayIndexOutOfBoundsException e) { 2865 return null; 2866 } 2867 } 2868 public int getValue() { 2869 return value; 2870 } 2871 } 2872 2873 public static enum ColorClassificationResolution { 2874 CLASSIFIER_LOW_RESOLUTION(0), // Low resolution version of the color classifier. 2875 CLASSIFIER_MEDIUM_RESOLUTION(1), // Medium resolution version of the color classifier. 2876 CLASSIFIER_HIGH_RESOLUTION(2), // High resolution version of the color classifier. 2877 ; 2878 private final int value; 2879 private ColorClassificationResolution(int value) { 2880 this.value = value; 2881 } 2882 public static ColorClassificationResolution fromValue(int val) { 2883 try { 2884 return values()[val]; 2885 } catch (ArrayIndexOutOfBoundsException e) { 2886 return null; 2887 } 2888 } 2889 public int getValue() { 2890 return value; 2891 } 2892 } 2893 2894 public static enum ConnectionConstraintType { 2895 DISTANCE_CONSTRAINT(0), // Specifies the distance, in pixels, within which the end points of two curves must lie in order to be considered part of a contour. 2896 ANGLE_CONSTRAINT(1), // Specifies the range, in degrees, within which the difference between the angle of two curves, measured at the end points, must lie in order for the two curves to be considered part of a contour. 2897 CONNECTIVITY_CONSTRAINT(2), // Specifies the distance, in pixels, within which a line extended from the end point of a curve must pass the end point of another curve in order for the two curves to be considered part of a contour. 2898 GRADIENT_CONSTRAINT(3), // Specifies the range, in degrees, within which the gradient angles of two curves, measured at the end points, must lie in order for the two curves to be considered part of a contour. 2899 NUM_CONNECTION_CONSTRAINT_TYPES(4), // . 2900 ; 2901 private final int value; 2902 private ConnectionConstraintType(int value) { 2903 this.value = value; 2904 } 2905 public static ConnectionConstraintType fromValue(int val) { 2906 try { 2907 return values()[val]; 2908 } catch (ArrayIndexOutOfBoundsException e) { 2909 return null; 2910 } 2911 } 2912 public int getValue() { 2913 return value; 2914 } 2915 } 2916 2917 public static enum Barcode2DContrast { 2918 ALL_BARCODE_2D_CONTRASTS(0), // The function searches for barcodes of each contrast type. 2919 BLACK_ON_WHITE_BARCODE_2D(1), // The function searches for 2D barcodes containing black data on a white background. 2920 WHITE_ON_BLACK_BARCODE_2D(2), // The function searches for 2D barcodes containing white data on a black background. 2921 ; 2922 private final int value; 2923 private Barcode2DContrast(int value) { 2924 this.value = value; 2925 } 2926 public static Barcode2DContrast fromValue(int val) { 2927 try { 2928 return values()[val]; 2929 } catch (ArrayIndexOutOfBoundsException e) { 2930 return null; 2931 } 2932 } 2933 public int getValue() { 2934 return value; 2935 } 2936 } 2937 2938 public static enum QRModelType { 2939 QR_MODELTYPE_AUTO_DETECT(0), // Specifies that the function will auto-detect the type of QR code. 2940 QR_MODELTYPE_MICRO(1), // Specifies the QR code is of a micro type. 2941 QR_MODELTYPE_MODEL1(2), // Specifies the QR code is of a model1 type. 2942 QR_MODELTYPE_MODEL2(3), // Specifies the QR code is of a model2 type. 2943 ; 2944 private final int value; 2945 private QRModelType(int value) { 2946 this.value = value; 2947 } 2948 public static QRModelType fromValue(int val) { 2949 try { 2950 return values()[val]; 2951 } catch (ArrayIndexOutOfBoundsException e) { 2952 return null; 2953 } 2954 } 2955 public int getValue() { 2956 return value; 2957 } 2958 } 2959 2960 public static enum WindowBackgroundFillStyle { 2961 FILL_STYLE_SOLID(0), // Fill the display window with a solid color. 2962 FILL_STYLE_HATCH(2), // Fill the display window with a pattern defined by WindowBackgroundHatchStyle. 2963 FILL_STYLE_DEFAULT(3), // Fill the display window with the NI Vision default pattern. 2964 ; 2965 private final int value; 2966 private WindowBackgroundFillStyle(int value) { 2967 this.value = value; 2968 } 2969 public static WindowBackgroundFillStyle fromValue(int val) { 2970 for (WindowBackgroundFillStyle v : values()) { 2971 if (v.value == val) 2972 return v; 2973 } 2974 return null; 2975 } 2976 public int getValue() { 2977 return value; 2978 } 2979 } 2980 2981 public static enum ExtractionMode { 2982 NORMAL_IMAGE(0), // Specifies that the function makes no assumptions about the uniformity of objects in the image or the image background. 2983 UNIFORM_REGIONS(1), // Specifies that the function assumes that either the objects in the image or the image background consists of uniform pixel values. 2984 ; 2985 private final int value; 2986 private ExtractionMode(int value) { 2987 this.value = value; 2988 } 2989 public static ExtractionMode fromValue(int val) { 2990 try { 2991 return values()[val]; 2992 } catch (ArrayIndexOutOfBoundsException e) { 2993 return null; 2994 } 2995 } 2996 public int getValue() { 2997 return value; 2998 } 2999 } 3000 3001 public static enum EdgeFilterSize { 3002 FINE(0), // Specifies that the function uses a fine (narrow) edge filter. 3003 NORMAL(1), // Specifies that the function uses a normal edge filter. 3004 CONTOUR_TRACING(2), // Sets the Edge Filter Size to contour tracing, which provides the best results for contour extraction but increases the time required to process the image. 3005 ; 3006 private final int value; 3007 private EdgeFilterSize(int value) { 3008 this.value = value; 3009 } 3010 public static EdgeFilterSize fromValue(int val) { 3011 try { 3012 return values()[val]; 3013 } catch (ArrayIndexOutOfBoundsException e) { 3014 return null; 3015 } 3016 } 3017 public int getValue() { 3018 return value; 3019 } 3020 } 3021 3022 public static enum Barcode2DSearchMode { 3023 SEARCH_MULTIPLE(0), // The function searches for multiple 2D barcodes. 3024 SEARCH_SINGLE_CONSERVATIVE(1), // The function searches for 2D barcodes using the same searching algorithm as IMAQ_SEARCH_MULTIPLE but stops searching after locating one valid barcode. 3025 SEARCH_SINGLE_AGGRESSIVE(2), // The function searches for a single 2D barcode using a method that assumes the barcode occupies a majority of the search region. 3026 ; 3027 private final int value; 3028 private Barcode2DSearchMode(int value) { 3029 this.value = value; 3030 } 3031 public static Barcode2DSearchMode fromValue(int val) { 3032 try { 3033 return values()[val]; 3034 } catch (ArrayIndexOutOfBoundsException e) { 3035 return null; 3036 } 3037 } 3038 public int getValue() { 3039 return value; 3040 } 3041 } 3042 3043 public static enum DataMatrixSubtype { 3044 ALL_DATA_MATRIX_SUBTYPES(0), // The function searches for Data Matrix barcodes of all subtypes. 3045 DATA_MATRIX_SUBTYPES_ECC_000_ECC_140(1), // The function searches for Data Matrix barcodes of subtypes ECC 000, ECC 050, ECC 080, ECC 100 and ECC 140. 3046 DATA_MATRIX_SUBTYPE_ECC_200(2), // The function searches for Data Matrix ECC 200 barcodes. 3047 ; 3048 private final int value; 3049 private DataMatrixSubtype(int value) { 3050 this.value = value; 3051 } 3052 public static DataMatrixSubtype fromValue(int val) { 3053 try { 3054 return values()[val]; 3055 } catch (ArrayIndexOutOfBoundsException e) { 3056 return null; 3057 } 3058 } 3059 public int getValue() { 3060 return value; 3061 } 3062 } 3063 3064 public static enum FeatureType { 3065 NOT_FOUND_FEATURE(0), // Specifies the feature is not found. 3066 CIRCLE_FEATURE(1), // Specifies the feature is a circle. 3067 ELLIPSE_FEATURE(2), // Specifies the feature is an ellipse. 3068 CONST_CURVE_FEATURE(3), // Specifies the features is a constant curve. 3069 RECTANGLE_FEATURE(4), // Specifies the feature is a rectangle. 3070 LEG_FEATURE(5), // Specifies the feature is a leg. 3071 CORNER_FEATURE(6), // Specifies the feature is a corner. 3072 PARALLEL_LINE_PAIR_FEATURE(7), // Specifies the feature is a parallel line pair. 3073 PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE(8), // Specifies the feature is a pair of parallel line pairs. 3074 LINE_FEATURE(9), // Specifies the feature is a line. 3075 CLOSED_CURVE_FEATURE(10), // Specifies the feature is a closed curve. 3076 ; 3077 private final int value; 3078 private FeatureType(int value) { 3079 this.value = value; 3080 } 3081 public static FeatureType fromValue(int val) { 3082 try { 3083 return values()[val]; 3084 } catch (ArrayIndexOutOfBoundsException e) { 3085 return null; 3086 } 3087 } 3088 public int getValue() { 3089 return value; 3090 } 3091 } 3092 3093 public static enum Barcode2DCellShape { 3094 SQUARE_CELLS(0), // The function uses an algorithm for decoding the 2D barcode that works with square data cells. 3095 ROUND_CELLS(1), // The function uses an algorithm for decoding the 2D barcode that works with round data cells. 3096 ; 3097 private final int value; 3098 private Barcode2DCellShape(int value) { 3099 this.value = value; 3100 } 3101 public static Barcode2DCellShape fromValue(int val) { 3102 try { 3103 return values()[val]; 3104 } catch (ArrayIndexOutOfBoundsException e) { 3105 return null; 3106 } 3107 } 3108 public int getValue() { 3109 return value; 3110 } 3111 } 3112 3113 public static enum LocalThresholdMethod { 3114 NIBLACK(0), // The function computes thresholds for each pixel based on its local statistics using the Niblack local thresholding algorithm. 3115 BACKGROUND_CORRECTION(1), // The function performs background correction first to eliminate non-uniform lighting effects, then performs thresholding using the Otsu thresholding algorithm. 3116 ; 3117 private final int value; 3118 private LocalThresholdMethod(int value) { 3119 this.value = value; 3120 } 3121 public static LocalThresholdMethod fromValue(int val) { 3122 try { 3123 return values()[val]; 3124 } catch (ArrayIndexOutOfBoundsException e) { 3125 return null; 3126 } 3127 } 3128 public int getValue() { 3129 return value; 3130 } 3131 } 3132 3133 public static enum Barcode2DType { 3134 PDF417(0), // The 2D barcode is of type PDF417. 3135 DATA_MATRIX_ECC_000(1), // The 2D barcode is of type Data Matrix ECC 000. 3136 DATA_MATRIX_ECC_050(2), // The 2D barcode is of type Data Matrix ECC 050. 3137 DATA_MATRIX_ECC_080(3), // The 2D barcode is of type Data Matrix ECC 080. 3138 DATA_MATRIX_ECC_100(4), // The 2D barcode is of type Data Matrix ECC 100. 3139 DATA_MATRIX_ECC_140(5), // The 2D barcode is of type Data Matrix ECC 140. 3140 DATA_MATRIX_ECC_200(6), // The 2D barcode is of type Data Matrix ECC 200. 3141 ; 3142 private final int value; 3143 private Barcode2DType(int value) { 3144 this.value = value; 3145 } 3146 public static Barcode2DType fromValue(int val) { 3147 try { 3148 return values()[val]; 3149 } catch (ArrayIndexOutOfBoundsException e) { 3150 return null; 3151 } 3152 } 3153 public int getValue() { 3154 return value; 3155 } 3156 } 3157 3158 public static enum ClassifierEngineType { 3159 ENGINE_NONE(0), // No engine has been set on this classifier session. 3160 ENGINE_NEAREST_NEIGHBOR(1), // Nearest neighbor engine. 3161 ENGINE_SUPPORT_VECTOR_MACHINE(2), 3162 ; 3163 private final int value; 3164 private ClassifierEngineType(int value) { 3165 this.value = value; 3166 } 3167 public static ClassifierEngineType fromValue(int val) { 3168 try { 3169 return values()[val]; 3170 } catch (ArrayIndexOutOfBoundsException e) { 3171 return null; 3172 } 3173 } 3174 public int getValue() { 3175 return value; 3176 } 3177 } 3178 3179 public static enum ClassifierType { 3180 CLASSIFIER_CUSTOM(0), // The classifier session classifies vectors of doubles. 3181 CLASSIFIER_PARTICLE(1), // The classifier session classifies particles in binary images. 3182 CLASSIFIER_COLOR(2), // The classifier session classifies an image based on its color. 3183 CLASSIFIER_TEXTURE(3), // The classifier session classifies an image based on its texture. 3184 ; 3185 private final int value; 3186 private ClassifierType(int value) { 3187 this.value = value; 3188 } 3189 public static ClassifierType fromValue(int val) { 3190 try { 3191 return values()[val]; 3192 } catch (ArrayIndexOutOfBoundsException e) { 3193 return null; 3194 } 3195 } 3196 public int getValue() { 3197 return value; 3198 } 3199 } 3200 3201 public static enum ParticleType { 3202 PARTICLE_BRIGHT(0), // Bright particles. 3203 PARTICLE_DARK(1), // Dark particles. 3204 ; 3205 private final int value; 3206 private ParticleType(int value) { 3207 this.value = value; 3208 } 3209 public static ParticleType fromValue(int val) { 3210 try { 3211 return values()[val]; 3212 } catch (ArrayIndexOutOfBoundsException e) { 3213 return null; 3214 } 3215 } 3216 public int getValue() { 3217 return value; 3218 } 3219 } 3220 3221 public static enum VisionInfoType2 { 3222 VISIONINFO_CALIBRATION(0x01), // Used to indicate interaction with the Calibration information in an image. 3223 VISIONINFO_OVERLAY(0x02), // Used to indicate interaction with the Overlay information in an image. 3224 VISIONINFO_GRAYTEMPLATE(0x04), // Used to indicate interaction with the grayscale template information in an image. 3225 VISIONINFO_COLORTEMPLATE(0x08), // Used to indicate interaction with the color template information in an image. 3226 VISIONINFO_GEOMETRICTEMPLATE(0x10), // Used to indicate interaction with the geometric template information in an image. 3227 VISIONINFO_CUSTOMDATA(0x20), // Used to indicate interaction with the binary or text Custom Data in an image. 3228 VISIONINFO_GOLDENTEMPLATE(0x40), // Used to indicate interaction with the golden template information in an image. 3229 VISIONINFO_GEOMETRICTEMPLATE2(0x80), // Used to indicate interaction with the geometric template 2 information in an image. 3230 VISIONINFO_ALL(0xFFFFFFFF), // Removes, checks for, or indicates the presence of all types of extra information in an image. 3231 ; 3232 private final int value; 3233 private VisionInfoType2(int value) { 3234 this.value = value; 3235 } 3236 public static VisionInfoType2 fromValue(int val) { 3237 for (VisionInfoType2 v : values()) { 3238 if (v.value == val) 3239 return v; 3240 } 3241 return null; 3242 } 3243 public int getValue() { 3244 return value; 3245 } 3246 } 3247 3248 public static enum ReadClassifierFileMode { 3249 CLASSIFIER_READ_ALL(0), // Read all information from the classifier file. 3250 CLASSIFIER_READ_SAMPLES(1), // Read only the samples from the classifier file. 3251 CLASSIFIER_READ_PROPERTIES(2), // Read only the properties from the classifier file. 3252 ; 3253 private final int value; 3254 private ReadClassifierFileMode(int value) { 3255 this.value = value; 3256 } 3257 public static ReadClassifierFileMode fromValue(int val) { 3258 try { 3259 return values()[val]; 3260 } catch (ArrayIndexOutOfBoundsException e) { 3261 return null; 3262 } 3263 } 3264 public int getValue() { 3265 return value; 3266 } 3267 } 3268 3269 public static enum WriteClassifierFileMode { 3270 CLASSIFIER_WRITE_ALL(0), // Writes all information to the classifier file. 3271 CLASSIFIER_WRITE_CLASSIFY_ONLY(1), // Write only the information needed to classify to the classifier file. 3272 ; 3273 private final int value; 3274 private WriteClassifierFileMode(int value) { 3275 this.value = value; 3276 } 3277 public static WriteClassifierFileMode fromValue(int val) { 3278 try { 3279 return values()[val]; 3280 } catch (ArrayIndexOutOfBoundsException e) { 3281 return null; 3282 } 3283 } 3284 public int getValue() { 3285 return value; 3286 } 3287 } 3288 3289 public static enum Barcode2DShape { 3290 SQUARE_BARCODE_2D(0), // The function searches for square 2D barcodes. 3291 RECTANGULAR_BARCODE_2D(1), // The function searches for rectangular 2D barcodes. 3292 ; 3293 private final int value; 3294 private Barcode2DShape(int value) { 3295 this.value = value; 3296 } 3297 public static Barcode2DShape fromValue(int val) { 3298 try { 3299 return values()[val]; 3300 } catch (ArrayIndexOutOfBoundsException e) { 3301 return null; 3302 } 3303 } 3304 public int getValue() { 3305 return value; 3306 } 3307 } 3308 3309 public static enum DataMatrixRotationMode { 3310 UNLIMITED_ROTATION(0), // The function allows for unlimited rotation. 3311 C0_DEGREES(1), // The function allows for between -5 and 5 degrees of rotation. 3312 C90_DEGREES(2), // The function allows for between 85 and 95 degrees of rotation. 3313 C180_DEGREES(3), // The function allows for between 175 and 185 degrees of rotation. 3314 C270_DEGREES(4), // The function allows for between 265 and 275 degrees of rotation. 3315 ; 3316 private final int value; 3317 private DataMatrixRotationMode(int value) { 3318 this.value = value; 3319 } 3320 public static DataMatrixRotationMode fromValue(int val) { 3321 try { 3322 return values()[val]; 3323 } catch (ArrayIndexOutOfBoundsException e) { 3324 return null; 3325 } 3326 } 3327 public int getValue() { 3328 return value; 3329 } 3330 } 3331 3332 public static enum AIMGrade { 3333 AIM_GRADE_F(0), // The Data Matrix barcode received a grade of F. 3334 AIM_GRADE_D(1), // The Data Matrix barcode received a grade of D. 3335 AIM_GRADE_C(2), // The Data Matrix barcode received a grade of C. 3336 AIM_GRADE_B(3), // The Data Matrix barcode received a grade of B. 3337 AIM_GRADE_A(4), // The Data Matrix barcode received a grade of A. 3338 ; 3339 private final int value; 3340 private AIMGrade(int value) { 3341 this.value = value; 3342 } 3343 public static AIMGrade fromValue(int val) { 3344 try { 3345 return values()[val]; 3346 } catch (ArrayIndexOutOfBoundsException e) { 3347 return null; 3348 } 3349 } 3350 public int getValue() { 3351 return value; 3352 } 3353 } 3354 3355 public static enum DataMatrixCellFillMode { 3356 AUTO_DETECT_CELL_FILL_MODE(-2), // Sets the function to determine the Data Matrix barcode cell fill percentage automatically. 3357 LOW_FILL(0), // Sets the function to read Data Matrix barcodes with a cell fill percentage of less than 30 percent. 3358 NORMAL_FILL(1), // Sets the function to read Data Matrix barcodes with a cell fill percentage greater than or equal to 30 percent. 3359 ; 3360 private final int value; 3361 private DataMatrixCellFillMode(int value) { 3362 this.value = value; 3363 } 3364 public static DataMatrixCellFillMode fromValue(int val) { 3365 for (DataMatrixCellFillMode v : values()) { 3366 if (v.value == val) 3367 return v; 3368 } 3369 return null; 3370 } 3371 public int getValue() { 3372 return value; 3373 } 3374 } 3375 3376 public static enum DataMatrixDemodulationMode { 3377 AUTO_DETECT_DEMODULATION_MODE(-2), // The function will try each demodulation mode and use the one which decodes the Data Matrix barcode within the fewest iterations and utilizing the least amount of error correction. 3378 HISTOGRAM(0), // The function uses a histogram of all of the Data Matrix cells to calculate a threshold. 3379 LOCAL_CONTRAST(1), // The function examines each of the cell's neighbors to determine if the cell is on or off. 3380 COMBINED(2), // The function uses the histogram of the Data Matrix barcode to calculate a threshold. 3381 ALL_DEMODULATION_MODES(3), // The function tries IMAQ_HISTOGRAM, then IMAQ_LOCAL_CONTRAST and then IMAQ_COMBINATION, stopping once one mode is successful. 3382 ; 3383 private final int value; 3384 private DataMatrixDemodulationMode(int value) { 3385 this.value = value; 3386 } 3387 public static DataMatrixDemodulationMode fromValue(int val) { 3388 for (DataMatrixDemodulationMode v : values()) { 3389 if (v.value == val) 3390 return v; 3391 } 3392 return null; 3393 } 3394 public int getValue() { 3395 return value; 3396 } 3397 } 3398 3399 public static enum DataMatrixECC { 3400 AUTO_DETECT_ECC(-2), // Sets the function to determine the Data Matrix barcode ECC automatically. 3401 ECC_000(0), // Sets the function to read Data Matrix barcodes of ECC 000 only. 3402 ECC_050(50), // Sets the function to read Data Matrix barcodes of ECC 050 only. 3403 ECC_080(80), // Sets the function to read Data Matrix barcodes of ECC 080 only. 3404 ECC_100(100), // Sets the function to read Data Matrix barcodes of ECC 100 only. 3405 ECC_140(140), // Sets the function to read Data Matrix barcodes of ECC 140 only. 3406 ECC_000_140(190), // Sets the function to read Data Matrix barcodes of ECC 000, ECC 050, ECC 080, ECC 100, and ECC 140 only. 3407 ECC_200(200), // Sets the function to read Data Matrix barcodes of ECC 200 only. 3408 ; 3409 private final int value; 3410 private DataMatrixECC(int value) { 3411 this.value = value; 3412 } 3413 public static DataMatrixECC fromValue(int val) { 3414 for (DataMatrixECC v : values()) { 3415 if (v.value == val) 3416 return v; 3417 } 3418 return null; 3419 } 3420 public int getValue() { 3421 return value; 3422 } 3423 } 3424 3425 public static enum DataMatrixPolarity { 3426 AUTO_DETECT_POLARITY(-2), // Sets the function to determine the Data Matrix barcode polarity automatically. 3427 BLACK_DATA_ON_WHITE_BACKGROUND(0), // Sets the function to read Data Matrix barcodes with dark data on a bright background. 3428 WHITE_DATA_ON_BLACK_BACKGROUND(1), // Sets the function to read Data Matrix barcodes with bright data on a dark background. 3429 ; 3430 private final int value; 3431 private DataMatrixPolarity(int value) { 3432 this.value = value; 3433 } 3434 public static DataMatrixPolarity fromValue(int val) { 3435 for (DataMatrixPolarity v : values()) { 3436 if (v.value == val) 3437 return v; 3438 } 3439 return null; 3440 } 3441 public int getValue() { 3442 return value; 3443 } 3444 } 3445 3446 public static enum DataMatrixCellFilterMode { 3447 AUTO_DETECT_CELL_FILTER_MODE(-2), // The function will try all filter modes and uses the one that decodes the Data Matrix barcode within the fewest iterations and utilizing the least amount of error correction. 3448 AVERAGE_FILTER(0), // The function sets the pixel value for the cell to the average of the sampled pixels. 3449 MEDIAN_FILTER(1), // The function sets the pixel value for the cell to the median of the sampled pixels. 3450 CENTRAL_AVERAGE_FILTER(2), // The function sets the pixel value for the cell to the average of the pixels in the center of the cell sample. 3451 HIGH_AVERAGE_FILTER(3), // The function sets the pixel value for the cell to the average value of the half of the sampled pixels with the highest pixel values. 3452 LOW_AVERAGE_FILTER(4), // The function sets the pixel value for the cell to the average value of the half of the sampled pixels with the lowest pixel values. 3453 VERY_HIGH_AVERAGE_FILTER(5), // The function sets the pixel value for the cell to the average value of the ninth of the sampled pixels with the highest pixel values. 3454 VERY_LOW_AVERAGE_FILTER(6), // The function sets the pixel value for the cell to the average value of the ninth of the sampled pixels with the lowest pixel values. 3455 ALL_CELL_FILTERS(8), // The function tries each filter mode, starting with IMAQ_AVERAGE_FILTER and ending with IMAQ_VERY_LOW_AVERAGE_FILTER, stopping once a filter mode decodes correctly. 3456 ; 3457 private final int value; 3458 private DataMatrixCellFilterMode(int value) { 3459 this.value = value; 3460 } 3461 public static DataMatrixCellFilterMode fromValue(int val) { 3462 for (DataMatrixCellFilterMode v : values()) { 3463 if (v.value == val) 3464 return v; 3465 } 3466 return null; 3467 } 3468 public int getValue() { 3469 return value; 3470 } 3471 } 3472 3473 public static enum WindowBackgroundHatchStyle { 3474 HATCH_STYLE_HORIZONTAL(0), // The background of the display window will be horizontal bars. 3475 HATCH_STYLE_VERTICAL(1), // The background of the display window will be vertical bars. 3476 HATCH_STYLE_FORWARD_DIAGONAL(2), // The background of the display window will be diagonal bars. 3477 HATCH_STYLE_BACKWARD_DIAGONAL(3), // The background of the display window will be diagonal bars. 3478 HATCH_STYLE_CROSS(4), // The background of the display window will be intersecting horizontal and vertical bars. 3479 HATCH_STYLE_CROSS_HATCH(5), // The background of the display window will be intersecting forward and backward diagonal bars. 3480 ; 3481 private final int value; 3482 private WindowBackgroundHatchStyle(int value) { 3483 this.value = value; 3484 } 3485 public static WindowBackgroundHatchStyle fromValue(int val) { 3486 try { 3487 return values()[val]; 3488 } catch (ArrayIndexOutOfBoundsException e) { 3489 return null; 3490 } 3491 } 3492 public int getValue() { 3493 return value; 3494 } 3495 } 3496 3497 public static enum DataMatrixMirrorMode { 3498 AUTO_DETECT_MIRROR(-2), // Specifies that the function should determine if the Data Matrix barcode is mirrored. 3499 APPEARS_NORMAL(0), // Specifies that the function should expect the Data Matrix barcode to appear normal. 3500 APPEARS_MIRRORED(1), // Specifies that the function should expect the Data Matrix barcode to appear mirrored. 3501 ; 3502 private final int value; 3503 private DataMatrixMirrorMode(int value) { 3504 this.value = value; 3505 } 3506 public static DataMatrixMirrorMode fromValue(int val) { 3507 for (DataMatrixMirrorMode v : values()) { 3508 if (v.value == val) 3509 return v; 3510 } 3511 return null; 3512 } 3513 public int getValue() { 3514 return value; 3515 } 3516 } 3517 3518 public static enum CalibrationMode2 { 3519 PERSPECTIVE_MODE(0), // Functions correct for distortion caused by the camera's perspective. 3520 MICROPLANE_MODE(1), // Functions correct for distortion caused by the camera's lens. 3521 SIMPLE_CALIBRATION_MODE(2), // Functions do not correct for distortion. 3522 CORRECTED_IMAGE_MODE(3), // The image is already corrected. 3523 NO_CALIBRATION_MODE(4), // Image with No calibration. 3524 ; 3525 private final int value; 3526 private CalibrationMode2(int value) { 3527 this.value = value; 3528 } 3529 public static CalibrationMode2 fromValue(int val) { 3530 try { 3531 return values()[val]; 3532 } catch (ArrayIndexOutOfBoundsException e) { 3533 return null; 3534 } 3535 } 3536 public int getValue() { 3537 return value; 3538 } 3539 } 3540 3541 public static enum DataMatrixGradingMode { 3542 NO_GRADING(0), // The function does not make any preparatory calculations. 3543 PREPARE_FOR_AIM(1), // The function prepares the image for grading using the AIM Print Quality metrics. 3544 ; 3545 private final int value; 3546 private DataMatrixGradingMode(int value) { 3547 this.value = value; 3548 } 3549 public static DataMatrixGradingMode fromValue(int val) { 3550 try { 3551 return values()[val]; 3552 } catch (ArrayIndexOutOfBoundsException e) { 3553 return null; 3554 } 3555 } 3556 public int getValue() { 3557 return value; 3558 } 3559 } 3560 3561 public static enum WaveletTransformMode { 3562 WAVELET_TRANSFORM_INTEGER(0), // Uses a 5-3 reversible integer transform. 3563 WAVELET_TRANSFORM_FLOATING_POINT(1), // Performs a 9-7 irreversible floating-point transform. 3564 ; 3565 private final int value; 3566 private WaveletTransformMode(int value) { 3567 this.value = value; 3568 } 3569 public static WaveletTransformMode fromValue(int val) { 3570 try { 3571 return values()[val]; 3572 } catch (ArrayIndexOutOfBoundsException e) { 3573 return null; 3574 } 3575 } 3576 public int getValue() { 3577 return value; 3578 } 3579 } 3580 3581 public static enum NormalizationMethod { 3582 NORMALIZATION_NONE(0), // No normalization. 3583 NORMALIZATION_HISTOGRAM_MATCHING(1), // Adjust image so its histogram is similar to the golden template's histogram. 3584 NORMALIZATION_AVERAGE_MATCHING(2), // Adjust image so its mean pixel value equals the golden template's mean pixel value. 3585 ; 3586 private final int value; 3587 private NormalizationMethod(int value) { 3588 this.value = value; 3589 } 3590 public static NormalizationMethod fromValue(int val) { 3591 try { 3592 return values()[val]; 3593 } catch (ArrayIndexOutOfBoundsException e) { 3594 return null; 3595 } 3596 } 3597 public int getValue() { 3598 return value; 3599 } 3600 } 3601 3602 public static enum RegistrationMethod { 3603 REGISTRATION_NONE(0), // No registration. 3604 REGISTRATION_PERSPECTIVE(1), // Adjust image to correct for minor variations in alignment or perspective. 3605 ; 3606 private final int value; 3607 private RegistrationMethod(int value) { 3608 this.value = value; 3609 } 3610 public static RegistrationMethod fromValue(int val) { 3611 try { 3612 return values()[val]; 3613 } catch (ArrayIndexOutOfBoundsException e) { 3614 return null; 3615 } 3616 } 3617 public int getValue() { 3618 return value; 3619 } 3620 } 3621 3622 public static enum LinearAveragesMode { 3623 COLUMN_AVERAGES(1), // Specifies that the function calculates the mean pixel value of each column. 3624 ROW_AVERAGES(2), // Specifies that the function calculates the mean pixel value of each row. 3625 RISING_DIAGONAL_AVERAGES(4), // Specifies that the function calculates the mean pixel value of each diagonal running from the lower left to the upper right of the inspected area of the image. 3626 FALLING_DIAGONAL_AVERAGES(8), // Specifies that the function calculates the mean pixel value of each diagonal running from the upper left to the lower right of the inspected area of the image. 3627 ALL_LINEAR_AVERAGES(15), // Specifies that the function calculates all four linear mean pixel values. 3628 ; 3629 private final int value; 3630 private LinearAveragesMode(int value) { 3631 this.value = value; 3632 } 3633 public static LinearAveragesMode fromValue(int val) { 3634 for (LinearAveragesMode v : values()) { 3635 if (v.value == val) 3636 return v; 3637 } 3638 return null; 3639 } 3640 public int getValue() { 3641 return value; 3642 } 3643 } 3644 3645 public static enum CompressionType { 3646 COMPRESSION_NONE(0), // Specifies that the function should not compress the image. 3647 COMPRESSION_JPEG(1), // Specifies that the function should use lossy JPEG compression on the image. 3648 COMPRESSION_PACKED_BINARY(2), // Specifies that the function should use lossless binary packing on the image. 3649 ; 3650 private final int value; 3651 private CompressionType(int value) { 3652 this.value = value; 3653 } 3654 public static CompressionType fromValue(int val) { 3655 try { 3656 return values()[val]; 3657 } catch (ArrayIndexOutOfBoundsException e) { 3658 return null; 3659 } 3660 } 3661 public int getValue() { 3662 return value; 3663 } 3664 } 3665 3666 public static enum FlattenType { 3667 FLATTEN_IMAGE(0), // Flattens just the image data. 3668 FLATTEN_IMAGE_AND_VISION_INFO(1), // Flattens the image data and any Vision information associated with the image. 3669 ; 3670 private final int value; 3671 private FlattenType(int value) { 3672 this.value = value; 3673 } 3674 public static FlattenType fromValue(int val) { 3675 try { 3676 return values()[val]; 3677 } catch (ArrayIndexOutOfBoundsException e) { 3678 return null; 3679 } 3680 } 3681 public int getValue() { 3682 return value; 3683 } 3684 } 3685 3686 public static enum DataMatrixCellSampleSize { 3687 AUTO_DETECT_CELL_SAMPLE_SIZE(-2), // The function will try each sample size and use the one which decodes the Data Matrix barcode within the fewest iterations and utilizing the least amount of error correction. 3688 C1x1(1), // The function will use a 1x1 sized sample from each cell. 3689 C2x2(2), // The function will use a 2x2 sized sample from each cell. 3690 C3x3(3), // The function will use a 3x3 sized sample from each cell. 3691 C4x4(4), // The function will use a 4x4 sized sample from each cell. 3692 C5x5(5), // The function will use a 5x5 sized sample from each cell. 3693 C6x6(6), // The function will use a 6x6 sized sample from each cell. 3694 C7x7(7), // The function will use a 7x7 sized sample from each cell. 3695 ; 3696 private final int value; 3697 private DataMatrixCellSampleSize(int value) { 3698 this.value = value; 3699 } 3700 public static DataMatrixCellSampleSize fromValue(int val) { 3701 for (DataMatrixCellSampleSize v : values()) { 3702 if (v.value == val) 3703 return v; 3704 } 3705 return null; 3706 } 3707 public int getValue() { 3708 return value; 3709 } 3710 } 3711 3712 /** 3713 * Forward Declare Data Structures 3714 */ 3715 3716 /** 3717 * Data Structures 3718 */ 3719 3720 public static class DivisionModel extends DisposedStruct { 3721 public float kappa; // The learned kappa coefficient of division model. 3722 3723 private void init() { 3724 3725 } 3726 public DivisionModel() { 3727 super(4); 3728 init(); 3729 } 3730 public DivisionModel(double kappa) { 3731 super(4); 3732 this.kappa = (float)kappa; 3733 } 3734 protected DivisionModel(ByteBuffer backing, int offset) { 3735 super(backing, offset, 4); 3736 init(); 3737 } 3738 protected DivisionModel(long nativeObj, boolean owned) { 3739 super(nativeObj, owned, 4); 3740 init(); 3741 } 3742 protected void setBuffer(ByteBuffer backing, int offset) { 3743 super.setBuffer(backing, offset, 4); 3744 } 3745 public void read() { 3746 kappa = backing.getFloat(0); 3747 } 3748 public void write() { 3749 backing.putFloat(0, kappa); 3750 } 3751 public int size() { 3752 return 4; 3753 } 3754 } 3755 3756 public static class FocalLength extends DisposedStruct { 3757 public float fx; // Focal length in X direction. 3758 public float fy; // Focal length in Y direction. 3759 3760 private void init() { 3761 3762 } 3763 public FocalLength() { 3764 super(8); 3765 init(); 3766 } 3767 public FocalLength(double fx, double fy) { 3768 super(8); 3769 this.fx = (float)fx; 3770 this.fy = (float)fy; 3771 } 3772 protected FocalLength(ByteBuffer backing, int offset) { 3773 super(backing, offset, 8); 3774 init(); 3775 } 3776 protected FocalLength(long nativeObj, boolean owned) { 3777 super(nativeObj, owned, 8); 3778 init(); 3779 } 3780 protected void setBuffer(ByteBuffer backing, int offset) { 3781 super.setBuffer(backing, offset, 8); 3782 } 3783 public void read() { 3784 fx = backing.getFloat(0); 3785 fy = backing.getFloat(4); 3786 } 3787 public void write() { 3788 backing.putFloat(0, fx); 3789 backing.putFloat(4, fy); 3790 } 3791 public int size() { 3792 return 8; 3793 } 3794 } 3795 3796 public static class PolyModel extends DisposedStruct { 3797 public float[] kCoeffs; // The learned radial coefficients of polynomial model. 3798 public float p1; // The P1(learned tangential coefficients of polynomial model). 3799 public float p2; // The P2(learned tangential coefficients of polynomial model). 3800 private ByteBuffer kCoeffs_buf; 3801 3802 private void init() { 3803 kCoeffs = new float[0]; 3804 } 3805 public PolyModel() { 3806 super(16); 3807 init(); 3808 } 3809 public PolyModel(float[] kCoeffs, double p1, double p2) { 3810 super(16); 3811 this.kCoeffs = kCoeffs; 3812 this.p1 = (float)p1; 3813 this.p2 = (float)p2; 3814 } 3815 protected PolyModel(ByteBuffer backing, int offset) { 3816 super(backing, offset, 16); 3817 init(); 3818 } 3819 protected PolyModel(long nativeObj, boolean owned) { 3820 super(nativeObj, owned, 16); 3821 init(); 3822 } 3823 protected void setBuffer(ByteBuffer backing, int offset) { 3824 super.setBuffer(backing, offset, 16); 3825 } 3826 public void read() { 3827 int kCoeffs_numKCoeffs = backing.getInt(4); 3828 long kCoeffs_addr = getPointer(backing, 0); 3829 kCoeffs = new float[kCoeffs_numKCoeffs]; 3830 if (kCoeffs_numKCoeffs > 0 && kCoeffs_addr != 0) { 3831 newDirectByteBuffer(kCoeffs_addr, kCoeffs_numKCoeffs*4).asFloatBuffer().get(kCoeffs); 3832 } 3833 p1 = backing.getFloat(8); 3834 p2 = backing.getFloat(12); 3835 } 3836 public void write() { 3837 kCoeffs_buf = ByteBuffer.allocateDirect(kCoeffs.length*4).order(ByteOrder.nativeOrder()); 3838 kCoeffs_buf.asFloatBuffer().put(kCoeffs).rewind(); 3839 backing.putInt(4, kCoeffs.length); 3840 putPointer(backing, 0, kCoeffs_buf); 3841 backing.putFloat(8, p1); 3842 backing.putFloat(12, p2); 3843 } 3844 public int size() { 3845 return 16; 3846 } 3847 } 3848 3849 public static class DistortionModelParams extends DisposedStruct { 3850 public DistortionModel distortionModel; // Type of learned distortion model. 3851 public PolyModel polyModel; // The learned coefficients of polynomial model. 3852 public DivisionModel divisionModel; // The learned coefficient of division model. 3853 3854 private void init() { 3855 polyModel = new PolyModel(backing, 4); 3856 divisionModel = new DivisionModel(backing, 20); 3857 } 3858 public DistortionModelParams() { 3859 super(24); 3860 init(); 3861 } 3862 public DistortionModelParams(DistortionModel distortionModel, PolyModel polyModel, DivisionModel divisionModel) { 3863 super(24); 3864 this.distortionModel = distortionModel; 3865 this.polyModel = polyModel; 3866 this.divisionModel = divisionModel; 3867 } 3868 protected DistortionModelParams(ByteBuffer backing, int offset) { 3869 super(backing, offset, 24); 3870 init(); 3871 } 3872 protected DistortionModelParams(long nativeObj, boolean owned) { 3873 super(nativeObj, owned, 24); 3874 init(); 3875 } 3876 protected void setBuffer(ByteBuffer backing, int offset) { 3877 super.setBuffer(backing, offset, 24); 3878 } 3879 public void read() { 3880 distortionModel = DistortionModel.fromValue(backing.getInt(0)); 3881 polyModel.read(); 3882 divisionModel.read(); 3883 } 3884 public void write() { 3885 if (distortionModel != null) 3886 backing.putInt(0, distortionModel.getValue()); 3887 polyModel.write(); 3888 divisionModel.write(); 3889 } 3890 public int size() { 3891 return 24; 3892 } 3893 } 3894 3895 public static class PointFloat extends DisposedStruct { 3896 public float x; // The x-coordinate of the point. 3897 public float y; // The y-coordinate of the point. 3898 3899 private void init() { 3900 3901 } 3902 public PointFloat() { 3903 super(8); 3904 init(); 3905 } 3906 public PointFloat(double x, double y) { 3907 super(8); 3908 this.x = (float)x; 3909 this.y = (float)y; 3910 } 3911 protected PointFloat(ByteBuffer backing, int offset) { 3912 super(backing, offset, 8); 3913 init(); 3914 } 3915 protected PointFloat(long nativeObj, boolean owned) { 3916 super(nativeObj, owned, 8); 3917 init(); 3918 } 3919 protected void setBuffer(ByteBuffer backing, int offset) { 3920 super.setBuffer(backing, offset, 8); 3921 } 3922 public void read() { 3923 x = backing.getFloat(0); 3924 y = backing.getFloat(4); 3925 } 3926 public void write() { 3927 backing.putFloat(0, x); 3928 backing.putFloat(4, y); 3929 } 3930 public int size() { 3931 return 8; 3932 } 3933 } 3934 3935 public static class InternalParameters extends DisposedStruct { 3936 public byte isInsufficientData; 3937 public FocalLength focalLength; 3938 public PointFloat opticalCenter; 3939 3940 private void init() { 3941 focalLength = new FocalLength(backing, 4); 3942 opticalCenter = new PointFloat(backing, 12); 3943 } 3944 public InternalParameters() { 3945 super(20); 3946 init(); 3947 } 3948 public InternalParameters(byte isInsufficientData, FocalLength focalLength, PointFloat opticalCenter) { 3949 super(20); 3950 this.isInsufficientData = isInsufficientData; 3951 this.focalLength = focalLength; 3952 this.opticalCenter = opticalCenter; 3953 } 3954 protected InternalParameters(ByteBuffer backing, int offset) { 3955 super(backing, offset, 20); 3956 init(); 3957 } 3958 protected InternalParameters(long nativeObj, boolean owned) { 3959 super(nativeObj, owned, 20); 3960 init(); 3961 } 3962 protected void setBuffer(ByteBuffer backing, int offset) { 3963 super.setBuffer(backing, offset, 20); 3964 } 3965 public void read() { 3966 isInsufficientData = backing.get(0); 3967 focalLength.read(); 3968 opticalCenter.read(); 3969 } 3970 public void write() { 3971 backing.put(0, isInsufficientData); 3972 focalLength.write(); 3973 opticalCenter.write(); 3974 } 3975 public int size() { 3976 return 20; 3977 } 3978 } 3979 3980 public static class MaxGridSize extends DisposedStruct { 3981 public int xMax; // Maximum x limit for the grid size. 3982 public int yMax; // Maximum y limit for the grid size. 3983 3984 private void init() { 3985 3986 } 3987 public MaxGridSize() { 3988 super(8); 3989 init(); 3990 } 3991 public MaxGridSize(int xMax, int yMax) { 3992 super(8); 3993 this.xMax = xMax; 3994 this.yMax = yMax; 3995 } 3996 protected MaxGridSize(ByteBuffer backing, int offset) { 3997 super(backing, offset, 8); 3998 init(); 3999 } 4000 protected MaxGridSize(long nativeObj, boolean owned) { 4001 super(nativeObj, owned, 8); 4002 init(); 4003 } 4004 protected void setBuffer(ByteBuffer backing, int offset) { 4005 super.setBuffer(backing, offset, 8); 4006 } 4007 public void read() { 4008 xMax = backing.getInt(0); 4009 yMax = backing.getInt(4); 4010 } 4011 public void write() { 4012 backing.putInt(0, xMax); 4013 backing.putInt(4, yMax); 4014 } 4015 public int size() { 4016 return 8; 4017 } 4018 } 4019 4020 public static class ImageSize extends DisposedStruct { 4021 public int xRes; // X resolution of the image. 4022 public int yRes; // Y resolution of the image. 4023 4024 private void init() { 4025 4026 } 4027 public ImageSize() { 4028 super(8); 4029 init(); 4030 } 4031 public ImageSize(int xRes, int yRes) { 4032 super(8); 4033 this.xRes = xRes; 4034 this.yRes = yRes; 4035 } 4036 protected ImageSize(ByteBuffer backing, int offset) { 4037 super(backing, offset, 8); 4038 init(); 4039 } 4040 protected ImageSize(long nativeObj, boolean owned) { 4041 super(nativeObj, owned, 8); 4042 init(); 4043 } 4044 protected void setBuffer(ByteBuffer backing, int offset) { 4045 super.setBuffer(backing, offset, 8); 4046 } 4047 public void read() { 4048 xRes = backing.getInt(0); 4049 yRes = backing.getInt(4); 4050 } 4051 public void write() { 4052 backing.putInt(0, xRes); 4053 backing.putInt(4, yRes); 4054 } 4055 public int size() { 4056 return 8; 4057 } 4058 } 4059 4060 public static class CalibrationReferencePoints extends DisposedStruct { 4061 public PointDouble[] pixelCoords; // Specifies the coordinates of the pixel reference points. 4062 public PointDouble[] realCoords; // Specifies the measuring unit associated with the image. 4063 public CalibrationUnit units; // Specifies the units of X Step and Y Step. 4064 public ImageSize imageSize; // Specifies the size of calibration template image. 4065 private ByteBuffer pixelCoords_buf; 4066 private ByteBuffer realCoords_buf; 4067 4068 private void init() { 4069 pixelCoords = new PointDouble[0]; 4070 realCoords = new PointDouble[0]; 4071 imageSize = new ImageSize(backing, 20); 4072 } 4073 public CalibrationReferencePoints() { 4074 super(28); 4075 init(); 4076 } 4077 public CalibrationReferencePoints(PointDouble[] pixelCoords, PointDouble[] realCoords, CalibrationUnit units, ImageSize imageSize) { 4078 super(28); 4079 this.pixelCoords = pixelCoords; 4080 this.realCoords = realCoords; 4081 this.units = units; 4082 this.imageSize = imageSize; 4083 } 4084 protected CalibrationReferencePoints(ByteBuffer backing, int offset) { 4085 super(backing, offset, 28); 4086 init(); 4087 } 4088 protected CalibrationReferencePoints(long nativeObj, boolean owned) { 4089 super(nativeObj, owned, 28); 4090 init(); 4091 } 4092 protected void setBuffer(ByteBuffer backing, int offset) { 4093 super.setBuffer(backing, offset, 28); 4094 } 4095 public void read() { 4096 int pixelCoords_numPixelCoords = backing.getInt(4); 4097 long pixelCoords_addr = getPointer(backing, 0); 4098 pixelCoords = new PointDouble[pixelCoords_numPixelCoords]; 4099 if (pixelCoords_numPixelCoords > 0 && pixelCoords_addr != 0) { 4100 ByteBuffer bb = newDirectByteBuffer(pixelCoords_addr, pixelCoords_numPixelCoords*16); 4101 for (int i=0, off=0; i<pixelCoords_numPixelCoords; i++, off += 16) { 4102 pixelCoords[i] = new PointDouble(bb, off); 4103 pixelCoords[i].read(); 4104 } 4105 } 4106 int realCoords_numRealCoords = backing.getInt(12); 4107 long realCoords_addr = getPointer(backing, 8); 4108 realCoords = new PointDouble[realCoords_numRealCoords]; 4109 if (realCoords_numRealCoords > 0 && realCoords_addr != 0) { 4110 ByteBuffer bb = newDirectByteBuffer(realCoords_addr, realCoords_numRealCoords*16); 4111 for (int i=0, off=0; i<realCoords_numRealCoords; i++, off += 16) { 4112 realCoords[i] = new PointDouble(bb, off); 4113 realCoords[i].read(); 4114 } 4115 } 4116 units = CalibrationUnit.fromValue(backing.getInt(16)); 4117 imageSize.read(); 4118 } 4119 public void write() { 4120 pixelCoords_buf = ByteBuffer.allocateDirect(pixelCoords.length*16).order(ByteOrder.nativeOrder()); 4121 for (int i=0, off=0; i<pixelCoords.length; i++, off += 16) { 4122 pixelCoords[i].setBuffer(pixelCoords_buf, off); 4123 pixelCoords[i].write(); 4124 } 4125 backing.putInt(4, pixelCoords.length); 4126 putPointer(backing, 0, pixelCoords_buf); 4127 realCoords_buf = ByteBuffer.allocateDirect(realCoords.length*16).order(ByteOrder.nativeOrder()); 4128 for (int i=0, off=0; i<realCoords.length; i++, off += 16) { 4129 realCoords[i].setBuffer(realCoords_buf, off); 4130 realCoords[i].write(); 4131 } 4132 backing.putInt(12, realCoords.length); 4133 putPointer(backing, 8, realCoords_buf); 4134 if (units != null) 4135 backing.putInt(16, units.getValue()); 4136 imageSize.write(); 4137 } 4138 public int size() { 4139 return 28; 4140 } 4141 } 4142 4143 public static class GetCameraParametersReport extends DisposedStruct { 4144 public int projectionMatrixRows; // Number of rows in projection matrix. 4145 public int projectionMatrixCols; // Number of columns in projection matrix. 4146 public DistortionModelParams distortion; // Distortion model Coefficients. 4147 public InternalParameters internalParams; // The learned internal paramters of camera model such as focal length and optical center. 4148 4149 private void init() { 4150 distortion = new DistortionModelParams(backing, 12); 4151 internalParams = new InternalParameters(backing, 36); 4152 } 4153 public GetCameraParametersReport() { 4154 super(56); 4155 init(); 4156 } 4157 public GetCameraParametersReport(int projectionMatrixRows, int projectionMatrixCols, DistortionModelParams distortion, InternalParameters internalParams) { 4158 super(56); 4159 this.projectionMatrixRows = projectionMatrixRows; 4160 this.projectionMatrixCols = projectionMatrixCols; 4161 this.distortion = distortion; 4162 this.internalParams = internalParams; 4163 } 4164 protected GetCameraParametersReport(ByteBuffer backing, int offset) { 4165 super(backing, offset, 56); 4166 init(); 4167 } 4168 protected GetCameraParametersReport(long nativeObj, boolean owned) { 4169 super(nativeObj, owned, 56); 4170 init(); 4171 } 4172 protected void setBuffer(ByteBuffer backing, int offset) { 4173 super.setBuffer(backing, offset, 56); 4174 } 4175 public void read() { 4176 projectionMatrixRows = backing.getInt(4); 4177 projectionMatrixCols = backing.getInt(8); 4178 distortion.read(); 4179 internalParams.read(); 4180 } 4181 public void write() { 4182 backing.putInt(4, projectionMatrixRows); 4183 backing.putInt(8, projectionMatrixCols); 4184 distortion.write(); 4185 internalParams.write(); 4186 } 4187 public int size() { 4188 return 56; 4189 } 4190 } 4191 4192 public static class CalibrationAxisInfo extends DisposedStruct { 4193 public PointFloat center; // The origin of the reference coordinate system, expressed in pixel units. 4194 public float rotationAngle; // The angle of the x-axis of the real-world coordinate system, in relation to the horizontal. 4195 public AxisOrientation axisDirection; // Specifies the direction of the calibraiton axis which is either Direct or Indirect. 4196 4197 private void init() { 4198 center = new PointFloat(backing, 0); 4199 } 4200 public CalibrationAxisInfo() { 4201 super(16); 4202 init(); 4203 } 4204 public CalibrationAxisInfo(PointFloat center, double rotationAngle, AxisOrientation axisDirection) { 4205 super(16); 4206 this.center = center; 4207 this.rotationAngle = (float)rotationAngle; 4208 this.axisDirection = axisDirection; 4209 } 4210 protected CalibrationAxisInfo(ByteBuffer backing, int offset) { 4211 super(backing, offset, 16); 4212 init(); 4213 } 4214 protected CalibrationAxisInfo(long nativeObj, boolean owned) { 4215 super(nativeObj, owned, 16); 4216 init(); 4217 } 4218 protected void setBuffer(ByteBuffer backing, int offset) { 4219 super.setBuffer(backing, offset, 16); 4220 } 4221 public void read() { 4222 center.read(); 4223 rotationAngle = backing.getFloat(8); 4224 axisDirection = AxisOrientation.fromValue(backing.getInt(12)); 4225 } 4226 public void write() { 4227 center.write(); 4228 backing.putFloat(8, rotationAngle); 4229 if (axisDirection != null) 4230 backing.putInt(12, axisDirection.getValue()); 4231 } 4232 public int size() { 4233 return 16; 4234 } 4235 } 4236 4237 public static class CalibrationLearnSetupInfo extends DisposedStruct { 4238 public CalibrationMode2 calibrationMethod; // Type of calibration method used. 4239 public DistortionModel distortionModel; // Type of learned distortion model. 4240 public ScalingMethod scaleMode; // The aspect scaling to use when correcting an image. 4241 public CalibrationROI roiMode; // The ROI to use when correcting an image. 4242 public byte learnCorrectionTable; // Set this input to true value if you want the correction table to be determined and stored. 4243 4244 private void init() { 4245 4246 } 4247 public CalibrationLearnSetupInfo() { 4248 super(20); 4249 init(); 4250 } 4251 public CalibrationLearnSetupInfo(CalibrationMode2 calibrationMethod, DistortionModel distortionModel, ScalingMethod scaleMode, CalibrationROI roiMode, byte learnCorrectionTable) { 4252 super(20); 4253 this.calibrationMethod = calibrationMethod; 4254 this.distortionModel = distortionModel; 4255 this.scaleMode = scaleMode; 4256 this.roiMode = roiMode; 4257 this.learnCorrectionTable = learnCorrectionTable; 4258 } 4259 protected CalibrationLearnSetupInfo(ByteBuffer backing, int offset) { 4260 super(backing, offset, 20); 4261 init(); 4262 } 4263 protected CalibrationLearnSetupInfo(long nativeObj, boolean owned) { 4264 super(nativeObj, owned, 20); 4265 init(); 4266 } 4267 protected void setBuffer(ByteBuffer backing, int offset) { 4268 super.setBuffer(backing, offset, 20); 4269 } 4270 public void read() { 4271 calibrationMethod = CalibrationMode2.fromValue(backing.getInt(0)); 4272 distortionModel = DistortionModel.fromValue(backing.getInt(4)); 4273 scaleMode = ScalingMethod.fromValue(backing.getInt(8)); 4274 roiMode = CalibrationROI.fromValue(backing.getInt(12)); 4275 learnCorrectionTable = backing.get(16); 4276 } 4277 public void write() { 4278 if (calibrationMethod != null) 4279 backing.putInt(0, calibrationMethod.getValue()); 4280 if (distortionModel != null) 4281 backing.putInt(4, distortionModel.getValue()); 4282 if (scaleMode != null) 4283 backing.putInt(8, scaleMode.getValue()); 4284 if (roiMode != null) 4285 backing.putInt(12, roiMode.getValue()); 4286 backing.put(16, learnCorrectionTable); 4287 } 4288 public int size() { 4289 return 20; 4290 } 4291 } 4292 4293 public static class GridDescriptor extends DisposedStruct { 4294 public float xStep; // The distance in the x direction between two adjacent pixels in units specified by unit. 4295 public float yStep; // The distance in the y direction between two adjacent pixels in units specified by unit. 4296 public CalibrationUnit unit; // The unit of measure for the image. 4297 4298 private void init() { 4299 4300 } 4301 public GridDescriptor() { 4302 super(12); 4303 init(); 4304 } 4305 public GridDescriptor(double xStep, double yStep, CalibrationUnit unit) { 4306 super(12); 4307 this.xStep = (float)xStep; 4308 this.yStep = (float)yStep; 4309 this.unit = unit; 4310 } 4311 protected GridDescriptor(ByteBuffer backing, int offset) { 4312 super(backing, offset, 12); 4313 init(); 4314 } 4315 protected GridDescriptor(long nativeObj, boolean owned) { 4316 super(nativeObj, owned, 12); 4317 init(); 4318 } 4319 protected void setBuffer(ByteBuffer backing, int offset) { 4320 super.setBuffer(backing, offset, 12); 4321 } 4322 public void read() { 4323 xStep = backing.getFloat(0); 4324 yStep = backing.getFloat(4); 4325 unit = CalibrationUnit.fromValue(backing.getInt(8)); 4326 } 4327 public void write() { 4328 backing.putFloat(0, xStep); 4329 backing.putFloat(4, yStep); 4330 if (unit != null) 4331 backing.putInt(8, unit.getValue()); 4332 } 4333 public int size() { 4334 return 12; 4335 } 4336 } 4337 4338 public static class ErrorStatistics extends DisposedStruct { 4339 public double mean; // Mean error statistics value. 4340 public double maximum; // Maximum value of error. 4341 public double standardDeviation; // The standard deviation error statistiscs value. 4342 public double distortion; // The distortion error statistics value. 4343 4344 private void init() { 4345 4346 } 4347 public ErrorStatistics() { 4348 super(32); 4349 init(); 4350 } 4351 public ErrorStatistics(double mean, double maximum, double standardDeviation, double distortion) { 4352 super(32); 4353 this.mean = mean; 4354 this.maximum = maximum; 4355 this.standardDeviation = standardDeviation; 4356 this.distortion = distortion; 4357 } 4358 protected ErrorStatistics(ByteBuffer backing, int offset) { 4359 super(backing, offset, 32); 4360 init(); 4361 } 4362 protected ErrorStatistics(long nativeObj, boolean owned) { 4363 super(nativeObj, owned, 32); 4364 init(); 4365 } 4366 protected void setBuffer(ByteBuffer backing, int offset) { 4367 super.setBuffer(backing, offset, 32); 4368 } 4369 public void read() { 4370 mean = backing.getDouble(0); 4371 maximum = backing.getDouble(8); 4372 standardDeviation = backing.getDouble(16); 4373 distortion = backing.getDouble(24); 4374 } 4375 public void write() { 4376 backing.putDouble(0, mean); 4377 backing.putDouble(8, maximum); 4378 backing.putDouble(16, standardDeviation); 4379 backing.putDouble(24, distortion); 4380 } 4381 public int size() { 4382 return 32; 4383 } 4384 } 4385 4386 public static class GetCalibrationInfoReport extends DisposedStruct { 4387 public ROI userRoi; // Specifies the ROI the user provided when learning the calibration. 4388 public ROI calibrationRoi; // Specifies the ROI that corresponds to the region of the image where the calibration information is accurate. 4389 public CalibrationAxisInfo axisInfo; // Reference Coordinate System for the real-world coordinates. 4390 public CalibrationLearnSetupInfo learnSetupInfo; // Calibration learn setup information. 4391 public GridDescriptor gridDescriptor; // Specifies scaling constants used to calibrate the image. 4392 public int errorMapRows; // Number of rows in error map. 4393 public int errorMapCols; // Number of Columns in error map. 4394 public ErrorStatistics errorStatistics; // Error statistics of the calibration. 4395 4396 private void init() { 4397 axisInfo = new CalibrationAxisInfo(backing, 8); 4398 learnSetupInfo = new CalibrationLearnSetupInfo(backing, 24); 4399 gridDescriptor = new GridDescriptor(backing, 44); 4400 errorStatistics = new ErrorStatistics(backing, 72); 4401 } 4402 public GetCalibrationInfoReport() { 4403 super(104); 4404 init(); 4405 } 4406 public GetCalibrationInfoReport(ROI userRoi, ROI calibrationRoi, CalibrationAxisInfo axisInfo, CalibrationLearnSetupInfo learnSetupInfo, GridDescriptor gridDescriptor, int errorMapRows, int errorMapCols, ErrorStatistics errorStatistics) { 4407 super(104); 4408 this.userRoi = userRoi; 4409 this.calibrationRoi = calibrationRoi; 4410 this.axisInfo = axisInfo; 4411 this.learnSetupInfo = learnSetupInfo; 4412 this.gridDescriptor = gridDescriptor; 4413 this.errorMapRows = errorMapRows; 4414 this.errorMapCols = errorMapCols; 4415 this.errorStatistics = errorStatistics; 4416 } 4417 protected GetCalibrationInfoReport(ByteBuffer backing, int offset) { 4418 super(backing, offset, 104); 4419 init(); 4420 } 4421 protected GetCalibrationInfoReport(long nativeObj, boolean owned) { 4422 super(nativeObj, owned, 104); 4423 init(); 4424 } 4425 protected void setBuffer(ByteBuffer backing, int offset) { 4426 super.setBuffer(backing, offset, 104); 4427 } 4428 public void read() { 4429 long userRoi_addr = getPointer(backing, 0); 4430 if (userRoi_addr == 0) 4431 userRoi = null; 4432 else 4433 userRoi = new ROI(userRoi_addr, false); 4434 long calibrationRoi_addr = getPointer(backing, 4); 4435 if (calibrationRoi_addr == 0) 4436 calibrationRoi = null; 4437 else 4438 calibrationRoi = new ROI(calibrationRoi_addr, false); 4439 axisInfo.read(); 4440 learnSetupInfo.read(); 4441 gridDescriptor.read(); 4442 errorMapRows = backing.getInt(60); 4443 errorMapCols = backing.getInt(64); 4444 errorStatistics.read(); 4445 } 4446 public void write() { 4447 putPointer(backing, 0, userRoi); 4448 putPointer(backing, 4, calibrationRoi); 4449 axisInfo.write(); 4450 learnSetupInfo.write(); 4451 gridDescriptor.write(); 4452 backing.putInt(60, errorMapRows); 4453 backing.putInt(64, errorMapCols); 4454 errorStatistics.write(); 4455 } 4456 public int size() { 4457 return 104; 4458 } 4459 } 4460 4461 public static class EdgePolarity extends DisposedStruct { 4462 public EdgePolaritySearchMode start; 4463 public EdgePolaritySearchMode end; 4464 4465 private void init() { 4466 4467 } 4468 public EdgePolarity() { 4469 super(8); 4470 init(); 4471 } 4472 public EdgePolarity(EdgePolaritySearchMode start, EdgePolaritySearchMode end) { 4473 super(8); 4474 this.start = start; 4475 this.end = end; 4476 } 4477 protected EdgePolarity(ByteBuffer backing, int offset) { 4478 super(backing, offset, 8); 4479 init(); 4480 } 4481 protected EdgePolarity(long nativeObj, boolean owned) { 4482 super(nativeObj, owned, 8); 4483 init(); 4484 } 4485 protected void setBuffer(ByteBuffer backing, int offset) { 4486 super.setBuffer(backing, offset, 8); 4487 } 4488 public void read() { 4489 start = EdgePolaritySearchMode.fromValue(backing.getInt(0)); 4490 end = EdgePolaritySearchMode.fromValue(backing.getInt(4)); 4491 } 4492 public void write() { 4493 if (start != null) 4494 backing.putInt(0, start.getValue()); 4495 if (end != null) 4496 backing.putInt(4, end.getValue()); 4497 } 4498 public int size() { 4499 return 8; 4500 } 4501 } 4502 4503 public static class ClampSettings extends DisposedStruct { 4504 public double angleRange; // Specifies the angle range. 4505 public EdgePolarity edgePolarity; // Specifies the edge polarity. 4506 4507 private void init() { 4508 edgePolarity = new EdgePolarity(backing, 8); 4509 } 4510 public ClampSettings() { 4511 super(16); 4512 init(); 4513 } 4514 public ClampSettings(double angleRange, EdgePolarity edgePolarity) { 4515 super(16); 4516 this.angleRange = angleRange; 4517 this.edgePolarity = edgePolarity; 4518 } 4519 protected ClampSettings(ByteBuffer backing, int offset) { 4520 super(backing, offset, 16); 4521 init(); 4522 } 4523 protected ClampSettings(long nativeObj, boolean owned) { 4524 super(nativeObj, owned, 16); 4525 init(); 4526 } 4527 protected void setBuffer(ByteBuffer backing, int offset) { 4528 super.setBuffer(backing, offset, 16); 4529 } 4530 public void read() { 4531 angleRange = backing.getDouble(0); 4532 edgePolarity.read(); 4533 } 4534 public void write() { 4535 backing.putDouble(0, angleRange); 4536 edgePolarity.write(); 4537 } 4538 public int size() { 4539 return 16; 4540 } 4541 } 4542 4543 public static class PointDouble extends DisposedStruct { 4544 public double x; // The x-coordinate of the point. 4545 public double y; // The y-coordinate of the point. 4546 4547 private void init() { 4548 4549 } 4550 public PointDouble() { 4551 super(16); 4552 init(); 4553 } 4554 public PointDouble(double x, double y) { 4555 super(16); 4556 this.x = x; 4557 this.y = y; 4558 } 4559 protected PointDouble(ByteBuffer backing, int offset) { 4560 super(backing, offset, 16); 4561 init(); 4562 } 4563 protected PointDouble(long nativeObj, boolean owned) { 4564 super(nativeObj, owned, 16); 4565 init(); 4566 } 4567 protected void setBuffer(ByteBuffer backing, int offset) { 4568 super.setBuffer(backing, offset, 16); 4569 } 4570 public void read() { 4571 x = backing.getDouble(0); 4572 y = backing.getDouble(8); 4573 } 4574 public void write() { 4575 backing.putDouble(0, x); 4576 backing.putDouble(8, y); 4577 } 4578 public int size() { 4579 return 16; 4580 } 4581 } 4582 4583 public static class PointDoublePair extends DisposedStruct { 4584 public PointDouble start; // The Start co-ordinate of the pair. 4585 public PointDouble end; // The End co-ordinate of the pair. 4586 4587 private void init() { 4588 start = new PointDouble(backing, 0); 4589 end = new PointDouble(backing, 16); 4590 } 4591 public PointDoublePair() { 4592 super(32); 4593 init(); 4594 } 4595 public PointDoublePair(PointDouble start, PointDouble end) { 4596 super(32); 4597 this.start = start; 4598 this.end = end; 4599 } 4600 protected PointDoublePair(ByteBuffer backing, int offset) { 4601 super(backing, offset, 32); 4602 init(); 4603 } 4604 protected PointDoublePair(long nativeObj, boolean owned) { 4605 super(nativeObj, owned, 32); 4606 init(); 4607 } 4608 protected void setBuffer(ByteBuffer backing, int offset) { 4609 super.setBuffer(backing, offset, 32); 4610 } 4611 public void read() { 4612 start.read(); 4613 end.read(); 4614 } 4615 public void write() { 4616 start.write(); 4617 end.write(); 4618 } 4619 public int size() { 4620 return 32; 4621 } 4622 } 4623 4624 public static class ClampResults extends DisposedStruct { 4625 public double distancePix; // Defines the Pixel world distance. 4626 public double distanceRealWorld; // Defines the real world distance. 4627 public double angleAbs; // Defines the absolute angle. 4628 public double angleRelative; // Defines the relative angle. 4629 4630 private void init() { 4631 4632 } 4633 public ClampResults() { 4634 super(32); 4635 init(); 4636 } 4637 public ClampResults(double distancePix, double distanceRealWorld, double angleAbs, double angleRelative) { 4638 super(32); 4639 this.distancePix = distancePix; 4640 this.distanceRealWorld = distanceRealWorld; 4641 this.angleAbs = angleAbs; 4642 this.angleRelative = angleRelative; 4643 } 4644 protected ClampResults(ByteBuffer backing, int offset) { 4645 super(backing, offset, 32); 4646 init(); 4647 } 4648 protected ClampResults(long nativeObj, boolean owned) { 4649 super(nativeObj, owned, 32); 4650 init(); 4651 } 4652 protected void setBuffer(ByteBuffer backing, int offset) { 4653 super.setBuffer(backing, offset, 32); 4654 } 4655 public void read() { 4656 distancePix = backing.getDouble(0); 4657 distanceRealWorld = backing.getDouble(8); 4658 angleAbs = backing.getDouble(16); 4659 angleRelative = backing.getDouble(24); 4660 } 4661 public void write() { 4662 backing.putDouble(0, distancePix); 4663 backing.putDouble(8, distanceRealWorld); 4664 backing.putDouble(16, angleAbs); 4665 backing.putDouble(24, angleRelative); 4666 } 4667 public int size() { 4668 return 32; 4669 } 4670 } 4671 4672 public static class ClampPoints extends DisposedStruct { 4673 public PointDoublePair pixel; // Specifies the pixel world point pair for clamp. 4674 public PointDoublePair realWorld; // Specifies the real world point pair for clamp. 4675 4676 private void init() { 4677 pixel = new PointDoublePair(backing, 0); 4678 realWorld = new PointDoublePair(backing, 32); 4679 } 4680 public ClampPoints() { 4681 super(64); 4682 init(); 4683 } 4684 public ClampPoints(PointDoublePair pixel, PointDoublePair realWorld) { 4685 super(64); 4686 this.pixel = pixel; 4687 this.realWorld = realWorld; 4688 } 4689 protected ClampPoints(ByteBuffer backing, int offset) { 4690 super(backing, offset, 64); 4691 init(); 4692 } 4693 protected ClampPoints(long nativeObj, boolean owned) { 4694 super(nativeObj, owned, 64); 4695 init(); 4696 } 4697 protected void setBuffer(ByteBuffer backing, int offset) { 4698 super.setBuffer(backing, offset, 64); 4699 } 4700 public void read() { 4701 pixel.read(); 4702 realWorld.read(); 4703 } 4704 public void write() { 4705 pixel.write(); 4706 realWorld.write(); 4707 } 4708 public int size() { 4709 return 64; 4710 } 4711 } 4712 4713 public static class RGBValue extends DisposedStruct { 4714 public short B; // The blue value of the color. 4715 public short G; // The green value of the color. 4716 public short R; // The red value of the color. 4717 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 4718 4719 private void init() { 4720 4721 } 4722 public RGBValue() { 4723 super(4); 4724 init(); 4725 } 4726 public RGBValue(int B, int G, int R, int alpha) { 4727 super(4); 4728 this.B = (short)B; 4729 this.G = (short)G; 4730 this.R = (short)R; 4731 this.alpha = (short)alpha; 4732 } 4733 protected RGBValue(ByteBuffer backing, int offset) { 4734 super(backing, offset, 4); 4735 init(); 4736 } 4737 protected RGBValue(long nativeObj, boolean owned) { 4738 super(nativeObj, owned, 4); 4739 init(); 4740 } 4741 protected void setBuffer(ByteBuffer backing, int offset) { 4742 super.setBuffer(backing, offset, 4); 4743 } 4744 public void read() { 4745 B = (short)(backing.get(0) & 0xff); 4746 G = (short)(backing.get(1) & 0xff); 4747 R = (short)(backing.get(2) & 0xff); 4748 alpha = (short)(backing.get(3) & 0xff); 4749 } 4750 public void write() { 4751 backing.put(0, (byte)(B & 0xff)); 4752 backing.put(1, (byte)(G & 0xff)); 4753 backing.put(2, (byte)(R & 0xff)); 4754 backing.put(3, (byte)(alpha & 0xff)); 4755 } 4756 public int size() { 4757 return 4; 4758 } 4759 } 4760 4761 public static class ClampOverlaySettings extends DisposedStruct { 4762 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 4763 public int showCurves; // If TRUE, the function overlays the curves on the image. 4764 public int showClampLocation; // If TRUE, the function overlays the clamp location on the image. 4765 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 4766 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 4767 public RGBValue curvesColor; // Specifies the RGB color value to use to overlay the curves. 4768 public RGBValue clampLocationsColor; // Specifies the RGB color value to use to overlay the clamp locations. 4769 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 4770 public String overlayGroupName; // Specifies the group overlay name for the step overlays. 4771 private ByteBuffer overlayGroupName_buf; 4772 4773 private void init() { 4774 searchAreaColor = new RGBValue(backing, 16); 4775 curvesColor = new RGBValue(backing, 20); 4776 clampLocationsColor = new RGBValue(backing, 24); 4777 resultColor = new RGBValue(backing, 28); 4778 } 4779 public ClampOverlaySettings() { 4780 super(36); 4781 init(); 4782 } 4783 public ClampOverlaySettings(int showSearchArea, int showCurves, int showClampLocation, int showResult, RGBValue searchAreaColor, RGBValue curvesColor, RGBValue clampLocationsColor, RGBValue resultColor, String overlayGroupName) { 4784 super(36); 4785 this.showSearchArea = showSearchArea; 4786 this.showCurves = showCurves; 4787 this.showClampLocation = showClampLocation; 4788 this.showResult = showResult; 4789 this.searchAreaColor = searchAreaColor; 4790 this.curvesColor = curvesColor; 4791 this.clampLocationsColor = clampLocationsColor; 4792 this.resultColor = resultColor; 4793 this.overlayGroupName = overlayGroupName; 4794 } 4795 protected ClampOverlaySettings(ByteBuffer backing, int offset) { 4796 super(backing, offset, 36); 4797 init(); 4798 } 4799 protected ClampOverlaySettings(long nativeObj, boolean owned) { 4800 super(nativeObj, owned, 36); 4801 init(); 4802 } 4803 protected void setBuffer(ByteBuffer backing, int offset) { 4804 super.setBuffer(backing, offset, 36); 4805 } 4806 public void read() { 4807 showSearchArea = backing.getInt(0); 4808 showCurves = backing.getInt(4); 4809 showClampLocation = backing.getInt(8); 4810 showResult = backing.getInt(12); 4811 searchAreaColor.read(); 4812 curvesColor.read(); 4813 clampLocationsColor.read(); 4814 resultColor.read(); 4815 long overlayGroupName_addr = getPointer(backing, 32); 4816 if (overlayGroupName_addr == 0) 4817 overlayGroupName = null; 4818 else { 4819 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 4820 while (bb.get() != 0) {} 4821 byte[] bytes = new byte[bb.position()-1]; 4822 getBytes(bb, bytes, 0, bytes.length); 4823 try { 4824 overlayGroupName = new String(bytes, "UTF-8"); 4825 } catch (UnsupportedEncodingException e) { 4826 overlayGroupName = ""; 4827 } 4828 } 4829 4830 } 4831 public void write() { 4832 backing.putInt(0, showSearchArea); 4833 backing.putInt(4, showCurves); 4834 backing.putInt(8, showClampLocation); 4835 backing.putInt(12, showResult); 4836 searchAreaColor.write(); 4837 curvesColor.write(); 4838 clampLocationsColor.write(); 4839 resultColor.write(); 4840 if (overlayGroupName != null) { 4841 byte[] overlayGroupName_bytes; 4842 try { 4843 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 4844 } catch (UnsupportedEncodingException e) { 4845 overlayGroupName_bytes = new byte[0]; 4846 } 4847 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 4848 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 4849 } 4850 putPointer(backing, 32, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 4851 } 4852 public int size() { 4853 return 36; 4854 } 4855 } 4856 4857 public static class ClampMax2Report extends DisposedStruct { 4858 public ClampResults clampResults; // Specifies the Clamp results information returned by the function. 4859 public ClampPoints clampPoints; // Specifies the clamp points information returned by the function. 4860 public int calibrationValid; // Specifies if the calibration information is valid or not. 4861 4862 private void init() { 4863 clampResults = new ClampResults(backing, 0); 4864 clampPoints = new ClampPoints(backing, 32); 4865 } 4866 public ClampMax2Report() { 4867 super(104); 4868 init(); 4869 } 4870 public ClampMax2Report(ClampResults clampResults, ClampPoints clampPoints, int calibrationValid) { 4871 super(104); 4872 this.clampResults = clampResults; 4873 this.clampPoints = clampPoints; 4874 this.calibrationValid = calibrationValid; 4875 } 4876 protected ClampMax2Report(ByteBuffer backing, int offset) { 4877 super(backing, offset, 104); 4878 init(); 4879 } 4880 protected ClampMax2Report(long nativeObj, boolean owned) { 4881 super(nativeObj, owned, 104); 4882 init(); 4883 } 4884 protected void setBuffer(ByteBuffer backing, int offset) { 4885 super.setBuffer(backing, offset, 104); 4886 } 4887 public void read() { 4888 clampResults.read(); 4889 clampPoints.read(); 4890 calibrationValid = backing.getInt(96); 4891 } 4892 public void write() { 4893 clampResults.write(); 4894 clampPoints.write(); 4895 backing.putInt(96, calibrationValid); 4896 } 4897 public int size() { 4898 return 104; 4899 } 4900 } 4901 4902 public static class ContourFitSplineReport extends DisposedStruct { 4903 public PointDouble[] points; // It returns the points of the best-fit B-spline curve. 4904 private ByteBuffer points_buf; 4905 4906 private void init() { 4907 points = new PointDouble[0]; 4908 } 4909 public ContourFitSplineReport() { 4910 super(8); 4911 init(); 4912 } 4913 public ContourFitSplineReport(PointDouble[] points) { 4914 super(8); 4915 this.points = points; 4916 } 4917 protected ContourFitSplineReport(ByteBuffer backing, int offset) { 4918 super(backing, offset, 8); 4919 init(); 4920 } 4921 protected ContourFitSplineReport(long nativeObj, boolean owned) { 4922 super(nativeObj, owned, 8); 4923 init(); 4924 } 4925 protected void setBuffer(ByteBuffer backing, int offset) { 4926 super.setBuffer(backing, offset, 8); 4927 } 4928 public void read() { 4929 int points_numberOfPoints = backing.getInt(4); 4930 long points_addr = getPointer(backing, 0); 4931 points = new PointDouble[points_numberOfPoints]; 4932 if (points_numberOfPoints > 0 && points_addr != 0) { 4933 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numberOfPoints*16); 4934 for (int i=0, off=0; i<points_numberOfPoints; i++, off += 16) { 4935 points[i] = new PointDouble(bb, off); 4936 points[i].read(); 4937 } 4938 } 4939 } 4940 public void write() { 4941 points_buf = ByteBuffer.allocateDirect(points.length*16).order(ByteOrder.nativeOrder()); 4942 for (int i=0, off=0; i<points.length; i++, off += 16) { 4943 points[i].setBuffer(points_buf, off); 4944 points[i].write(); 4945 } 4946 backing.putInt(4, points.length); 4947 putPointer(backing, 0, points_buf); 4948 } 4949 public int size() { 4950 return 8; 4951 } 4952 } 4953 4954 public static class LineFloat extends DisposedStruct { 4955 public PointFloat start; // The coordinate location of the start of the line. 4956 public PointFloat end; // The coordinate location of the end of the line. 4957 4958 private void init() { 4959 start = new PointFloat(backing, 0); 4960 end = new PointFloat(backing, 8); 4961 } 4962 public LineFloat() { 4963 super(16); 4964 init(); 4965 } 4966 public LineFloat(PointFloat start, PointFloat end) { 4967 super(16); 4968 this.start = start; 4969 this.end = end; 4970 } 4971 protected LineFloat(ByteBuffer backing, int offset) { 4972 super(backing, offset, 16); 4973 init(); 4974 } 4975 protected LineFloat(long nativeObj, boolean owned) { 4976 super(nativeObj, owned, 16); 4977 init(); 4978 } 4979 protected void setBuffer(ByteBuffer backing, int offset) { 4980 super.setBuffer(backing, offset, 16); 4981 } 4982 public void read() { 4983 start.read(); 4984 end.read(); 4985 } 4986 public void write() { 4987 start.write(); 4988 end.write(); 4989 } 4990 public int size() { 4991 return 16; 4992 } 4993 } 4994 4995 public static class LineEquation extends DisposedStruct { 4996 public double a; // The a coefficient of the line equation. 4997 public double b; // The b coefficient of the line equation. 4998 public double c; // The c coefficient of the line equation. 4999 5000 private void init() { 5001 5002 } 5003 public LineEquation() { 5004 super(24); 5005 init(); 5006 } 5007 public LineEquation(double a, double b, double c) { 5008 super(24); 5009 this.a = a; 5010 this.b = b; 5011 this.c = c; 5012 } 5013 protected LineEquation(ByteBuffer backing, int offset) { 5014 super(backing, offset, 24); 5015 init(); 5016 } 5017 protected LineEquation(long nativeObj, boolean owned) { 5018 super(nativeObj, owned, 24); 5019 init(); 5020 } 5021 protected void setBuffer(ByteBuffer backing, int offset) { 5022 super.setBuffer(backing, offset, 24); 5023 } 5024 public void read() { 5025 a = backing.getDouble(0); 5026 b = backing.getDouble(8); 5027 c = backing.getDouble(16); 5028 } 5029 public void write() { 5030 backing.putDouble(0, a); 5031 backing.putDouble(8, b); 5032 backing.putDouble(16, c); 5033 } 5034 public int size() { 5035 return 24; 5036 } 5037 } 5038 5039 public static class ContourFitLineReport extends DisposedStruct { 5040 public LineFloat lineSegment; // Line Segment represents the intersection of the line equation and the contour. 5041 public LineEquation lineEquation; // Line Equation is a structure of three coefficients A, B, and C of the equation in the normal form (Ax + By + C=0) of the best fit line. 5042 5043 private void init() { 5044 lineSegment = new LineFloat(backing, 0); 5045 lineEquation = new LineEquation(backing, 16); 5046 } 5047 public ContourFitLineReport() { 5048 super(40); 5049 init(); 5050 } 5051 public ContourFitLineReport(LineFloat lineSegment, LineEquation lineEquation) { 5052 super(40); 5053 this.lineSegment = lineSegment; 5054 this.lineEquation = lineEquation; 5055 } 5056 protected ContourFitLineReport(ByteBuffer backing, int offset) { 5057 super(backing, offset, 40); 5058 init(); 5059 } 5060 protected ContourFitLineReport(long nativeObj, boolean owned) { 5061 super(nativeObj, owned, 40); 5062 init(); 5063 } 5064 protected void setBuffer(ByteBuffer backing, int offset) { 5065 super.setBuffer(backing, offset, 40); 5066 } 5067 public void read() { 5068 lineSegment.read(); 5069 lineEquation.read(); 5070 } 5071 public void write() { 5072 lineSegment.write(); 5073 lineEquation.write(); 5074 } 5075 public int size() { 5076 return 40; 5077 } 5078 } 5079 5080 public static class ContourFitPolynomialReport extends DisposedStruct { 5081 public PointDouble[] bestFit; // It returns the points of the best-fit polynomial. 5082 public double[] polynomialCoefficients; // Polynomial Coefficients returns the coefficients of the polynomial equation. 5083 private ByteBuffer bestFit_buf; 5084 private ByteBuffer polynomialCoefficients_buf; 5085 5086 private void init() { 5087 bestFit = new PointDouble[0]; 5088 polynomialCoefficients = new double[0]; 5089 } 5090 public ContourFitPolynomialReport() { 5091 super(16); 5092 init(); 5093 } 5094 public ContourFitPolynomialReport(PointDouble[] bestFit, double[] polynomialCoefficients) { 5095 super(16); 5096 this.bestFit = bestFit; 5097 this.polynomialCoefficients = polynomialCoefficients; 5098 } 5099 protected ContourFitPolynomialReport(ByteBuffer backing, int offset) { 5100 super(backing, offset, 16); 5101 init(); 5102 } 5103 protected ContourFitPolynomialReport(long nativeObj, boolean owned) { 5104 super(nativeObj, owned, 16); 5105 init(); 5106 } 5107 protected void setBuffer(ByteBuffer backing, int offset) { 5108 super.setBuffer(backing, offset, 16); 5109 } 5110 public void read() { 5111 int bestFit_numberOfPoints = backing.getInt(4); 5112 long bestFit_addr = getPointer(backing, 0); 5113 bestFit = new PointDouble[bestFit_numberOfPoints]; 5114 if (bestFit_numberOfPoints > 0 && bestFit_addr != 0) { 5115 ByteBuffer bb = newDirectByteBuffer(bestFit_addr, bestFit_numberOfPoints*16); 5116 for (int i=0, off=0; i<bestFit_numberOfPoints; i++, off += 16) { 5117 bestFit[i] = new PointDouble(bb, off); 5118 bestFit[i].read(); 5119 } 5120 } 5121 int polynomialCoefficients_numberOfCoefficients = backing.getInt(12); 5122 long polynomialCoefficients_addr = getPointer(backing, 8); 5123 polynomialCoefficients = new double[polynomialCoefficients_numberOfCoefficients]; 5124 if (polynomialCoefficients_numberOfCoefficients > 0 && polynomialCoefficients_addr != 0) { 5125 newDirectByteBuffer(polynomialCoefficients_addr, polynomialCoefficients_numberOfCoefficients*8).asDoubleBuffer().get(polynomialCoefficients); 5126 } 5127 } 5128 public void write() { 5129 bestFit_buf = ByteBuffer.allocateDirect(bestFit.length*16).order(ByteOrder.nativeOrder()); 5130 for (int i=0, off=0; i<bestFit.length; i++, off += 16) { 5131 bestFit[i].setBuffer(bestFit_buf, off); 5132 bestFit[i].write(); 5133 } 5134 backing.putInt(4, bestFit.length); 5135 putPointer(backing, 0, bestFit_buf); 5136 polynomialCoefficients_buf = ByteBuffer.allocateDirect(polynomialCoefficients.length*8).order(ByteOrder.nativeOrder()); 5137 polynomialCoefficients_buf.asDoubleBuffer().put(polynomialCoefficients).rewind(); 5138 backing.putInt(12, polynomialCoefficients.length); 5139 putPointer(backing, 8, polynomialCoefficients_buf); 5140 } 5141 public int size() { 5142 return 16; 5143 } 5144 } 5145 5146 public static class PartialCircle extends DisposedStruct { 5147 public PointFloat center; // Center of the circle. 5148 public double radius; // Radius of the circle. 5149 public double startAngle; // Start angle of the fitted structure. 5150 public double endAngle; // End angle of the fitted structure. 5151 5152 private void init() { 5153 center = new PointFloat(backing, 0); 5154 } 5155 public PartialCircle() { 5156 super(32); 5157 init(); 5158 } 5159 public PartialCircle(PointFloat center, double radius, double startAngle, double endAngle) { 5160 super(32); 5161 this.center = center; 5162 this.radius = radius; 5163 this.startAngle = startAngle; 5164 this.endAngle = endAngle; 5165 } 5166 protected PartialCircle(ByteBuffer backing, int offset) { 5167 super(backing, offset, 32); 5168 init(); 5169 } 5170 protected PartialCircle(long nativeObj, boolean owned) { 5171 super(nativeObj, owned, 32); 5172 init(); 5173 } 5174 protected void setBuffer(ByteBuffer backing, int offset) { 5175 super.setBuffer(backing, offset, 32); 5176 } 5177 public void read() { 5178 center.read(); 5179 radius = backing.getDouble(8); 5180 startAngle = backing.getDouble(16); 5181 endAngle = backing.getDouble(24); 5182 } 5183 public void write() { 5184 center.write(); 5185 backing.putDouble(8, radius); 5186 backing.putDouble(16, startAngle); 5187 backing.putDouble(24, endAngle); 5188 } 5189 public int size() { 5190 return 32; 5191 } 5192 } 5193 5194 public static class PartialEllipse extends DisposedStruct { 5195 public PointFloat center; // Center of the Ellipse. 5196 public double angle; // Angle of the ellipse. 5197 public double majorRadius; // The length of the semi-major axis of the ellipse. 5198 public double minorRadius; // The length of the semi-minor axis of the ellipse. 5199 public double startAngle; // Start angle of the fitted structure. 5200 public double endAngle; // End angle of the fitted structure. 5201 5202 private void init() { 5203 center = new PointFloat(backing, 0); 5204 } 5205 public PartialEllipse() { 5206 super(48); 5207 init(); 5208 } 5209 public PartialEllipse(PointFloat center, double angle, double majorRadius, double minorRadius, double startAngle, double endAngle) { 5210 super(48); 5211 this.center = center; 5212 this.angle = angle; 5213 this.majorRadius = majorRadius; 5214 this.minorRadius = minorRadius; 5215 this.startAngle = startAngle; 5216 this.endAngle = endAngle; 5217 } 5218 protected PartialEllipse(ByteBuffer backing, int offset) { 5219 super(backing, offset, 48); 5220 init(); 5221 } 5222 protected PartialEllipse(long nativeObj, boolean owned) { 5223 super(nativeObj, owned, 48); 5224 init(); 5225 } 5226 protected void setBuffer(ByteBuffer backing, int offset) { 5227 super.setBuffer(backing, offset, 48); 5228 } 5229 public void read() { 5230 center.read(); 5231 angle = backing.getDouble(8); 5232 majorRadius = backing.getDouble(16); 5233 minorRadius = backing.getDouble(24); 5234 startAngle = backing.getDouble(32); 5235 endAngle = backing.getDouble(40); 5236 } 5237 public void write() { 5238 center.write(); 5239 backing.putDouble(8, angle); 5240 backing.putDouble(16, majorRadius); 5241 backing.putDouble(24, minorRadius); 5242 backing.putDouble(32, startAngle); 5243 backing.putDouble(40, endAngle); 5244 } 5245 public int size() { 5246 return 48; 5247 } 5248 } 5249 5250 public static class SetupMatchPatternData extends DisposedStruct { 5251 public byte[] matchSetupData; // String containing the match setup data. 5252 private ByteBuffer matchSetupData_buf; 5253 5254 private void init() { 5255 matchSetupData = new byte[0]; 5256 } 5257 public SetupMatchPatternData() { 5258 super(8); 5259 init(); 5260 } 5261 public SetupMatchPatternData(byte[] matchSetupData) { 5262 super(8); 5263 this.matchSetupData = matchSetupData; 5264 } 5265 protected SetupMatchPatternData(ByteBuffer backing, int offset) { 5266 super(backing, offset, 8); 5267 init(); 5268 } 5269 protected SetupMatchPatternData(long nativeObj, boolean owned) { 5270 super(nativeObj, owned, 8); 5271 init(); 5272 } 5273 protected void setBuffer(ByteBuffer backing, int offset) { 5274 super.setBuffer(backing, offset, 8); 5275 } 5276 public void read() { 5277 int matchSetupData_numMatchSetupData = backing.getInt(4); 5278 long matchSetupData_addr = getPointer(backing, 0); 5279 matchSetupData = new byte[matchSetupData_numMatchSetupData]; 5280 if (matchSetupData_numMatchSetupData > 0 && matchSetupData_addr != 0) { 5281 getBytes(newDirectByteBuffer(matchSetupData_addr, matchSetupData_numMatchSetupData), matchSetupData, 0, matchSetupData_numMatchSetupData); 5282 } 5283 } 5284 public void write() { 5285 matchSetupData_buf = ByteBuffer.allocateDirect(matchSetupData.length); 5286 putBytes(matchSetupData_buf, matchSetupData, 0, matchSetupData.length); 5287 backing.putInt(4, matchSetupData.length); 5288 putPointer(backing, 0, matchSetupData_buf); 5289 } 5290 public int size() { 5291 return 8; 5292 } 5293 } 5294 5295 public static class RangeSettingDouble extends DisposedStruct { 5296 public SettingType settingType; // Match Constraints specifies the match option whose values you want to constrain by the given range. 5297 public double min; // Min is the minimum value of the range for a given Match Constraint. 5298 public double max; // Max is the maximum value of the range for a given Match Constraint. 5299 5300 private void init() { 5301 5302 } 5303 public RangeSettingDouble() { 5304 super(24); 5305 init(); 5306 } 5307 public RangeSettingDouble(SettingType settingType, double min, double max) { 5308 super(24); 5309 this.settingType = settingType; 5310 this.min = min; 5311 this.max = max; 5312 } 5313 protected RangeSettingDouble(ByteBuffer backing, int offset) { 5314 super(backing, offset, 24); 5315 init(); 5316 } 5317 protected RangeSettingDouble(long nativeObj, boolean owned) { 5318 super(nativeObj, owned, 24); 5319 init(); 5320 } 5321 protected void setBuffer(ByteBuffer backing, int offset) { 5322 super.setBuffer(backing, offset, 24); 5323 } 5324 public void read() { 5325 settingType = SettingType.fromValue(backing.getInt(0)); 5326 min = backing.getDouble(8); 5327 max = backing.getDouble(16); 5328 } 5329 public void write() { 5330 if (settingType != null) 5331 backing.putInt(0, settingType.getValue()); 5332 backing.putDouble(8, min); 5333 backing.putDouble(16, max); 5334 } 5335 public int size() { 5336 return 24; 5337 } 5338 } 5339 5340 public static class GeometricAdvancedSetupDataOption extends DisposedStruct { 5341 public GeometricSetupDataItem type; // It determines the option you want to use during the matching phase. 5342 public double value; // Value is the value for the option you want to use during the matching phase. 5343 5344 private void init() { 5345 5346 } 5347 public GeometricAdvancedSetupDataOption() { 5348 super(16); 5349 init(); 5350 } 5351 public GeometricAdvancedSetupDataOption(GeometricSetupDataItem type, double value) { 5352 super(16); 5353 this.type = type; 5354 this.value = value; 5355 } 5356 protected GeometricAdvancedSetupDataOption(ByteBuffer backing, int offset) { 5357 super(backing, offset, 16); 5358 init(); 5359 } 5360 protected GeometricAdvancedSetupDataOption(long nativeObj, boolean owned) { 5361 super(nativeObj, owned, 16); 5362 init(); 5363 } 5364 protected void setBuffer(ByteBuffer backing, int offset) { 5365 super.setBuffer(backing, offset, 16); 5366 } 5367 public void read() { 5368 type = GeometricSetupDataItem.fromValue(backing.getInt(0)); 5369 value = backing.getDouble(8); 5370 } 5371 public void write() { 5372 if (type != null) 5373 backing.putInt(0, type.getValue()); 5374 backing.putDouble(8, value); 5375 } 5376 public int size() { 5377 return 16; 5378 } 5379 } 5380 5381 public static class ContourInfoReport extends DisposedStruct { 5382 public PointDouble[] pointsPixel; // Points (pixel) specifies the location of every point detected on the curve, in pixels. 5383 public PointDouble[] pointsReal; // Points (real) specifies the location of every point detected on the curve, in calibrated units. 5384 public double[] curvaturePixel; // Curvature Pixel displays the curvature profile for the selected contour, in pixels. 5385 public double[] curvatureReal; // Curvature Real displays the curvature profile for the selected contour, in calibrated units. 5386 public double length; // Length (pixel) specifies the length, in pixels, of the curves in the image. 5387 public double lengthReal; // Length (real) specifies the length, in calibrated units, of the curves within the curvature range. 5388 public int hasEquation; // Has Equation specifies whether the contour has a fitted equation. 5389 private ByteBuffer pointsPixel_buf; 5390 private ByteBuffer pointsReal_buf; 5391 private ByteBuffer curvaturePixel_buf; 5392 private ByteBuffer curvatureReal_buf; 5393 5394 private void init() { 5395 pointsPixel = new PointDouble[0]; 5396 pointsReal = new PointDouble[0]; 5397 curvaturePixel = new double[0]; 5398 curvatureReal = new double[0]; 5399 } 5400 public ContourInfoReport() { 5401 super(56); 5402 init(); 5403 } 5404 public ContourInfoReport(PointDouble[] pointsPixel, PointDouble[] pointsReal, double[] curvaturePixel, double[] curvatureReal, double length, double lengthReal, int hasEquation) { 5405 super(56); 5406 this.pointsPixel = pointsPixel; 5407 this.pointsReal = pointsReal; 5408 this.curvaturePixel = curvaturePixel; 5409 this.curvatureReal = curvatureReal; 5410 this.length = length; 5411 this.lengthReal = lengthReal; 5412 this.hasEquation = hasEquation; 5413 } 5414 protected ContourInfoReport(ByteBuffer backing, int offset) { 5415 super(backing, offset, 56); 5416 init(); 5417 } 5418 protected ContourInfoReport(long nativeObj, boolean owned) { 5419 super(nativeObj, owned, 56); 5420 init(); 5421 } 5422 protected void setBuffer(ByteBuffer backing, int offset) { 5423 super.setBuffer(backing, offset, 56); 5424 } 5425 public void read() { 5426 int pointsPixel_numPointsPixel = backing.getInt(4); 5427 long pointsPixel_addr = getPointer(backing, 0); 5428 pointsPixel = new PointDouble[pointsPixel_numPointsPixel]; 5429 if (pointsPixel_numPointsPixel > 0 && pointsPixel_addr != 0) { 5430 ByteBuffer bb = newDirectByteBuffer(pointsPixel_addr, pointsPixel_numPointsPixel*16); 5431 for (int i=0, off=0; i<pointsPixel_numPointsPixel; i++, off += 16) { 5432 pointsPixel[i] = new PointDouble(bb, off); 5433 pointsPixel[i].read(); 5434 } 5435 } 5436 int pointsReal_numPointsReal = backing.getInt(12); 5437 long pointsReal_addr = getPointer(backing, 8); 5438 pointsReal = new PointDouble[pointsReal_numPointsReal]; 5439 if (pointsReal_numPointsReal > 0 && pointsReal_addr != 0) { 5440 ByteBuffer bb = newDirectByteBuffer(pointsReal_addr, pointsReal_numPointsReal*16); 5441 for (int i=0, off=0; i<pointsReal_numPointsReal; i++, off += 16) { 5442 pointsReal[i] = new PointDouble(bb, off); 5443 pointsReal[i].read(); 5444 } 5445 } 5446 int curvaturePixel_numCurvaturePixel = backing.getInt(20); 5447 long curvaturePixel_addr = getPointer(backing, 16); 5448 curvaturePixel = new double[curvaturePixel_numCurvaturePixel]; 5449 if (curvaturePixel_numCurvaturePixel > 0 && curvaturePixel_addr != 0) { 5450 newDirectByteBuffer(curvaturePixel_addr, curvaturePixel_numCurvaturePixel*8).asDoubleBuffer().get(curvaturePixel); 5451 } 5452 int curvatureReal_numCurvatureReal = backing.getInt(28); 5453 long curvatureReal_addr = getPointer(backing, 24); 5454 curvatureReal = new double[curvatureReal_numCurvatureReal]; 5455 if (curvatureReal_numCurvatureReal > 0 && curvatureReal_addr != 0) { 5456 newDirectByteBuffer(curvatureReal_addr, curvatureReal_numCurvatureReal*8).asDoubleBuffer().get(curvatureReal); 5457 } 5458 length = backing.getDouble(32); 5459 lengthReal = backing.getDouble(40); 5460 hasEquation = backing.getInt(48); 5461 } 5462 public void write() { 5463 pointsPixel_buf = ByteBuffer.allocateDirect(pointsPixel.length*16).order(ByteOrder.nativeOrder()); 5464 for (int i=0, off=0; i<pointsPixel.length; i++, off += 16) { 5465 pointsPixel[i].setBuffer(pointsPixel_buf, off); 5466 pointsPixel[i].write(); 5467 } 5468 backing.putInt(4, pointsPixel.length); 5469 putPointer(backing, 0, pointsPixel_buf); 5470 pointsReal_buf = ByteBuffer.allocateDirect(pointsReal.length*16).order(ByteOrder.nativeOrder()); 5471 for (int i=0, off=0; i<pointsReal.length; i++, off += 16) { 5472 pointsReal[i].setBuffer(pointsReal_buf, off); 5473 pointsReal[i].write(); 5474 } 5475 backing.putInt(12, pointsReal.length); 5476 putPointer(backing, 8, pointsReal_buf); 5477 curvaturePixel_buf = ByteBuffer.allocateDirect(curvaturePixel.length*8).order(ByteOrder.nativeOrder()); 5478 curvaturePixel_buf.asDoubleBuffer().put(curvaturePixel).rewind(); 5479 backing.putInt(20, curvaturePixel.length); 5480 putPointer(backing, 16, curvaturePixel_buf); 5481 curvatureReal_buf = ByteBuffer.allocateDirect(curvatureReal.length*8).order(ByteOrder.nativeOrder()); 5482 curvatureReal_buf.asDoubleBuffer().put(curvatureReal).rewind(); 5483 backing.putInt(28, curvatureReal.length); 5484 putPointer(backing, 24, curvatureReal_buf); 5485 backing.putDouble(32, length); 5486 backing.putDouble(40, lengthReal); 5487 backing.putInt(48, hasEquation); 5488 } 5489 public int size() { 5490 return 56; 5491 } 5492 } 5493 5494 public static class ROILabel extends DisposedStruct { 5495 public String className; // Specifies the classname you want to segment. 5496 public int label; // Label is the label number associated with the Class Name. 5497 private ByteBuffer className_buf; 5498 5499 private void init() { 5500 5501 } 5502 public ROILabel() { 5503 super(8); 5504 init(); 5505 } 5506 public ROILabel(String className, int label) { 5507 super(8); 5508 this.className = className; 5509 this.label = label; 5510 } 5511 protected ROILabel(ByteBuffer backing, int offset) { 5512 super(backing, offset, 8); 5513 init(); 5514 } 5515 protected ROILabel(long nativeObj, boolean owned) { 5516 super(nativeObj, owned, 8); 5517 init(); 5518 } 5519 protected void setBuffer(ByteBuffer backing, int offset) { 5520 super.setBuffer(backing, offset, 8); 5521 } 5522 public void read() { 5523 long className_addr = getPointer(backing, 0); 5524 if (className_addr == 0) 5525 className = null; 5526 else { 5527 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 5528 while (bb.get() != 0) {} 5529 byte[] bytes = new byte[bb.position()-1]; 5530 getBytes(bb, bytes, 0, bytes.length); 5531 try { 5532 className = new String(bytes, "UTF-8"); 5533 } catch (UnsupportedEncodingException e) { 5534 className = ""; 5535 } 5536 } 5537 5538 label = backing.getInt(4); 5539 } 5540 public void write() { 5541 if (className != null) { 5542 byte[] className_bytes; 5543 try { 5544 className_bytes = className.getBytes("UTF-8"); 5545 } catch (UnsupportedEncodingException e) { 5546 className_bytes = new byte[0]; 5547 } 5548 className_buf = ByteBuffer.allocateDirect(className_bytes.length+1); 5549 putBytes(className_buf, className_bytes, 0, className_bytes.length).put(className_bytes.length, (byte)0); 5550 } 5551 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 5552 backing.putInt(4, label); 5553 } 5554 public int size() { 5555 return 8; 5556 } 5557 } 5558 5559 public static class SupervisedColorSegmentationReport extends DisposedStruct { 5560 public ROILabel[] labelOut; // The Roi labels array. 5561 private ByteBuffer labelOut_buf; 5562 5563 private void init() { 5564 labelOut = new ROILabel[0]; 5565 } 5566 public SupervisedColorSegmentationReport() { 5567 super(8); 5568 init(); 5569 } 5570 public SupervisedColorSegmentationReport(ROILabel[] labelOut) { 5571 super(8); 5572 this.labelOut = labelOut; 5573 } 5574 protected SupervisedColorSegmentationReport(ByteBuffer backing, int offset) { 5575 super(backing, offset, 8); 5576 init(); 5577 } 5578 protected SupervisedColorSegmentationReport(long nativeObj, boolean owned) { 5579 super(nativeObj, owned, 8); 5580 init(); 5581 } 5582 protected void setBuffer(ByteBuffer backing, int offset) { 5583 super.setBuffer(backing, offset, 8); 5584 } 5585 public void read() { 5586 int labelOut_numLabelOut = backing.getInt(4); 5587 long labelOut_addr = getPointer(backing, 0); 5588 labelOut = new ROILabel[labelOut_numLabelOut]; 5589 if (labelOut_numLabelOut > 0 && labelOut_addr != 0) { 5590 ByteBuffer bb = newDirectByteBuffer(labelOut_addr, labelOut_numLabelOut*8); 5591 for (int i=0, off=0; i<labelOut_numLabelOut; i++, off += 8) { 5592 labelOut[i] = new ROILabel(bb, off); 5593 labelOut[i].read(); 5594 } 5595 } 5596 } 5597 public void write() { 5598 labelOut_buf = ByteBuffer.allocateDirect(labelOut.length*8).order(ByteOrder.nativeOrder()); 5599 for (int i=0, off=0; i<labelOut.length; i++, off += 8) { 5600 labelOut[i].setBuffer(labelOut_buf, off); 5601 labelOut[i].write(); 5602 } 5603 backing.putInt(4, labelOut.length); 5604 putPointer(backing, 0, labelOut_buf); 5605 } 5606 public int size() { 5607 return 8; 5608 } 5609 } 5610 5611 public static class LabelToROIReport extends DisposedStruct { 5612 public ROI[] roiArray; // Array of ROIs. 5613 public int[] labelsOutArray; // Array of labels. 5614 public int[] isTooManyVectorsArray; // isTooManyVectorsArray array. 5615 private ByteBuffer roiArray_buf; 5616 private ByteBuffer labelsOutArray_buf; 5617 private ByteBuffer isTooManyVectorsArray_buf; 5618 5619 private void init() { 5620 roiArray = new ROI[0]; 5621 labelsOutArray = new int[0]; 5622 isTooManyVectorsArray = new int[0]; 5623 } 5624 public LabelToROIReport() { 5625 super(24); 5626 init(); 5627 } 5628 public LabelToROIReport(ROI[] roiArray, int[] labelsOutArray, int[] isTooManyVectorsArray) { 5629 super(24); 5630 this.roiArray = roiArray; 5631 this.labelsOutArray = labelsOutArray; 5632 this.isTooManyVectorsArray = isTooManyVectorsArray; 5633 } 5634 protected LabelToROIReport(ByteBuffer backing, int offset) { 5635 super(backing, offset, 24); 5636 init(); 5637 } 5638 protected LabelToROIReport(long nativeObj, boolean owned) { 5639 super(nativeObj, owned, 24); 5640 init(); 5641 } 5642 protected void setBuffer(ByteBuffer backing, int offset) { 5643 super.setBuffer(backing, offset, 24); 5644 } 5645 public void read() { 5646 int roiArray_numOfROIs = backing.getInt(4); 5647 long roiArray_addr = getPointer(backing, 0); 5648 roiArray = new ROI[roiArray_numOfROIs]; 5649 if (roiArray_numOfROIs > 0 && roiArray_addr != 0) { 5650 ByteBuffer bb = newDirectByteBuffer(roiArray_addr, roiArray_numOfROIs*4); 5651 for (int i=0, off=0; i<roiArray_numOfROIs; i++, off += 4) { 5652 roiArray[i] = new ROI(getPointer(bb, off), false); 5653 } 5654 } 5655 int labelsOutArray_numOfLabels = backing.getInt(12); 5656 long labelsOutArray_addr = getPointer(backing, 8); 5657 labelsOutArray = new int[labelsOutArray_numOfLabels]; 5658 if (labelsOutArray_numOfLabels > 0 && labelsOutArray_addr != 0) { 5659 newDirectByteBuffer(labelsOutArray_addr, labelsOutArray_numOfLabels*4).asIntBuffer().get(labelsOutArray); 5660 } 5661 int isTooManyVectorsArray_isTooManyVectorsArraySize = backing.getInt(20); 5662 long isTooManyVectorsArray_addr = getPointer(backing, 16); 5663 isTooManyVectorsArray = new int[isTooManyVectorsArray_isTooManyVectorsArraySize]; 5664 if (isTooManyVectorsArray_isTooManyVectorsArraySize > 0 && isTooManyVectorsArray_addr != 0) { 5665 newDirectByteBuffer(isTooManyVectorsArray_addr, isTooManyVectorsArray_isTooManyVectorsArraySize*4).asIntBuffer().get(isTooManyVectorsArray); 5666 } 5667 } 5668 public void write() { 5669 roiArray_buf = ByteBuffer.allocateDirect(roiArray.length*4).order(ByteOrder.nativeOrder()); 5670 for (int i=0, off=0; i<roiArray.length; i++, off += 4) { 5671 putPointer(roiArray_buf, off, roiArray[i]); 5672 } 5673 backing.putInt(4, roiArray.length); 5674 putPointer(backing, 0, roiArray_buf); 5675 labelsOutArray_buf = ByteBuffer.allocateDirect(labelsOutArray.length*4).order(ByteOrder.nativeOrder()); 5676 labelsOutArray_buf.asIntBuffer().put(labelsOutArray).rewind(); 5677 backing.putInt(12, labelsOutArray.length); 5678 putPointer(backing, 8, labelsOutArray_buf); 5679 isTooManyVectorsArray_buf = ByteBuffer.allocateDirect(isTooManyVectorsArray.length*4).order(ByteOrder.nativeOrder()); 5680 isTooManyVectorsArray_buf.asIntBuffer().put(isTooManyVectorsArray).rewind(); 5681 backing.putInt(20, isTooManyVectorsArray.length); 5682 putPointer(backing, 16, isTooManyVectorsArray_buf); 5683 } 5684 public int size() { 5685 return 24; 5686 } 5687 } 5688 5689 public static class ColorSegmenationOptions extends DisposedStruct { 5690 public int windowX; // X is the window size in x direction. 5691 public int windowY; // Y is the window size in y direction. 5692 public int stepSize; // Step Size is the distance between two windows. 5693 public int minParticleArea; // Min Particle Area is the minimum number of allowed pixels. 5694 public int maxParticleArea; // Max Particle Area is the maximum number of allowed pixels. 5695 public short isFineSegment; // When enabled, the step processes the boundary pixels of each segmentation cluster using a step size of 1. 5696 5697 private void init() { 5698 5699 } 5700 public ColorSegmenationOptions() { 5701 super(24); 5702 init(); 5703 } 5704 public ColorSegmenationOptions(int windowX, int windowY, int stepSize, int minParticleArea, int maxParticleArea, int isFineSegment) { 5705 super(24); 5706 this.windowX = windowX; 5707 this.windowY = windowY; 5708 this.stepSize = stepSize; 5709 this.minParticleArea = minParticleArea; 5710 this.maxParticleArea = maxParticleArea; 5711 this.isFineSegment = (short)isFineSegment; 5712 } 5713 protected ColorSegmenationOptions(ByteBuffer backing, int offset) { 5714 super(backing, offset, 24); 5715 init(); 5716 } 5717 protected ColorSegmenationOptions(long nativeObj, boolean owned) { 5718 super(nativeObj, owned, 24); 5719 init(); 5720 } 5721 protected void setBuffer(ByteBuffer backing, int offset) { 5722 super.setBuffer(backing, offset, 24); 5723 } 5724 public void read() { 5725 windowX = backing.getInt(0); 5726 windowY = backing.getInt(4); 5727 stepSize = backing.getInt(8); 5728 minParticleArea = backing.getInt(12); 5729 maxParticleArea = backing.getInt(16); 5730 isFineSegment = backing.getShort(20); 5731 } 5732 public void write() { 5733 backing.putInt(0, windowX); 5734 backing.putInt(4, windowY); 5735 backing.putInt(8, stepSize); 5736 backing.putInt(12, minParticleArea); 5737 backing.putInt(16, maxParticleArea); 5738 backing.putShort(20, isFineSegment); 5739 } 5740 public int size() { 5741 return 24; 5742 } 5743 } 5744 5745 public static class ClassifiedCurve extends DisposedStruct { 5746 public double length; // Specifies the length, in pixels, of the curves within the curvature range. 5747 public double lengthReal; // specifies the length, in calibrated units, of the curves within the curvature range. 5748 public double maxCurvature; // specifies the maximum curvature, in pixels, for the selected curvature range. 5749 public double maxCurvatureReal; // specifies the maximum curvature, in calibrated units, for the selected curvature range. 5750 public int label; // specifies the class to which the the sample belongs. 5751 public PointDouble[] curvePoints; // Curve Points is a point-coordinate cluster that defines the points of the curve. 5752 private ByteBuffer curvePoints_buf; 5753 5754 private void init() { 5755 curvePoints = new PointDouble[0]; 5756 } 5757 public ClassifiedCurve() { 5758 super(48); 5759 init(); 5760 } 5761 public ClassifiedCurve(double length, double lengthReal, double maxCurvature, double maxCurvatureReal, int label, PointDouble[] curvePoints) { 5762 super(48); 5763 this.length = length; 5764 this.lengthReal = lengthReal; 5765 this.maxCurvature = maxCurvature; 5766 this.maxCurvatureReal = maxCurvatureReal; 5767 this.label = label; 5768 this.curvePoints = curvePoints; 5769 } 5770 protected ClassifiedCurve(ByteBuffer backing, int offset) { 5771 super(backing, offset, 48); 5772 init(); 5773 } 5774 protected ClassifiedCurve(long nativeObj, boolean owned) { 5775 super(nativeObj, owned, 48); 5776 init(); 5777 } 5778 protected void setBuffer(ByteBuffer backing, int offset) { 5779 super.setBuffer(backing, offset, 48); 5780 } 5781 public void read() { 5782 length = backing.getDouble(0); 5783 lengthReal = backing.getDouble(8); 5784 maxCurvature = backing.getDouble(16); 5785 maxCurvatureReal = backing.getDouble(24); 5786 label = backing.getInt(32); 5787 int curvePoints_numCurvePoints = backing.getInt(40); 5788 long curvePoints_addr = getPointer(backing, 36); 5789 curvePoints = new PointDouble[curvePoints_numCurvePoints]; 5790 if (curvePoints_numCurvePoints > 0 && curvePoints_addr != 0) { 5791 ByteBuffer bb = newDirectByteBuffer(curvePoints_addr, curvePoints_numCurvePoints*16); 5792 for (int i=0, off=0; i<curvePoints_numCurvePoints; i++, off += 16) { 5793 curvePoints[i] = new PointDouble(bb, off); 5794 curvePoints[i].read(); 5795 } 5796 } 5797 } 5798 public void write() { 5799 backing.putDouble(0, length); 5800 backing.putDouble(8, lengthReal); 5801 backing.putDouble(16, maxCurvature); 5802 backing.putDouble(24, maxCurvatureReal); 5803 backing.putInt(32, label); 5804 curvePoints_buf = ByteBuffer.allocateDirect(curvePoints.length*16).order(ByteOrder.nativeOrder()); 5805 for (int i=0, off=0; i<curvePoints.length; i++, off += 16) { 5806 curvePoints[i].setBuffer(curvePoints_buf, off); 5807 curvePoints[i].write(); 5808 } 5809 backing.putInt(40, curvePoints.length); 5810 putPointer(backing, 36, curvePoints_buf); 5811 } 5812 public int size() { 5813 return 48; 5814 } 5815 } 5816 5817 public static class RangeDouble extends DisposedStruct { 5818 public double minValue; // The minimum value of the range. 5819 public double maxValue; // The maximum value of the range. 5820 5821 private void init() { 5822 5823 } 5824 public RangeDouble() { 5825 super(16); 5826 init(); 5827 } 5828 public RangeDouble(double minValue, double maxValue) { 5829 super(16); 5830 this.minValue = minValue; 5831 this.maxValue = maxValue; 5832 } 5833 protected RangeDouble(ByteBuffer backing, int offset) { 5834 super(backing, offset, 16); 5835 init(); 5836 } 5837 protected RangeDouble(long nativeObj, boolean owned) { 5838 super(nativeObj, owned, 16); 5839 init(); 5840 } 5841 protected void setBuffer(ByteBuffer backing, int offset) { 5842 super.setBuffer(backing, offset, 16); 5843 } 5844 public void read() { 5845 minValue = backing.getDouble(0); 5846 maxValue = backing.getDouble(8); 5847 } 5848 public void write() { 5849 backing.putDouble(0, minValue); 5850 backing.putDouble(8, maxValue); 5851 } 5852 public int size() { 5853 return 16; 5854 } 5855 } 5856 5857 public static class RangeLabel extends DisposedStruct { 5858 public RangeDouble range; // Specifies the range of curvature values. 5859 public int label; // Class Label specifies the class to which the the sample belongs. 5860 5861 private void init() { 5862 range = new RangeDouble(backing, 0); 5863 } 5864 public RangeLabel() { 5865 super(24); 5866 init(); 5867 } 5868 public RangeLabel(RangeDouble range, int label) { 5869 super(24); 5870 this.range = range; 5871 this.label = label; 5872 } 5873 protected RangeLabel(ByteBuffer backing, int offset) { 5874 super(backing, offset, 24); 5875 init(); 5876 } 5877 protected RangeLabel(long nativeObj, boolean owned) { 5878 super(nativeObj, owned, 24); 5879 init(); 5880 } 5881 protected void setBuffer(ByteBuffer backing, int offset) { 5882 super.setBuffer(backing, offset, 24); 5883 } 5884 public void read() { 5885 range.read(); 5886 label = backing.getInt(16); 5887 } 5888 public void write() { 5889 range.write(); 5890 backing.putInt(16, label); 5891 } 5892 public int size() { 5893 return 24; 5894 } 5895 } 5896 5897 public static class CurvatureAnalysisReport extends DisposedStruct { 5898 public ClassifiedCurve[] curves; 5899 private ByteBuffer curves_buf; 5900 5901 private void init() { 5902 curves = new ClassifiedCurve[0]; 5903 } 5904 public CurvatureAnalysisReport() { 5905 super(8); 5906 init(); 5907 } 5908 public CurvatureAnalysisReport(ClassifiedCurve[] curves) { 5909 super(8); 5910 this.curves = curves; 5911 } 5912 protected CurvatureAnalysisReport(ByteBuffer backing, int offset) { 5913 super(backing, offset, 8); 5914 init(); 5915 } 5916 protected CurvatureAnalysisReport(long nativeObj, boolean owned) { 5917 super(nativeObj, owned, 8); 5918 init(); 5919 } 5920 protected void setBuffer(ByteBuffer backing, int offset) { 5921 super.setBuffer(backing, offset, 8); 5922 } 5923 public void read() { 5924 int curves_numCurves = backing.getInt(4); 5925 long curves_addr = getPointer(backing, 0); 5926 curves = new ClassifiedCurve[curves_numCurves]; 5927 if (curves_numCurves > 0 && curves_addr != 0) { 5928 ByteBuffer bb = newDirectByteBuffer(curves_addr, curves_numCurves*48); 5929 for (int i=0, off=0; i<curves_numCurves; i++, off += 48) { 5930 curves[i] = new ClassifiedCurve(bb, off); 5931 curves[i].read(); 5932 } 5933 } 5934 } 5935 public void write() { 5936 curves_buf = ByteBuffer.allocateDirect(curves.length*48).order(ByteOrder.nativeOrder()); 5937 for (int i=0, off=0; i<curves.length; i++, off += 48) { 5938 curves[i].setBuffer(curves_buf, off); 5939 curves[i].write(); 5940 } 5941 backing.putInt(4, curves.length); 5942 putPointer(backing, 0, curves_buf); 5943 } 5944 public int size() { 5945 return 8; 5946 } 5947 } 5948 5949 public static class Disparity extends DisposedStruct { 5950 public PointDouble current; // Current is a array of points that defines the target contour. 5951 public PointDouble reference; // reference is a array of points that defines the template contour. 5952 public double distance; // Specifies the distance, in pixels, between the template contour point and the target contour point. 5953 5954 private void init() { 5955 current = new PointDouble(backing, 0); 5956 reference = new PointDouble(backing, 16); 5957 } 5958 public Disparity() { 5959 super(40); 5960 init(); 5961 } 5962 public Disparity(PointDouble current, PointDouble reference, double distance) { 5963 super(40); 5964 this.current = current; 5965 this.reference = reference; 5966 this.distance = distance; 5967 } 5968 protected Disparity(ByteBuffer backing, int offset) { 5969 super(backing, offset, 40); 5970 init(); 5971 } 5972 protected Disparity(long nativeObj, boolean owned) { 5973 super(nativeObj, owned, 40); 5974 init(); 5975 } 5976 protected void setBuffer(ByteBuffer backing, int offset) { 5977 super.setBuffer(backing, offset, 40); 5978 } 5979 public void read() { 5980 current.read(); 5981 reference.read(); 5982 distance = backing.getDouble(32); 5983 } 5984 public void write() { 5985 current.write(); 5986 reference.write(); 5987 backing.putDouble(32, distance); 5988 } 5989 public int size() { 5990 return 40; 5991 } 5992 } 5993 5994 public static class ComputeDistancesReport extends DisposedStruct { 5995 public Disparity[] distances; // Distances is an array containing the computed distances. 5996 public Disparity[] distancesReal; // Distances Real is an array containing the computed distances in calibrated units. 5997 private ByteBuffer distances_buf; 5998 private ByteBuffer distancesReal_buf; 5999 6000 private void init() { 6001 distances = new Disparity[0]; 6002 distancesReal = new Disparity[0]; 6003 } 6004 public ComputeDistancesReport() { 6005 super(16); 6006 init(); 6007 } 6008 public ComputeDistancesReport(Disparity[] distances, Disparity[] distancesReal) { 6009 super(16); 6010 this.distances = distances; 6011 this.distancesReal = distancesReal; 6012 } 6013 protected ComputeDistancesReport(ByteBuffer backing, int offset) { 6014 super(backing, offset, 16); 6015 init(); 6016 } 6017 protected ComputeDistancesReport(long nativeObj, boolean owned) { 6018 super(nativeObj, owned, 16); 6019 init(); 6020 } 6021 protected void setBuffer(ByteBuffer backing, int offset) { 6022 super.setBuffer(backing, offset, 16); 6023 } 6024 public void read() { 6025 int distances_numDistances = backing.getInt(4); 6026 long distances_addr = getPointer(backing, 0); 6027 distances = new Disparity[distances_numDistances]; 6028 if (distances_numDistances > 0 && distances_addr != 0) { 6029 ByteBuffer bb = newDirectByteBuffer(distances_addr, distances_numDistances*40); 6030 for (int i=0, off=0; i<distances_numDistances; i++, off += 40) { 6031 distances[i] = new Disparity(bb, off); 6032 distances[i].read(); 6033 } 6034 } 6035 int distancesReal_numDistancesReal = backing.getInt(12); 6036 long distancesReal_addr = getPointer(backing, 8); 6037 distancesReal = new Disparity[distancesReal_numDistancesReal]; 6038 if (distancesReal_numDistancesReal > 0 && distancesReal_addr != 0) { 6039 ByteBuffer bb = newDirectByteBuffer(distancesReal_addr, distancesReal_numDistancesReal*40); 6040 for (int i=0, off=0; i<distancesReal_numDistancesReal; i++, off += 40) { 6041 distancesReal[i] = new Disparity(bb, off); 6042 distancesReal[i].read(); 6043 } 6044 } 6045 } 6046 public void write() { 6047 distances_buf = ByteBuffer.allocateDirect(distances.length*40).order(ByteOrder.nativeOrder()); 6048 for (int i=0, off=0; i<distances.length; i++, off += 40) { 6049 distances[i].setBuffer(distances_buf, off); 6050 distances[i].write(); 6051 } 6052 backing.putInt(4, distances.length); 6053 putPointer(backing, 0, distances_buf); 6054 distancesReal_buf = ByteBuffer.allocateDirect(distancesReal.length*40).order(ByteOrder.nativeOrder()); 6055 for (int i=0, off=0; i<distancesReal.length; i++, off += 40) { 6056 distancesReal[i].setBuffer(distancesReal_buf, off); 6057 distancesReal[i].write(); 6058 } 6059 backing.putInt(12, distancesReal.length); 6060 putPointer(backing, 8, distancesReal_buf); 6061 } 6062 public int size() { 6063 return 16; 6064 } 6065 } 6066 6067 public static class MatchMode extends DisposedStruct { 6068 public int rotation; // Rotation When enabled, the Function searches for occurrences of the template in the inspection image, allowing for template matches to be rotated. 6069 public int scale; // Rotation When enabled, the Function searches for occurrences of the template in the inspection image, allowing for template matches to be rotated. 6070 public int occlusion; // Occlusion specifies whether or not to search for occluded versions of the shape. 6071 6072 private void init() { 6073 6074 } 6075 public MatchMode() { 6076 super(12); 6077 init(); 6078 } 6079 public MatchMode(int rotation, int scale, int occlusion) { 6080 super(12); 6081 this.rotation = rotation; 6082 this.scale = scale; 6083 this.occlusion = occlusion; 6084 } 6085 protected MatchMode(ByteBuffer backing, int offset) { 6086 super(backing, offset, 12); 6087 init(); 6088 } 6089 protected MatchMode(long nativeObj, boolean owned) { 6090 super(nativeObj, owned, 12); 6091 init(); 6092 } 6093 protected void setBuffer(ByteBuffer backing, int offset) { 6094 super.setBuffer(backing, offset, 12); 6095 } 6096 public void read() { 6097 rotation = backing.getInt(0); 6098 scale = backing.getInt(4); 6099 occlusion = backing.getInt(8); 6100 } 6101 public void write() { 6102 backing.putInt(0, rotation); 6103 backing.putInt(4, scale); 6104 backing.putInt(8, occlusion); 6105 } 6106 public int size() { 6107 return 12; 6108 } 6109 } 6110 6111 public static class ClassifiedDisparity extends DisposedStruct { 6112 public double length; // Length (pixel) specifies the length, in pixels, of the curves within the curvature range. 6113 public double lengthReal; // Length (real) specifies the length, in calibrated units, of the curves within the curvature range. 6114 public double maxDistance; // Maximum Distance (pixel) specifies the maximum distance, in pixels, between points along the selected contour and the template contour. 6115 public double maxDistanceReal; // Maximum Distance (real) specifies the maximum distance, in calibrated units, between points along the selected contour and the template contour. 6116 public int label; // Class Label specifies the class to which the the sample belongs. 6117 public PointDouble[] templateSubsection; // Template subsection points is an array of points that defines the boundary of the template. 6118 public PointDouble[] targetSubsection; // Current Points(Target subsection points) is an array of points that defines the boundary of the target. 6119 private ByteBuffer templateSubsection_buf; 6120 private ByteBuffer targetSubsection_buf; 6121 6122 private void init() { 6123 templateSubsection = new PointDouble[0]; 6124 targetSubsection = new PointDouble[0]; 6125 } 6126 public ClassifiedDisparity() { 6127 super(56); 6128 init(); 6129 } 6130 public ClassifiedDisparity(double length, double lengthReal, double maxDistance, double maxDistanceReal, int label, PointDouble[] templateSubsection, PointDouble[] targetSubsection) { 6131 super(56); 6132 this.length = length; 6133 this.lengthReal = lengthReal; 6134 this.maxDistance = maxDistance; 6135 this.maxDistanceReal = maxDistanceReal; 6136 this.label = label; 6137 this.templateSubsection = templateSubsection; 6138 this.targetSubsection = targetSubsection; 6139 } 6140 protected ClassifiedDisparity(ByteBuffer backing, int offset) { 6141 super(backing, offset, 56); 6142 init(); 6143 } 6144 protected ClassifiedDisparity(long nativeObj, boolean owned) { 6145 super(nativeObj, owned, 56); 6146 init(); 6147 } 6148 protected void setBuffer(ByteBuffer backing, int offset) { 6149 super.setBuffer(backing, offset, 56); 6150 } 6151 public void read() { 6152 length = backing.getDouble(0); 6153 lengthReal = backing.getDouble(8); 6154 maxDistance = backing.getDouble(16); 6155 maxDistanceReal = backing.getDouble(24); 6156 label = backing.getInt(32); 6157 int templateSubsection_numTemplateSubsection = backing.getInt(40); 6158 long templateSubsection_addr = getPointer(backing, 36); 6159 templateSubsection = new PointDouble[templateSubsection_numTemplateSubsection]; 6160 if (templateSubsection_numTemplateSubsection > 0 && templateSubsection_addr != 0) { 6161 ByteBuffer bb = newDirectByteBuffer(templateSubsection_addr, templateSubsection_numTemplateSubsection*16); 6162 for (int i=0, off=0; i<templateSubsection_numTemplateSubsection; i++, off += 16) { 6163 templateSubsection[i] = new PointDouble(bb, off); 6164 templateSubsection[i].read(); 6165 } 6166 } 6167 int targetSubsection_numTargetSubsection = backing.getInt(48); 6168 long targetSubsection_addr = getPointer(backing, 44); 6169 targetSubsection = new PointDouble[targetSubsection_numTargetSubsection]; 6170 if (targetSubsection_numTargetSubsection > 0 && targetSubsection_addr != 0) { 6171 ByteBuffer bb = newDirectByteBuffer(targetSubsection_addr, targetSubsection_numTargetSubsection*16); 6172 for (int i=0, off=0; i<targetSubsection_numTargetSubsection; i++, off += 16) { 6173 targetSubsection[i] = new PointDouble(bb, off); 6174 targetSubsection[i].read(); 6175 } 6176 } 6177 } 6178 public void write() { 6179 backing.putDouble(0, length); 6180 backing.putDouble(8, lengthReal); 6181 backing.putDouble(16, maxDistance); 6182 backing.putDouble(24, maxDistanceReal); 6183 backing.putInt(32, label); 6184 templateSubsection_buf = ByteBuffer.allocateDirect(templateSubsection.length*16).order(ByteOrder.nativeOrder()); 6185 for (int i=0, off=0; i<templateSubsection.length; i++, off += 16) { 6186 templateSubsection[i].setBuffer(templateSubsection_buf, off); 6187 templateSubsection[i].write(); 6188 } 6189 backing.putInt(40, templateSubsection.length); 6190 putPointer(backing, 36, templateSubsection_buf); 6191 targetSubsection_buf = ByteBuffer.allocateDirect(targetSubsection.length*16).order(ByteOrder.nativeOrder()); 6192 for (int i=0, off=0; i<targetSubsection.length; i++, off += 16) { 6193 targetSubsection[i].setBuffer(targetSubsection_buf, off); 6194 targetSubsection[i].write(); 6195 } 6196 backing.putInt(48, targetSubsection.length); 6197 putPointer(backing, 44, targetSubsection_buf); 6198 } 6199 public int size() { 6200 return 56; 6201 } 6202 } 6203 6204 public static class ClassifyDistancesReport extends DisposedStruct { 6205 public ClassifiedDisparity[] classifiedDistances; // Disparity array containing the classified distances. 6206 private ByteBuffer classifiedDistances_buf; 6207 6208 private void init() { 6209 classifiedDistances = new ClassifiedDisparity[0]; 6210 } 6211 public ClassifyDistancesReport() { 6212 super(8); 6213 init(); 6214 } 6215 public ClassifyDistancesReport(ClassifiedDisparity[] classifiedDistances) { 6216 super(8); 6217 this.classifiedDistances = classifiedDistances; 6218 } 6219 protected ClassifyDistancesReport(ByteBuffer backing, int offset) { 6220 super(backing, offset, 8); 6221 init(); 6222 } 6223 protected ClassifyDistancesReport(long nativeObj, boolean owned) { 6224 super(nativeObj, owned, 8); 6225 init(); 6226 } 6227 protected void setBuffer(ByteBuffer backing, int offset) { 6228 super.setBuffer(backing, offset, 8); 6229 } 6230 public void read() { 6231 int classifiedDistances_numClassifiedDistances = backing.getInt(4); 6232 long classifiedDistances_addr = getPointer(backing, 0); 6233 classifiedDistances = new ClassifiedDisparity[classifiedDistances_numClassifiedDistances]; 6234 if (classifiedDistances_numClassifiedDistances > 0 && classifiedDistances_addr != 0) { 6235 ByteBuffer bb = newDirectByteBuffer(classifiedDistances_addr, classifiedDistances_numClassifiedDistances*56); 6236 for (int i=0, off=0; i<classifiedDistances_numClassifiedDistances; i++, off += 56) { 6237 classifiedDistances[i] = new ClassifiedDisparity(bb, off); 6238 classifiedDistances[i].read(); 6239 } 6240 } 6241 } 6242 public void write() { 6243 classifiedDistances_buf = ByteBuffer.allocateDirect(classifiedDistances.length*56).order(ByteOrder.nativeOrder()); 6244 for (int i=0, off=0; i<classifiedDistances.length; i++, off += 56) { 6245 classifiedDistances[i].setBuffer(classifiedDistances_buf, off); 6246 classifiedDistances[i].write(); 6247 } 6248 backing.putInt(4, classifiedDistances.length); 6249 putPointer(backing, 0, classifiedDistances_buf); 6250 } 6251 public int size() { 6252 return 8; 6253 } 6254 } 6255 6256 public static class ContourComputeCurvatureReport extends DisposedStruct { 6257 public double[] curvaturePixel; // Curvature Pixel displays the curvature profile for the selected contour, in pixels. 6258 public double[] curvatureReal; // Curvature Real displays the curvature profile for the selected contour, in calibrated units. 6259 private ByteBuffer curvaturePixel_buf; 6260 private ByteBuffer curvatureReal_buf; 6261 6262 private void init() { 6263 curvaturePixel = new double[0]; 6264 curvatureReal = new double[0]; 6265 } 6266 public ContourComputeCurvatureReport() { 6267 super(16); 6268 init(); 6269 } 6270 public ContourComputeCurvatureReport(double[] curvaturePixel, double[] curvatureReal) { 6271 super(16); 6272 this.curvaturePixel = curvaturePixel; 6273 this.curvatureReal = curvatureReal; 6274 } 6275 protected ContourComputeCurvatureReport(ByteBuffer backing, int offset) { 6276 super(backing, offset, 16); 6277 init(); 6278 } 6279 protected ContourComputeCurvatureReport(long nativeObj, boolean owned) { 6280 super(nativeObj, owned, 16); 6281 init(); 6282 } 6283 protected void setBuffer(ByteBuffer backing, int offset) { 6284 super.setBuffer(backing, offset, 16); 6285 } 6286 public void read() { 6287 int curvaturePixel_numCurvaturePixel = backing.getInt(4); 6288 long curvaturePixel_addr = getPointer(backing, 0); 6289 curvaturePixel = new double[curvaturePixel_numCurvaturePixel]; 6290 if (curvaturePixel_numCurvaturePixel > 0 && curvaturePixel_addr != 0) { 6291 newDirectByteBuffer(curvaturePixel_addr, curvaturePixel_numCurvaturePixel*8).asDoubleBuffer().get(curvaturePixel); 6292 } 6293 int curvatureReal_numCurvatureReal = backing.getInt(12); 6294 long curvatureReal_addr = getPointer(backing, 8); 6295 curvatureReal = new double[curvatureReal_numCurvatureReal]; 6296 if (curvatureReal_numCurvatureReal > 0 && curvatureReal_addr != 0) { 6297 newDirectByteBuffer(curvatureReal_addr, curvatureReal_numCurvatureReal*8).asDoubleBuffer().get(curvatureReal); 6298 } 6299 } 6300 public void write() { 6301 curvaturePixel_buf = ByteBuffer.allocateDirect(curvaturePixel.length*8).order(ByteOrder.nativeOrder()); 6302 curvaturePixel_buf.asDoubleBuffer().put(curvaturePixel).rewind(); 6303 backing.putInt(4, curvaturePixel.length); 6304 putPointer(backing, 0, curvaturePixel_buf); 6305 curvatureReal_buf = ByteBuffer.allocateDirect(curvatureReal.length*8).order(ByteOrder.nativeOrder()); 6306 curvatureReal_buf.asDoubleBuffer().put(curvatureReal).rewind(); 6307 backing.putInt(12, curvatureReal.length); 6308 putPointer(backing, 8, curvatureReal_buf); 6309 } 6310 public int size() { 6311 return 16; 6312 } 6313 } 6314 6315 public static class ContourOverlaySettings extends DisposedStruct { 6316 public int overlay; // Overlay specifies whether to display the overlay on the image. 6317 public RGBValue color; // Color is the color of the overlay. 6318 public int width; // Width specifies the width of the overlay in pixels. 6319 public int maintainWidth; // Maintain Width? specifies whether you want the overlay measured in screen pixels or image pixels. 6320 6321 private void init() { 6322 color = new RGBValue(backing, 4); 6323 } 6324 public ContourOverlaySettings() { 6325 super(16); 6326 init(); 6327 } 6328 public ContourOverlaySettings(int overlay, RGBValue color, int width, int maintainWidth) { 6329 super(16); 6330 this.overlay = overlay; 6331 this.color = color; 6332 this.width = width; 6333 this.maintainWidth = maintainWidth; 6334 } 6335 protected ContourOverlaySettings(ByteBuffer backing, int offset) { 6336 super(backing, offset, 16); 6337 init(); 6338 } 6339 protected ContourOverlaySettings(long nativeObj, boolean owned) { 6340 super(nativeObj, owned, 16); 6341 init(); 6342 } 6343 protected void setBuffer(ByteBuffer backing, int offset) { 6344 super.setBuffer(backing, offset, 16); 6345 } 6346 public void read() { 6347 overlay = backing.getInt(0); 6348 color.read(); 6349 width = backing.getInt(8); 6350 maintainWidth = backing.getInt(12); 6351 } 6352 public void write() { 6353 backing.putInt(0, overlay); 6354 color.write(); 6355 backing.putInt(8, width); 6356 backing.putInt(12, maintainWidth); 6357 } 6358 public int size() { 6359 return 16; 6360 } 6361 } 6362 6363 public static class CurveParameters extends DisposedStruct { 6364 public ExtractionMode extractionMode; // Specifies the method the function uses to identify curves in the image. 6365 public int threshold; // Specifies the minimum contrast a seed point must have in order to begin a curve. 6366 public EdgeFilterSize filterSize; // Specifies the width of the edge filter the function uses to identify curves in the image. 6367 public int minLength; // Specifies the length, in pixels, of the smallest curve the function will extract. 6368 public int searchStep; // Search Step Size specifies the distance, in the y direction, between the image rows that the algorithm inspects for curve seed points. 6369 public int maxEndPointGap; // Specifies the maximum gap, in pixels, between the endpoints of a curve that the function identifies as a closed curve. 6370 public int subpixel; // Subpixel specifies whether to detect curve points with subpixel accuracy. 6371 6372 private void init() { 6373 6374 } 6375 public CurveParameters() { 6376 super(28); 6377 init(); 6378 } 6379 public CurveParameters(ExtractionMode extractionMode, int threshold, EdgeFilterSize filterSize, int minLength, int searchStep, int maxEndPointGap, int subpixel) { 6380 super(28); 6381 this.extractionMode = extractionMode; 6382 this.threshold = threshold; 6383 this.filterSize = filterSize; 6384 this.minLength = minLength; 6385 this.searchStep = searchStep; 6386 this.maxEndPointGap = maxEndPointGap; 6387 this.subpixel = subpixel; 6388 } 6389 protected CurveParameters(ByteBuffer backing, int offset) { 6390 super(backing, offset, 28); 6391 init(); 6392 } 6393 protected CurveParameters(long nativeObj, boolean owned) { 6394 super(nativeObj, owned, 28); 6395 init(); 6396 } 6397 protected void setBuffer(ByteBuffer backing, int offset) { 6398 super.setBuffer(backing, offset, 28); 6399 } 6400 public void read() { 6401 extractionMode = ExtractionMode.fromValue(backing.getInt(0)); 6402 threshold = backing.getInt(4); 6403 filterSize = EdgeFilterSize.fromValue(backing.getInt(8)); 6404 minLength = backing.getInt(12); 6405 searchStep = backing.getInt(16); 6406 maxEndPointGap = backing.getInt(20); 6407 subpixel = backing.getInt(24); 6408 } 6409 public void write() { 6410 if (extractionMode != null) 6411 backing.putInt(0, extractionMode.getValue()); 6412 backing.putInt(4, threshold); 6413 if (filterSize != null) 6414 backing.putInt(8, filterSize.getValue()); 6415 backing.putInt(12, minLength); 6416 backing.putInt(16, searchStep); 6417 backing.putInt(20, maxEndPointGap); 6418 backing.putInt(24, subpixel); 6419 } 6420 public int size() { 6421 return 28; 6422 } 6423 } 6424 6425 public static class ExtractContourReport extends DisposedStruct { 6426 public PointDouble[] contourPoints; // Contour Points specifies every point found on the contour. 6427 public PointDouble[] sourcePoints; // Source Image Points specifies every point found on the contour in the source image. 6428 private ByteBuffer contourPoints_buf; 6429 private ByteBuffer sourcePoints_buf; 6430 6431 private void init() { 6432 contourPoints = new PointDouble[0]; 6433 sourcePoints = new PointDouble[0]; 6434 } 6435 public ExtractContourReport() { 6436 super(16); 6437 init(); 6438 } 6439 public ExtractContourReport(PointDouble[] contourPoints, PointDouble[] sourcePoints) { 6440 super(16); 6441 this.contourPoints = contourPoints; 6442 this.sourcePoints = sourcePoints; 6443 } 6444 protected ExtractContourReport(ByteBuffer backing, int offset) { 6445 super(backing, offset, 16); 6446 init(); 6447 } 6448 protected ExtractContourReport(long nativeObj, boolean owned) { 6449 super(nativeObj, owned, 16); 6450 init(); 6451 } 6452 protected void setBuffer(ByteBuffer backing, int offset) { 6453 super.setBuffer(backing, offset, 16); 6454 } 6455 public void read() { 6456 int contourPoints_numContourPoints = backing.getInt(4); 6457 long contourPoints_addr = getPointer(backing, 0); 6458 contourPoints = new PointDouble[contourPoints_numContourPoints]; 6459 if (contourPoints_numContourPoints > 0 && contourPoints_addr != 0) { 6460 ByteBuffer bb = newDirectByteBuffer(contourPoints_addr, contourPoints_numContourPoints*16); 6461 for (int i=0, off=0; i<contourPoints_numContourPoints; i++, off += 16) { 6462 contourPoints[i] = new PointDouble(bb, off); 6463 contourPoints[i].read(); 6464 } 6465 } 6466 int sourcePoints_numSourcePoints = backing.getInt(12); 6467 long sourcePoints_addr = getPointer(backing, 8); 6468 sourcePoints = new PointDouble[sourcePoints_numSourcePoints]; 6469 if (sourcePoints_numSourcePoints > 0 && sourcePoints_addr != 0) { 6470 ByteBuffer bb = newDirectByteBuffer(sourcePoints_addr, sourcePoints_numSourcePoints*16); 6471 for (int i=0, off=0; i<sourcePoints_numSourcePoints; i++, off += 16) { 6472 sourcePoints[i] = new PointDouble(bb, off); 6473 sourcePoints[i].read(); 6474 } 6475 } 6476 } 6477 public void write() { 6478 contourPoints_buf = ByteBuffer.allocateDirect(contourPoints.length*16).order(ByteOrder.nativeOrder()); 6479 for (int i=0, off=0; i<contourPoints.length; i++, off += 16) { 6480 contourPoints[i].setBuffer(contourPoints_buf, off); 6481 contourPoints[i].write(); 6482 } 6483 backing.putInt(4, contourPoints.length); 6484 putPointer(backing, 0, contourPoints_buf); 6485 sourcePoints_buf = ByteBuffer.allocateDirect(sourcePoints.length*16).order(ByteOrder.nativeOrder()); 6486 for (int i=0, off=0; i<sourcePoints.length; i++, off += 16) { 6487 sourcePoints[i].setBuffer(sourcePoints_buf, off); 6488 sourcePoints[i].write(); 6489 } 6490 backing.putInt(12, sourcePoints.length); 6491 putPointer(backing, 8, sourcePoints_buf); 6492 } 6493 public int size() { 6494 return 16; 6495 } 6496 } 6497 6498 public static class ConnectionConstraint extends DisposedStruct { 6499 public ConnectionConstraintType constraintType; // Constraint Type specifies what criteria to use to consider two curves part of a contour. 6500 public RangeDouble range; // Specifies range for a given Match Constraint. 6501 6502 private void init() { 6503 range = new RangeDouble(backing, 8); 6504 } 6505 public ConnectionConstraint() { 6506 super(24); 6507 init(); 6508 } 6509 public ConnectionConstraint(ConnectionConstraintType constraintType, RangeDouble range) { 6510 super(24); 6511 this.constraintType = constraintType; 6512 this.range = range; 6513 } 6514 protected ConnectionConstraint(ByteBuffer backing, int offset) { 6515 super(backing, offset, 24); 6516 init(); 6517 } 6518 protected ConnectionConstraint(long nativeObj, boolean owned) { 6519 super(nativeObj, owned, 24); 6520 init(); 6521 } 6522 protected void setBuffer(ByteBuffer backing, int offset) { 6523 super.setBuffer(backing, offset, 24); 6524 } 6525 public void read() { 6526 constraintType = ConnectionConstraintType.fromValue(backing.getInt(0)); 6527 range.read(); 6528 } 6529 public void write() { 6530 if (constraintType != null) 6531 backing.putInt(0, constraintType.getValue()); 6532 range.write(); 6533 } 6534 public int size() { 6535 return 24; 6536 } 6537 } 6538 6539 public static class ExtractTextureFeaturesReport extends DisposedStruct { 6540 public int[] waveletBands; // The array having all the Wavelet Banks used for extraction. 6541 public int textureFeaturesRows; // Number of Rows in the Texture Features array. 6542 public int textureFeaturesCols; // Number of Cols in Texture Features array. 6543 private ByteBuffer waveletBands_buf; 6544 6545 private void init() { 6546 waveletBands = new int[0]; 6547 } 6548 public ExtractTextureFeaturesReport() { 6549 super(20); 6550 init(); 6551 } 6552 public ExtractTextureFeaturesReport(int[] waveletBands, int textureFeaturesRows, int textureFeaturesCols) { 6553 super(20); 6554 this.waveletBands = waveletBands; 6555 this.textureFeaturesRows = textureFeaturesRows; 6556 this.textureFeaturesCols = textureFeaturesCols; 6557 } 6558 protected ExtractTextureFeaturesReport(ByteBuffer backing, int offset) { 6559 super(backing, offset, 20); 6560 init(); 6561 } 6562 protected ExtractTextureFeaturesReport(long nativeObj, boolean owned) { 6563 super(nativeObj, owned, 20); 6564 init(); 6565 } 6566 protected void setBuffer(ByteBuffer backing, int offset) { 6567 super.setBuffer(backing, offset, 20); 6568 } 6569 public void read() { 6570 int waveletBands_numWaveletBands = backing.getInt(4); 6571 long waveletBands_addr = getPointer(backing, 0); 6572 waveletBands = new int[waveletBands_numWaveletBands]; 6573 if (waveletBands_numWaveletBands > 0 && waveletBands_addr != 0) { 6574 newDirectByteBuffer(waveletBands_addr, waveletBands_numWaveletBands*4).asIntBuffer().get(waveletBands); 6575 } 6576 textureFeaturesRows = backing.getInt(12); 6577 textureFeaturesCols = backing.getInt(16); 6578 } 6579 public void write() { 6580 waveletBands_buf = ByteBuffer.allocateDirect(waveletBands.length*4).order(ByteOrder.nativeOrder()); 6581 waveletBands_buf.asIntBuffer().put(waveletBands).rewind(); 6582 backing.putInt(4, waveletBands.length); 6583 putPointer(backing, 0, waveletBands_buf); 6584 backing.putInt(12, textureFeaturesRows); 6585 backing.putInt(16, textureFeaturesCols); 6586 } 6587 public int size() { 6588 return 20; 6589 } 6590 } 6591 6592 public static class WaveletBandsReport extends DisposedStruct { 6593 public float LHLBand; // 2-D array for LHL Band. 6594 public int rows; // Number of Rows for each of the 2-D arrays. 6595 public int cols; // Number of Columns for each of the 2-D arrays. 6596 6597 private void init() { 6598 6599 } 6600 public WaveletBandsReport() { 6601 super(40); 6602 init(); 6603 } 6604 public WaveletBandsReport(double LHLBand, int rows, int cols) { 6605 super(40); 6606 this.LHLBand = (float)LHLBand; 6607 this.rows = rows; 6608 this.cols = cols; 6609 } 6610 protected WaveletBandsReport(ByteBuffer backing, int offset) { 6611 super(backing, offset, 40); 6612 init(); 6613 } 6614 protected WaveletBandsReport(long nativeObj, boolean owned) { 6615 super(nativeObj, owned, 40); 6616 init(); 6617 } 6618 protected void setBuffer(ByteBuffer backing, int offset) { 6619 super.setBuffer(backing, offset, 40); 6620 } 6621 public void read() { 6622 LHLBand = backing.getFloat(24); 6623 rows = backing.getInt(32); 6624 cols = backing.getInt(36); 6625 } 6626 public void write() { 6627 backing.putFloat(24, LHLBand); 6628 backing.putInt(32, rows); 6629 backing.putInt(36, cols); 6630 } 6631 public int size() { 6632 return 40; 6633 } 6634 } 6635 6636 public static class CircleFitOptions extends DisposedStruct { 6637 public int maxRadius; // Specifies the acceptable distance, in pixels, that a point determined to belong to the circle can be from the perimeter of the circle. 6638 public double stepSize; // Step Size is the angle, in degrees, between each radial line in the annular region. 6639 public RakeProcessType processType; // Method used to process the data extracted for edge detection. 6640 6641 private void init() { 6642 6643 } 6644 public CircleFitOptions() { 6645 super(24); 6646 init(); 6647 } 6648 public CircleFitOptions(int maxRadius, double stepSize, RakeProcessType processType) { 6649 super(24); 6650 this.maxRadius = maxRadius; 6651 this.stepSize = stepSize; 6652 this.processType = processType; 6653 } 6654 protected CircleFitOptions(ByteBuffer backing, int offset) { 6655 super(backing, offset, 24); 6656 init(); 6657 } 6658 protected CircleFitOptions(long nativeObj, boolean owned) { 6659 super(nativeObj, owned, 24); 6660 init(); 6661 } 6662 protected void setBuffer(ByteBuffer backing, int offset) { 6663 super.setBuffer(backing, offset, 24); 6664 } 6665 public void read() { 6666 maxRadius = backing.getInt(0); 6667 stepSize = backing.getDouble(8); 6668 processType = RakeProcessType.fromValue(backing.getInt(16)); 6669 } 6670 public void write() { 6671 backing.putInt(0, maxRadius); 6672 backing.putDouble(8, stepSize); 6673 if (processType != null) 6674 backing.putInt(16, processType.getValue()); 6675 } 6676 public int size() { 6677 return 24; 6678 } 6679 } 6680 6681 public static class EdgeOptions2 extends DisposedStruct { 6682 public EdgePolaritySearchMode polarity; // Specifies the polarity of the edges to be found. 6683 public int kernelSize; // Specifies the size of the edge detection kernel. 6684 public int width; // Specifies the number of pixels averaged perpendicular to the search direction to compute the edge profile strength at each point along the search ROI. 6685 public float minThreshold; // Specifies the minimum edge strength (gradient magnitude) required for a detected edge. 6686 public InterpolationMethod interpolationType; // Specifies the interpolation method used to locate the edge position. 6687 public ColumnProcessingMode columnProcessingMode; // Specifies the method used to find the straight edge. 6688 6689 private void init() { 6690 6691 } 6692 public EdgeOptions2() { 6693 super(24); 6694 init(); 6695 } 6696 public EdgeOptions2(EdgePolaritySearchMode polarity, int kernelSize, int width, double minThreshold, InterpolationMethod interpolationType, ColumnProcessingMode columnProcessingMode) { 6697 super(24); 6698 this.polarity = polarity; 6699 this.kernelSize = kernelSize; 6700 this.width = width; 6701 this.minThreshold = (float)minThreshold; 6702 this.interpolationType = interpolationType; 6703 this.columnProcessingMode = columnProcessingMode; 6704 } 6705 protected EdgeOptions2(ByteBuffer backing, int offset) { 6706 super(backing, offset, 24); 6707 init(); 6708 } 6709 protected EdgeOptions2(long nativeObj, boolean owned) { 6710 super(nativeObj, owned, 24); 6711 init(); 6712 } 6713 protected void setBuffer(ByteBuffer backing, int offset) { 6714 super.setBuffer(backing, offset, 24); 6715 } 6716 public void read() { 6717 polarity = EdgePolaritySearchMode.fromValue(backing.getInt(0)); 6718 kernelSize = backing.getInt(4); 6719 width = backing.getInt(8); 6720 minThreshold = backing.getFloat(12); 6721 interpolationType = InterpolationMethod.fromValue(backing.getInt(16)); 6722 columnProcessingMode = ColumnProcessingMode.fromValue(backing.getInt(20)); 6723 } 6724 public void write() { 6725 if (polarity != null) 6726 backing.putInt(0, polarity.getValue()); 6727 backing.putInt(4, kernelSize); 6728 backing.putInt(8, width); 6729 backing.putFloat(12, minThreshold); 6730 if (interpolationType != null) 6731 backing.putInt(16, interpolationType.getValue()); 6732 if (columnProcessingMode != null) 6733 backing.putInt(20, columnProcessingMode.getValue()); 6734 } 6735 public int size() { 6736 return 24; 6737 } 6738 } 6739 6740 public static class FindCircularEdgeOptions extends DisposedStruct { 6741 public SpokeDirection direction; // Specifies the Spoke direction to search in the ROI. 6742 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 6743 public int showSearchLines; // If TRUE, the function overlays the search lines used to locate the edges on the image. 6744 public int showEdgesFound; // If TRUE, the function overlays the locations of the edges found on the image. 6745 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 6746 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 6747 public RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay the search lines. 6748 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay the search edges. 6749 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 6750 public String overlayGroupName; // Specifies the overlay group name to assign to the overlays. 6751 public EdgeOptions2 edgeOptions; // Specifies the edge detection options along a single search line. 6752 private ByteBuffer overlayGroupName_buf; 6753 6754 private void init() { 6755 searchAreaColor = new RGBValue(backing, 20); 6756 searchLinesColor = new RGBValue(backing, 24); 6757 searchEdgesColor = new RGBValue(backing, 28); 6758 resultColor = new RGBValue(backing, 32); 6759 edgeOptions = new EdgeOptions2(backing, 40); 6760 } 6761 public FindCircularEdgeOptions() { 6762 super(64); 6763 init(); 6764 } 6765 public FindCircularEdgeOptions(SpokeDirection direction, int showSearchArea, int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, EdgeOptions2 edgeOptions) { 6766 super(64); 6767 this.direction = direction; 6768 this.showSearchArea = showSearchArea; 6769 this.showSearchLines = showSearchLines; 6770 this.showEdgesFound = showEdgesFound; 6771 this.showResult = showResult; 6772 this.searchAreaColor = searchAreaColor; 6773 this.searchLinesColor = searchLinesColor; 6774 this.searchEdgesColor = searchEdgesColor; 6775 this.resultColor = resultColor; 6776 this.overlayGroupName = overlayGroupName; 6777 this.edgeOptions = edgeOptions; 6778 } 6779 protected FindCircularEdgeOptions(ByteBuffer backing, int offset) { 6780 super(backing, offset, 64); 6781 init(); 6782 } 6783 protected FindCircularEdgeOptions(long nativeObj, boolean owned) { 6784 super(nativeObj, owned, 64); 6785 init(); 6786 } 6787 protected void setBuffer(ByteBuffer backing, int offset) { 6788 super.setBuffer(backing, offset, 64); 6789 } 6790 public void read() { 6791 direction = SpokeDirection.fromValue(backing.getInt(0)); 6792 showSearchArea = backing.getInt(4); 6793 showSearchLines = backing.getInt(8); 6794 showEdgesFound = backing.getInt(12); 6795 showResult = backing.getInt(16); 6796 searchAreaColor.read(); 6797 searchLinesColor.read(); 6798 searchEdgesColor.read(); 6799 resultColor.read(); 6800 long overlayGroupName_addr = getPointer(backing, 36); 6801 if (overlayGroupName_addr == 0) 6802 overlayGroupName = null; 6803 else { 6804 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 6805 while (bb.get() != 0) {} 6806 byte[] bytes = new byte[bb.position()-1]; 6807 getBytes(bb, bytes, 0, bytes.length); 6808 try { 6809 overlayGroupName = new String(bytes, "UTF-8"); 6810 } catch (UnsupportedEncodingException e) { 6811 overlayGroupName = ""; 6812 } 6813 } 6814 6815 edgeOptions.read(); 6816 } 6817 public void write() { 6818 if (direction != null) 6819 backing.putInt(0, direction.getValue()); 6820 backing.putInt(4, showSearchArea); 6821 backing.putInt(8, showSearchLines); 6822 backing.putInt(12, showEdgesFound); 6823 backing.putInt(16, showResult); 6824 searchAreaColor.write(); 6825 searchLinesColor.write(); 6826 searchEdgesColor.write(); 6827 resultColor.write(); 6828 if (overlayGroupName != null) { 6829 byte[] overlayGroupName_bytes; 6830 try { 6831 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 6832 } catch (UnsupportedEncodingException e) { 6833 overlayGroupName_bytes = new byte[0]; 6834 } 6835 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 6836 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 6837 } 6838 putPointer(backing, 36, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 6839 edgeOptions.write(); 6840 } 6841 public int size() { 6842 return 64; 6843 } 6844 } 6845 6846 public static class FindConcentricEdgeOptions extends DisposedStruct { 6847 public ConcentricRakeDirection direction; // Specifies the Concentric Rake direction. 6848 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 6849 public int showSearchLines; // If TRUE, the function overlays the search lines used to locate the edges on the image. 6850 public int showEdgesFound; // If TRUE, the function overlays the locations of the edges found on the image. 6851 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 6852 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 6853 public RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay the search lines. 6854 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay the search edges. 6855 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 6856 public String overlayGroupName; // Specifies the overlay group name to assign to the overlays. 6857 public EdgeOptions2 edgeOptions; // Specifies the edge detection options along a single search line. 6858 private ByteBuffer overlayGroupName_buf; 6859 6860 private void init() { 6861 searchAreaColor = new RGBValue(backing, 20); 6862 searchLinesColor = new RGBValue(backing, 24); 6863 searchEdgesColor = new RGBValue(backing, 28); 6864 resultColor = new RGBValue(backing, 32); 6865 edgeOptions = new EdgeOptions2(backing, 40); 6866 } 6867 public FindConcentricEdgeOptions() { 6868 super(64); 6869 init(); 6870 } 6871 public FindConcentricEdgeOptions(ConcentricRakeDirection direction, int showSearchArea, int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, EdgeOptions2 edgeOptions) { 6872 super(64); 6873 this.direction = direction; 6874 this.showSearchArea = showSearchArea; 6875 this.showSearchLines = showSearchLines; 6876 this.showEdgesFound = showEdgesFound; 6877 this.showResult = showResult; 6878 this.searchAreaColor = searchAreaColor; 6879 this.searchLinesColor = searchLinesColor; 6880 this.searchEdgesColor = searchEdgesColor; 6881 this.resultColor = resultColor; 6882 this.overlayGroupName = overlayGroupName; 6883 this.edgeOptions = edgeOptions; 6884 } 6885 protected FindConcentricEdgeOptions(ByteBuffer backing, int offset) { 6886 super(backing, offset, 64); 6887 init(); 6888 } 6889 protected FindConcentricEdgeOptions(long nativeObj, boolean owned) { 6890 super(nativeObj, owned, 64); 6891 init(); 6892 } 6893 protected void setBuffer(ByteBuffer backing, int offset) { 6894 super.setBuffer(backing, offset, 64); 6895 } 6896 public void read() { 6897 direction = ConcentricRakeDirection.fromValue(backing.getInt(0)); 6898 showSearchArea = backing.getInt(4); 6899 showSearchLines = backing.getInt(8); 6900 showEdgesFound = backing.getInt(12); 6901 showResult = backing.getInt(16); 6902 searchAreaColor.read(); 6903 searchLinesColor.read(); 6904 searchEdgesColor.read(); 6905 resultColor.read(); 6906 long overlayGroupName_addr = getPointer(backing, 36); 6907 if (overlayGroupName_addr == 0) 6908 overlayGroupName = null; 6909 else { 6910 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 6911 while (bb.get() != 0) {} 6912 byte[] bytes = new byte[bb.position()-1]; 6913 getBytes(bb, bytes, 0, bytes.length); 6914 try { 6915 overlayGroupName = new String(bytes, "UTF-8"); 6916 } catch (UnsupportedEncodingException e) { 6917 overlayGroupName = ""; 6918 } 6919 } 6920 6921 edgeOptions.read(); 6922 } 6923 public void write() { 6924 if (direction != null) 6925 backing.putInt(0, direction.getValue()); 6926 backing.putInt(4, showSearchArea); 6927 backing.putInt(8, showSearchLines); 6928 backing.putInt(12, showEdgesFound); 6929 backing.putInt(16, showResult); 6930 searchAreaColor.write(); 6931 searchLinesColor.write(); 6932 searchEdgesColor.write(); 6933 resultColor.write(); 6934 if (overlayGroupName != null) { 6935 byte[] overlayGroupName_bytes; 6936 try { 6937 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 6938 } catch (UnsupportedEncodingException e) { 6939 overlayGroupName_bytes = new byte[0]; 6940 } 6941 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 6942 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 6943 } 6944 putPointer(backing, 36, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 6945 edgeOptions.write(); 6946 } 6947 public int size() { 6948 return 64; 6949 } 6950 } 6951 6952 public static class ConcentricEdgeFitOptions extends DisposedStruct { 6953 public int maxRadius; // Specifies the acceptable distance, in pixels, that a point determined to belong to the circle can be from the perimeter of the circle. 6954 public double stepSize; // The sampling factor that determines the gap between the rake lines. 6955 public RakeProcessType processType; // Method used to process the data extracted for edge detection. 6956 6957 private void init() { 6958 6959 } 6960 public ConcentricEdgeFitOptions() { 6961 super(24); 6962 init(); 6963 } 6964 public ConcentricEdgeFitOptions(int maxRadius, double stepSize, RakeProcessType processType) { 6965 super(24); 6966 this.maxRadius = maxRadius; 6967 this.stepSize = stepSize; 6968 this.processType = processType; 6969 } 6970 protected ConcentricEdgeFitOptions(ByteBuffer backing, int offset) { 6971 super(backing, offset, 24); 6972 init(); 6973 } 6974 protected ConcentricEdgeFitOptions(long nativeObj, boolean owned) { 6975 super(nativeObj, owned, 24); 6976 init(); 6977 } 6978 protected void setBuffer(ByteBuffer backing, int offset) { 6979 super.setBuffer(backing, offset, 24); 6980 } 6981 public void read() { 6982 maxRadius = backing.getInt(0); 6983 stepSize = backing.getDouble(8); 6984 processType = RakeProcessType.fromValue(backing.getInt(16)); 6985 } 6986 public void write() { 6987 backing.putInt(0, maxRadius); 6988 backing.putDouble(8, stepSize); 6989 if (processType != null) 6990 backing.putInt(16, processType.getValue()); 6991 } 6992 public int size() { 6993 return 24; 6994 } 6995 } 6996 6997 public static class FindConcentricEdgeReport extends DisposedStruct { 6998 public PointFloat startPt; // Pixel Coordinates for starting point of the edge. 6999 public PointFloat endPt; // Pixel Coordinates for end point of the edge. 7000 public PointFloat startPtCalibrated; // Real world Coordinates for starting point of the edge. 7001 public PointFloat endPtCalibrated; // Real world Coordinates for end point of the edge. 7002 public double angle; // Angle of the edge found. 7003 public double angleCalibrated; // Calibrated angle of the edge found. 7004 public double straightness; // The straightness value of the detected straight edge. 7005 public double avgStrength; // Average strength of the egde found. 7006 public double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge found. 7007 public int lineFound; // If the edge is found or not. 7008 7009 private void init() { 7010 startPt = new PointFloat(backing, 0); 7011 endPt = new PointFloat(backing, 8); 7012 startPtCalibrated = new PointFloat(backing, 16); 7013 endPtCalibrated = new PointFloat(backing, 24); 7014 } 7015 public FindConcentricEdgeReport() { 7016 super(80); 7017 init(); 7018 } 7019 public FindConcentricEdgeReport(PointFloat startPt, PointFloat endPt, PointFloat startPtCalibrated, PointFloat endPtCalibrated, double angle, double angleCalibrated, double straightness, double avgStrength, double avgSNR, int lineFound) { 7020 super(80); 7021 this.startPt = startPt; 7022 this.endPt = endPt; 7023 this.startPtCalibrated = startPtCalibrated; 7024 this.endPtCalibrated = endPtCalibrated; 7025 this.angle = angle; 7026 this.angleCalibrated = angleCalibrated; 7027 this.straightness = straightness; 7028 this.avgStrength = avgStrength; 7029 this.avgSNR = avgSNR; 7030 this.lineFound = lineFound; 7031 } 7032 protected FindConcentricEdgeReport(ByteBuffer backing, int offset) { 7033 super(backing, offset, 80); 7034 init(); 7035 } 7036 protected FindConcentricEdgeReport(long nativeObj, boolean owned) { 7037 super(nativeObj, owned, 80); 7038 init(); 7039 } 7040 protected void setBuffer(ByteBuffer backing, int offset) { 7041 super.setBuffer(backing, offset, 80); 7042 } 7043 public void read() { 7044 startPt.read(); 7045 endPt.read(); 7046 startPtCalibrated.read(); 7047 endPtCalibrated.read(); 7048 angle = backing.getDouble(32); 7049 angleCalibrated = backing.getDouble(40); 7050 straightness = backing.getDouble(48); 7051 avgStrength = backing.getDouble(56); 7052 avgSNR = backing.getDouble(64); 7053 lineFound = backing.getInt(72); 7054 } 7055 public void write() { 7056 startPt.write(); 7057 endPt.write(); 7058 startPtCalibrated.write(); 7059 endPtCalibrated.write(); 7060 backing.putDouble(32, angle); 7061 backing.putDouble(40, angleCalibrated); 7062 backing.putDouble(48, straightness); 7063 backing.putDouble(56, avgStrength); 7064 backing.putDouble(64, avgSNR); 7065 backing.putInt(72, lineFound); 7066 } 7067 public int size() { 7068 return 80; 7069 } 7070 } 7071 7072 public static class FindCircularEdgeReport extends DisposedStruct { 7073 public PointFloat centerCalibrated; // Real world Coordinates of the Center. 7074 public double radiusCalibrated; // Real world radius of the Circular Edge found. 7075 public PointFloat center; // Pixel Coordinates of the Center. 7076 public double radius; // Radius in pixels of the Circular Edge found. 7077 public double roundness; // The roundness of the calculated circular edge. 7078 public double avgStrength; // Average strength of the egde found. 7079 public double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge found. 7080 public int circleFound; // If the circlular edge is found or not. 7081 7082 private void init() { 7083 centerCalibrated = new PointFloat(backing, 0); 7084 center = new PointFloat(backing, 16); 7085 } 7086 public FindCircularEdgeReport() { 7087 super(64); 7088 init(); 7089 } 7090 public FindCircularEdgeReport(PointFloat centerCalibrated, double radiusCalibrated, PointFloat center, double radius, double roundness, double avgStrength, double avgSNR, int circleFound) { 7091 super(64); 7092 this.centerCalibrated = centerCalibrated; 7093 this.radiusCalibrated = radiusCalibrated; 7094 this.center = center; 7095 this.radius = radius; 7096 this.roundness = roundness; 7097 this.avgStrength = avgStrength; 7098 this.avgSNR = avgSNR; 7099 this.circleFound = circleFound; 7100 } 7101 protected FindCircularEdgeReport(ByteBuffer backing, int offset) { 7102 super(backing, offset, 64); 7103 init(); 7104 } 7105 protected FindCircularEdgeReport(long nativeObj, boolean owned) { 7106 super(nativeObj, owned, 64); 7107 init(); 7108 } 7109 protected void setBuffer(ByteBuffer backing, int offset) { 7110 super.setBuffer(backing, offset, 64); 7111 } 7112 public void read() { 7113 centerCalibrated.read(); 7114 radiusCalibrated = backing.getDouble(8); 7115 center.read(); 7116 radius = backing.getDouble(24); 7117 roundness = backing.getDouble(32); 7118 avgStrength = backing.getDouble(40); 7119 avgSNR = backing.getDouble(48); 7120 circleFound = backing.getInt(56); 7121 } 7122 public void write() { 7123 centerCalibrated.write(); 7124 backing.putDouble(8, radiusCalibrated); 7125 center.write(); 7126 backing.putDouble(24, radius); 7127 backing.putDouble(32, roundness); 7128 backing.putDouble(40, avgStrength); 7129 backing.putDouble(48, avgSNR); 7130 backing.putInt(56, circleFound); 7131 } 7132 public int size() { 7133 return 64; 7134 } 7135 } 7136 7137 public static class WindowSize extends DisposedStruct { 7138 public int x; // Window lenght on X direction. 7139 public int y; // Window lenght on Y direction. 7140 public int stepSize; // Distance between windows. 7141 7142 private void init() { 7143 7144 } 7145 public WindowSize() { 7146 super(12); 7147 init(); 7148 } 7149 public WindowSize(int x, int y, int stepSize) { 7150 super(12); 7151 this.x = x; 7152 this.y = y; 7153 this.stepSize = stepSize; 7154 } 7155 protected WindowSize(ByteBuffer backing, int offset) { 7156 super(backing, offset, 12); 7157 init(); 7158 } 7159 protected WindowSize(long nativeObj, boolean owned) { 7160 super(nativeObj, owned, 12); 7161 init(); 7162 } 7163 protected void setBuffer(ByteBuffer backing, int offset) { 7164 super.setBuffer(backing, offset, 12); 7165 } 7166 public void read() { 7167 x = backing.getInt(0); 7168 y = backing.getInt(4); 7169 stepSize = backing.getInt(8); 7170 } 7171 public void write() { 7172 backing.putInt(0, x); 7173 backing.putInt(4, y); 7174 backing.putInt(8, stepSize); 7175 } 7176 public int size() { 7177 return 12; 7178 } 7179 } 7180 7181 public static class DisplacementVector extends DisposedStruct { 7182 public int x; // length on X direction. 7183 public int y; // length on Y direction. 7184 7185 private void init() { 7186 7187 } 7188 public DisplacementVector() { 7189 super(8); 7190 init(); 7191 } 7192 public DisplacementVector(int x, int y) { 7193 super(8); 7194 this.x = x; 7195 this.y = y; 7196 } 7197 protected DisplacementVector(ByteBuffer backing, int offset) { 7198 super(backing, offset, 8); 7199 init(); 7200 } 7201 protected DisplacementVector(long nativeObj, boolean owned) { 7202 super(nativeObj, owned, 8); 7203 init(); 7204 } 7205 protected void setBuffer(ByteBuffer backing, int offset) { 7206 super.setBuffer(backing, offset, 8); 7207 } 7208 public void read() { 7209 x = backing.getInt(0); 7210 y = backing.getInt(4); 7211 } 7212 public void write() { 7213 backing.putInt(0, x); 7214 backing.putInt(4, y); 7215 } 7216 public int size() { 7217 return 8; 7218 } 7219 } 7220 7221 public static class WaveletOptions extends DisposedStruct { 7222 public WaveletType typeOfWavelet; // Type of wavelet(db, bior. 7223 public float minEnergy; // Minimum Energy in the bands to consider for texture defect detection. 7224 7225 private void init() { 7226 7227 } 7228 public WaveletOptions() { 7229 super(8); 7230 init(); 7231 } 7232 public WaveletOptions(WaveletType typeOfWavelet, double minEnergy) { 7233 super(8); 7234 this.typeOfWavelet = typeOfWavelet; 7235 this.minEnergy = (float)minEnergy; 7236 } 7237 protected WaveletOptions(ByteBuffer backing, int offset) { 7238 super(backing, offset, 8); 7239 init(); 7240 } 7241 protected WaveletOptions(long nativeObj, boolean owned) { 7242 super(nativeObj, owned, 8); 7243 init(); 7244 } 7245 protected void setBuffer(ByteBuffer backing, int offset) { 7246 super.setBuffer(backing, offset, 8); 7247 } 7248 public void read() { 7249 typeOfWavelet = WaveletType.fromValue(backing.getInt(0)); 7250 minEnergy = backing.getFloat(4); 7251 } 7252 public void write() { 7253 if (typeOfWavelet != null) 7254 backing.putInt(0, typeOfWavelet.getValue()); 7255 backing.putFloat(4, minEnergy); 7256 } 7257 public int size() { 7258 return 8; 7259 } 7260 } 7261 7262 public static class CooccurrenceOptions extends DisposedStruct { 7263 public int level; // Level/size of matrix. 7264 public DisplacementVector displacement; // Displacemnet between pixels to accumulate the matrix. 7265 7266 private void init() { 7267 displacement = new DisplacementVector(backing, 4); 7268 } 7269 public CooccurrenceOptions() { 7270 super(12); 7271 init(); 7272 } 7273 public CooccurrenceOptions(int level, DisplacementVector displacement) { 7274 super(12); 7275 this.level = level; 7276 this.displacement = displacement; 7277 } 7278 protected CooccurrenceOptions(ByteBuffer backing, int offset) { 7279 super(backing, offset, 12); 7280 init(); 7281 } 7282 protected CooccurrenceOptions(long nativeObj, boolean owned) { 7283 super(nativeObj, owned, 12); 7284 init(); 7285 } 7286 protected void setBuffer(ByteBuffer backing, int offset) { 7287 super.setBuffer(backing, offset, 12); 7288 } 7289 public void read() { 7290 level = backing.getInt(0); 7291 displacement.read(); 7292 } 7293 public void write() { 7294 backing.putInt(0, level); 7295 displacement.write(); 7296 } 7297 public int size() { 7298 return 12; 7299 } 7300 } 7301 7302 public static class ParticleClassifierLocalThresholdOptions extends DisposedStruct { 7303 public LocalThresholdMethod method; // Specifies the local thresholding method the function uses. 7304 public ParticleType particleType; // Specifies what kind of particles to look for. 7305 public int windowWidth; // The width of the rectangular window around the pixel on which the function performs the local threshold. 7306 public int windowHeight; // The height of the rectangular window around the pixel on which the function performs the local threshold. 7307 public double deviationWeight; // Specifies the k constant used in the Niblack local thresholding algorithm, which determines the weight applied to the variance calculation. 7308 7309 private void init() { 7310 7311 } 7312 public ParticleClassifierLocalThresholdOptions() { 7313 super(24); 7314 init(); 7315 } 7316 public ParticleClassifierLocalThresholdOptions(LocalThresholdMethod method, ParticleType particleType, int windowWidth, int windowHeight, double deviationWeight) { 7317 super(24); 7318 this.method = method; 7319 this.particleType = particleType; 7320 this.windowWidth = windowWidth; 7321 this.windowHeight = windowHeight; 7322 this.deviationWeight = deviationWeight; 7323 } 7324 protected ParticleClassifierLocalThresholdOptions(ByteBuffer backing, int offset) { 7325 super(backing, offset, 24); 7326 init(); 7327 } 7328 protected ParticleClassifierLocalThresholdOptions(long nativeObj, boolean owned) { 7329 super(nativeObj, owned, 24); 7330 init(); 7331 } 7332 protected void setBuffer(ByteBuffer backing, int offset) { 7333 super.setBuffer(backing, offset, 24); 7334 } 7335 public void read() { 7336 method = LocalThresholdMethod.fromValue(backing.getInt(0)); 7337 particleType = ParticleType.fromValue(backing.getInt(4)); 7338 windowWidth = backing.getInt(8); 7339 windowHeight = backing.getInt(12); 7340 deviationWeight = backing.getDouble(16); 7341 } 7342 public void write() { 7343 if (method != null) 7344 backing.putInt(0, method.getValue()); 7345 if (particleType != null) 7346 backing.putInt(4, particleType.getValue()); 7347 backing.putInt(8, windowWidth); 7348 backing.putInt(12, windowHeight); 7349 backing.putDouble(16, deviationWeight); 7350 } 7351 public int size() { 7352 return 24; 7353 } 7354 } 7355 7356 public static class RangeFloat extends DisposedStruct { 7357 public float minValue; // The minimum value of the range. 7358 public float maxValue; // The maximum value of the range. 7359 7360 private void init() { 7361 7362 } 7363 public RangeFloat() { 7364 super(8); 7365 init(); 7366 } 7367 public RangeFloat(double minValue, double maxValue) { 7368 super(8); 7369 this.minValue = (float)minValue; 7370 this.maxValue = (float)maxValue; 7371 } 7372 protected RangeFloat(ByteBuffer backing, int offset) { 7373 super(backing, offset, 8); 7374 init(); 7375 } 7376 protected RangeFloat(long nativeObj, boolean owned) { 7377 super(nativeObj, owned, 8); 7378 init(); 7379 } 7380 protected void setBuffer(ByteBuffer backing, int offset) { 7381 super.setBuffer(backing, offset, 8); 7382 } 7383 public void read() { 7384 minValue = backing.getFloat(0); 7385 maxValue = backing.getFloat(4); 7386 } 7387 public void write() { 7388 backing.putFloat(0, minValue); 7389 backing.putFloat(4, maxValue); 7390 } 7391 public int size() { 7392 return 8; 7393 } 7394 } 7395 7396 public static class ParticleClassifierAutoThresholdOptions extends DisposedStruct { 7397 public ThresholdMethod method; // The method for binary thresholding, which specifies how to calculate the classes. 7398 public ParticleType particleType; // Specifies what kind of particles to look for. 7399 public RangeFloat limits; // The limits on the automatic threshold range. 7400 7401 private void init() { 7402 limits = new RangeFloat(backing, 8); 7403 } 7404 public ParticleClassifierAutoThresholdOptions() { 7405 super(16); 7406 init(); 7407 } 7408 public ParticleClassifierAutoThresholdOptions(ThresholdMethod method, ParticleType particleType, RangeFloat limits) { 7409 super(16); 7410 this.method = method; 7411 this.particleType = particleType; 7412 this.limits = limits; 7413 } 7414 protected ParticleClassifierAutoThresholdOptions(ByteBuffer backing, int offset) { 7415 super(backing, offset, 16); 7416 init(); 7417 } 7418 protected ParticleClassifierAutoThresholdOptions(long nativeObj, boolean owned) { 7419 super(nativeObj, owned, 16); 7420 init(); 7421 } 7422 protected void setBuffer(ByteBuffer backing, int offset) { 7423 super.setBuffer(backing, offset, 16); 7424 } 7425 public void read() { 7426 method = ThresholdMethod.fromValue(backing.getInt(0)); 7427 particleType = ParticleType.fromValue(backing.getInt(4)); 7428 limits.read(); 7429 } 7430 public void write() { 7431 if (method != null) 7432 backing.putInt(0, method.getValue()); 7433 if (particleType != null) 7434 backing.putInt(4, particleType.getValue()); 7435 limits.write(); 7436 } 7437 public int size() { 7438 return 16; 7439 } 7440 } 7441 7442 public static class ParticleClassifierPreprocessingOptions2 extends DisposedStruct { 7443 public ParticleClassifierThresholdType thresholdType; // The type of threshold to perform on the image. 7444 public RangeFloat manualThresholdRange; // The range of pixels to keep if manually thresholding the image. 7445 public ParticleClassifierAutoThresholdOptions autoThresholdOptions; // The options used to auto threshold the image. 7446 public ParticleClassifierLocalThresholdOptions localThresholdOptions; // The options used to local threshold the image. 7447 public int rejectBorder; // Set this element to TRUE to reject border particles. 7448 public int numErosions; // The number of erosions to perform. 7449 7450 private void init() { 7451 manualThresholdRange = new RangeFloat(backing, 4); 7452 autoThresholdOptions = new ParticleClassifierAutoThresholdOptions(backing, 12); 7453 localThresholdOptions = new ParticleClassifierLocalThresholdOptions(backing, 32); 7454 } 7455 public ParticleClassifierPreprocessingOptions2() { 7456 super(64); 7457 init(); 7458 } 7459 public ParticleClassifierPreprocessingOptions2(ParticleClassifierThresholdType thresholdType, RangeFloat manualThresholdRange, ParticleClassifierAutoThresholdOptions autoThresholdOptions, ParticleClassifierLocalThresholdOptions localThresholdOptions, int rejectBorder, int numErosions) { 7460 super(64); 7461 this.thresholdType = thresholdType; 7462 this.manualThresholdRange = manualThresholdRange; 7463 this.autoThresholdOptions = autoThresholdOptions; 7464 this.localThresholdOptions = localThresholdOptions; 7465 this.rejectBorder = rejectBorder; 7466 this.numErosions = numErosions; 7467 } 7468 protected ParticleClassifierPreprocessingOptions2(ByteBuffer backing, int offset) { 7469 super(backing, offset, 64); 7470 init(); 7471 } 7472 protected ParticleClassifierPreprocessingOptions2(long nativeObj, boolean owned) { 7473 super(nativeObj, owned, 64); 7474 init(); 7475 } 7476 protected void setBuffer(ByteBuffer backing, int offset) { 7477 super.setBuffer(backing, offset, 64); 7478 } 7479 public void read() { 7480 thresholdType = ParticleClassifierThresholdType.fromValue(backing.getInt(0)); 7481 manualThresholdRange.read(); 7482 autoThresholdOptions.read(); 7483 localThresholdOptions.read(); 7484 rejectBorder = backing.getInt(56); 7485 numErosions = backing.getInt(60); 7486 } 7487 public void write() { 7488 if (thresholdType != null) 7489 backing.putInt(0, thresholdType.getValue()); 7490 manualThresholdRange.write(); 7491 autoThresholdOptions.write(); 7492 localThresholdOptions.write(); 7493 backing.putInt(56, rejectBorder); 7494 backing.putInt(60, numErosions); 7495 } 7496 public int size() { 7497 return 64; 7498 } 7499 } 7500 7501 public static class MeasureParticlesReport extends DisposedStruct { 7502 public int numParticles; // The number of particles on which measurements were taken. 7503 public int numMeasurements; // The number of measurements taken. 7504 7505 private void init() { 7506 7507 } 7508 public MeasureParticlesReport() { 7509 super(16); 7510 init(); 7511 } 7512 public MeasureParticlesReport(int numParticles, int numMeasurements) { 7513 super(16); 7514 this.numParticles = numParticles; 7515 this.numMeasurements = numMeasurements; 7516 } 7517 protected MeasureParticlesReport(ByteBuffer backing, int offset) { 7518 super(backing, offset, 16); 7519 init(); 7520 } 7521 protected MeasureParticlesReport(long nativeObj, boolean owned) { 7522 super(nativeObj, owned, 16); 7523 init(); 7524 } 7525 protected void setBuffer(ByteBuffer backing, int offset) { 7526 super.setBuffer(backing, offset, 16); 7527 } 7528 public void read() { 7529 numParticles = backing.getInt(8); 7530 numMeasurements = backing.getInt(12); 7531 } 7532 public void write() { 7533 backing.putInt(8, numParticles); 7534 backing.putInt(12, numMeasurements); 7535 } 7536 public int size() { 7537 return 16; 7538 } 7539 } 7540 7541 public static class GeometricPatternMatch3 extends DisposedStruct { 7542 public PointFloat position; // The location of the origin of the template in the match. 7543 public float rotation; // The rotation of the match relative to the template image, in degrees. 7544 public float scale; // The size of the match relative to the size of the template image, expressed as a percentage. 7545 public float score; // The accuracy of the match. 7546 public PointFloat[] corner; // An array of four points describing the rectangle surrounding the template image. 7547 public int inverse; // This element is TRUE if the match is an inverse of the template image. 7548 public float occlusion; // The percentage of the match that is occluded. 7549 public float templateMatchCurveScore; // The accuracy of the match obtained by comparing the template curves to the curves in the match region. 7550 public float matchTemplateCurveScore; // The accuracy of the match obtained by comparing the curves in the match region to the template curves. 7551 public float correlationScore; // The accuracy of the match obtained by comparing the template image to the match region using a correlation metric that compares the two regions as a function of their pixel values. 7552 public PointFloat calibratedPosition; // The location of the origin of the template in the match. 7553 public float calibratedRotation; // The rotation of the match relative to the template image, in degrees. 7554 public PointFloat[] calibratedCorner; // An array of four points describing the rectangle surrounding the template image. 7555 7556 private void init() { 7557 position = new PointFloat(backing, 0); 7558 corner = new PointFloat[4]; 7559 7560 for (int i=0, off=20; i<4; i++, off += 8) 7561 corner[i] = new PointFloat(backing, off); 7562 calibratedPosition = new PointFloat(backing, 72); 7563 calibratedCorner = new PointFloat[4]; 7564 7565 for (int i=0, off=84; i<4; i++, off += 8) 7566 calibratedCorner[i] = new PointFloat(backing, off); 7567 } 7568 public GeometricPatternMatch3() { 7569 super(116); 7570 init(); 7571 } 7572 public GeometricPatternMatch3(PointFloat position, double rotation, double scale, double score, PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, double matchTemplateCurveScore, double correlationScore, PointFloat calibratedPosition, double calibratedRotation, PointFloat[] calibratedCorner) { 7573 super(116); 7574 this.position = position; 7575 this.rotation = (float)rotation; 7576 this.scale = (float)scale; 7577 this.score = (float)score; 7578 this.corner = corner; 7579 this.inverse = inverse; 7580 this.occlusion = (float)occlusion; 7581 this.templateMatchCurveScore = (float)templateMatchCurveScore; 7582 this.matchTemplateCurveScore = (float)matchTemplateCurveScore; 7583 this.correlationScore = (float)correlationScore; 7584 this.calibratedPosition = calibratedPosition; 7585 this.calibratedRotation = (float)calibratedRotation; 7586 this.calibratedCorner = calibratedCorner; 7587 } 7588 protected GeometricPatternMatch3(ByteBuffer backing, int offset) { 7589 super(backing, offset, 116); 7590 init(); 7591 } 7592 protected GeometricPatternMatch3(long nativeObj, boolean owned) { 7593 super(nativeObj, owned, 116); 7594 init(); 7595 } 7596 protected void setBuffer(ByteBuffer backing, int offset) { 7597 super.setBuffer(backing, offset, 116); 7598 } 7599 public void read() { 7600 position.read(); 7601 rotation = backing.getFloat(8); 7602 scale = backing.getFloat(12); 7603 score = backing.getFloat(16); 7604 for (PointFloat it : corner) { 7605 it.read(); 7606 } 7607 inverse = backing.getInt(52); 7608 occlusion = backing.getFloat(56); 7609 templateMatchCurveScore = backing.getFloat(60); 7610 matchTemplateCurveScore = backing.getFloat(64); 7611 correlationScore = backing.getFloat(68); 7612 calibratedPosition.read(); 7613 calibratedRotation = backing.getFloat(80); 7614 for (PointFloat it : calibratedCorner) { 7615 it.read(); 7616 } 7617 } 7618 public void write() { 7619 position.write(); 7620 backing.putFloat(8, rotation); 7621 backing.putFloat(12, scale); 7622 backing.putFloat(16, score); 7623 for (PointFloat it : corner) { 7624 it.write(); 7625 } 7626 backing.putInt(52, inverse); 7627 backing.putFloat(56, occlusion); 7628 backing.putFloat(60, templateMatchCurveScore); 7629 backing.putFloat(64, matchTemplateCurveScore); 7630 backing.putFloat(68, correlationScore); 7631 calibratedPosition.write(); 7632 backing.putFloat(80, calibratedRotation); 7633 for (PointFloat it : calibratedCorner) { 7634 it.write(); 7635 } 7636 } 7637 public int size() { 7638 return 116; 7639 } 7640 } 7641 7642 public static class MatchGeometricPatternAdvancedOptions3 extends DisposedStruct { 7643 public int subpixelIterations; // Specifies the maximum number of incremental improvements used to refine matches with subpixel information. 7644 public double subpixelTolerance; // Specifies the maximum amount of change, in pixels, between consecutive incremental improvements in the match position before the function stops refining the match position. 7645 public int initialMatchListLength; // Specifies the maximum size of the match list. 7646 public int targetTemplateCurveScore; // Set this element to TRUE to specify that the function should calculate the match curve to template curve score and return it for each match result. 7647 public int correlationScore; // Set this element to TRUE to specify that the function should calculate the correlation score and return it for each match result. 7648 public double minMatchSeparationDistance; // Specifies the minimum separation distance, in pixels, between the origins of two matches that have unique positions. 7649 public double minMatchSeparationAngle; // Specifies the minimum angular difference, in degrees, between two matches that have unique angles. 7650 public double minMatchSeparationScale; // Specifies the minimum difference in scale, expressed as a percentage, between two matches that have unique scales. 7651 public double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed as a percentage, allowed between the bounding rectangles of two unique matches. 7652 public int coarseResult; // Specifies whether you want the function to spend less time accurately estimating the location of a match. 7653 public int enableCalibrationSupport; // Set this element to TRUE to specify the algorithm treat the inspection image as a calibrated image. 7654 public ContrastMode enableContrastReversal; // Use this element to specify the contrast of the matches to search for in the image. 7655 public GeometricMatchingSearchStrategy matchStrategy; // Specifies the aggressiveness of the search strategy. 7656 public int refineMatchFactor; // Specifies the factor that is applied to the number of matches requested by the user to determine the number of matches that are refined at the initial matching stage. 7657 public int subpixelMatchFactor; // Specifies the factor that is applied to the number of matches requested by the user to determine the number of matches that are evaluated at the final subpixel matching stage. 7658 7659 private void init() { 7660 7661 } 7662 public MatchGeometricPatternAdvancedOptions3() { 7663 super(88); 7664 init(); 7665 } 7666 public MatchGeometricPatternAdvancedOptions3(int subpixelIterations, double subpixelTolerance, int initialMatchListLength, int targetTemplateCurveScore, int correlationScore, double minMatchSeparationDistance, double minMatchSeparationAngle, double minMatchSeparationScale, double maxMatchOverlap, int coarseResult, int enableCalibrationSupport, ContrastMode enableContrastReversal, GeometricMatchingSearchStrategy matchStrategy, int refineMatchFactor, int subpixelMatchFactor) { 7667 super(88); 7668 this.subpixelIterations = subpixelIterations; 7669 this.subpixelTolerance = subpixelTolerance; 7670 this.initialMatchListLength = initialMatchListLength; 7671 this.targetTemplateCurveScore = targetTemplateCurveScore; 7672 this.correlationScore = correlationScore; 7673 this.minMatchSeparationDistance = minMatchSeparationDistance; 7674 this.minMatchSeparationAngle = minMatchSeparationAngle; 7675 this.minMatchSeparationScale = minMatchSeparationScale; 7676 this.maxMatchOverlap = maxMatchOverlap; 7677 this.coarseResult = coarseResult; 7678 this.enableCalibrationSupport = enableCalibrationSupport; 7679 this.enableContrastReversal = enableContrastReversal; 7680 this.matchStrategy = matchStrategy; 7681 this.refineMatchFactor = refineMatchFactor; 7682 this.subpixelMatchFactor = subpixelMatchFactor; 7683 } 7684 protected MatchGeometricPatternAdvancedOptions3(ByteBuffer backing, int offset) { 7685 super(backing, offset, 88); 7686 init(); 7687 } 7688 protected MatchGeometricPatternAdvancedOptions3(long nativeObj, boolean owned) { 7689 super(nativeObj, owned, 88); 7690 init(); 7691 } 7692 protected void setBuffer(ByteBuffer backing, int offset) { 7693 super.setBuffer(backing, offset, 88); 7694 } 7695 public void read() { 7696 subpixelIterations = backing.getInt(0); 7697 subpixelTolerance = backing.getDouble(8); 7698 initialMatchListLength = backing.getInt(16); 7699 targetTemplateCurveScore = backing.getInt(20); 7700 correlationScore = backing.getInt(24); 7701 minMatchSeparationDistance = backing.getDouble(32); 7702 minMatchSeparationAngle = backing.getDouble(40); 7703 minMatchSeparationScale = backing.getDouble(48); 7704 maxMatchOverlap = backing.getDouble(56); 7705 coarseResult = backing.getInt(64); 7706 enableCalibrationSupport = backing.getInt(68); 7707 enableContrastReversal = ContrastMode.fromValue(backing.getInt(72)); 7708 matchStrategy = GeometricMatchingSearchStrategy.fromValue(backing.getInt(76)); 7709 refineMatchFactor = backing.getInt(80); 7710 subpixelMatchFactor = backing.getInt(84); 7711 } 7712 public void write() { 7713 backing.putInt(0, subpixelIterations); 7714 backing.putDouble(8, subpixelTolerance); 7715 backing.putInt(16, initialMatchListLength); 7716 backing.putInt(20, targetTemplateCurveScore); 7717 backing.putInt(24, correlationScore); 7718 backing.putDouble(32, minMatchSeparationDistance); 7719 backing.putDouble(40, minMatchSeparationAngle); 7720 backing.putDouble(48, minMatchSeparationScale); 7721 backing.putDouble(56, maxMatchOverlap); 7722 backing.putInt(64, coarseResult); 7723 backing.putInt(68, enableCalibrationSupport); 7724 if (enableContrastReversal != null) 7725 backing.putInt(72, enableContrastReversal.getValue()); 7726 if (matchStrategy != null) 7727 backing.putInt(76, matchStrategy.getValue()); 7728 backing.putInt(80, refineMatchFactor); 7729 backing.putInt(84, subpixelMatchFactor); 7730 } 7731 public int size() { 7732 return 88; 7733 } 7734 } 7735 7736 public static class ColorOptions extends DisposedStruct { 7737 public ColorClassificationResolution colorClassificationResolution; // Specifies the color resolution of the classifier. 7738 public int useLuminance; // Specifies if the luminance band is going to be used in the feature vector. 7739 public ColorMode colorMode; // Specifies the color mode of the classifier. 7740 7741 private void init() { 7742 7743 } 7744 public ColorOptions() { 7745 super(12); 7746 init(); 7747 } 7748 public ColorOptions(ColorClassificationResolution colorClassificationResolution, int useLuminance, ColorMode colorMode) { 7749 super(12); 7750 this.colorClassificationResolution = colorClassificationResolution; 7751 this.useLuminance = useLuminance; 7752 this.colorMode = colorMode; 7753 } 7754 protected ColorOptions(ByteBuffer backing, int offset) { 7755 super(backing, offset, 12); 7756 init(); 7757 } 7758 protected ColorOptions(long nativeObj, boolean owned) { 7759 super(nativeObj, owned, 12); 7760 init(); 7761 } 7762 protected void setBuffer(ByteBuffer backing, int offset) { 7763 super.setBuffer(backing, offset, 12); 7764 } 7765 public void read() { 7766 colorClassificationResolution = ColorClassificationResolution.fromValue(backing.getInt(0)); 7767 useLuminance = backing.getInt(4); 7768 colorMode = ColorMode.fromValue(backing.getInt(8)); 7769 } 7770 public void write() { 7771 if (colorClassificationResolution != null) 7772 backing.putInt(0, colorClassificationResolution.getValue()); 7773 backing.putInt(4, useLuminance); 7774 if (colorMode != null) 7775 backing.putInt(8, colorMode.getValue()); 7776 } 7777 public int size() { 7778 return 12; 7779 } 7780 } 7781 7782 public static class SampleScore extends DisposedStruct { 7783 public String className; // The name of the class. 7784 public float distance; // The distance from the item to this class. 7785 public int index; // index of this sample. 7786 private ByteBuffer className_buf; 7787 7788 private void init() { 7789 7790 } 7791 public SampleScore() { 7792 super(12); 7793 init(); 7794 } 7795 public SampleScore(String className, double distance, int index) { 7796 super(12); 7797 this.className = className; 7798 this.distance = (float)distance; 7799 this.index = index; 7800 } 7801 protected SampleScore(ByteBuffer backing, int offset) { 7802 super(backing, offset, 12); 7803 init(); 7804 } 7805 protected SampleScore(long nativeObj, boolean owned) { 7806 super(nativeObj, owned, 12); 7807 init(); 7808 } 7809 protected void setBuffer(ByteBuffer backing, int offset) { 7810 super.setBuffer(backing, offset, 12); 7811 } 7812 public void read() { 7813 long className_addr = getPointer(backing, 0); 7814 if (className_addr == 0) 7815 className = null; 7816 else { 7817 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 7818 while (bb.get() != 0) {} 7819 byte[] bytes = new byte[bb.position()-1]; 7820 getBytes(bb, bytes, 0, bytes.length); 7821 try { 7822 className = new String(bytes, "UTF-8"); 7823 } catch (UnsupportedEncodingException e) { 7824 className = ""; 7825 } 7826 } 7827 7828 distance = backing.getFloat(4); 7829 index = backing.getInt(8); 7830 } 7831 public void write() { 7832 if (className != null) { 7833 byte[] className_bytes; 7834 try { 7835 className_bytes = className.getBytes("UTF-8"); 7836 } catch (UnsupportedEncodingException e) { 7837 className_bytes = new byte[0]; 7838 } 7839 className_buf = ByteBuffer.allocateDirect(className_bytes.length+1); 7840 putBytes(className_buf, className_bytes, 0, className_bytes.length).put(className_bytes.length, (byte)0); 7841 } 7842 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 7843 backing.putFloat(4, distance); 7844 backing.putInt(8, index); 7845 } 7846 public int size() { 7847 return 12; 7848 } 7849 } 7850 7851 public static class ClassifierReportAdvanced extends DisposedStruct { 7852 public String bestClassName; // The name of the best class for the sample. 7853 public float classificationScore; // The similarity of the sample and the two closest classes in the classifier. 7854 public float identificationScore; // The similarity of the sample and the assigned class. 7855 public ClassScore[] allScores; // All classes and their scores. 7856 public SampleScore[] sampleScores; // All samples and their scores. 7857 private ByteBuffer bestClassName_buf; 7858 private ByteBuffer allScores_buf; 7859 private ByteBuffer sampleScores_buf; 7860 7861 private void init() { 7862 allScores = new ClassScore[0]; 7863 sampleScores = new SampleScore[0]; 7864 } 7865 public ClassifierReportAdvanced() { 7866 super(28); 7867 init(); 7868 } 7869 public ClassifierReportAdvanced(String bestClassName, double classificationScore, double identificationScore, ClassScore[] allScores, SampleScore[] sampleScores) { 7870 super(28); 7871 this.bestClassName = bestClassName; 7872 this.classificationScore = (float)classificationScore; 7873 this.identificationScore = (float)identificationScore; 7874 this.allScores = allScores; 7875 this.sampleScores = sampleScores; 7876 } 7877 protected ClassifierReportAdvanced(ByteBuffer backing, int offset) { 7878 super(backing, offset, 28); 7879 init(); 7880 } 7881 protected ClassifierReportAdvanced(long nativeObj, boolean owned) { 7882 super(nativeObj, owned, 28); 7883 init(); 7884 } 7885 protected void setBuffer(ByteBuffer backing, int offset) { 7886 super.setBuffer(backing, offset, 28); 7887 } 7888 public void read() { 7889 long bestClassName_addr = getPointer(backing, 0); 7890 if (bestClassName_addr == 0) 7891 bestClassName = null; 7892 else { 7893 ByteBuffer bb = newDirectByteBuffer(bestClassName_addr, 1000); // FIXME 7894 while (bb.get() != 0) {} 7895 byte[] bytes = new byte[bb.position()-1]; 7896 getBytes(bb, bytes, 0, bytes.length); 7897 try { 7898 bestClassName = new String(bytes, "UTF-8"); 7899 } catch (UnsupportedEncodingException e) { 7900 bestClassName = ""; 7901 } 7902 } 7903 7904 classificationScore = backing.getFloat(4); 7905 identificationScore = backing.getFloat(8); 7906 int allScores_allScoresSize = backing.getInt(16); 7907 long allScores_addr = getPointer(backing, 12); 7908 allScores = new ClassScore[allScores_allScoresSize]; 7909 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 7910 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize*8); 7911 for (int i=0, off=0; i<allScores_allScoresSize; i++, off += 8) { 7912 allScores[i] = new ClassScore(bb, off); 7913 allScores[i].read(); 7914 } 7915 } 7916 int sampleScores_sampleScoresSize = backing.getInt(24); 7917 long sampleScores_addr = getPointer(backing, 20); 7918 sampleScores = new SampleScore[sampleScores_sampleScoresSize]; 7919 if (sampleScores_sampleScoresSize > 0 && sampleScores_addr != 0) { 7920 ByteBuffer bb = newDirectByteBuffer(sampleScores_addr, sampleScores_sampleScoresSize*12); 7921 for (int i=0, off=0; i<sampleScores_sampleScoresSize; i++, off += 12) { 7922 sampleScores[i] = new SampleScore(bb, off); 7923 sampleScores[i].read(); 7924 } 7925 } 7926 } 7927 public void write() { 7928 if (bestClassName != null) { 7929 byte[] bestClassName_bytes; 7930 try { 7931 bestClassName_bytes = bestClassName.getBytes("UTF-8"); 7932 } catch (UnsupportedEncodingException e) { 7933 bestClassName_bytes = new byte[0]; 7934 } 7935 bestClassName_buf = ByteBuffer.allocateDirect(bestClassName_bytes.length+1); 7936 putBytes(bestClassName_buf, bestClassName_bytes, 0, bestClassName_bytes.length).put(bestClassName_bytes.length, (byte)0); 7937 } 7938 putPointer(backing, 0, bestClassName == null ? 0 : getByteBufferAddress(bestClassName_buf)); 7939 backing.putFloat(4, classificationScore); 7940 backing.putFloat(8, identificationScore); 7941 allScores_buf = ByteBuffer.allocateDirect(allScores.length*8).order(ByteOrder.nativeOrder()); 7942 for (int i=0, off=0; i<allScores.length; i++, off += 8) { 7943 allScores[i].setBuffer(allScores_buf, off); 7944 allScores[i].write(); 7945 } 7946 backing.putInt(16, allScores.length); 7947 putPointer(backing, 12, allScores_buf); 7948 sampleScores_buf = ByteBuffer.allocateDirect(sampleScores.length*12).order(ByteOrder.nativeOrder()); 7949 for (int i=0, off=0; i<sampleScores.length; i++, off += 12) { 7950 sampleScores[i].setBuffer(sampleScores_buf, off); 7951 sampleScores[i].write(); 7952 } 7953 backing.putInt(24, sampleScores.length); 7954 putPointer(backing, 20, sampleScores_buf); 7955 } 7956 public int size() { 7957 return 28; 7958 } 7959 } 7960 7961 public static class LearnGeometricPatternAdvancedOptions2 extends DisposedStruct { 7962 public double minScaleFactor; // Specifies the minimum scale factor that the template is learned for. 7963 public double maxScaleFactor; // Specifies the maximum scale factor the template is learned for. 7964 public double minRotationAngleValue; // Specifies the minimum rotation angle the template is learned for. 7965 public double maxRotationAngleValue; // Specifies the maximum rotation angle the template is learned for. 7966 public int imageSamplingFactor; // Specifies the factor that is used to subsample the template and the image for the initial matching phase. 7967 7968 private void init() { 7969 7970 } 7971 public LearnGeometricPatternAdvancedOptions2() { 7972 super(40); 7973 init(); 7974 } 7975 public LearnGeometricPatternAdvancedOptions2(double minScaleFactor, double maxScaleFactor, double minRotationAngleValue, double maxRotationAngleValue, int imageSamplingFactor) { 7976 super(40); 7977 this.minScaleFactor = minScaleFactor; 7978 this.maxScaleFactor = maxScaleFactor; 7979 this.minRotationAngleValue = minRotationAngleValue; 7980 this.maxRotationAngleValue = maxRotationAngleValue; 7981 this.imageSamplingFactor = imageSamplingFactor; 7982 } 7983 protected LearnGeometricPatternAdvancedOptions2(ByteBuffer backing, int offset) { 7984 super(backing, offset, 40); 7985 init(); 7986 } 7987 protected LearnGeometricPatternAdvancedOptions2(long nativeObj, boolean owned) { 7988 super(nativeObj, owned, 40); 7989 init(); 7990 } 7991 protected void setBuffer(ByteBuffer backing, int offset) { 7992 super.setBuffer(backing, offset, 40); 7993 } 7994 public void read() { 7995 minScaleFactor = backing.getDouble(0); 7996 maxScaleFactor = backing.getDouble(8); 7997 minRotationAngleValue = backing.getDouble(16); 7998 maxRotationAngleValue = backing.getDouble(24); 7999 imageSamplingFactor = backing.getInt(32); 8000 } 8001 public void write() { 8002 backing.putDouble(0, minScaleFactor); 8003 backing.putDouble(8, maxScaleFactor); 8004 backing.putDouble(16, minRotationAngleValue); 8005 backing.putDouble(24, maxRotationAngleValue); 8006 backing.putInt(32, imageSamplingFactor); 8007 } 8008 public int size() { 8009 return 40; 8010 } 8011 } 8012 8013 public static class ParticleFilterOptions2 extends DisposedStruct { 8014 public int rejectMatches; // Set this parameter to TRUE to transfer only those particles that do not meet all the criteria. 8015 public int rejectBorder; // Set this element to TRUE to reject border particles. 8016 public int fillHoles; // Set this element to TRUE to fill holes in particles. 8017 public int connectivity8; // Set this parameter to TRUE to use connectivity-8 to determine whether particles are touching. 8018 8019 private void init() { 8020 8021 } 8022 public ParticleFilterOptions2() { 8023 super(16); 8024 init(); 8025 } 8026 public ParticleFilterOptions2(int rejectMatches, int rejectBorder, int fillHoles, int connectivity8) { 8027 super(16); 8028 this.rejectMatches = rejectMatches; 8029 this.rejectBorder = rejectBorder; 8030 this.fillHoles = fillHoles; 8031 this.connectivity8 = connectivity8; 8032 } 8033 protected ParticleFilterOptions2(ByteBuffer backing, int offset) { 8034 super(backing, offset, 16); 8035 init(); 8036 } 8037 protected ParticleFilterOptions2(long nativeObj, boolean owned) { 8038 super(nativeObj, owned, 16); 8039 init(); 8040 } 8041 protected void setBuffer(ByteBuffer backing, int offset) { 8042 super.setBuffer(backing, offset, 16); 8043 } 8044 public void read() { 8045 rejectMatches = backing.getInt(0); 8046 rejectBorder = backing.getInt(4); 8047 fillHoles = backing.getInt(8); 8048 connectivity8 = backing.getInt(12); 8049 } 8050 public void write() { 8051 backing.putInt(0, rejectMatches); 8052 backing.putInt(4, rejectBorder); 8053 backing.putInt(8, fillHoles); 8054 backing.putInt(12, connectivity8); 8055 } 8056 public int size() { 8057 return 16; 8058 } 8059 } 8060 8061 public static class FindEdgeOptions2 extends DisposedStruct { 8062 public RakeDirection direction; // The direction to search in the ROI. 8063 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 8064 public int showSearchLines; // If TRUE, the function overlays the search lines used to locate the edges on the image. 8065 public int showEdgesFound; // If TRUE, the function overlays the locations of the edges found on the image. 8066 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 8067 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 8068 public RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay the search lines. 8069 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay the search edges. 8070 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 8071 public String overlayGroupName; // Specifies the overlay group name to assign to the overlays. 8072 public EdgeOptions2 edgeOptions; // Specifies the edge detection options along a single search line. 8073 private ByteBuffer overlayGroupName_buf; 8074 8075 private void init() { 8076 searchAreaColor = new RGBValue(backing, 20); 8077 searchLinesColor = new RGBValue(backing, 24); 8078 searchEdgesColor = new RGBValue(backing, 28); 8079 resultColor = new RGBValue(backing, 32); 8080 edgeOptions = new EdgeOptions2(backing, 40); 8081 } 8082 public FindEdgeOptions2() { 8083 super(64); 8084 init(); 8085 } 8086 public FindEdgeOptions2(RakeDirection direction, int showSearchArea, int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, EdgeOptions2 edgeOptions) { 8087 super(64); 8088 this.direction = direction; 8089 this.showSearchArea = showSearchArea; 8090 this.showSearchLines = showSearchLines; 8091 this.showEdgesFound = showEdgesFound; 8092 this.showResult = showResult; 8093 this.searchAreaColor = searchAreaColor; 8094 this.searchLinesColor = searchLinesColor; 8095 this.searchEdgesColor = searchEdgesColor; 8096 this.resultColor = resultColor; 8097 this.overlayGroupName = overlayGroupName; 8098 this.edgeOptions = edgeOptions; 8099 } 8100 protected FindEdgeOptions2(ByteBuffer backing, int offset) { 8101 super(backing, offset, 64); 8102 init(); 8103 } 8104 protected FindEdgeOptions2(long nativeObj, boolean owned) { 8105 super(nativeObj, owned, 64); 8106 init(); 8107 } 8108 protected void setBuffer(ByteBuffer backing, int offset) { 8109 super.setBuffer(backing, offset, 64); 8110 } 8111 public void read() { 8112 direction = RakeDirection.fromValue(backing.getInt(0)); 8113 showSearchArea = backing.getInt(4); 8114 showSearchLines = backing.getInt(8); 8115 showEdgesFound = backing.getInt(12); 8116 showResult = backing.getInt(16); 8117 searchAreaColor.read(); 8118 searchLinesColor.read(); 8119 searchEdgesColor.read(); 8120 resultColor.read(); 8121 long overlayGroupName_addr = getPointer(backing, 36); 8122 if (overlayGroupName_addr == 0) 8123 overlayGroupName = null; 8124 else { 8125 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 8126 while (bb.get() != 0) {} 8127 byte[] bytes = new byte[bb.position()-1]; 8128 getBytes(bb, bytes, 0, bytes.length); 8129 try { 8130 overlayGroupName = new String(bytes, "UTF-8"); 8131 } catch (UnsupportedEncodingException e) { 8132 overlayGroupName = ""; 8133 } 8134 } 8135 8136 edgeOptions.read(); 8137 } 8138 public void write() { 8139 if (direction != null) 8140 backing.putInt(0, direction.getValue()); 8141 backing.putInt(4, showSearchArea); 8142 backing.putInt(8, showSearchLines); 8143 backing.putInt(12, showEdgesFound); 8144 backing.putInt(16, showResult); 8145 searchAreaColor.write(); 8146 searchLinesColor.write(); 8147 searchEdgesColor.write(); 8148 resultColor.write(); 8149 if (overlayGroupName != null) { 8150 byte[] overlayGroupName_bytes; 8151 try { 8152 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 8153 } catch (UnsupportedEncodingException e) { 8154 overlayGroupName_bytes = new byte[0]; 8155 } 8156 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 8157 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 8158 } 8159 putPointer(backing, 36, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 8160 edgeOptions.write(); 8161 } 8162 public int size() { 8163 return 64; 8164 } 8165 } 8166 8167 public static class FindEdgeReport extends DisposedStruct { 8168 public StraightEdge[] straightEdges; // An array of straight edges detected. 8169 private ByteBuffer straightEdges_buf; 8170 8171 private void init() { 8172 straightEdges = new StraightEdge[0]; 8173 } 8174 public FindEdgeReport() { 8175 super(8); 8176 init(); 8177 } 8178 public FindEdgeReport(StraightEdge[] straightEdges) { 8179 super(8); 8180 this.straightEdges = straightEdges; 8181 } 8182 protected FindEdgeReport(ByteBuffer backing, int offset) { 8183 super(backing, offset, 8); 8184 init(); 8185 } 8186 protected FindEdgeReport(long nativeObj, boolean owned) { 8187 super(nativeObj, owned, 8); 8188 init(); 8189 } 8190 protected void setBuffer(ByteBuffer backing, int offset) { 8191 super.setBuffer(backing, offset, 8); 8192 } 8193 public void read() { 8194 int straightEdges_numStraightEdges = backing.getInt(4); 8195 long straightEdges_addr = getPointer(backing, 0); 8196 straightEdges = new StraightEdge[straightEdges_numStraightEdges]; 8197 if (straightEdges_numStraightEdges > 0 && straightEdges_addr != 0) { 8198 ByteBuffer bb = newDirectByteBuffer(straightEdges_addr, straightEdges_numStraightEdges*88); 8199 for (int i=0, off=0; i<straightEdges_numStraightEdges; i++, off += 88) { 8200 straightEdges[i] = new StraightEdge(bb, off); 8201 straightEdges[i].read(); 8202 } 8203 } 8204 } 8205 public void write() { 8206 straightEdges_buf = ByteBuffer.allocateDirect(straightEdges.length*88).order(ByteOrder.nativeOrder()); 8207 for (int i=0, off=0; i<straightEdges.length; i++, off += 88) { 8208 straightEdges[i].setBuffer(straightEdges_buf, off); 8209 straightEdges[i].write(); 8210 } 8211 backing.putInt(4, straightEdges.length); 8212 putPointer(backing, 0, straightEdges_buf); 8213 } 8214 public int size() { 8215 return 8; 8216 } 8217 } 8218 8219 public static class FindTransformRectOptions2 extends DisposedStruct { 8220 public FindReferenceDirection direction; // Specifies the direction and orientation in which the function searches for the primary axis. 8221 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 8222 public int showSearchLines; // If TRUE, the function overlays the search lines used to locate the edges on the image. 8223 public int showEdgesFound; // If TRUE, the function overlays the locations of the edges found on the image. 8224 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 8225 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 8226 public RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay the search lines. 8227 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay the search edges. 8228 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 8229 public String overlayGroupName; // Specifies the overlay group name to assign to the overlays. 8230 public EdgeOptions2 edgeOptions; // Specifies the edge detection options along a single search line. 8231 private ByteBuffer overlayGroupName_buf; 8232 8233 private void init() { 8234 searchAreaColor = new RGBValue(backing, 20); 8235 searchLinesColor = new RGBValue(backing, 24); 8236 searchEdgesColor = new RGBValue(backing, 28); 8237 resultColor = new RGBValue(backing, 32); 8238 edgeOptions = new EdgeOptions2(backing, 40); 8239 } 8240 public FindTransformRectOptions2() { 8241 super(64); 8242 init(); 8243 } 8244 public FindTransformRectOptions2(FindReferenceDirection direction, int showSearchArea, int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, EdgeOptions2 edgeOptions) { 8245 super(64); 8246 this.direction = direction; 8247 this.showSearchArea = showSearchArea; 8248 this.showSearchLines = showSearchLines; 8249 this.showEdgesFound = showEdgesFound; 8250 this.showResult = showResult; 8251 this.searchAreaColor = searchAreaColor; 8252 this.searchLinesColor = searchLinesColor; 8253 this.searchEdgesColor = searchEdgesColor; 8254 this.resultColor = resultColor; 8255 this.overlayGroupName = overlayGroupName; 8256 this.edgeOptions = edgeOptions; 8257 } 8258 protected FindTransformRectOptions2(ByteBuffer backing, int offset) { 8259 super(backing, offset, 64); 8260 init(); 8261 } 8262 protected FindTransformRectOptions2(long nativeObj, boolean owned) { 8263 super(nativeObj, owned, 64); 8264 init(); 8265 } 8266 protected void setBuffer(ByteBuffer backing, int offset) { 8267 super.setBuffer(backing, offset, 64); 8268 } 8269 public void read() { 8270 direction = FindReferenceDirection.fromValue(backing.getInt(0)); 8271 showSearchArea = backing.getInt(4); 8272 showSearchLines = backing.getInt(8); 8273 showEdgesFound = backing.getInt(12); 8274 showResult = backing.getInt(16); 8275 searchAreaColor.read(); 8276 searchLinesColor.read(); 8277 searchEdgesColor.read(); 8278 resultColor.read(); 8279 long overlayGroupName_addr = getPointer(backing, 36); 8280 if (overlayGroupName_addr == 0) 8281 overlayGroupName = null; 8282 else { 8283 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 8284 while (bb.get() != 0) {} 8285 byte[] bytes = new byte[bb.position()-1]; 8286 getBytes(bb, bytes, 0, bytes.length); 8287 try { 8288 overlayGroupName = new String(bytes, "UTF-8"); 8289 } catch (UnsupportedEncodingException e) { 8290 overlayGroupName = ""; 8291 } 8292 } 8293 8294 edgeOptions.read(); 8295 } 8296 public void write() { 8297 if (direction != null) 8298 backing.putInt(0, direction.getValue()); 8299 backing.putInt(4, showSearchArea); 8300 backing.putInt(8, showSearchLines); 8301 backing.putInt(12, showEdgesFound); 8302 backing.putInt(16, showResult); 8303 searchAreaColor.write(); 8304 searchLinesColor.write(); 8305 searchEdgesColor.write(); 8306 resultColor.write(); 8307 if (overlayGroupName != null) { 8308 byte[] overlayGroupName_bytes; 8309 try { 8310 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 8311 } catch (UnsupportedEncodingException e) { 8312 overlayGroupName_bytes = new byte[0]; 8313 } 8314 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 8315 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 8316 } 8317 putPointer(backing, 36, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 8318 edgeOptions.write(); 8319 } 8320 public int size() { 8321 return 64; 8322 } 8323 } 8324 8325 public static class FindTransformRectsOptions2 extends DisposedStruct { 8326 public FindReferenceDirection direction; // Specifies the direction and orientation in which the function searches for the primary axis. 8327 public int showSearchArea; // If TRUE, the function overlays the search area on the image. 8328 public int showSearchLines; // If TRUE, the function overlays the search lines used to locate the edges on the image. 8329 public int showEdgesFound; // If TRUE, the function overlays the locations of the edges found on the image. 8330 public int showResult; // If TRUE, the function overlays the hit lines to the object and the edge used to generate the hit line on the result image. 8331 public RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay the search area. 8332 public RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay the search lines. 8333 public RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay the search edges. 8334 public RGBValue resultColor; // Specifies the RGB color value to use to overlay the results. 8335 public String overlayGroupName; // Specifies the overlay group name to assign to the overlays. 8336 public EdgeOptions2 primaryEdgeOptions; // Specifies the parameters used to compute the edge gradient information and detect the edges for the primary ROI. 8337 public EdgeOptions2 secondaryEdgeOptions; // Specifies the parameters used to compute the edge gradient information and detect the edges for the secondary ROI. 8338 private ByteBuffer overlayGroupName_buf; 8339 8340 private void init() { 8341 searchAreaColor = new RGBValue(backing, 20); 8342 searchLinesColor = new RGBValue(backing, 24); 8343 searchEdgesColor = new RGBValue(backing, 28); 8344 resultColor = new RGBValue(backing, 32); 8345 primaryEdgeOptions = new EdgeOptions2(backing, 40); 8346 secondaryEdgeOptions = new EdgeOptions2(backing, 64); 8347 } 8348 public FindTransformRectsOptions2() { 8349 super(88); 8350 init(); 8351 } 8352 public FindTransformRectsOptions2(FindReferenceDirection direction, int showSearchArea, int showSearchLines, int showEdgesFound, int showResult, RGBValue searchAreaColor, RGBValue searchLinesColor, RGBValue searchEdgesColor, RGBValue resultColor, String overlayGroupName, EdgeOptions2 primaryEdgeOptions, EdgeOptions2 secondaryEdgeOptions) { 8353 super(88); 8354 this.direction = direction; 8355 this.showSearchArea = showSearchArea; 8356 this.showSearchLines = showSearchLines; 8357 this.showEdgesFound = showEdgesFound; 8358 this.showResult = showResult; 8359 this.searchAreaColor = searchAreaColor; 8360 this.searchLinesColor = searchLinesColor; 8361 this.searchEdgesColor = searchEdgesColor; 8362 this.resultColor = resultColor; 8363 this.overlayGroupName = overlayGroupName; 8364 this.primaryEdgeOptions = primaryEdgeOptions; 8365 this.secondaryEdgeOptions = secondaryEdgeOptions; 8366 } 8367 protected FindTransformRectsOptions2(ByteBuffer backing, int offset) { 8368 super(backing, offset, 88); 8369 init(); 8370 } 8371 protected FindTransformRectsOptions2(long nativeObj, boolean owned) { 8372 super(nativeObj, owned, 88); 8373 init(); 8374 } 8375 protected void setBuffer(ByteBuffer backing, int offset) { 8376 super.setBuffer(backing, offset, 88); 8377 } 8378 public void read() { 8379 direction = FindReferenceDirection.fromValue(backing.getInt(0)); 8380 showSearchArea = backing.getInt(4); 8381 showSearchLines = backing.getInt(8); 8382 showEdgesFound = backing.getInt(12); 8383 showResult = backing.getInt(16); 8384 searchAreaColor.read(); 8385 searchLinesColor.read(); 8386 searchEdgesColor.read(); 8387 resultColor.read(); 8388 long overlayGroupName_addr = getPointer(backing, 36); 8389 if (overlayGroupName_addr == 0) 8390 overlayGroupName = null; 8391 else { 8392 ByteBuffer bb = newDirectByteBuffer(overlayGroupName_addr, 1000); // FIXME 8393 while (bb.get() != 0) {} 8394 byte[] bytes = new byte[bb.position()-1]; 8395 getBytes(bb, bytes, 0, bytes.length); 8396 try { 8397 overlayGroupName = new String(bytes, "UTF-8"); 8398 } catch (UnsupportedEncodingException e) { 8399 overlayGroupName = ""; 8400 } 8401 } 8402 8403 primaryEdgeOptions.read(); 8404 secondaryEdgeOptions.read(); 8405 } 8406 public void write() { 8407 if (direction != null) 8408 backing.putInt(0, direction.getValue()); 8409 backing.putInt(4, showSearchArea); 8410 backing.putInt(8, showSearchLines); 8411 backing.putInt(12, showEdgesFound); 8412 backing.putInt(16, showResult); 8413 searchAreaColor.write(); 8414 searchLinesColor.write(); 8415 searchEdgesColor.write(); 8416 resultColor.write(); 8417 if (overlayGroupName != null) { 8418 byte[] overlayGroupName_bytes; 8419 try { 8420 overlayGroupName_bytes = overlayGroupName.getBytes("UTF-8"); 8421 } catch (UnsupportedEncodingException e) { 8422 overlayGroupName_bytes = new byte[0]; 8423 } 8424 overlayGroupName_buf = ByteBuffer.allocateDirect(overlayGroupName_bytes.length+1); 8425 putBytes(overlayGroupName_buf, overlayGroupName_bytes, 0, overlayGroupName_bytes.length).put(overlayGroupName_bytes.length, (byte)0); 8426 } 8427 putPointer(backing, 36, overlayGroupName == null ? 0 : getByteBufferAddress(overlayGroupName_buf)); 8428 primaryEdgeOptions.write(); 8429 secondaryEdgeOptions.write(); 8430 } 8431 public int size() { 8432 return 88; 8433 } 8434 } 8435 8436 public static class ReadTextReport3 extends DisposedStruct { 8437 public String readString; // The read string. 8438 public CharReport3[] characterReport; // An array of reports describing the properties of each identified character. 8439 public ROI roiBoundingCharacters; // An array specifying the coordinates of the character bounding ROI. 8440 private ByteBuffer readString_buf; 8441 private ByteBuffer characterReport_buf; 8442 8443 private void init() { 8444 characterReport = new CharReport3[0]; 8445 } 8446 public ReadTextReport3() { 8447 super(16); 8448 init(); 8449 } 8450 public ReadTextReport3(String readString, CharReport3[] characterReport, ROI roiBoundingCharacters) { 8451 super(16); 8452 this.readString = readString; 8453 this.characterReport = characterReport; 8454 this.roiBoundingCharacters = roiBoundingCharacters; 8455 } 8456 protected ReadTextReport3(ByteBuffer backing, int offset) { 8457 super(backing, offset, 16); 8458 init(); 8459 } 8460 protected ReadTextReport3(long nativeObj, boolean owned) { 8461 super(nativeObj, owned, 16); 8462 init(); 8463 } 8464 protected void setBuffer(ByteBuffer backing, int offset) { 8465 super.setBuffer(backing, offset, 16); 8466 } 8467 public void read() { 8468 long readString_addr = getPointer(backing, 0); 8469 if (readString_addr == 0) 8470 readString = null; 8471 else { 8472 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 8473 while (bb.get() != 0) {} 8474 byte[] bytes = new byte[bb.position()-1]; 8475 getBytes(bb, bytes, 0, bytes.length); 8476 try { 8477 readString = new String(bytes, "UTF-8"); 8478 } catch (UnsupportedEncodingException e) { 8479 readString = ""; 8480 } 8481 } 8482 8483 int characterReport_numCharacterReports = backing.getInt(8); 8484 long characterReport_addr = getPointer(backing, 4); 8485 characterReport = new CharReport3[characterReport_numCharacterReports]; 8486 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 8487 ByteBuffer bb = newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports*44); 8488 for (int i=0, off=0; i<characterReport_numCharacterReports; i++, off += 44) { 8489 characterReport[i] = new CharReport3(bb, off); 8490 characterReport[i].read(); 8491 } 8492 } 8493 long roiBoundingCharacters_addr = getPointer(backing, 12); 8494 if (roiBoundingCharacters_addr == 0) 8495 roiBoundingCharacters = null; 8496 else 8497 roiBoundingCharacters = new ROI(roiBoundingCharacters_addr, false); 8498 } 8499 public void write() { 8500 if (readString != null) { 8501 byte[] readString_bytes; 8502 try { 8503 readString_bytes = readString.getBytes("UTF-8"); 8504 } catch (UnsupportedEncodingException e) { 8505 readString_bytes = new byte[0]; 8506 } 8507 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length+1); 8508 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put(readString_bytes.length, (byte)0); 8509 } 8510 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 8511 characterReport_buf = ByteBuffer.allocateDirect(characterReport.length*44).order(ByteOrder.nativeOrder()); 8512 for (int i=0, off=0; i<characterReport.length; i++, off += 44) { 8513 characterReport[i].setBuffer(characterReport_buf, off); 8514 characterReport[i].write(); 8515 } 8516 backing.putInt(8, characterReport.length); 8517 putPointer(backing, 4, characterReport_buf); 8518 putPointer(backing, 12, roiBoundingCharacters); 8519 } 8520 public int size() { 8521 return 16; 8522 } 8523 } 8524 8525 public static class CharacterStatistics extends DisposedStruct { 8526 public int left; // The left offset of the character bounding rectangles in the current ROI. 8527 public int top; // The top offset of the character bounding rectangles in the current ROI. 8528 public int width; // The width of each of the characters you trained in the current ROI. 8529 public int height; // The height of each trained character in the current ROI. 8530 public int characterSize; // The size of the character in pixels. 8531 8532 private void init() { 8533 8534 } 8535 public CharacterStatistics() { 8536 super(20); 8537 init(); 8538 } 8539 public CharacterStatistics(int left, int top, int width, int height, int characterSize) { 8540 super(20); 8541 this.left = left; 8542 this.top = top; 8543 this.width = width; 8544 this.height = height; 8545 this.characterSize = characterSize; 8546 } 8547 protected CharacterStatistics(ByteBuffer backing, int offset) { 8548 super(backing, offset, 20); 8549 init(); 8550 } 8551 protected CharacterStatistics(long nativeObj, boolean owned) { 8552 super(nativeObj, owned, 20); 8553 init(); 8554 } 8555 protected void setBuffer(ByteBuffer backing, int offset) { 8556 super.setBuffer(backing, offset, 20); 8557 } 8558 public void read() { 8559 left = backing.getInt(0); 8560 top = backing.getInt(4); 8561 width = backing.getInt(8); 8562 height = backing.getInt(12); 8563 characterSize = backing.getInt(16); 8564 } 8565 public void write() { 8566 backing.putInt(0, left); 8567 backing.putInt(4, top); 8568 backing.putInt(8, width); 8569 backing.putInt(12, height); 8570 backing.putInt(16, characterSize); 8571 } 8572 public int size() { 8573 return 20; 8574 } 8575 } 8576 8577 public static class CharReport3 extends DisposedStruct { 8578 public String character; // The character value. 8579 public int classificationScore; // The degree to which the assigned character class represents the object better than the other character classes in the character set. 8580 public int verificationScore; // The similarity of the character and the reference character for the character class. 8581 public int verified; // This element is TRUE if a reference character was found for the character class and FALSE if a reference character was not found. 8582 public int lowThreshold; // The minimum value of the threshold range used for this character. 8583 public int highThreshold; // The maximum value of the threshold range used for this character. 8584 public CharacterStatistics characterStats; // Describes the characters segmented in the ROI. 8585 private ByteBuffer character_buf; 8586 8587 private void init() { 8588 characterStats = new CharacterStatistics(backing, 24); 8589 } 8590 public CharReport3() { 8591 super(44); 8592 init(); 8593 } 8594 public CharReport3(String character, int classificationScore, int verificationScore, int verified, int lowThreshold, int highThreshold, CharacterStatistics characterStats) { 8595 super(44); 8596 this.character = character; 8597 this.classificationScore = classificationScore; 8598 this.verificationScore = verificationScore; 8599 this.verified = verified; 8600 this.lowThreshold = lowThreshold; 8601 this.highThreshold = highThreshold; 8602 this.characterStats = characterStats; 8603 } 8604 protected CharReport3(ByteBuffer backing, int offset) { 8605 super(backing, offset, 44); 8606 init(); 8607 } 8608 protected CharReport3(long nativeObj, boolean owned) { 8609 super(nativeObj, owned, 44); 8610 init(); 8611 } 8612 protected void setBuffer(ByteBuffer backing, int offset) { 8613 super.setBuffer(backing, offset, 44); 8614 } 8615 public void read() { 8616 long character_addr = getPointer(backing, 0); 8617 if (character_addr == 0) 8618 character = null; 8619 else { 8620 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 8621 while (bb.get() != 0) {} 8622 byte[] bytes = new byte[bb.position()-1]; 8623 getBytes(bb, bytes, 0, bytes.length); 8624 try { 8625 character = new String(bytes, "UTF-8"); 8626 } catch (UnsupportedEncodingException e) { 8627 character = ""; 8628 } 8629 } 8630 8631 classificationScore = backing.getInt(4); 8632 verificationScore = backing.getInt(8); 8633 verified = backing.getInt(12); 8634 lowThreshold = backing.getInt(16); 8635 highThreshold = backing.getInt(20); 8636 characterStats.read(); 8637 } 8638 public void write() { 8639 if (character != null) { 8640 byte[] character_bytes; 8641 try { 8642 character_bytes = character.getBytes("UTF-8"); 8643 } catch (UnsupportedEncodingException e) { 8644 character_bytes = new byte[0]; 8645 } 8646 character_buf = ByteBuffer.allocateDirect(character_bytes.length+1); 8647 putBytes(character_buf, character_bytes, 0, character_bytes.length).put(character_bytes.length, (byte)0); 8648 } 8649 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 8650 backing.putInt(4, classificationScore); 8651 backing.putInt(8, verificationScore); 8652 backing.putInt(12, verified); 8653 backing.putInt(16, lowThreshold); 8654 backing.putInt(20, highThreshold); 8655 characterStats.write(); 8656 } 8657 public int size() { 8658 return 44; 8659 } 8660 } 8661 8662 public static class ArcInfo2 extends DisposedStruct { 8663 public PointFloat center; // The center point of the arc. 8664 public double radius; // The radius of the arc. 8665 public double startAngle; // The starting angle of the arc, specified counter-clockwise from the x-axis. 8666 public double endAngle; // The ending angle of the arc, specified counter-clockwise from the x-axis. 8667 8668 private void init() { 8669 center = new PointFloat(backing, 0); 8670 } 8671 public ArcInfo2() { 8672 super(32); 8673 init(); 8674 } 8675 public ArcInfo2(PointFloat center, double radius, double startAngle, double endAngle) { 8676 super(32); 8677 this.center = center; 8678 this.radius = radius; 8679 this.startAngle = startAngle; 8680 this.endAngle = endAngle; 8681 } 8682 protected ArcInfo2(ByteBuffer backing, int offset) { 8683 super(backing, offset, 32); 8684 init(); 8685 } 8686 protected ArcInfo2(long nativeObj, boolean owned) { 8687 super(nativeObj, owned, 32); 8688 init(); 8689 } 8690 protected void setBuffer(ByteBuffer backing, int offset) { 8691 super.setBuffer(backing, offset, 32); 8692 } 8693 public void read() { 8694 center.read(); 8695 radius = backing.getDouble(8); 8696 startAngle = backing.getDouble(16); 8697 endAngle = backing.getDouble(24); 8698 } 8699 public void write() { 8700 center.write(); 8701 backing.putDouble(8, radius); 8702 backing.putDouble(16, startAngle); 8703 backing.putDouble(24, endAngle); 8704 } 8705 public int size() { 8706 return 32; 8707 } 8708 } 8709 8710 public static class EdgeReport2 extends DisposedStruct { 8711 public EdgeInfo[] edges; // An array of edges detected. 8712 public double[] gradientInfo; // An array that contains the calculated edge strengths along the user-defined search area. 8713 public int calibrationValid; // Indicates if the calibration data corresponding to the location of the edges is correct. 8714 private ByteBuffer edges_buf; 8715 private ByteBuffer gradientInfo_buf; 8716 8717 private void init() { 8718 edges = new EdgeInfo[0]; 8719 gradientInfo = new double[0]; 8720 } 8721 public EdgeReport2() { 8722 super(20); 8723 init(); 8724 } 8725 public EdgeReport2(EdgeInfo[] edges, double[] gradientInfo, int calibrationValid) { 8726 super(20); 8727 this.edges = edges; 8728 this.gradientInfo = gradientInfo; 8729 this.calibrationValid = calibrationValid; 8730 } 8731 protected EdgeReport2(ByteBuffer backing, int offset) { 8732 super(backing, offset, 20); 8733 init(); 8734 } 8735 protected EdgeReport2(long nativeObj, boolean owned) { 8736 super(nativeObj, owned, 20); 8737 init(); 8738 } 8739 protected void setBuffer(ByteBuffer backing, int offset) { 8740 super.setBuffer(backing, offset, 20); 8741 } 8742 public void read() { 8743 int edges_numEdges = backing.getInt(4); 8744 long edges_addr = getPointer(backing, 0); 8745 edges = new EdgeInfo[edges_numEdges]; 8746 if (edges_numEdges > 0 && edges_addr != 0) { 8747 ByteBuffer bb = newDirectByteBuffer(edges_addr, edges_numEdges*56); 8748 for (int i=0, off=0; i<edges_numEdges; i++, off += 56) { 8749 edges[i] = new EdgeInfo(bb, off); 8750 edges[i].read(); 8751 } 8752 } 8753 int gradientInfo_numGradientInfo = backing.getInt(12); 8754 long gradientInfo_addr = getPointer(backing, 8); 8755 gradientInfo = new double[gradientInfo_numGradientInfo]; 8756 if (gradientInfo_numGradientInfo > 0 && gradientInfo_addr != 0) { 8757 newDirectByteBuffer(gradientInfo_addr, gradientInfo_numGradientInfo*8).asDoubleBuffer().get(gradientInfo); 8758 } 8759 calibrationValid = backing.getInt(16); 8760 } 8761 public void write() { 8762 edges_buf = ByteBuffer.allocateDirect(edges.length*56).order(ByteOrder.nativeOrder()); 8763 for (int i=0, off=0; i<edges.length; i++, off += 56) { 8764 edges[i].setBuffer(edges_buf, off); 8765 edges[i].write(); 8766 } 8767 backing.putInt(4, edges.length); 8768 putPointer(backing, 0, edges_buf); 8769 gradientInfo_buf = ByteBuffer.allocateDirect(gradientInfo.length*8).order(ByteOrder.nativeOrder()); 8770 gradientInfo_buf.asDoubleBuffer().put(gradientInfo).rewind(); 8771 backing.putInt(12, gradientInfo.length); 8772 putPointer(backing, 8, gradientInfo_buf); 8773 backing.putInt(16, calibrationValid); 8774 } 8775 public int size() { 8776 return 20; 8777 } 8778 } 8779 8780 public static class SearchArcInfo extends DisposedStruct { 8781 public ArcInfo2 arcCoordinates; // Describes the arc used for edge detection. 8782 public EdgeReport2 edgeReport; // Describes the edges found in this search line. 8783 8784 private void init() { 8785 arcCoordinates = new ArcInfo2(backing, 0); 8786 edgeReport = new EdgeReport2(backing, 32); 8787 } 8788 public SearchArcInfo() { 8789 super(56); 8790 init(); 8791 } 8792 public SearchArcInfo(ArcInfo2 arcCoordinates, EdgeReport2 edgeReport) { 8793 super(56); 8794 this.arcCoordinates = arcCoordinates; 8795 this.edgeReport = edgeReport; 8796 } 8797 protected SearchArcInfo(ByteBuffer backing, int offset) { 8798 super(backing, offset, 56); 8799 init(); 8800 } 8801 protected SearchArcInfo(long nativeObj, boolean owned) { 8802 super(nativeObj, owned, 56); 8803 init(); 8804 } 8805 protected void setBuffer(ByteBuffer backing, int offset) { 8806 super.setBuffer(backing, offset, 56); 8807 } 8808 public void read() { 8809 arcCoordinates.read(); 8810 edgeReport.read(); 8811 } 8812 public void write() { 8813 arcCoordinates.write(); 8814 edgeReport.write(); 8815 } 8816 public int size() { 8817 return 56; 8818 } 8819 } 8820 8821 public static class ConcentricRakeReport2 extends DisposedStruct { 8822 public EdgeInfo[] firstEdges; // The first edge point detected along each search line in the ROI. 8823 public EdgeInfo[] lastEdges; // The last edge point detected along each search line in the ROI. 8824 public SearchArcInfo[] searchArcs; // Contains the arcs used for edge detection and the edge information for each arc. 8825 private ByteBuffer firstEdges_buf; 8826 private ByteBuffer lastEdges_buf; 8827 private ByteBuffer searchArcs_buf; 8828 8829 private void init() { 8830 firstEdges = new EdgeInfo[0]; 8831 lastEdges = new EdgeInfo[0]; 8832 searchArcs = new SearchArcInfo[0]; 8833 } 8834 public ConcentricRakeReport2() { 8835 super(24); 8836 init(); 8837 } 8838 public ConcentricRakeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, SearchArcInfo[] searchArcs) { 8839 super(24); 8840 this.firstEdges = firstEdges; 8841 this.lastEdges = lastEdges; 8842 this.searchArcs = searchArcs; 8843 } 8844 protected ConcentricRakeReport2(ByteBuffer backing, int offset) { 8845 super(backing, offset, 24); 8846 init(); 8847 } 8848 protected ConcentricRakeReport2(long nativeObj, boolean owned) { 8849 super(nativeObj, owned, 24); 8850 init(); 8851 } 8852 protected void setBuffer(ByteBuffer backing, int offset) { 8853 super.setBuffer(backing, offset, 24); 8854 } 8855 public void read() { 8856 int firstEdges_numFirstEdges = backing.getInt(4); 8857 long firstEdges_addr = getPointer(backing, 0); 8858 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 8859 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 8860 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*56); 8861 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 56) { 8862 firstEdges[i] = new EdgeInfo(bb, off); 8863 firstEdges[i].read(); 8864 } 8865 } 8866 int lastEdges_numLastEdges = backing.getInt(12); 8867 long lastEdges_addr = getPointer(backing, 8); 8868 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 8869 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 8870 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*56); 8871 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 56) { 8872 lastEdges[i] = new EdgeInfo(bb, off); 8873 lastEdges[i].read(); 8874 } 8875 } 8876 int searchArcs_numSearchArcs = backing.getInt(20); 8877 long searchArcs_addr = getPointer(backing, 16); 8878 searchArcs = new SearchArcInfo[searchArcs_numSearchArcs]; 8879 if (searchArcs_numSearchArcs > 0 && searchArcs_addr != 0) { 8880 ByteBuffer bb = newDirectByteBuffer(searchArcs_addr, searchArcs_numSearchArcs*56); 8881 for (int i=0, off=0; i<searchArcs_numSearchArcs; i++, off += 56) { 8882 searchArcs[i] = new SearchArcInfo(bb, off); 8883 searchArcs[i].read(); 8884 } 8885 } 8886 } 8887 public void write() { 8888 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*56).order(ByteOrder.nativeOrder()); 8889 for (int i=0, off=0; i<firstEdges.length; i++, off += 56) { 8890 firstEdges[i].setBuffer(firstEdges_buf, off); 8891 firstEdges[i].write(); 8892 } 8893 backing.putInt(4, firstEdges.length); 8894 putPointer(backing, 0, firstEdges_buf); 8895 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*56).order(ByteOrder.nativeOrder()); 8896 for (int i=0, off=0; i<lastEdges.length; i++, off += 56) { 8897 lastEdges[i].setBuffer(lastEdges_buf, off); 8898 lastEdges[i].write(); 8899 } 8900 backing.putInt(12, lastEdges.length); 8901 putPointer(backing, 8, lastEdges_buf); 8902 searchArcs_buf = ByteBuffer.allocateDirect(searchArcs.length*56).order(ByteOrder.nativeOrder()); 8903 for (int i=0, off=0; i<searchArcs.length; i++, off += 56) { 8904 searchArcs[i].setBuffer(searchArcs_buf, off); 8905 searchArcs[i].write(); 8906 } 8907 backing.putInt(20, searchArcs.length); 8908 putPointer(backing, 16, searchArcs_buf); 8909 } 8910 public int size() { 8911 return 24; 8912 } 8913 } 8914 8915 public static class SpokeReport2 extends DisposedStruct { 8916 public EdgeInfo[] firstEdges; // The first edge point detected along each search line in the ROI. 8917 public EdgeInfo[] lastEdges; // The last edge point detected along each search line in the ROI. 8918 public SearchLineInfo[] searchLines; // The search lines used for edge detection. 8919 private ByteBuffer firstEdges_buf; 8920 private ByteBuffer lastEdges_buf; 8921 private ByteBuffer searchLines_buf; 8922 8923 private void init() { 8924 firstEdges = new EdgeInfo[0]; 8925 lastEdges = new EdgeInfo[0]; 8926 searchLines = new SearchLineInfo[0]; 8927 } 8928 public SpokeReport2() { 8929 super(24); 8930 init(); 8931 } 8932 public SpokeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, SearchLineInfo[] searchLines) { 8933 super(24); 8934 this.firstEdges = firstEdges; 8935 this.lastEdges = lastEdges; 8936 this.searchLines = searchLines; 8937 } 8938 protected SpokeReport2(ByteBuffer backing, int offset) { 8939 super(backing, offset, 24); 8940 init(); 8941 } 8942 protected SpokeReport2(long nativeObj, boolean owned) { 8943 super(nativeObj, owned, 24); 8944 init(); 8945 } 8946 protected void setBuffer(ByteBuffer backing, int offset) { 8947 super.setBuffer(backing, offset, 24); 8948 } 8949 public void read() { 8950 int firstEdges_numFirstEdges = backing.getInt(4); 8951 long firstEdges_addr = getPointer(backing, 0); 8952 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 8953 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 8954 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*56); 8955 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 56) { 8956 firstEdges[i] = new EdgeInfo(bb, off); 8957 firstEdges[i].read(); 8958 } 8959 } 8960 int lastEdges_numLastEdges = backing.getInt(12); 8961 long lastEdges_addr = getPointer(backing, 8); 8962 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 8963 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 8964 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*56); 8965 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 56) { 8966 lastEdges[i] = new EdgeInfo(bb, off); 8967 lastEdges[i].read(); 8968 } 8969 } 8970 int searchLines_numSearchLines = backing.getInt(20); 8971 long searchLines_addr = getPointer(backing, 16); 8972 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 8973 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 8974 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines*36); 8975 for (int i=0, off=0; i<searchLines_numSearchLines; i++, off += 36) { 8976 searchLines[i] = new SearchLineInfo(bb, off); 8977 searchLines[i].read(); 8978 } 8979 } 8980 } 8981 public void write() { 8982 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*56).order(ByteOrder.nativeOrder()); 8983 for (int i=0, off=0; i<firstEdges.length; i++, off += 56) { 8984 firstEdges[i].setBuffer(firstEdges_buf, off); 8985 firstEdges[i].write(); 8986 } 8987 backing.putInt(4, firstEdges.length); 8988 putPointer(backing, 0, firstEdges_buf); 8989 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*56).order(ByteOrder.nativeOrder()); 8990 for (int i=0, off=0; i<lastEdges.length; i++, off += 56) { 8991 lastEdges[i].setBuffer(lastEdges_buf, off); 8992 lastEdges[i].write(); 8993 } 8994 backing.putInt(12, lastEdges.length); 8995 putPointer(backing, 8, lastEdges_buf); 8996 searchLines_buf = ByteBuffer.allocateDirect(searchLines.length*36).order(ByteOrder.nativeOrder()); 8997 for (int i=0, off=0; i<searchLines.length; i++, off += 36) { 8998 searchLines[i].setBuffer(searchLines_buf, off); 8999 searchLines[i].write(); 9000 } 9001 backing.putInt(20, searchLines.length); 9002 putPointer(backing, 16, searchLines_buf); 9003 } 9004 public int size() { 9005 return 24; 9006 } 9007 } 9008 9009 public static class EdgeInfo extends DisposedStruct { 9010 public PointFloat position; // The location of the edge in the image. 9011 public PointFloat calibratedPosition; // The position of the edge in the image in real-world coordinates. 9012 public double distance; // The location of the edge from the first point along the boundary of the input ROI. 9013 public double calibratedDistance; // The location of the edge from the first point along the boundary of the input ROI in real-world coordinates. 9014 public double magnitude; // The intensity contrast at the edge. 9015 public double noisePeak; // The strength of the noise associated with the current edge. 9016 public int rising; // Indicates the polarity of the edge. 9017 9018 private void init() { 9019 position = new PointFloat(backing, 0); 9020 calibratedPosition = new PointFloat(backing, 8); 9021 } 9022 public EdgeInfo() { 9023 super(56); 9024 init(); 9025 } 9026 public EdgeInfo(PointFloat position, PointFloat calibratedPosition, double distance, double calibratedDistance, double magnitude, double noisePeak, int rising) { 9027 super(56); 9028 this.position = position; 9029 this.calibratedPosition = calibratedPosition; 9030 this.distance = distance; 9031 this.calibratedDistance = calibratedDistance; 9032 this.magnitude = magnitude; 9033 this.noisePeak = noisePeak; 9034 this.rising = rising; 9035 } 9036 protected EdgeInfo(ByteBuffer backing, int offset) { 9037 super(backing, offset, 56); 9038 init(); 9039 } 9040 protected EdgeInfo(long nativeObj, boolean owned) { 9041 super(nativeObj, owned, 56); 9042 init(); 9043 } 9044 protected void setBuffer(ByteBuffer backing, int offset) { 9045 super.setBuffer(backing, offset, 56); 9046 } 9047 public void read() { 9048 position.read(); 9049 calibratedPosition.read(); 9050 distance = backing.getDouble(16); 9051 calibratedDistance = backing.getDouble(24); 9052 magnitude = backing.getDouble(32); 9053 noisePeak = backing.getDouble(40); 9054 rising = backing.getInt(48); 9055 } 9056 public void write() { 9057 position.write(); 9058 calibratedPosition.write(); 9059 backing.putDouble(16, distance); 9060 backing.putDouble(24, calibratedDistance); 9061 backing.putDouble(32, magnitude); 9062 backing.putDouble(40, noisePeak); 9063 backing.putInt(48, rising); 9064 } 9065 public int size() { 9066 return 56; 9067 } 9068 } 9069 9070 public static class SearchLineInfo extends DisposedStruct { 9071 public LineFloat lineCoordinates; // The endpoints of the search line. 9072 public EdgeReport2 edgeReport; // Describes the edges found in this search line. 9073 9074 private void init() { 9075 lineCoordinates = new LineFloat(backing, 0); 9076 edgeReport = new EdgeReport2(backing, 16); 9077 } 9078 public SearchLineInfo() { 9079 super(36); 9080 init(); 9081 } 9082 public SearchLineInfo(LineFloat lineCoordinates, EdgeReport2 edgeReport) { 9083 super(36); 9084 this.lineCoordinates = lineCoordinates; 9085 this.edgeReport = edgeReport; 9086 } 9087 protected SearchLineInfo(ByteBuffer backing, int offset) { 9088 super(backing, offset, 36); 9089 init(); 9090 } 9091 protected SearchLineInfo(long nativeObj, boolean owned) { 9092 super(nativeObj, owned, 36); 9093 init(); 9094 } 9095 protected void setBuffer(ByteBuffer backing, int offset) { 9096 super.setBuffer(backing, offset, 36); 9097 } 9098 public void read() { 9099 lineCoordinates.read(); 9100 edgeReport.read(); 9101 } 9102 public void write() { 9103 lineCoordinates.write(); 9104 edgeReport.write(); 9105 } 9106 public int size() { 9107 return 36; 9108 } 9109 } 9110 9111 public static class RakeReport2 extends DisposedStruct { 9112 public EdgeInfo[] firstEdges; // The first edge point detected along each search line in the ROI. 9113 public EdgeInfo[] lastEdges; // The last edge point detected along each search line in the ROI. 9114 public SearchLineInfo[] searchLines; // The search lines used for edge detection. 9115 private ByteBuffer firstEdges_buf; 9116 private ByteBuffer lastEdges_buf; 9117 private ByteBuffer searchLines_buf; 9118 9119 private void init() { 9120 firstEdges = new EdgeInfo[0]; 9121 lastEdges = new EdgeInfo[0]; 9122 searchLines = new SearchLineInfo[0]; 9123 } 9124 public RakeReport2() { 9125 super(24); 9126 init(); 9127 } 9128 public RakeReport2(EdgeInfo[] firstEdges, EdgeInfo[] lastEdges, SearchLineInfo[] searchLines) { 9129 super(24); 9130 this.firstEdges = firstEdges; 9131 this.lastEdges = lastEdges; 9132 this.searchLines = searchLines; 9133 } 9134 protected RakeReport2(ByteBuffer backing, int offset) { 9135 super(backing, offset, 24); 9136 init(); 9137 } 9138 protected RakeReport2(long nativeObj, boolean owned) { 9139 super(nativeObj, owned, 24); 9140 init(); 9141 } 9142 protected void setBuffer(ByteBuffer backing, int offset) { 9143 super.setBuffer(backing, offset, 24); 9144 } 9145 public void read() { 9146 int firstEdges_numFirstEdges = backing.getInt(4); 9147 long firstEdges_addr = getPointer(backing, 0); 9148 firstEdges = new EdgeInfo[firstEdges_numFirstEdges]; 9149 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 9150 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*56); 9151 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 56) { 9152 firstEdges[i] = new EdgeInfo(bb, off); 9153 firstEdges[i].read(); 9154 } 9155 } 9156 int lastEdges_numLastEdges = backing.getInt(12); 9157 long lastEdges_addr = getPointer(backing, 8); 9158 lastEdges = new EdgeInfo[lastEdges_numLastEdges]; 9159 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 9160 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*56); 9161 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 56) { 9162 lastEdges[i] = new EdgeInfo(bb, off); 9163 lastEdges[i].read(); 9164 } 9165 } 9166 int searchLines_numSearchLines = backing.getInt(20); 9167 long searchLines_addr = getPointer(backing, 16); 9168 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 9169 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 9170 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines*36); 9171 for (int i=0, off=0; i<searchLines_numSearchLines; i++, off += 36) { 9172 searchLines[i] = new SearchLineInfo(bb, off); 9173 searchLines[i].read(); 9174 } 9175 } 9176 } 9177 public void write() { 9178 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*56).order(ByteOrder.nativeOrder()); 9179 for (int i=0, off=0; i<firstEdges.length; i++, off += 56) { 9180 firstEdges[i].setBuffer(firstEdges_buf, off); 9181 firstEdges[i].write(); 9182 } 9183 backing.putInt(4, firstEdges.length); 9184 putPointer(backing, 0, firstEdges_buf); 9185 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*56).order(ByteOrder.nativeOrder()); 9186 for (int i=0, off=0; i<lastEdges.length; i++, off += 56) { 9187 lastEdges[i].setBuffer(lastEdges_buf, off); 9188 lastEdges[i].write(); 9189 } 9190 backing.putInt(12, lastEdges.length); 9191 putPointer(backing, 8, lastEdges_buf); 9192 searchLines_buf = ByteBuffer.allocateDirect(searchLines.length*36).order(ByteOrder.nativeOrder()); 9193 for (int i=0, off=0; i<searchLines.length; i++, off += 36) { 9194 searchLines[i].setBuffer(searchLines_buf, off); 9195 searchLines[i].write(); 9196 } 9197 backing.putInt(20, searchLines.length); 9198 putPointer(backing, 16, searchLines_buf); 9199 } 9200 public int size() { 9201 return 24; 9202 } 9203 } 9204 9205 public static class TransformBehaviors extends DisposedStruct { 9206 public GroupBehavior ShiftBehavior; // Specifies the behavior of an overlay group when a shift operation is applied to an image. 9207 public GroupBehavior ScaleBehavior; // Specifies the behavior of an overlay group when a scale operation is applied to an image. 9208 public GroupBehavior RotateBehavior; // Specifies the behavior of an overlay group when a rotate operation is applied to an image. 9209 public GroupBehavior SymmetryBehavior; // Specifies the behavior of an overlay group when a symmetry operation is applied to an image. 9210 9211 private void init() { 9212 9213 } 9214 public TransformBehaviors() { 9215 super(16); 9216 init(); 9217 } 9218 public TransformBehaviors(GroupBehavior ShiftBehavior, GroupBehavior ScaleBehavior, GroupBehavior RotateBehavior, GroupBehavior SymmetryBehavior) { 9219 super(16); 9220 this.ShiftBehavior = ShiftBehavior; 9221 this.ScaleBehavior = ScaleBehavior; 9222 this.RotateBehavior = RotateBehavior; 9223 this.SymmetryBehavior = SymmetryBehavior; 9224 } 9225 protected TransformBehaviors(ByteBuffer backing, int offset) { 9226 super(backing, offset, 16); 9227 init(); 9228 } 9229 protected TransformBehaviors(long nativeObj, boolean owned) { 9230 super(nativeObj, owned, 16); 9231 init(); 9232 } 9233 protected void setBuffer(ByteBuffer backing, int offset) { 9234 super.setBuffer(backing, offset, 16); 9235 } 9236 public void read() { 9237 ShiftBehavior = GroupBehavior.fromValue(backing.getInt(0)); 9238 ScaleBehavior = GroupBehavior.fromValue(backing.getInt(4)); 9239 RotateBehavior = GroupBehavior.fromValue(backing.getInt(8)); 9240 SymmetryBehavior = GroupBehavior.fromValue(backing.getInt(12)); 9241 } 9242 public void write() { 9243 if (ShiftBehavior != null) 9244 backing.putInt(0, ShiftBehavior.getValue()); 9245 if (ScaleBehavior != null) 9246 backing.putInt(4, ScaleBehavior.getValue()); 9247 if (RotateBehavior != null) 9248 backing.putInt(8, RotateBehavior.getValue()); 9249 if (SymmetryBehavior != null) 9250 backing.putInt(12, SymmetryBehavior.getValue()); 9251 } 9252 public int size() { 9253 return 16; 9254 } 9255 } 9256 9257 public static class QRCodeDataToken extends DisposedStruct { 9258 public QRStreamMode mode; // Specifies the stream mode or the format of the data that is encoded in the QR code. 9259 public int modeData; // Indicates specifiers used by the user to postprocess the data if it requires it. 9260 public byte[] data; // Shows the encoded data in the QR code. 9261 private ByteBuffer data_buf; 9262 9263 private void init() { 9264 data = new byte[0]; 9265 } 9266 public QRCodeDataToken() { 9267 super(16); 9268 init(); 9269 } 9270 public QRCodeDataToken(QRStreamMode mode, int modeData, byte[] data) { 9271 super(16); 9272 this.mode = mode; 9273 this.modeData = modeData; 9274 this.data = data; 9275 } 9276 protected QRCodeDataToken(ByteBuffer backing, int offset) { 9277 super(backing, offset, 16); 9278 init(); 9279 } 9280 protected QRCodeDataToken(long nativeObj, boolean owned) { 9281 super(nativeObj, owned, 16); 9282 init(); 9283 } 9284 protected void setBuffer(ByteBuffer backing, int offset) { 9285 super.setBuffer(backing, offset, 16); 9286 } 9287 public void read() { 9288 mode = QRStreamMode.fromValue(backing.getInt(0)); 9289 modeData = backing.getInt(4); 9290 int data_dataLength = backing.getInt(12); 9291 long data_addr = getPointer(backing, 8); 9292 data = new byte[data_dataLength]; 9293 if (data_dataLength > 0 && data_addr != 0) { 9294 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 9295 } 9296 } 9297 public void write() { 9298 if (mode != null) 9299 backing.putInt(0, mode.getValue()); 9300 backing.putInt(4, modeData); 9301 data_buf = ByteBuffer.allocateDirect(data.length); 9302 putBytes(data_buf, data, 0, data.length); 9303 backing.putInt(12, data.length); 9304 putPointer(backing, 8, data_buf); 9305 } 9306 public int size() { 9307 return 16; 9308 } 9309 } 9310 9311 public static class ParticleFilterOptions extends DisposedStruct { 9312 public int rejectMatches; // Set this parameter to TRUE to transfer only those particles that do not meet all the criteria. 9313 public int rejectBorder; // Set this element to TRUE to reject border particles. 9314 public int connectivity8; // Set this parameter to TRUE to use connectivity-8 to determine whether particles are touching. 9315 9316 private void init() { 9317 9318 } 9319 public ParticleFilterOptions() { 9320 super(12); 9321 init(); 9322 } 9323 public ParticleFilterOptions(int rejectMatches, int rejectBorder, int connectivity8) { 9324 super(12); 9325 this.rejectMatches = rejectMatches; 9326 this.rejectBorder = rejectBorder; 9327 this.connectivity8 = connectivity8; 9328 } 9329 protected ParticleFilterOptions(ByteBuffer backing, int offset) { 9330 super(backing, offset, 12); 9331 init(); 9332 } 9333 protected ParticleFilterOptions(long nativeObj, boolean owned) { 9334 super(nativeObj, owned, 12); 9335 init(); 9336 } 9337 protected void setBuffer(ByteBuffer backing, int offset) { 9338 super.setBuffer(backing, offset, 12); 9339 } 9340 public void read() { 9341 rejectMatches = backing.getInt(0); 9342 rejectBorder = backing.getInt(4); 9343 connectivity8 = backing.getInt(8); 9344 } 9345 public void write() { 9346 backing.putInt(0, rejectMatches); 9347 backing.putInt(4, rejectBorder); 9348 backing.putInt(8, connectivity8); 9349 } 9350 public int size() { 9351 return 12; 9352 } 9353 } 9354 9355 public static class StraightEdgeReport2 extends DisposedStruct { 9356 public StraightEdge[] straightEdges; // Contains an array of found straight edges. 9357 public SearchLineInfo[] searchLines; // Contains an array of all search lines used in the detection. 9358 private ByteBuffer straightEdges_buf; 9359 private ByteBuffer searchLines_buf; 9360 9361 private void init() { 9362 straightEdges = new StraightEdge[0]; 9363 searchLines = new SearchLineInfo[0]; 9364 } 9365 public StraightEdgeReport2() { 9366 super(16); 9367 init(); 9368 } 9369 public StraightEdgeReport2(StraightEdge[] straightEdges, SearchLineInfo[] searchLines) { 9370 super(16); 9371 this.straightEdges = straightEdges; 9372 this.searchLines = searchLines; 9373 } 9374 protected StraightEdgeReport2(ByteBuffer backing, int offset) { 9375 super(backing, offset, 16); 9376 init(); 9377 } 9378 protected StraightEdgeReport2(long nativeObj, boolean owned) { 9379 super(nativeObj, owned, 16); 9380 init(); 9381 } 9382 protected void setBuffer(ByteBuffer backing, int offset) { 9383 super.setBuffer(backing, offset, 16); 9384 } 9385 public void read() { 9386 int straightEdges_numStraightEdges = backing.getInt(4); 9387 long straightEdges_addr = getPointer(backing, 0); 9388 straightEdges = new StraightEdge[straightEdges_numStraightEdges]; 9389 if (straightEdges_numStraightEdges > 0 && straightEdges_addr != 0) { 9390 ByteBuffer bb = newDirectByteBuffer(straightEdges_addr, straightEdges_numStraightEdges*88); 9391 for (int i=0, off=0; i<straightEdges_numStraightEdges; i++, off += 88) { 9392 straightEdges[i] = new StraightEdge(bb, off); 9393 straightEdges[i].read(); 9394 } 9395 } 9396 int searchLines_numSearchLines = backing.getInt(12); 9397 long searchLines_addr = getPointer(backing, 8); 9398 searchLines = new SearchLineInfo[searchLines_numSearchLines]; 9399 if (searchLines_numSearchLines > 0 && searchLines_addr != 0) { 9400 ByteBuffer bb = newDirectByteBuffer(searchLines_addr, searchLines_numSearchLines*36); 9401 for (int i=0, off=0; i<searchLines_numSearchLines; i++, off += 36) { 9402 searchLines[i] = new SearchLineInfo(bb, off); 9403 searchLines[i].read(); 9404 } 9405 } 9406 } 9407 public void write() { 9408 straightEdges_buf = ByteBuffer.allocateDirect(straightEdges.length*88).order(ByteOrder.nativeOrder()); 9409 for (int i=0, off=0; i<straightEdges.length; i++, off += 88) { 9410 straightEdges[i].setBuffer(straightEdges_buf, off); 9411 straightEdges[i].write(); 9412 } 9413 backing.putInt(4, straightEdges.length); 9414 putPointer(backing, 0, straightEdges_buf); 9415 searchLines_buf = ByteBuffer.allocateDirect(searchLines.length*36).order(ByteOrder.nativeOrder()); 9416 for (int i=0, off=0; i<searchLines.length; i++, off += 36) { 9417 searchLines[i].setBuffer(searchLines_buf, off); 9418 searchLines[i].write(); 9419 } 9420 backing.putInt(12, searchLines.length); 9421 putPointer(backing, 8, searchLines_buf); 9422 } 9423 public int size() { 9424 return 16; 9425 } 9426 } 9427 9428 public static class StraightEdgeOptions extends DisposedStruct { 9429 public int numLines; // Specifies the number of straight edges to find. 9430 public StraightEdgeSearchMode searchMode; // Specifies the method used to find the straight edge. 9431 public double minScore; // Specifies the minimum score of a detected straight edge. 9432 public double maxScore; // Specifies the maximum score of a detected edge. 9433 public double orientation; // Specifies the angle at which the straight edge is expected to be found. 9434 public double angleRange; // Specifies the +/- range around the orientation within which the straight edge is expected to be found. 9435 public double angleTolerance; // Specifies the expected angular accuracy of the straight edge. 9436 public int stepSize; // Specifies the gap in pixels between the search lines used with the rake-based methods. 9437 public double minSignalToNoiseRatio; // Specifies the minimum signal to noise ratio (SNR) of the edge points used to fit the straight edge. 9438 public double minCoverage; // Specifies the minimum number of points as a percentage of the number of search lines that need to be included in the detected straight edge. 9439 public int houghIterations; // Specifies the number of iterations used in the Hough-based method. 9440 9441 private void init() { 9442 9443 } 9444 public StraightEdgeOptions() { 9445 super(80); 9446 init(); 9447 } 9448 public StraightEdgeOptions(int numLines, StraightEdgeSearchMode searchMode, double minScore, double maxScore, double orientation, double angleRange, double angleTolerance, int stepSize, double minSignalToNoiseRatio, double minCoverage, int houghIterations) { 9449 super(80); 9450 this.numLines = numLines; 9451 this.searchMode = searchMode; 9452 this.minScore = minScore; 9453 this.maxScore = maxScore; 9454 this.orientation = orientation; 9455 this.angleRange = angleRange; 9456 this.angleTolerance = angleTolerance; 9457 this.stepSize = stepSize; 9458 this.minSignalToNoiseRatio = minSignalToNoiseRatio; 9459 this.minCoverage = minCoverage; 9460 this.houghIterations = houghIterations; 9461 } 9462 protected StraightEdgeOptions(ByteBuffer backing, int offset) { 9463 super(backing, offset, 80); 9464 init(); 9465 } 9466 protected StraightEdgeOptions(long nativeObj, boolean owned) { 9467 super(nativeObj, owned, 80); 9468 init(); 9469 } 9470 protected void setBuffer(ByteBuffer backing, int offset) { 9471 super.setBuffer(backing, offset, 80); 9472 } 9473 public void read() { 9474 numLines = backing.getInt(0); 9475 searchMode = StraightEdgeSearchMode.fromValue(backing.getInt(4)); 9476 minScore = backing.getDouble(8); 9477 maxScore = backing.getDouble(16); 9478 orientation = backing.getDouble(24); 9479 angleRange = backing.getDouble(32); 9480 angleTolerance = backing.getDouble(40); 9481 stepSize = backing.getInt(48); 9482 minSignalToNoiseRatio = backing.getDouble(56); 9483 minCoverage = backing.getDouble(64); 9484 houghIterations = backing.getInt(72); 9485 } 9486 public void write() { 9487 backing.putInt(0, numLines); 9488 if (searchMode != null) 9489 backing.putInt(4, searchMode.getValue()); 9490 backing.putDouble(8, minScore); 9491 backing.putDouble(16, maxScore); 9492 backing.putDouble(24, orientation); 9493 backing.putDouble(32, angleRange); 9494 backing.putDouble(40, angleTolerance); 9495 backing.putInt(48, stepSize); 9496 backing.putDouble(56, minSignalToNoiseRatio); 9497 backing.putDouble(64, minCoverage); 9498 backing.putInt(72, houghIterations); 9499 } 9500 public int size() { 9501 return 80; 9502 } 9503 } 9504 9505 public static class StraightEdge extends DisposedStruct { 9506 public LineFloat straightEdgeCoordinates; // End points of the detected straight edge in pixel coordinates. 9507 public LineFloat calibratedStraightEdgeCoordinates; // End points of the detected straight edge in real-world coordinates. 9508 public double angle; // Angle of the found edge using the pixel coordinates. 9509 public double calibratedAngle; // Angle of the found edge using the real-world coordinates. 9510 public double score; // Describes the score of the detected edge. 9511 public double straightness; // The straightness value of the detected straight edge. 9512 public double averageSignalToNoiseRatio; // Describes the average signal to noise ratio (SNR) of the detected edge. 9513 public int calibrationValid; // Indicates if the calibration data for the straight edge is valid. 9514 public EdgeInfo[] usedEdges; // An array of edges that were used to determine this straight line. 9515 private ByteBuffer usedEdges_buf; 9516 9517 private void init() { 9518 straightEdgeCoordinates = new LineFloat(backing, 0); 9519 calibratedStraightEdgeCoordinates = new LineFloat(backing, 16); 9520 usedEdges = new EdgeInfo[0]; 9521 } 9522 public StraightEdge() { 9523 super(88); 9524 init(); 9525 } 9526 public StraightEdge(LineFloat straightEdgeCoordinates, LineFloat calibratedStraightEdgeCoordinates, double angle, double calibratedAngle, double score, double straightness, double averageSignalToNoiseRatio, int calibrationValid, EdgeInfo[] usedEdges) { 9527 super(88); 9528 this.straightEdgeCoordinates = straightEdgeCoordinates; 9529 this.calibratedStraightEdgeCoordinates = calibratedStraightEdgeCoordinates; 9530 this.angle = angle; 9531 this.calibratedAngle = calibratedAngle; 9532 this.score = score; 9533 this.straightness = straightness; 9534 this.averageSignalToNoiseRatio = averageSignalToNoiseRatio; 9535 this.calibrationValid = calibrationValid; 9536 this.usedEdges = usedEdges; 9537 } 9538 protected StraightEdge(ByteBuffer backing, int offset) { 9539 super(backing, offset, 88); 9540 init(); 9541 } 9542 protected StraightEdge(long nativeObj, boolean owned) { 9543 super(nativeObj, owned, 88); 9544 init(); 9545 } 9546 protected void setBuffer(ByteBuffer backing, int offset) { 9547 super.setBuffer(backing, offset, 88); 9548 } 9549 public void read() { 9550 straightEdgeCoordinates.read(); 9551 calibratedStraightEdgeCoordinates.read(); 9552 angle = backing.getDouble(32); 9553 calibratedAngle = backing.getDouble(40); 9554 score = backing.getDouble(48); 9555 straightness = backing.getDouble(56); 9556 averageSignalToNoiseRatio = backing.getDouble(64); 9557 calibrationValid = backing.getInt(72); 9558 int usedEdges_numUsedEdges = backing.getInt(80); 9559 long usedEdges_addr = getPointer(backing, 76); 9560 usedEdges = new EdgeInfo[usedEdges_numUsedEdges]; 9561 if (usedEdges_numUsedEdges > 0 && usedEdges_addr != 0) { 9562 ByteBuffer bb = newDirectByteBuffer(usedEdges_addr, usedEdges_numUsedEdges*56); 9563 for (int i=0, off=0; i<usedEdges_numUsedEdges; i++, off += 56) { 9564 usedEdges[i] = new EdgeInfo(bb, off); 9565 usedEdges[i].read(); 9566 } 9567 } 9568 } 9569 public void write() { 9570 straightEdgeCoordinates.write(); 9571 calibratedStraightEdgeCoordinates.write(); 9572 backing.putDouble(32, angle); 9573 backing.putDouble(40, calibratedAngle); 9574 backing.putDouble(48, score); 9575 backing.putDouble(56, straightness); 9576 backing.putDouble(64, averageSignalToNoiseRatio); 9577 backing.putInt(72, calibrationValid); 9578 usedEdges_buf = ByteBuffer.allocateDirect(usedEdges.length*56).order(ByteOrder.nativeOrder()); 9579 for (int i=0, off=0; i<usedEdges.length; i++, off += 56) { 9580 usedEdges[i].setBuffer(usedEdges_buf, off); 9581 usedEdges[i].write(); 9582 } 9583 backing.putInt(80, usedEdges.length); 9584 putPointer(backing, 76, usedEdges_buf); 9585 } 9586 public int size() { 9587 return 88; 9588 } 9589 } 9590 9591 public static class QRCodeSearchOptions extends DisposedStruct { 9592 public QRRotationMode rotationMode; // Specifies the amount of QR code rotation the function should allow for. 9593 public int skipLocation; // If set to TRUE, specifies that the function should assume that the QR code occupies the entire image (or the entire search region). 9594 public int edgeThreshold; // The strength of the weakest edge the function uses to find the coarse location of the QR code in the image. 9595 public QRDemodulationMode demodulationMode; // The demodulation mode the function uses to locate the QR code. 9596 public QRCellSampleSize cellSampleSize; // The cell sample size the function uses to locate the QR code. 9597 public QRCellFilterMode cellFilterMode; // The cell filter mode the function uses to locate the QR code. 9598 public int skewDegreesAllowed; // Specifies the amount of skew in the QR code the function should allow for. 9599 9600 private void init() { 9601 9602 } 9603 public QRCodeSearchOptions() { 9604 super(48); 9605 init(); 9606 } 9607 public QRCodeSearchOptions(QRRotationMode rotationMode, int skipLocation, int edgeThreshold, QRDemodulationMode demodulationMode, QRCellSampleSize cellSampleSize, QRCellFilterMode cellFilterMode, int skewDegreesAllowed) { 9608 super(48); 9609 this.rotationMode = rotationMode; 9610 this.skipLocation = skipLocation; 9611 this.edgeThreshold = edgeThreshold; 9612 this.demodulationMode = demodulationMode; 9613 this.cellSampleSize = cellSampleSize; 9614 this.cellFilterMode = cellFilterMode; 9615 this.skewDegreesAllowed = skewDegreesAllowed; 9616 } 9617 protected QRCodeSearchOptions(ByteBuffer backing, int offset) { 9618 super(backing, offset, 48); 9619 init(); 9620 } 9621 protected QRCodeSearchOptions(long nativeObj, boolean owned) { 9622 super(nativeObj, owned, 48); 9623 init(); 9624 } 9625 protected void setBuffer(ByteBuffer backing, int offset) { 9626 super.setBuffer(backing, offset, 48); 9627 } 9628 public void read() { 9629 rotationMode = QRRotationMode.fromValue(backing.getInt(0)); 9630 skipLocation = backing.getInt(4); 9631 edgeThreshold = backing.getInt(8); 9632 demodulationMode = QRDemodulationMode.fromValue(backing.getInt(16)); 9633 cellSampleSize = QRCellSampleSize.fromValue(backing.getInt(24)); 9634 cellFilterMode = QRCellFilterMode.fromValue(backing.getInt(32)); 9635 skewDegreesAllowed = backing.getInt(40); 9636 } 9637 public void write() { 9638 if (rotationMode != null) 9639 backing.putInt(0, rotationMode.getValue()); 9640 backing.putInt(4, skipLocation); 9641 backing.putInt(8, edgeThreshold); 9642 if (demodulationMode != null) 9643 backing.putInt(16, demodulationMode.getValue()); 9644 if (cellSampleSize != null) 9645 backing.putInt(24, cellSampleSize.getValue()); 9646 if (cellFilterMode != null) 9647 backing.putInt(32, cellFilterMode.getValue()); 9648 backing.putInt(40, skewDegreesAllowed); 9649 } 9650 public int size() { 9651 return 48; 9652 } 9653 } 9654 9655 public static class QRCodeSizeOptions extends DisposedStruct { 9656 public int minSize; // Specifies the minimum size (in pixels) of the QR code in the image. 9657 public int maxSize; // Specifies the maximum size (in pixels) of the QR code in the image. 9658 9659 private void init() { 9660 9661 } 9662 public QRCodeSizeOptions() { 9663 super(8); 9664 init(); 9665 } 9666 public QRCodeSizeOptions(int minSize, int maxSize) { 9667 super(8); 9668 this.minSize = minSize; 9669 this.maxSize = maxSize; 9670 } 9671 protected QRCodeSizeOptions(ByteBuffer backing, int offset) { 9672 super(backing, offset, 8); 9673 init(); 9674 } 9675 protected QRCodeSizeOptions(long nativeObj, boolean owned) { 9676 super(nativeObj, owned, 8); 9677 init(); 9678 } 9679 protected void setBuffer(ByteBuffer backing, int offset) { 9680 super.setBuffer(backing, offset, 8); 9681 } 9682 public void read() { 9683 minSize = backing.getInt(0); 9684 maxSize = backing.getInt(4); 9685 } 9686 public void write() { 9687 backing.putInt(0, minSize); 9688 backing.putInt(4, maxSize); 9689 } 9690 public int size() { 9691 return 8; 9692 } 9693 } 9694 9695 public static class QRCodeDescriptionOptions extends DisposedStruct { 9696 public QRDimensions dimensions; // The number of rows and columns that are populated for the QR code, measured in cells. 9697 public QRPolarities polarity; // The polarity of the QR code. 9698 public QRMirrorMode mirror; // This element is TRUE if the QR code appears mirrored in the image and FALSE if the QR code appears normally in the image. 9699 public QRModelType modelType; // This option allows you to specify the type of QR code. 9700 9701 private void init() { 9702 9703 } 9704 public QRCodeDescriptionOptions() { 9705 super(32); 9706 init(); 9707 } 9708 public QRCodeDescriptionOptions(QRDimensions dimensions, QRPolarities polarity, QRMirrorMode mirror, QRModelType modelType) { 9709 super(32); 9710 this.dimensions = dimensions; 9711 this.polarity = polarity; 9712 this.mirror = mirror; 9713 this.modelType = modelType; 9714 } 9715 protected QRCodeDescriptionOptions(ByteBuffer backing, int offset) { 9716 super(backing, offset, 32); 9717 init(); 9718 } 9719 protected QRCodeDescriptionOptions(long nativeObj, boolean owned) { 9720 super(nativeObj, owned, 32); 9721 init(); 9722 } 9723 protected void setBuffer(ByteBuffer backing, int offset) { 9724 super.setBuffer(backing, offset, 32); 9725 } 9726 public void read() { 9727 dimensions = QRDimensions.fromValue(backing.getInt(0)); 9728 polarity = QRPolarities.fromValue(backing.getInt(8)); 9729 mirror = QRMirrorMode.fromValue(backing.getInt(16)); 9730 modelType = QRModelType.fromValue(backing.getInt(24)); 9731 } 9732 public void write() { 9733 if (dimensions != null) 9734 backing.putInt(0, dimensions.getValue()); 9735 if (polarity != null) 9736 backing.putInt(8, polarity.getValue()); 9737 if (mirror != null) 9738 backing.putInt(16, mirror.getValue()); 9739 if (modelType != null) 9740 backing.putInt(24, modelType.getValue()); 9741 } 9742 public int size() { 9743 return 32; 9744 } 9745 } 9746 9747 public static class QRCodeReport extends DisposedStruct { 9748 public int found; // This element is TRUE if the function located and decoded a QR code and FALSE if the function failed to locate and decode a QR code. 9749 public byte[] data; // The data encoded in the QR code. 9750 public PointFloat[] boundingBox; // An array of four points describing the rectangle surrounding the QR code. 9751 public QRCodeDataToken[] tokenizedData; // Contains the data tokenized in exactly the way it was encoded in the code. 9752 public int numErrorsCorrected; // The number of errors the function corrected when decoding the QR code. 9753 public int dimensions; // The number of rows and columns that are populated for the QR code, measured in cells. 9754 public int version; // The version of the QR code. 9755 public QRModelType modelType; // This option allows you to specify what type of QR code this is. 9756 public QRStreamMode streamMode; // The format of the data encoded in the stream. 9757 public QRPolarities matrixPolarity; // The polarity of the QR code. 9758 public int mirrored; // This element is TRUE if the QR code appears mirrored in the image and FALSE if the QR code appears normally in the image. 9759 public int positionInAppendStream; // Indicates what position the QR code is in with respect to the stream of data in all codes. 9760 public int sizeOfAppendStream; // Specifies how many QR codes are part of a larger array of codes. 9761 public int firstEAN128ApplicationID; // The first EAN-128 Application ID encountered in the stream. 9762 public int firstECIDesignator; // The first Regional Language Designator encountered in the stream. 9763 public int appendStreamIdentifier; // Specifies what stream the QR code is in relation to when the code is part of a larger array of codes. 9764 public int minimumEdgeStrength; // The strength of the weakest edge the function used to find the coarse location of the QR code in the image. 9765 public QRDemodulationMode demodulationMode; // The demodulation mode the function used to locate the QR code. 9766 public QRCellSampleSize cellSampleSize; // The cell sample size the function used to locate the QR code. 9767 public QRCellFilterMode cellFilterMode; // The cell filter mode the function used to locate the QR code. 9768 private ByteBuffer data_buf; 9769 private ByteBuffer tokenizedData_buf; 9770 9771 private void init() { 9772 data = new byte[0]; 9773 boundingBox = new PointFloat[4]; 9774 9775 for (int i=0, off=12; i<4; i++, off += 8) 9776 boundingBox[i] = new PointFloat(backing, off); 9777 tokenizedData = new QRCodeDataToken[0]; 9778 } 9779 public QRCodeReport() { 9780 super(136); 9781 init(); 9782 } 9783 public QRCodeReport(int found, byte[] data, PointFloat[] boundingBox, QRCodeDataToken[] tokenizedData, int numErrorsCorrected, int dimensions, int version, QRModelType modelType, QRStreamMode streamMode, QRPolarities matrixPolarity, int mirrored, int positionInAppendStream, int sizeOfAppendStream, int firstEAN128ApplicationID, int firstECIDesignator, int appendStreamIdentifier, int minimumEdgeStrength, QRDemodulationMode demodulationMode, QRCellSampleSize cellSampleSize, QRCellFilterMode cellFilterMode) { 9784 super(136); 9785 this.found = found; 9786 this.data = data; 9787 this.boundingBox = boundingBox; 9788 this.tokenizedData = tokenizedData; 9789 this.numErrorsCorrected = numErrorsCorrected; 9790 this.dimensions = dimensions; 9791 this.version = version; 9792 this.modelType = modelType; 9793 this.streamMode = streamMode; 9794 this.matrixPolarity = matrixPolarity; 9795 this.mirrored = mirrored; 9796 this.positionInAppendStream = positionInAppendStream; 9797 this.sizeOfAppendStream = sizeOfAppendStream; 9798 this.firstEAN128ApplicationID = firstEAN128ApplicationID; 9799 this.firstECIDesignator = firstECIDesignator; 9800 this.appendStreamIdentifier = appendStreamIdentifier; 9801 this.minimumEdgeStrength = minimumEdgeStrength; 9802 this.demodulationMode = demodulationMode; 9803 this.cellSampleSize = cellSampleSize; 9804 this.cellFilterMode = cellFilterMode; 9805 } 9806 protected QRCodeReport(ByteBuffer backing, int offset) { 9807 super(backing, offset, 136); 9808 init(); 9809 } 9810 protected QRCodeReport(long nativeObj, boolean owned) { 9811 super(nativeObj, owned, 136); 9812 init(); 9813 } 9814 protected void setBuffer(ByteBuffer backing, int offset) { 9815 super.setBuffer(backing, offset, 136); 9816 } 9817 public void read() { 9818 found = backing.getInt(0); 9819 int data_dataLength = backing.getInt(8); 9820 long data_addr = getPointer(backing, 4); 9821 data = new byte[data_dataLength]; 9822 if (data_dataLength > 0 && data_addr != 0) { 9823 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 9824 } 9825 for (PointFloat it : boundingBox) { 9826 it.read(); 9827 } 9828 int tokenizedData_sizeOfTokenizedData = backing.getInt(48); 9829 long tokenizedData_addr = getPointer(backing, 44); 9830 tokenizedData = new QRCodeDataToken[tokenizedData_sizeOfTokenizedData]; 9831 if (tokenizedData_sizeOfTokenizedData > 0 && tokenizedData_addr != 0) { 9832 ByteBuffer bb = newDirectByteBuffer(tokenizedData_addr, tokenizedData_sizeOfTokenizedData*16); 9833 for (int i=0, off=0; i<tokenizedData_sizeOfTokenizedData; i++, off += 16) { 9834 tokenizedData[i] = new QRCodeDataToken(bb, off); 9835 tokenizedData[i].read(); 9836 } 9837 } 9838 numErrorsCorrected = backing.getInt(52); 9839 dimensions = backing.getInt(56); 9840 version = backing.getInt(60); 9841 modelType = QRModelType.fromValue(backing.getInt(64)); 9842 streamMode = QRStreamMode.fromValue(backing.getInt(68)); 9843 matrixPolarity = QRPolarities.fromValue(backing.getInt(72)); 9844 mirrored = backing.getInt(80); 9845 positionInAppendStream = backing.getInt(84); 9846 sizeOfAppendStream = backing.getInt(88); 9847 firstEAN128ApplicationID = backing.getInt(92); 9848 firstECIDesignator = backing.getInt(96); 9849 appendStreamIdentifier = backing.getInt(100); 9850 minimumEdgeStrength = backing.getInt(104); 9851 demodulationMode = QRDemodulationMode.fromValue(backing.getInt(112)); 9852 cellSampleSize = QRCellSampleSize.fromValue(backing.getInt(120)); 9853 cellFilterMode = QRCellFilterMode.fromValue(backing.getInt(128)); 9854 } 9855 public void write() { 9856 backing.putInt(0, found); 9857 data_buf = ByteBuffer.allocateDirect(data.length); 9858 putBytes(data_buf, data, 0, data.length); 9859 backing.putInt(8, data.length); 9860 putPointer(backing, 4, data_buf); 9861 for (PointFloat it : boundingBox) { 9862 it.write(); 9863 } 9864 tokenizedData_buf = ByteBuffer.allocateDirect(tokenizedData.length*16).order(ByteOrder.nativeOrder()); 9865 for (int i=0, off=0; i<tokenizedData.length; i++, off += 16) { 9866 tokenizedData[i].setBuffer(tokenizedData_buf, off); 9867 tokenizedData[i].write(); 9868 } 9869 backing.putInt(48, tokenizedData.length); 9870 putPointer(backing, 44, tokenizedData_buf); 9871 backing.putInt(52, numErrorsCorrected); 9872 backing.putInt(56, dimensions); 9873 backing.putInt(60, version); 9874 if (modelType != null) 9875 backing.putInt(64, modelType.getValue()); 9876 if (streamMode != null) 9877 backing.putInt(68, streamMode.getValue()); 9878 if (matrixPolarity != null) 9879 backing.putInt(72, matrixPolarity.getValue()); 9880 backing.putInt(80, mirrored); 9881 backing.putInt(84, positionInAppendStream); 9882 backing.putInt(88, sizeOfAppendStream); 9883 backing.putInt(92, firstEAN128ApplicationID); 9884 backing.putInt(96, firstECIDesignator); 9885 backing.putInt(100, appendStreamIdentifier); 9886 backing.putInt(104, minimumEdgeStrength); 9887 if (demodulationMode != null) 9888 backing.putInt(112, demodulationMode.getValue()); 9889 if (cellSampleSize != null) 9890 backing.putInt(120, cellSampleSize.getValue()); 9891 if (cellFilterMode != null) 9892 backing.putInt(128, cellFilterMode.getValue()); 9893 } 9894 public int size() { 9895 return 136; 9896 } 9897 } 9898 9899 public static class AIMGradeReport extends DisposedStruct { 9900 public AIMGrade overallGrade; // The overall letter grade, which is equal to the lowest of the other five letter grades. 9901 public AIMGrade decodingGrade; // The letter grade assigned to a Data Matrix barcode based on the success of the function in decoding the Data Matrix barcode. 9902 public AIMGrade symbolContrastGrade; // The letter grade assigned to a Data Matrix barcode based on the symbol contrast raw score. 9903 public float symbolContrast; // The symbol contrast raw score representing the percentage difference between the mean of the reflectance of the darkest 10 percent and lightest 10 percent of the Data Matrix barcode. 9904 public AIMGrade printGrowthGrade; // The print growth letter grade for the Data Matrix barcode. 9905 public float printGrowth; // The print growth raw score for the barcode, which is based on the extent to which dark or light markings appropriately fill their module boundaries. 9906 public AIMGrade axialNonuniformityGrade; // The axial nonuniformity grade for the Data Matrix barcode. 9907 public float axialNonuniformity; // The axial nonuniformity raw score for the barcode, which is based on how much the sampling point spacing differs from one axis to another. 9908 public AIMGrade unusedErrorCorrectionGrade; // The unused error correction letter grade for the Data Matrix barcode. 9909 public float unusedErrorCorrection; // The unused error correction raw score for the Data Matrix barcode, which is based on the extent to which regional or spot damage in the Data Matrix barcode has eroded the reading safety margin provided by the error correction. 9910 9911 private void init() { 9912 9913 } 9914 public AIMGradeReport() { 9915 super(40); 9916 init(); 9917 } 9918 public AIMGradeReport(AIMGrade overallGrade, AIMGrade decodingGrade, AIMGrade symbolContrastGrade, double symbolContrast, AIMGrade printGrowthGrade, double printGrowth, AIMGrade axialNonuniformityGrade, double axialNonuniformity, AIMGrade unusedErrorCorrectionGrade, double unusedErrorCorrection) { 9919 super(40); 9920 this.overallGrade = overallGrade; 9921 this.decodingGrade = decodingGrade; 9922 this.symbolContrastGrade = symbolContrastGrade; 9923 this.symbolContrast = (float)symbolContrast; 9924 this.printGrowthGrade = printGrowthGrade; 9925 this.printGrowth = (float)printGrowth; 9926 this.axialNonuniformityGrade = axialNonuniformityGrade; 9927 this.axialNonuniformity = (float)axialNonuniformity; 9928 this.unusedErrorCorrectionGrade = unusedErrorCorrectionGrade; 9929 this.unusedErrorCorrection = (float)unusedErrorCorrection; 9930 } 9931 protected AIMGradeReport(ByteBuffer backing, int offset) { 9932 super(backing, offset, 40); 9933 init(); 9934 } 9935 protected AIMGradeReport(long nativeObj, boolean owned) { 9936 super(nativeObj, owned, 40); 9937 init(); 9938 } 9939 protected void setBuffer(ByteBuffer backing, int offset) { 9940 super.setBuffer(backing, offset, 40); 9941 } 9942 public void read() { 9943 overallGrade = AIMGrade.fromValue(backing.getInt(0)); 9944 decodingGrade = AIMGrade.fromValue(backing.getInt(4)); 9945 symbolContrastGrade = AIMGrade.fromValue(backing.getInt(8)); 9946 symbolContrast = backing.getFloat(12); 9947 printGrowthGrade = AIMGrade.fromValue(backing.getInt(16)); 9948 printGrowth = backing.getFloat(20); 9949 axialNonuniformityGrade = AIMGrade.fromValue(backing.getInt(24)); 9950 axialNonuniformity = backing.getFloat(28); 9951 unusedErrorCorrectionGrade = AIMGrade.fromValue(backing.getInt(32)); 9952 unusedErrorCorrection = backing.getFloat(36); 9953 } 9954 public void write() { 9955 if (overallGrade != null) 9956 backing.putInt(0, overallGrade.getValue()); 9957 if (decodingGrade != null) 9958 backing.putInt(4, decodingGrade.getValue()); 9959 if (symbolContrastGrade != null) 9960 backing.putInt(8, symbolContrastGrade.getValue()); 9961 backing.putFloat(12, symbolContrast); 9962 if (printGrowthGrade != null) 9963 backing.putInt(16, printGrowthGrade.getValue()); 9964 backing.putFloat(20, printGrowth); 9965 if (axialNonuniformityGrade != null) 9966 backing.putInt(24, axialNonuniformityGrade.getValue()); 9967 backing.putFloat(28, axialNonuniformity); 9968 if (unusedErrorCorrectionGrade != null) 9969 backing.putInt(32, unusedErrorCorrectionGrade.getValue()); 9970 backing.putFloat(36, unusedErrorCorrection); 9971 } 9972 public int size() { 9973 return 40; 9974 } 9975 } 9976 9977 public static class DataMatrixSizeOptions extends DisposedStruct { 9978 public int minSize; // Specifies the minimum size (in pixels) of the Data Matrix barcode in the image. 9979 public int maxSize; // Specifies the maximum size (in pixels) of the Data Matrix barcode in the image. 9980 public int quietZoneWidth; // Specifies the expected minimum size of the quiet zone, in pixels. 9981 9982 private void init() { 9983 9984 } 9985 public DataMatrixSizeOptions() { 9986 super(12); 9987 init(); 9988 } 9989 public DataMatrixSizeOptions(int minSize, int maxSize, int quietZoneWidth) { 9990 super(12); 9991 this.minSize = minSize; 9992 this.maxSize = maxSize; 9993 this.quietZoneWidth = quietZoneWidth; 9994 } 9995 protected DataMatrixSizeOptions(ByteBuffer backing, int offset) { 9996 super(backing, offset, 12); 9997 init(); 9998 } 9999 protected DataMatrixSizeOptions(long nativeObj, boolean owned) { 10000 super(nativeObj, owned, 12); 10001 init(); 10002 } 10003 protected void setBuffer(ByteBuffer backing, int offset) { 10004 super.setBuffer(backing, offset, 12); 10005 } 10006 public void read() { 10007 minSize = backing.getInt(0); 10008 maxSize = backing.getInt(4); 10009 quietZoneWidth = backing.getInt(8); 10010 } 10011 public void write() { 10012 backing.putInt(0, minSize); 10013 backing.putInt(4, maxSize); 10014 backing.putInt(8, quietZoneWidth); 10015 } 10016 public int size() { 10017 return 12; 10018 } 10019 } 10020 10021 public static class DataMatrixDescriptionOptions extends DisposedStruct { 10022 public float aspectRatio; // Specifies the ratio of the width of each Data Matrix barcode cell (in pixels) to the height of the Data Matrix barcode (in pixels). 10023 public int rows; // Specifies the number of rows in the Data Matrix barcode. 10024 public int columns; // Specifies the number of columns in the Data Matrix barcode. 10025 public int rectangle; // Set this element to TRUE to specify that the Data Matrix barcode is rectangular. 10026 public DataMatrixECC ecc; // Specifies the ECC used for this Data Matrix barcode. 10027 public DataMatrixPolarity polarity; // Specifies the data-to-background contrast for the Data Matrix barcode. 10028 public DataMatrixCellFillMode cellFill; // Specifies the fill percentage for a cell of the Data Matrix barcode that is in the "ON" state. 10029 public float minBorderIntegrity; // Specifies the minimum percentage of the border (locator pattern and timing pattern) the function should expect in the Data Matrix barcode. 10030 public DataMatrixMirrorMode mirrorMode; // Specifies if the Data Matrix barcode appears normally in the image or if the barcode appears mirrored in the image. 10031 10032 private void init() { 10033 10034 } 10035 public DataMatrixDescriptionOptions() { 10036 super(56); 10037 init(); 10038 } 10039 public DataMatrixDescriptionOptions(double aspectRatio, int rows, int columns, int rectangle, DataMatrixECC ecc, DataMatrixPolarity polarity, DataMatrixCellFillMode cellFill, double minBorderIntegrity, DataMatrixMirrorMode mirrorMode) { 10040 super(56); 10041 this.aspectRatio = (float)aspectRatio; 10042 this.rows = rows; 10043 this.columns = columns; 10044 this.rectangle = rectangle; 10045 this.ecc = ecc; 10046 this.polarity = polarity; 10047 this.cellFill = cellFill; 10048 this.minBorderIntegrity = (float)minBorderIntegrity; 10049 this.mirrorMode = mirrorMode; 10050 } 10051 protected DataMatrixDescriptionOptions(ByteBuffer backing, int offset) { 10052 super(backing, offset, 56); 10053 init(); 10054 } 10055 protected DataMatrixDescriptionOptions(long nativeObj, boolean owned) { 10056 super(nativeObj, owned, 56); 10057 init(); 10058 } 10059 protected void setBuffer(ByteBuffer backing, int offset) { 10060 super.setBuffer(backing, offset, 56); 10061 } 10062 public void read() { 10063 aspectRatio = backing.getFloat(0); 10064 rows = backing.getInt(4); 10065 columns = backing.getInt(8); 10066 rectangle = backing.getInt(12); 10067 ecc = DataMatrixECC.fromValue(backing.getInt(16)); 10068 polarity = DataMatrixPolarity.fromValue(backing.getInt(24)); 10069 cellFill = DataMatrixCellFillMode.fromValue(backing.getInt(32)); 10070 minBorderIntegrity = backing.getFloat(40); 10071 mirrorMode = DataMatrixMirrorMode.fromValue(backing.getInt(48)); 10072 } 10073 public void write() { 10074 backing.putFloat(0, aspectRatio); 10075 backing.putInt(4, rows); 10076 backing.putInt(8, columns); 10077 backing.putInt(12, rectangle); 10078 if (ecc != null) 10079 backing.putInt(16, ecc.getValue()); 10080 if (polarity != null) 10081 backing.putInt(24, polarity.getValue()); 10082 if (cellFill != null) 10083 backing.putInt(32, cellFill.getValue()); 10084 backing.putFloat(40, minBorderIntegrity); 10085 if (mirrorMode != null) 10086 backing.putInt(48, mirrorMode.getValue()); 10087 } 10088 public int size() { 10089 return 56; 10090 } 10091 } 10092 10093 public static class DataMatrixSearchOptions extends DisposedStruct { 10094 public DataMatrixRotationMode rotationMode; // Specifies the amount of Data Matrix barcode rotation the function should allow for. 10095 public int skipLocation; // If set to TRUE, specifies that the function should assume that the Data Matrix barcode occupies the entire image (or the entire search region). 10096 public int edgeThreshold; // Specifies the minimum contrast a pixel must have in order to be considered part of a matrix cell edge. 10097 public DataMatrixDemodulationMode demodulationMode; // Specifies the mode the function should use to demodulate (determine which cells are on and which cells are off) the Data Matrix barcode. 10098 public DataMatrixCellSampleSize cellSampleSize; // Specifies the sample size, in pixels, the function should take to determine if each cell is on or off. 10099 public DataMatrixCellFilterMode cellFilterMode; // Specifies the mode the function uses to determine the pixel value for each cell. 10100 public int skewDegreesAllowed; // Specifies the amount of skew in the Data Matrix barcode the function should allow for. 10101 public int maxIterations; // Specifies the maximum number of iterations before the function stops looking for the Data Matrix barcode. 10102 public int initialSearchVectorWidth; // Specifies the number of pixels the function should average together to determine the location of an edge. 10103 10104 private void init() { 10105 10106 } 10107 public DataMatrixSearchOptions() { 10108 super(56); 10109 init(); 10110 } 10111 public DataMatrixSearchOptions(DataMatrixRotationMode rotationMode, int skipLocation, int edgeThreshold, DataMatrixDemodulationMode demodulationMode, DataMatrixCellSampleSize cellSampleSize, DataMatrixCellFilterMode cellFilterMode, int skewDegreesAllowed, int maxIterations, int initialSearchVectorWidth) { 10112 super(56); 10113 this.rotationMode = rotationMode; 10114 this.skipLocation = skipLocation; 10115 this.edgeThreshold = edgeThreshold; 10116 this.demodulationMode = demodulationMode; 10117 this.cellSampleSize = cellSampleSize; 10118 this.cellFilterMode = cellFilterMode; 10119 this.skewDegreesAllowed = skewDegreesAllowed; 10120 this.maxIterations = maxIterations; 10121 this.initialSearchVectorWidth = initialSearchVectorWidth; 10122 } 10123 protected DataMatrixSearchOptions(ByteBuffer backing, int offset) { 10124 super(backing, offset, 56); 10125 init(); 10126 } 10127 protected DataMatrixSearchOptions(long nativeObj, boolean owned) { 10128 super(nativeObj, owned, 56); 10129 init(); 10130 } 10131 protected void setBuffer(ByteBuffer backing, int offset) { 10132 super.setBuffer(backing, offset, 56); 10133 } 10134 public void read() { 10135 rotationMode = DataMatrixRotationMode.fromValue(backing.getInt(0)); 10136 skipLocation = backing.getInt(4); 10137 edgeThreshold = backing.getInt(8); 10138 demodulationMode = DataMatrixDemodulationMode.fromValue(backing.getInt(16)); 10139 cellSampleSize = DataMatrixCellSampleSize.fromValue(backing.getInt(24)); 10140 cellFilterMode = DataMatrixCellFilterMode.fromValue(backing.getInt(32)); 10141 skewDegreesAllowed = backing.getInt(40); 10142 maxIterations = backing.getInt(44); 10143 initialSearchVectorWidth = backing.getInt(48); 10144 } 10145 public void write() { 10146 if (rotationMode != null) 10147 backing.putInt(0, rotationMode.getValue()); 10148 backing.putInt(4, skipLocation); 10149 backing.putInt(8, edgeThreshold); 10150 if (demodulationMode != null) 10151 backing.putInt(16, demodulationMode.getValue()); 10152 if (cellSampleSize != null) 10153 backing.putInt(24, cellSampleSize.getValue()); 10154 if (cellFilterMode != null) 10155 backing.putInt(32, cellFilterMode.getValue()); 10156 backing.putInt(40, skewDegreesAllowed); 10157 backing.putInt(44, maxIterations); 10158 backing.putInt(48, initialSearchVectorWidth); 10159 } 10160 public int size() { 10161 return 56; 10162 } 10163 } 10164 10165 public static class DataMatrixReport extends DisposedStruct { 10166 public int found; // This element is TRUE if the function located and decoded a Data Matrix barcode and FALSE if the function failed to locate and decode a Data Matrix barcode. 10167 public int binary; // This element is TRUE if the Data Matrix barcode contains binary data and FALSE if the Data Matrix barcode contains text data. 10168 public byte[] data; // The data encoded in the Data Matrix barcode. 10169 public PointFloat[] boundingBox; // An array of four points describing the rectangle surrounding the Data Matrix barcode. 10170 public int numErrorsCorrected; // The number of errors the function corrected when decoding the Data Matrix barcode. 10171 public int numErasuresCorrected; // The number of erasures the function corrected when decoding the Data Matrix barcode. 10172 public float aspectRatio; // Specifies the aspect ratio of the Data Matrix barcode in the image, which equals the ratio of the width of a Data Matrix barcode cell (in pixels) to the height of a Data Matrix barcode cell (in pixels). 10173 public int rows; // The number of rows in the Data Matrix barcode. 10174 public int columns; // The number of columns in the Data Matrix barcode. 10175 public DataMatrixECC ecc; // The Error Correction Code (ECC) used by the Data Matrix barcode. 10176 public DataMatrixPolarity polarity; // The polarity of the Data Matrix barcode. 10177 public DataMatrixCellFillMode cellFill; // The cell fill percentage of the Data Matrix barcode. 10178 public float borderIntegrity; // The percentage of the Data Matrix barcode border that appears correctly in the image. 10179 public int mirrored; // This element is TRUE if the Data Matrix barcode appears mirrored in the image and FALSE if the Data Matrix barcode appears normally in the image. 10180 public int minimumEdgeStrength; // The strength of the weakest edge the function used to find the coarse location of the Data Matrix barcode in the image. 10181 public DataMatrixDemodulationMode demodulationMode; // The demodulation mode the function used to locate the Data Matrix barcode. 10182 public DataMatrixCellSampleSize cellSampleSize; // The cell sample size the function used to locate the Data Matrix barcode. 10183 public DataMatrixCellFilterMode cellFilterMode; // The cell filter mode the function used to locate the Data Matrix barcode. 10184 public int iterations; // The number of iterations the function took in attempting to locate the Data Matrix barcode. 10185 private ByteBuffer data_buf; 10186 10187 private void init() { 10188 data = new byte[0]; 10189 boundingBox = new PointFloat[4]; 10190 10191 for (int i=0, off=16; i<4; i++, off += 8) 10192 boundingBox[i] = new PointFloat(backing, off); 10193 } 10194 public DataMatrixReport() { 10195 super(144); 10196 init(); 10197 } 10198 public DataMatrixReport(int found, int binary, byte[] data, PointFloat[] boundingBox, int numErrorsCorrected, int numErasuresCorrected, double aspectRatio, int rows, int columns, DataMatrixECC ecc, DataMatrixPolarity polarity, DataMatrixCellFillMode cellFill, double borderIntegrity, int mirrored, int minimumEdgeStrength, DataMatrixDemodulationMode demodulationMode, DataMatrixCellSampleSize cellSampleSize, DataMatrixCellFilterMode cellFilterMode, int iterations) { 10199 super(144); 10200 this.found = found; 10201 this.binary = binary; 10202 this.data = data; 10203 this.boundingBox = boundingBox; 10204 this.numErrorsCorrected = numErrorsCorrected; 10205 this.numErasuresCorrected = numErasuresCorrected; 10206 this.aspectRatio = (float)aspectRatio; 10207 this.rows = rows; 10208 this.columns = columns; 10209 this.ecc = ecc; 10210 this.polarity = polarity; 10211 this.cellFill = cellFill; 10212 this.borderIntegrity = (float)borderIntegrity; 10213 this.mirrored = mirrored; 10214 this.minimumEdgeStrength = minimumEdgeStrength; 10215 this.demodulationMode = demodulationMode; 10216 this.cellSampleSize = cellSampleSize; 10217 this.cellFilterMode = cellFilterMode; 10218 this.iterations = iterations; 10219 } 10220 protected DataMatrixReport(ByteBuffer backing, int offset) { 10221 super(backing, offset, 144); 10222 init(); 10223 } 10224 protected DataMatrixReport(long nativeObj, boolean owned) { 10225 super(nativeObj, owned, 144); 10226 init(); 10227 } 10228 protected void setBuffer(ByteBuffer backing, int offset) { 10229 super.setBuffer(backing, offset, 144); 10230 } 10231 public void read() { 10232 found = backing.getInt(0); 10233 binary = backing.getInt(4); 10234 int data_dataLength = backing.getInt(12); 10235 long data_addr = getPointer(backing, 8); 10236 data = new byte[data_dataLength]; 10237 if (data_dataLength > 0 && data_addr != 0) { 10238 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 10239 } 10240 for (PointFloat it : boundingBox) { 10241 it.read(); 10242 } 10243 numErrorsCorrected = backing.getInt(48); 10244 numErasuresCorrected = backing.getInt(52); 10245 aspectRatio = backing.getFloat(56); 10246 rows = backing.getInt(60); 10247 columns = backing.getInt(64); 10248 ecc = DataMatrixECC.fromValue(backing.getInt(72)); 10249 polarity = DataMatrixPolarity.fromValue(backing.getInt(80)); 10250 cellFill = DataMatrixCellFillMode.fromValue(backing.getInt(88)); 10251 borderIntegrity = backing.getFloat(96); 10252 mirrored = backing.getInt(100); 10253 minimumEdgeStrength = backing.getInt(104); 10254 demodulationMode = DataMatrixDemodulationMode.fromValue(backing.getInt(112)); 10255 cellSampleSize = DataMatrixCellSampleSize.fromValue(backing.getInt(120)); 10256 cellFilterMode = DataMatrixCellFilterMode.fromValue(backing.getInt(128)); 10257 iterations = backing.getInt(136); 10258 } 10259 public void write() { 10260 backing.putInt(0, found); 10261 backing.putInt(4, binary); 10262 data_buf = ByteBuffer.allocateDirect(data.length); 10263 putBytes(data_buf, data, 0, data.length); 10264 backing.putInt(12, data.length); 10265 putPointer(backing, 8, data_buf); 10266 for (PointFloat it : boundingBox) { 10267 it.write(); 10268 } 10269 backing.putInt(48, numErrorsCorrected); 10270 backing.putInt(52, numErasuresCorrected); 10271 backing.putFloat(56, aspectRatio); 10272 backing.putInt(60, rows); 10273 backing.putInt(64, columns); 10274 if (ecc != null) 10275 backing.putInt(72, ecc.getValue()); 10276 if (polarity != null) 10277 backing.putInt(80, polarity.getValue()); 10278 if (cellFill != null) 10279 backing.putInt(88, cellFill.getValue()); 10280 backing.putFloat(96, borderIntegrity); 10281 backing.putInt(100, mirrored); 10282 backing.putInt(104, minimumEdgeStrength); 10283 if (demodulationMode != null) 10284 backing.putInt(112, demodulationMode.getValue()); 10285 if (cellSampleSize != null) 10286 backing.putInt(120, cellSampleSize.getValue()); 10287 if (cellFilterMode != null) 10288 backing.putInt(128, cellFilterMode.getValue()); 10289 backing.putInt(136, iterations); 10290 } 10291 public int size() { 10292 return 144; 10293 } 10294 } 10295 10296 public static class JPEG2000FileAdvancedOptions extends DisposedStruct { 10297 public WaveletTransformMode waveletMode; // Determines which wavelet transform to use when writing the file. 10298 public int useMultiComponentTransform; // Set this parameter to TRUE to use an additional transform on RGB images. 10299 public int maxWaveletTransformLevel; // Specifies the maximum allowed level of wavelet transform. 10300 public float quantizationStepSize; // Specifies the absolute base quantization step size for derived quantization mode. 10301 10302 private void init() { 10303 10304 } 10305 public JPEG2000FileAdvancedOptions() { 10306 super(16); 10307 init(); 10308 } 10309 public JPEG2000FileAdvancedOptions(WaveletTransformMode waveletMode, int useMultiComponentTransform, int maxWaveletTransformLevel, double quantizationStepSize) { 10310 super(16); 10311 this.waveletMode = waveletMode; 10312 this.useMultiComponentTransform = useMultiComponentTransform; 10313 this.maxWaveletTransformLevel = maxWaveletTransformLevel; 10314 this.quantizationStepSize = (float)quantizationStepSize; 10315 } 10316 protected JPEG2000FileAdvancedOptions(ByteBuffer backing, int offset) { 10317 super(backing, offset, 16); 10318 init(); 10319 } 10320 protected JPEG2000FileAdvancedOptions(long nativeObj, boolean owned) { 10321 super(nativeObj, owned, 16); 10322 init(); 10323 } 10324 protected void setBuffer(ByteBuffer backing, int offset) { 10325 super.setBuffer(backing, offset, 16); 10326 } 10327 public void read() { 10328 waveletMode = WaveletTransformMode.fromValue(backing.getInt(0)); 10329 useMultiComponentTransform = backing.getInt(4); 10330 maxWaveletTransformLevel = backing.getInt(8); 10331 quantizationStepSize = backing.getFloat(12); 10332 } 10333 public void write() { 10334 if (waveletMode != null) 10335 backing.putInt(0, waveletMode.getValue()); 10336 backing.putInt(4, useMultiComponentTransform); 10337 backing.putInt(8, maxWaveletTransformLevel); 10338 backing.putFloat(12, quantizationStepSize); 10339 } 10340 public int size() { 10341 return 16; 10342 } 10343 } 10344 10345 public static class MatchGeometricPatternAdvancedOptions2 extends DisposedStruct { 10346 public int minFeaturesUsed; // Specifies the minimum number of features the function uses when matching. 10347 public int maxFeaturesUsed; // Specifies the maximum number of features the function uses when matching. 10348 public int subpixelIterations; // Specifies the maximum number of incremental improvements used to refine matches with subpixel information. 10349 public double subpixelTolerance; // Specifies the maximum amount of change, in pixels, between consecutive incremental improvements in the match position before the function stops refining the match position. 10350 public int initialMatchListLength; // Specifies the maximum size of the match list. 10351 public float matchTemplateCurveScore; // Set this element to TRUE to specify that the function should calculate the match curve to template curve score and return it for each match result. 10352 public int correlationScore; // Set this element to TRUE to specify that the function should calculate the correlation score and return it for each match result. 10353 public double minMatchSeparationDistance; // Specifies the minimum separation distance, in pixels, between the origins of two matches that have unique positions. 10354 public double minMatchSeparationAngle; // Specifies the minimum angular difference, in degrees, between two matches that have unique angles. 10355 public double minMatchSeparationScale; // Specifies the minimum difference in scale, expressed as a percentage, between two matches that have unique scales. 10356 public double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed as a percentage, allowed between the bounding rectangles of two unique matches. 10357 public int coarseResult; // Specifies whether you want the function to spend less time accurately estimating the location of a match. 10358 public int smoothContours; // Set this element to TRUE to specify smoothing be done on the contours of the inspection image before feature extraction. 10359 public int enableCalibrationSupport; // Set this element to TRUE to specify the algorithm treat the inspection image as a calibrated image. 10360 10361 private void init() { 10362 10363 } 10364 public MatchGeometricPatternAdvancedOptions2() { 10365 super(88); 10366 init(); 10367 } 10368 public MatchGeometricPatternAdvancedOptions2(int minFeaturesUsed, int maxFeaturesUsed, int subpixelIterations, double subpixelTolerance, int initialMatchListLength, double matchTemplateCurveScore, int correlationScore, double minMatchSeparationDistance, double minMatchSeparationAngle, double minMatchSeparationScale, double maxMatchOverlap, int coarseResult, int smoothContours, int enableCalibrationSupport) { 10369 super(88); 10370 this.minFeaturesUsed = minFeaturesUsed; 10371 this.maxFeaturesUsed = maxFeaturesUsed; 10372 this.subpixelIterations = subpixelIterations; 10373 this.subpixelTolerance = subpixelTolerance; 10374 this.initialMatchListLength = initialMatchListLength; 10375 this.matchTemplateCurveScore = (float)matchTemplateCurveScore; 10376 this.correlationScore = correlationScore; 10377 this.minMatchSeparationDistance = minMatchSeparationDistance; 10378 this.minMatchSeparationAngle = minMatchSeparationAngle; 10379 this.minMatchSeparationScale = minMatchSeparationScale; 10380 this.maxMatchOverlap = maxMatchOverlap; 10381 this.coarseResult = coarseResult; 10382 this.smoothContours = smoothContours; 10383 this.enableCalibrationSupport = enableCalibrationSupport; 10384 } 10385 protected MatchGeometricPatternAdvancedOptions2(ByteBuffer backing, int offset) { 10386 super(backing, offset, 88); 10387 init(); 10388 } 10389 protected MatchGeometricPatternAdvancedOptions2(long nativeObj, boolean owned) { 10390 super(nativeObj, owned, 88); 10391 init(); 10392 } 10393 protected void setBuffer(ByteBuffer backing, int offset) { 10394 super.setBuffer(backing, offset, 88); 10395 } 10396 public void read() { 10397 minFeaturesUsed = backing.getInt(0); 10398 maxFeaturesUsed = backing.getInt(4); 10399 subpixelIterations = backing.getInt(8); 10400 subpixelTolerance = backing.getDouble(16); 10401 initialMatchListLength = backing.getInt(24); 10402 matchTemplateCurveScore = backing.getFloat(28); 10403 correlationScore = backing.getInt(32); 10404 minMatchSeparationDistance = backing.getDouble(40); 10405 minMatchSeparationAngle = backing.getDouble(48); 10406 minMatchSeparationScale = backing.getDouble(56); 10407 maxMatchOverlap = backing.getDouble(64); 10408 coarseResult = backing.getInt(72); 10409 smoothContours = backing.getInt(76); 10410 enableCalibrationSupport = backing.getInt(80); 10411 } 10412 public void write() { 10413 backing.putInt(0, minFeaturesUsed); 10414 backing.putInt(4, maxFeaturesUsed); 10415 backing.putInt(8, subpixelIterations); 10416 backing.putDouble(16, subpixelTolerance); 10417 backing.putInt(24, initialMatchListLength); 10418 backing.putFloat(28, matchTemplateCurveScore); 10419 backing.putInt(32, correlationScore); 10420 backing.putDouble(40, minMatchSeparationDistance); 10421 backing.putDouble(48, minMatchSeparationAngle); 10422 backing.putDouble(56, minMatchSeparationScale); 10423 backing.putDouble(64, maxMatchOverlap); 10424 backing.putInt(72, coarseResult); 10425 backing.putInt(76, smoothContours); 10426 backing.putInt(80, enableCalibrationSupport); 10427 } 10428 public int size() { 10429 return 88; 10430 } 10431 } 10432 10433 public static class InspectionAlignment extends DisposedStruct { 10434 public PointFloat position; // The location of the center of the golden template in the image under inspection. 10435 public float rotation; // The rotation of the golden template in the image under inspection, in degrees. 10436 public float scale; // The percentage of the size of the area under inspection compared to the size of the golden template. 10437 10438 private void init() { 10439 position = new PointFloat(backing, 0); 10440 } 10441 public InspectionAlignment() { 10442 super(16); 10443 init(); 10444 } 10445 public InspectionAlignment(PointFloat position, double rotation, double scale) { 10446 super(16); 10447 this.position = position; 10448 this.rotation = (float)rotation; 10449 this.scale = (float)scale; 10450 } 10451 protected InspectionAlignment(ByteBuffer backing, int offset) { 10452 super(backing, offset, 16); 10453 init(); 10454 } 10455 protected InspectionAlignment(long nativeObj, boolean owned) { 10456 super(nativeObj, owned, 16); 10457 init(); 10458 } 10459 protected void setBuffer(ByteBuffer backing, int offset) { 10460 super.setBuffer(backing, offset, 16); 10461 } 10462 public void read() { 10463 position.read(); 10464 rotation = backing.getFloat(8); 10465 scale = backing.getFloat(12); 10466 } 10467 public void write() { 10468 position.write(); 10469 backing.putFloat(8, rotation); 10470 backing.putFloat(12, scale); 10471 } 10472 public int size() { 10473 return 16; 10474 } 10475 } 10476 10477 public static class InspectionOptions extends DisposedStruct { 10478 public RegistrationMethod registrationMethod; // Specifies how the function registers the golden template and the target image. 10479 public NormalizationMethod normalizationMethod; // Specifies how the function normalizes the golden template to the target image. 10480 public int edgeThicknessToIgnore; // Specifies desired thickness of edges to be ignored. 10481 public float brightThreshold; // Specifies the threshold for areas where the target image is brighter than the golden template. 10482 public float darkThreshold; // Specifies the threshold for areas where the target image is darker than the golden template. 10483 public int binary; // Specifies whether the function should return a binary image giving the location of defects, or a grayscale image giving the intensity of defects. 10484 10485 private void init() { 10486 10487 } 10488 public InspectionOptions() { 10489 super(24); 10490 init(); 10491 } 10492 public InspectionOptions(RegistrationMethod registrationMethod, NormalizationMethod normalizationMethod, int edgeThicknessToIgnore, double brightThreshold, double darkThreshold, int binary) { 10493 super(24); 10494 this.registrationMethod = registrationMethod; 10495 this.normalizationMethod = normalizationMethod; 10496 this.edgeThicknessToIgnore = edgeThicknessToIgnore; 10497 this.brightThreshold = (float)brightThreshold; 10498 this.darkThreshold = (float)darkThreshold; 10499 this.binary = binary; 10500 } 10501 protected InspectionOptions(ByteBuffer backing, int offset) { 10502 super(backing, offset, 24); 10503 init(); 10504 } 10505 protected InspectionOptions(long nativeObj, boolean owned) { 10506 super(nativeObj, owned, 24); 10507 init(); 10508 } 10509 protected void setBuffer(ByteBuffer backing, int offset) { 10510 super.setBuffer(backing, offset, 24); 10511 } 10512 public void read() { 10513 registrationMethod = RegistrationMethod.fromValue(backing.getInt(0)); 10514 normalizationMethod = NormalizationMethod.fromValue(backing.getInt(4)); 10515 edgeThicknessToIgnore = backing.getInt(8); 10516 brightThreshold = backing.getFloat(12); 10517 darkThreshold = backing.getFloat(16); 10518 binary = backing.getInt(20); 10519 } 10520 public void write() { 10521 if (registrationMethod != null) 10522 backing.putInt(0, registrationMethod.getValue()); 10523 if (normalizationMethod != null) 10524 backing.putInt(4, normalizationMethod.getValue()); 10525 backing.putInt(8, edgeThicknessToIgnore); 10526 backing.putFloat(12, brightThreshold); 10527 backing.putFloat(16, darkThreshold); 10528 backing.putInt(20, binary); 10529 } 10530 public int size() { 10531 return 24; 10532 } 10533 } 10534 10535 public static class CharReport2 extends DisposedStruct { 10536 public String character; // The character value. 10537 public PointFloat[] corner; // An array of four points that describes the rectangle that surrounds the character. 10538 public int lowThreshold; // The minimum value of the threshold range used for this character. 10539 public int highThreshold; // The maximum value of the threshold range used for this character. 10540 public int classificationScore; // The degree to which the assigned character class represents the object better than the other character classes in the character set. 10541 public int verificationScore; // The similarity of the character and the reference character for the character class. 10542 public int verified; // This element is TRUE if a reference character was found for the character class and FALSE if a reference character was not found. 10543 private ByteBuffer character_buf; 10544 10545 private void init() { 10546 corner = new PointFloat[4]; 10547 10548 for (int i=0, off=4; i<4; i++, off += 8) 10549 corner[i] = new PointFloat(backing, off); 10550 } 10551 public CharReport2() { 10552 super(56); 10553 init(); 10554 } 10555 public CharReport2(String character, PointFloat[] corner, int lowThreshold, int highThreshold, int classificationScore, int verificationScore, int verified) { 10556 super(56); 10557 this.character = character; 10558 this.corner = corner; 10559 this.lowThreshold = lowThreshold; 10560 this.highThreshold = highThreshold; 10561 this.classificationScore = classificationScore; 10562 this.verificationScore = verificationScore; 10563 this.verified = verified; 10564 } 10565 protected CharReport2(ByteBuffer backing, int offset) { 10566 super(backing, offset, 56); 10567 init(); 10568 } 10569 protected CharReport2(long nativeObj, boolean owned) { 10570 super(nativeObj, owned, 56); 10571 init(); 10572 } 10573 protected void setBuffer(ByteBuffer backing, int offset) { 10574 super.setBuffer(backing, offset, 56); 10575 } 10576 public void read() { 10577 long character_addr = getPointer(backing, 0); 10578 if (character_addr == 0) 10579 character = null; 10580 else { 10581 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 10582 while (bb.get() != 0) {} 10583 byte[] bytes = new byte[bb.position()-1]; 10584 getBytes(bb, bytes, 0, bytes.length); 10585 try { 10586 character = new String(bytes, "UTF-8"); 10587 } catch (UnsupportedEncodingException e) { 10588 character = ""; 10589 } 10590 } 10591 10592 for (PointFloat it : corner) { 10593 it.read(); 10594 } 10595 lowThreshold = backing.getInt(36); 10596 highThreshold = backing.getInt(40); 10597 classificationScore = backing.getInt(44); 10598 verificationScore = backing.getInt(48); 10599 verified = backing.getInt(52); 10600 } 10601 public void write() { 10602 if (character != null) { 10603 byte[] character_bytes; 10604 try { 10605 character_bytes = character.getBytes("UTF-8"); 10606 } catch (UnsupportedEncodingException e) { 10607 character_bytes = new byte[0]; 10608 } 10609 character_buf = ByteBuffer.allocateDirect(character_bytes.length+1); 10610 putBytes(character_buf, character_bytes, 0, character_bytes.length).put(character_bytes.length, (byte)0); 10611 } 10612 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 10613 for (PointFloat it : corner) { 10614 it.write(); 10615 } 10616 backing.putInt(36, lowThreshold); 10617 backing.putInt(40, highThreshold); 10618 backing.putInt(44, classificationScore); 10619 backing.putInt(48, verificationScore); 10620 backing.putInt(52, verified); 10621 } 10622 public int size() { 10623 return 56; 10624 } 10625 } 10626 10627 public static class CharInfo2 extends DisposedStruct { 10628 public String charValue; // Retrieves the character value of the corresponding character in the character set. 10629 public Image charImage; // The image you used to train this character. 10630 public Image internalImage; // The internal representation that NI Vision uses to match objects to this character. 10631 public int isReferenceChar; // This element is TRUE if the character is the reference character for the character class. 10632 private ByteBuffer charValue_buf; 10633 10634 private void init() { 10635 10636 } 10637 public CharInfo2() { 10638 super(16); 10639 init(); 10640 } 10641 public CharInfo2(String charValue, Image charImage, Image internalImage, int isReferenceChar) { 10642 super(16); 10643 this.charValue = charValue; 10644 this.charImage = charImage; 10645 this.internalImage = internalImage; 10646 this.isReferenceChar = isReferenceChar; 10647 } 10648 protected CharInfo2(ByteBuffer backing, int offset) { 10649 super(backing, offset, 16); 10650 init(); 10651 } 10652 protected CharInfo2(long nativeObj, boolean owned) { 10653 super(nativeObj, owned, 16); 10654 init(); 10655 } 10656 protected void setBuffer(ByteBuffer backing, int offset) { 10657 super.setBuffer(backing, offset, 16); 10658 } 10659 public void read() { 10660 long charValue_addr = getPointer(backing, 0); 10661 if (charValue_addr == 0) 10662 charValue = null; 10663 else { 10664 ByteBuffer bb = newDirectByteBuffer(charValue_addr, 1000); // FIXME 10665 while (bb.get() != 0) {} 10666 byte[] bytes = new byte[bb.position()-1]; 10667 getBytes(bb, bytes, 0, bytes.length); 10668 try { 10669 charValue = new String(bytes, "UTF-8"); 10670 } catch (UnsupportedEncodingException e) { 10671 charValue = ""; 10672 } 10673 } 10674 10675 long charImage_addr = getPointer(backing, 4); 10676 if (charImage_addr == 0) 10677 charImage = null; 10678 else 10679 charImage = new Image(charImage_addr, false); 10680 long internalImage_addr = getPointer(backing, 8); 10681 if (internalImage_addr == 0) 10682 internalImage = null; 10683 else 10684 internalImage = new Image(internalImage_addr, false); 10685 isReferenceChar = backing.getInt(12); 10686 } 10687 public void write() { 10688 if (charValue != null) { 10689 byte[] charValue_bytes; 10690 try { 10691 charValue_bytes = charValue.getBytes("UTF-8"); 10692 } catch (UnsupportedEncodingException e) { 10693 charValue_bytes = new byte[0]; 10694 } 10695 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length+1); 10696 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put(charValue_bytes.length, (byte)0); 10697 } 10698 putPointer(backing, 0, charValue == null ? 0 : getByteBufferAddress(charValue_buf)); 10699 putPointer(backing, 4, charImage); 10700 putPointer(backing, 8, internalImage); 10701 backing.putInt(12, isReferenceChar); 10702 } 10703 public int size() { 10704 return 16; 10705 } 10706 } 10707 10708 public static class ReadTextReport2 extends DisposedStruct { 10709 public String readString; // The read string. 10710 public CharReport2[] characterReport; // An array of reports describing the properties of each identified character. 10711 private ByteBuffer readString_buf; 10712 private ByteBuffer characterReport_buf; 10713 10714 private void init() { 10715 characterReport = new CharReport2[0]; 10716 } 10717 public ReadTextReport2() { 10718 super(12); 10719 init(); 10720 } 10721 public ReadTextReport2(String readString, CharReport2[] characterReport) { 10722 super(12); 10723 this.readString = readString; 10724 this.characterReport = characterReport; 10725 } 10726 protected ReadTextReport2(ByteBuffer backing, int offset) { 10727 super(backing, offset, 12); 10728 init(); 10729 } 10730 protected ReadTextReport2(long nativeObj, boolean owned) { 10731 super(nativeObj, owned, 12); 10732 init(); 10733 } 10734 protected void setBuffer(ByteBuffer backing, int offset) { 10735 super.setBuffer(backing, offset, 12); 10736 } 10737 public void read() { 10738 long readString_addr = getPointer(backing, 0); 10739 if (readString_addr == 0) 10740 readString = null; 10741 else { 10742 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 10743 while (bb.get() != 0) {} 10744 byte[] bytes = new byte[bb.position()-1]; 10745 getBytes(bb, bytes, 0, bytes.length); 10746 try { 10747 readString = new String(bytes, "UTF-8"); 10748 } catch (UnsupportedEncodingException e) { 10749 readString = ""; 10750 } 10751 } 10752 10753 int characterReport_numCharacterReports = backing.getInt(8); 10754 long characterReport_addr = getPointer(backing, 4); 10755 characterReport = new CharReport2[characterReport_numCharacterReports]; 10756 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 10757 ByteBuffer bb = newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports*56); 10758 for (int i=0, off=0; i<characterReport_numCharacterReports; i++, off += 56) { 10759 characterReport[i] = new CharReport2(bb, off); 10760 characterReport[i].read(); 10761 } 10762 } 10763 } 10764 public void write() { 10765 if (readString != null) { 10766 byte[] readString_bytes; 10767 try { 10768 readString_bytes = readString.getBytes("UTF-8"); 10769 } catch (UnsupportedEncodingException e) { 10770 readString_bytes = new byte[0]; 10771 } 10772 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length+1); 10773 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put(readString_bytes.length, (byte)0); 10774 } 10775 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 10776 characterReport_buf = ByteBuffer.allocateDirect(characterReport.length*56).order(ByteOrder.nativeOrder()); 10777 for (int i=0, off=0; i<characterReport.length; i++, off += 56) { 10778 characterReport[i].setBuffer(characterReport_buf, off); 10779 characterReport[i].write(); 10780 } 10781 backing.putInt(8, characterReport.length); 10782 putPointer(backing, 4, characterReport_buf); 10783 } 10784 public int size() { 10785 return 12; 10786 } 10787 } 10788 10789 public static class EllipseFeature extends DisposedStruct { 10790 public PointFloat position; // The location of the center of the ellipse. 10791 public double rotation; // The orientation of the semi-major axis of the ellipse with respect to the horizontal. 10792 public double minorRadius; // The length of the semi-minor axis of the ellipse. 10793 public double majorRadius; // The length of the semi-major axis of the ellipse. 10794 10795 private void init() { 10796 position = new PointFloat(backing, 0); 10797 } 10798 public EllipseFeature() { 10799 super(32); 10800 init(); 10801 } 10802 public EllipseFeature(PointFloat position, double rotation, double minorRadius, double majorRadius) { 10803 super(32); 10804 this.position = position; 10805 this.rotation = rotation; 10806 this.minorRadius = minorRadius; 10807 this.majorRadius = majorRadius; 10808 } 10809 protected EllipseFeature(ByteBuffer backing, int offset) { 10810 super(backing, offset, 32); 10811 init(); 10812 } 10813 protected EllipseFeature(long nativeObj, boolean owned) { 10814 super(nativeObj, owned, 32); 10815 init(); 10816 } 10817 protected void setBuffer(ByteBuffer backing, int offset) { 10818 super.setBuffer(backing, offset, 32); 10819 } 10820 public void read() { 10821 position.read(); 10822 rotation = backing.getDouble(8); 10823 minorRadius = backing.getDouble(16); 10824 majorRadius = backing.getDouble(24); 10825 } 10826 public void write() { 10827 position.write(); 10828 backing.putDouble(8, rotation); 10829 backing.putDouble(16, minorRadius); 10830 backing.putDouble(24, majorRadius); 10831 } 10832 public int size() { 10833 return 32; 10834 } 10835 } 10836 10837 public static class CircleFeature extends DisposedStruct { 10838 public PointFloat position; // The location of the center of the circle. 10839 public double radius; // The radius of the circle. 10840 10841 private void init() { 10842 position = new PointFloat(backing, 0); 10843 } 10844 public CircleFeature() { 10845 super(16); 10846 init(); 10847 } 10848 public CircleFeature(PointFloat position, double radius) { 10849 super(16); 10850 this.position = position; 10851 this.radius = radius; 10852 } 10853 protected CircleFeature(ByteBuffer backing, int offset) { 10854 super(backing, offset, 16); 10855 init(); 10856 } 10857 protected CircleFeature(long nativeObj, boolean owned) { 10858 super(nativeObj, owned, 16); 10859 init(); 10860 } 10861 protected void setBuffer(ByteBuffer backing, int offset) { 10862 super.setBuffer(backing, offset, 16); 10863 } 10864 public void read() { 10865 position.read(); 10866 radius = backing.getDouble(8); 10867 } 10868 public void write() { 10869 position.write(); 10870 backing.putDouble(8, radius); 10871 } 10872 public int size() { 10873 return 16; 10874 } 10875 } 10876 10877 public static class ConstCurveFeature extends DisposedStruct { 10878 public PointFloat position; // The center of the circle that this constant curve lies upon. 10879 public double radius; // The radius of the circle that this constant curve lies upon. 10880 public double startAngle; // When traveling along the constant curve from one endpoint to the next in a counterclockwise manner, this is the angular component of the vector originating at the center of the constant curve and pointing towards the first endpoint of the constant curve. 10881 public double endAngle; // When traveling along the constant curve from one endpoint to the next in a counterclockwise manner, this is the angular component of the vector originating at the center of the constant curve and pointing towards the second endpoint of the constant curve. 10882 10883 private void init() { 10884 position = new PointFloat(backing, 0); 10885 } 10886 public ConstCurveFeature() { 10887 super(32); 10888 init(); 10889 } 10890 public ConstCurveFeature(PointFloat position, double radius, double startAngle, double endAngle) { 10891 super(32); 10892 this.position = position; 10893 this.radius = radius; 10894 this.startAngle = startAngle; 10895 this.endAngle = endAngle; 10896 } 10897 protected ConstCurveFeature(ByteBuffer backing, int offset) { 10898 super(backing, offset, 32); 10899 init(); 10900 } 10901 protected ConstCurveFeature(long nativeObj, boolean owned) { 10902 super(nativeObj, owned, 32); 10903 init(); 10904 } 10905 protected void setBuffer(ByteBuffer backing, int offset) { 10906 super.setBuffer(backing, offset, 32); 10907 } 10908 public void read() { 10909 position.read(); 10910 radius = backing.getDouble(8); 10911 startAngle = backing.getDouble(16); 10912 endAngle = backing.getDouble(24); 10913 } 10914 public void write() { 10915 position.write(); 10916 backing.putDouble(8, radius); 10917 backing.putDouble(16, startAngle); 10918 backing.putDouble(24, endAngle); 10919 } 10920 public int size() { 10921 return 32; 10922 } 10923 } 10924 10925 public static class RectangleFeature extends DisposedStruct { 10926 public PointFloat position; // The center of the rectangle. 10927 public PointFloat[] corner; // The four corners of the rectangle. 10928 public double rotation; // The orientation of the rectangle with respect to the horizontal. 10929 public double width; // The width of the rectangle. 10930 public double height; // The height of the rectangle. 10931 10932 private void init() { 10933 position = new PointFloat(backing, 0); 10934 corner = new PointFloat[4]; 10935 10936 for (int i=0, off=8; i<4; i++, off += 8) 10937 corner[i] = new PointFloat(backing, off); 10938 } 10939 public RectangleFeature() { 10940 super(64); 10941 init(); 10942 } 10943 public RectangleFeature(PointFloat position, PointFloat[] corner, double rotation, double width, double height) { 10944 super(64); 10945 this.position = position; 10946 this.corner = corner; 10947 this.rotation = rotation; 10948 this.width = width; 10949 this.height = height; 10950 } 10951 protected RectangleFeature(ByteBuffer backing, int offset) { 10952 super(backing, offset, 64); 10953 init(); 10954 } 10955 protected RectangleFeature(long nativeObj, boolean owned) { 10956 super(nativeObj, owned, 64); 10957 init(); 10958 } 10959 protected void setBuffer(ByteBuffer backing, int offset) { 10960 super.setBuffer(backing, offset, 64); 10961 } 10962 public void read() { 10963 position.read(); 10964 for (PointFloat it : corner) { 10965 it.read(); 10966 } 10967 rotation = backing.getDouble(40); 10968 width = backing.getDouble(48); 10969 height = backing.getDouble(56); 10970 } 10971 public void write() { 10972 position.write(); 10973 for (PointFloat it : corner) { 10974 it.write(); 10975 } 10976 backing.putDouble(40, rotation); 10977 backing.putDouble(48, width); 10978 backing.putDouble(56, height); 10979 } 10980 public int size() { 10981 return 64; 10982 } 10983 } 10984 10985 public static class LegFeature extends DisposedStruct { 10986 public PointFloat position; // The location of the leg feature. 10987 public PointFloat[] corner; // The four corners of the leg feature. 10988 public double rotation; // The orientation of the leg with respect to the horizontal. 10989 public double width; // The width of the leg. 10990 public double height; // The height of the leg. 10991 10992 private void init() { 10993 position = new PointFloat(backing, 0); 10994 corner = new PointFloat[4]; 10995 10996 for (int i=0, off=8; i<4; i++, off += 8) 10997 corner[i] = new PointFloat(backing, off); 10998 } 10999 public LegFeature() { 11000 super(64); 11001 init(); 11002 } 11003 public LegFeature(PointFloat position, PointFloat[] corner, double rotation, double width, double height) { 11004 super(64); 11005 this.position = position; 11006 this.corner = corner; 11007 this.rotation = rotation; 11008 this.width = width; 11009 this.height = height; 11010 } 11011 protected LegFeature(ByteBuffer backing, int offset) { 11012 super(backing, offset, 64); 11013 init(); 11014 } 11015 protected LegFeature(long nativeObj, boolean owned) { 11016 super(nativeObj, owned, 64); 11017 init(); 11018 } 11019 protected void setBuffer(ByteBuffer backing, int offset) { 11020 super.setBuffer(backing, offset, 64); 11021 } 11022 public void read() { 11023 position.read(); 11024 for (PointFloat it : corner) { 11025 it.read(); 11026 } 11027 rotation = backing.getDouble(40); 11028 width = backing.getDouble(48); 11029 height = backing.getDouble(56); 11030 } 11031 public void write() { 11032 position.write(); 11033 for (PointFloat it : corner) { 11034 it.write(); 11035 } 11036 backing.putDouble(40, rotation); 11037 backing.putDouble(48, width); 11038 backing.putDouble(56, height); 11039 } 11040 public int size() { 11041 return 64; 11042 } 11043 } 11044 11045 public static class CornerFeature extends DisposedStruct { 11046 public PointFloat position; // The location of the corner feature. 11047 public double rotation; // The angular component of the vector bisecting the corner from position. 11048 public double enclosedAngle; // The measure of the enclosed angle of the corner. 11049 public int isVirtual; 11050 11051 private void init() { 11052 position = new PointFloat(backing, 0); 11053 } 11054 public CornerFeature() { 11055 super(32); 11056 init(); 11057 } 11058 public CornerFeature(PointFloat position, double rotation, double enclosedAngle, int isVirtual) { 11059 super(32); 11060 this.position = position; 11061 this.rotation = rotation; 11062 this.enclosedAngle = enclosedAngle; 11063 this.isVirtual = isVirtual; 11064 } 11065 protected CornerFeature(ByteBuffer backing, int offset) { 11066 super(backing, offset, 32); 11067 init(); 11068 } 11069 protected CornerFeature(long nativeObj, boolean owned) { 11070 super(nativeObj, owned, 32); 11071 init(); 11072 } 11073 protected void setBuffer(ByteBuffer backing, int offset) { 11074 super.setBuffer(backing, offset, 32); 11075 } 11076 public void read() { 11077 position.read(); 11078 rotation = backing.getDouble(8); 11079 enclosedAngle = backing.getDouble(16); 11080 isVirtual = backing.getInt(24); 11081 } 11082 public void write() { 11083 position.write(); 11084 backing.putDouble(8, rotation); 11085 backing.putDouble(16, enclosedAngle); 11086 backing.putInt(24, isVirtual); 11087 } 11088 public int size() { 11089 return 32; 11090 } 11091 } 11092 11093 public static class LineFeature extends DisposedStruct { 11094 public PointFloat startPoint; // The starting point of the line. 11095 public PointFloat endPoint; // The ending point of the line. 11096 public double length; // The length of the line measured in pixels from the start point to the end point. 11097 public double rotation; // The orientation of the line with respect to the horizontal. 11098 11099 private void init() { 11100 startPoint = new PointFloat(backing, 0); 11101 endPoint = new PointFloat(backing, 8); 11102 } 11103 public LineFeature() { 11104 super(32); 11105 init(); 11106 } 11107 public LineFeature(PointFloat startPoint, PointFloat endPoint, double length, double rotation) { 11108 super(32); 11109 this.startPoint = startPoint; 11110 this.endPoint = endPoint; 11111 this.length = length; 11112 this.rotation = rotation; 11113 } 11114 protected LineFeature(ByteBuffer backing, int offset) { 11115 super(backing, offset, 32); 11116 init(); 11117 } 11118 protected LineFeature(long nativeObj, boolean owned) { 11119 super(nativeObj, owned, 32); 11120 init(); 11121 } 11122 protected void setBuffer(ByteBuffer backing, int offset) { 11123 super.setBuffer(backing, offset, 32); 11124 } 11125 public void read() { 11126 startPoint.read(); 11127 endPoint.read(); 11128 length = backing.getDouble(16); 11129 rotation = backing.getDouble(24); 11130 } 11131 public void write() { 11132 startPoint.write(); 11133 endPoint.write(); 11134 backing.putDouble(16, length); 11135 backing.putDouble(24, rotation); 11136 } 11137 public int size() { 11138 return 32; 11139 } 11140 } 11141 11142 public static class ParallelLinePairFeature extends DisposedStruct { 11143 public PointFloat firstStartPoint; // The starting point of the first line of the pair. 11144 public PointFloat firstEndPoint; // The ending point of the first line of the pair. 11145 public PointFloat secondStartPoint; // The starting point of the second line of the pair. 11146 public PointFloat secondEndPoint; // The ending point of the second line of the pair. 11147 public double rotation; // The orientation of the feature with respect to the horizontal. 11148 public double distance; // The distance from the first line to the second line. 11149 11150 private void init() { 11151 firstStartPoint = new PointFloat(backing, 0); 11152 firstEndPoint = new PointFloat(backing, 8); 11153 secondStartPoint = new PointFloat(backing, 16); 11154 secondEndPoint = new PointFloat(backing, 24); 11155 } 11156 public ParallelLinePairFeature() { 11157 super(48); 11158 init(); 11159 } 11160 public ParallelLinePairFeature(PointFloat firstStartPoint, PointFloat firstEndPoint, PointFloat secondStartPoint, PointFloat secondEndPoint, double rotation, double distance) { 11161 super(48); 11162 this.firstStartPoint = firstStartPoint; 11163 this.firstEndPoint = firstEndPoint; 11164 this.secondStartPoint = secondStartPoint; 11165 this.secondEndPoint = secondEndPoint; 11166 this.rotation = rotation; 11167 this.distance = distance; 11168 } 11169 protected ParallelLinePairFeature(ByteBuffer backing, int offset) { 11170 super(backing, offset, 48); 11171 init(); 11172 } 11173 protected ParallelLinePairFeature(long nativeObj, boolean owned) { 11174 super(nativeObj, owned, 48); 11175 init(); 11176 } 11177 protected void setBuffer(ByteBuffer backing, int offset) { 11178 super.setBuffer(backing, offset, 48); 11179 } 11180 public void read() { 11181 firstStartPoint.read(); 11182 firstEndPoint.read(); 11183 secondStartPoint.read(); 11184 secondEndPoint.read(); 11185 rotation = backing.getDouble(32); 11186 distance = backing.getDouble(40); 11187 } 11188 public void write() { 11189 firstStartPoint.write(); 11190 firstEndPoint.write(); 11191 secondStartPoint.write(); 11192 secondEndPoint.write(); 11193 backing.putDouble(32, rotation); 11194 backing.putDouble(40, distance); 11195 } 11196 public int size() { 11197 return 48; 11198 } 11199 } 11200 11201 public static class PairOfParallelLinePairsFeature extends DisposedStruct { 11202 public ParallelLinePairFeature firstParallelLinePair; // The first parallel line pair. 11203 public ParallelLinePairFeature secondParallelLinePair; // The second parallel line pair. 11204 public double rotation; // The orientation of the feature with respect to the horizontal. 11205 public double distance; // The distance from the midline of the first parallel line pair to the midline of the second parallel line pair. 11206 11207 private void init() { 11208 firstParallelLinePair = new ParallelLinePairFeature(backing, 0); 11209 secondParallelLinePair = new ParallelLinePairFeature(backing, 48); 11210 } 11211 public PairOfParallelLinePairsFeature() { 11212 super(112); 11213 init(); 11214 } 11215 public PairOfParallelLinePairsFeature(ParallelLinePairFeature firstParallelLinePair, ParallelLinePairFeature secondParallelLinePair, double rotation, double distance) { 11216 super(112); 11217 this.firstParallelLinePair = firstParallelLinePair; 11218 this.secondParallelLinePair = secondParallelLinePair; 11219 this.rotation = rotation; 11220 this.distance = distance; 11221 } 11222 protected PairOfParallelLinePairsFeature(ByteBuffer backing, int offset) { 11223 super(backing, offset, 112); 11224 init(); 11225 } 11226 protected PairOfParallelLinePairsFeature(long nativeObj, boolean owned) { 11227 super(nativeObj, owned, 112); 11228 init(); 11229 } 11230 protected void setBuffer(ByteBuffer backing, int offset) { 11231 super.setBuffer(backing, offset, 112); 11232 } 11233 public void read() { 11234 firstParallelLinePair.read(); 11235 secondParallelLinePair.read(); 11236 rotation = backing.getDouble(96); 11237 distance = backing.getDouble(104); 11238 } 11239 public void write() { 11240 firstParallelLinePair.write(); 11241 secondParallelLinePair.write(); 11242 backing.putDouble(96, rotation); 11243 backing.putDouble(104, distance); 11244 } 11245 public int size() { 11246 return 112; 11247 } 11248 } 11249 11250 public static class FeatureData extends DisposedStruct { 11251 public FeatureType type; // An enumeration representing the type of the feature. 11252 public PointFloat[] contourPoints; // A set of points describing the contour of the feature. 11253 public CircleFeature circle; // A pointer to a CircleFeature. 11254 public EllipseFeature ellipse; // A pointer to an EllipseFeature. 11255 public ConstCurveFeature constCurve; // A pointer to a ConstCurveFeature. 11256 public RectangleFeature rectangle; // A pointer to a RectangleFeature. 11257 public LegFeature leg; // A pointer to a LegFeature. 11258 public CornerFeature corner; // A pointer to a CornerFeature. 11259 public ParallelLinePairFeature parallelLinePair; // A pointer to a ParallelLinePairFeature. 11260 public PairOfParallelLinePairsFeature pairOfParallelLinePairs; // A pointer to a PairOfParallelLinePairsFeature. 11261 public LineFeature line; // A pointer to a LineFeature. 11262 public ClosedCurveFeature closedCurve; // A pointer to a ClosedCurveFeature. 11263 private ByteBuffer contourPoints_buf; 11264 11265 private void init() { 11266 contourPoints = new PointFloat[0]; 11267 } 11268 public FeatureData() { 11269 super(16); 11270 init(); 11271 } 11272 public FeatureData(FeatureType type, PointFloat[] contourPoints) { 11273 super(16); 11274 this.type = type; 11275 this.contourPoints = contourPoints; 11276 } 11277 protected FeatureData(ByteBuffer backing, int offset) { 11278 super(backing, offset, 16); 11279 init(); 11280 } 11281 protected FeatureData(long nativeObj, boolean owned) { 11282 super(nativeObj, owned, 16); 11283 init(); 11284 } 11285 protected void setBuffer(ByteBuffer backing, int offset) { 11286 super.setBuffer(backing, offset, 16); 11287 } 11288 public void read() { 11289 type = FeatureType.fromValue(backing.getInt(0)); 11290 int contourPoints_numContourPoints = backing.getInt(8); 11291 long contourPoints_addr = getPointer(backing, 4); 11292 contourPoints = new PointFloat[contourPoints_numContourPoints]; 11293 if (contourPoints_numContourPoints > 0 && contourPoints_addr != 0) { 11294 ByteBuffer bb = newDirectByteBuffer(contourPoints_addr, contourPoints_numContourPoints*8); 11295 for (int i=0, off=0; i<contourPoints_numContourPoints; i++, off += 8) { 11296 contourPoints[i] = new PointFloat(bb, off); 11297 contourPoints[i].read(); 11298 } 11299 } 11300 if (type == FeatureType.CIRCLE_FEATURE) { 11301 long circle_addr = getPointer(backing, 12); 11302 if (circle_addr == 0) 11303 circle = null; 11304 else 11305 circle = new CircleFeature(circle_addr, false); 11306 } 11307 if (type == FeatureType.ELLIPSE_FEATURE) { 11308 long ellipse_addr = getPointer(backing, 12); 11309 if (ellipse_addr == 0) 11310 ellipse = null; 11311 else 11312 ellipse = new EllipseFeature(ellipse_addr, false); 11313 } 11314 if (type == FeatureType.CONST_CURVE_FEATURE) { 11315 long constCurve_addr = getPointer(backing, 12); 11316 if (constCurve_addr == 0) 11317 constCurve = null; 11318 else 11319 constCurve = new ConstCurveFeature(constCurve_addr, false); 11320 } 11321 if (type == FeatureType.RECTANGLE_FEATURE) { 11322 long rectangle_addr = getPointer(backing, 12); 11323 if (rectangle_addr == 0) 11324 rectangle = null; 11325 else 11326 rectangle = new RectangleFeature(rectangle_addr, false); 11327 } 11328 if (type == FeatureType.LEG_FEATURE) { 11329 long leg_addr = getPointer(backing, 12); 11330 if (leg_addr == 0) 11331 leg = null; 11332 else 11333 leg = new LegFeature(leg_addr, false); 11334 } 11335 if (type == FeatureType.CORNER_FEATURE) { 11336 long corner_addr = getPointer(backing, 12); 11337 if (corner_addr == 0) 11338 corner = null; 11339 else 11340 corner = new CornerFeature(corner_addr, false); 11341 } 11342 if (type == FeatureType.PARALLEL_LINE_PAIR_FEATURE) { 11343 long parallelLinePair_addr = getPointer(backing, 12); 11344 if (parallelLinePair_addr == 0) 11345 parallelLinePair = null; 11346 else 11347 parallelLinePair = new ParallelLinePairFeature(parallelLinePair_addr, false); 11348 } 11349 if (type == FeatureType.PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE) { 11350 long pairOfParallelLinePairs_addr = getPointer(backing, 12); 11351 if (pairOfParallelLinePairs_addr == 0) 11352 pairOfParallelLinePairs = null; 11353 else 11354 pairOfParallelLinePairs = new PairOfParallelLinePairsFeature(pairOfParallelLinePairs_addr, false); 11355 } 11356 if (type == FeatureType.LINE_FEATURE) { 11357 long line_addr = getPointer(backing, 12); 11358 if (line_addr == 0) 11359 line = null; 11360 else 11361 line = new LineFeature(line_addr, false); 11362 } 11363 if (type == FeatureType.CLOSED_CURVE_FEATURE) { 11364 long closedCurve_addr = getPointer(backing, 12); 11365 if (closedCurve_addr == 0) 11366 closedCurve = null; 11367 else 11368 closedCurve = new ClosedCurveFeature(closedCurve_addr, false); 11369 } 11370 } 11371 public void write() { 11372 if (type != null) 11373 backing.putInt(0, type.getValue()); 11374 contourPoints_buf = ByteBuffer.allocateDirect(contourPoints.length*8).order(ByteOrder.nativeOrder()); 11375 for (int i=0, off=0; i<contourPoints.length; i++, off += 8) { 11376 contourPoints[i].setBuffer(contourPoints_buf, off); 11377 contourPoints[i].write(); 11378 } 11379 backing.putInt(8, contourPoints.length); 11380 putPointer(backing, 4, contourPoints_buf); 11381 if (type == FeatureType.CIRCLE_FEATURE) { 11382 putPointer(backing, 12, circle); 11383 } 11384 if (type == FeatureType.ELLIPSE_FEATURE) { 11385 putPointer(backing, 12, ellipse); 11386 } 11387 if (type == FeatureType.CONST_CURVE_FEATURE) { 11388 putPointer(backing, 12, constCurve); 11389 } 11390 if (type == FeatureType.RECTANGLE_FEATURE) { 11391 putPointer(backing, 12, rectangle); 11392 } 11393 if (type == FeatureType.LEG_FEATURE) { 11394 putPointer(backing, 12, leg); 11395 } 11396 if (type == FeatureType.CORNER_FEATURE) { 11397 putPointer(backing, 12, corner); 11398 } 11399 if (type == FeatureType.PARALLEL_LINE_PAIR_FEATURE) { 11400 putPointer(backing, 12, parallelLinePair); 11401 } 11402 if (type == FeatureType.PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE) { 11403 putPointer(backing, 12, pairOfParallelLinePairs); 11404 } 11405 if (type == FeatureType.LINE_FEATURE) { 11406 putPointer(backing, 12, line); 11407 } 11408 if (type == FeatureType.CLOSED_CURVE_FEATURE) { 11409 putPointer(backing, 12, closedCurve); 11410 } 11411 } 11412 public int size() { 11413 return 16; 11414 } 11415 } 11416 11417 public static class GeometricPatternMatch2 extends DisposedStruct { 11418 public PointFloat position; // The location of the origin of the template in the match. 11419 public float rotation; // The rotation of the match relative to the template image, in degrees. 11420 public float scale; // The size of the match relative to the size of the template image, expressed as a percentage. 11421 public float score; // The accuracy of the match. 11422 public PointFloat[] corner; // An array of four points describing the rectangle surrounding the template image. 11423 public int inverse; // This element is TRUE if the match is an inverse of the template image. 11424 public float occlusion; // The percentage of the match that is occluded. 11425 public float templateMatchCurveScore; // The accuracy of the match obtained by comparing the template curves to the curves in the match region. 11426 public float matchTemplateCurveScore; // The accuracy of the match obtained by comparing the curves in the match region to the template curves. 11427 public float correlationScore; // The accuracy of the match obtained by comparing the template image to the match region using a correlation metric that compares the two regions as a function of their pixel values. 11428 public String label; // The label corresponding to this match when the match is returned by imaqMatchMultipleGeometricPatterns(). 11429 public FeatureData[] featureData; // The features used in this match. 11430 public PointFloat calibratedPosition; // The location of the origin of the template in the match. 11431 public float calibratedRotation; // The rotation of the match relative to the template image, in degrees. 11432 public PointFloat[] calibratedCorner; // An array of four points describing the rectangle surrounding the template image. 11433 private ByteBuffer featureData_buf; 11434 11435 private void init() { 11436 position = new PointFloat(backing, 0); 11437 corner = new PointFloat[4]; 11438 11439 for (int i=0, off=20; i<4; i++, off += 8) 11440 corner[i] = new PointFloat(backing, off); 11441 featureData = new FeatureData[0]; 11442 calibratedPosition = new PointFloat(backing, 336); 11443 calibratedCorner = new PointFloat[4]; 11444 11445 for (int i=0, off=348; i<4; i++, off += 8) 11446 calibratedCorner[i] = new PointFloat(backing, off); 11447 } 11448 public GeometricPatternMatch2() { 11449 super(380); 11450 init(); 11451 } 11452 public GeometricPatternMatch2(PointFloat position, double rotation, double scale, double score, PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, double matchTemplateCurveScore, double correlationScore, String label, FeatureData[] featureData, PointFloat calibratedPosition, double calibratedRotation, PointFloat[] calibratedCorner) { 11453 super(380); 11454 this.position = position; 11455 this.rotation = (float)rotation; 11456 this.scale = (float)scale; 11457 this.score = (float)score; 11458 this.corner = corner; 11459 this.inverse = inverse; 11460 this.occlusion = (float)occlusion; 11461 this.templateMatchCurveScore = (float)templateMatchCurveScore; 11462 this.matchTemplateCurveScore = (float)matchTemplateCurveScore; 11463 this.correlationScore = (float)correlationScore; 11464 this.label = label; 11465 this.featureData = featureData; 11466 this.calibratedPosition = calibratedPosition; 11467 this.calibratedRotation = (float)calibratedRotation; 11468 this.calibratedCorner = calibratedCorner; 11469 } 11470 protected GeometricPatternMatch2(ByteBuffer backing, int offset) { 11471 super(backing, offset, 380); 11472 init(); 11473 } 11474 protected GeometricPatternMatch2(long nativeObj, boolean owned) { 11475 super(nativeObj, owned, 380); 11476 init(); 11477 } 11478 protected void setBuffer(ByteBuffer backing, int offset) { 11479 super.setBuffer(backing, offset, 380); 11480 } 11481 public void read() { 11482 position.read(); 11483 rotation = backing.getFloat(8); 11484 scale = backing.getFloat(12); 11485 score = backing.getFloat(16); 11486 for (PointFloat it : corner) { 11487 it.read(); 11488 } 11489 inverse = backing.getInt(52); 11490 occlusion = backing.getFloat(56); 11491 templateMatchCurveScore = backing.getFloat(60); 11492 matchTemplateCurveScore = backing.getFloat(64); 11493 correlationScore = backing.getFloat(68); 11494 { 11495 byte[] bytes = new byte[256]; 11496 getBytes(backing, bytes, 72, 256); 11497 int len; 11498 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 11499 try { 11500 label = new String(bytes, 0, len, "UTF-8"); 11501 } catch (UnsupportedEncodingException e) { 11502 label = ""; 11503 } 11504 } 11505 int featureData_numFeatureData = backing.getInt(332); 11506 long featureData_addr = getPointer(backing, 328); 11507 featureData = new FeatureData[featureData_numFeatureData]; 11508 if (featureData_numFeatureData > 0 && featureData_addr != 0) { 11509 ByteBuffer bb = newDirectByteBuffer(featureData_addr, featureData_numFeatureData*16); 11510 for (int i=0, off=0; i<featureData_numFeatureData; i++, off += 16) { 11511 featureData[i] = new FeatureData(bb, off); 11512 featureData[i].read(); 11513 } 11514 } 11515 calibratedPosition.read(); 11516 calibratedRotation = backing.getFloat(344); 11517 for (PointFloat it : calibratedCorner) { 11518 it.read(); 11519 } 11520 } 11521 public void write() { 11522 position.write(); 11523 backing.putFloat(8, rotation); 11524 backing.putFloat(12, scale); 11525 backing.putFloat(16, score); 11526 for (PointFloat it : corner) { 11527 it.write(); 11528 } 11529 backing.putInt(52, inverse); 11530 backing.putFloat(56, occlusion); 11531 backing.putFloat(60, templateMatchCurveScore); 11532 backing.putFloat(64, matchTemplateCurveScore); 11533 backing.putFloat(68, correlationScore); 11534 if (label != null) { 11535 byte[] bytes; 11536 try { 11537 bytes = label.getBytes("UTF-8"); 11538 } catch (UnsupportedEncodingException e) { 11539 bytes = new byte[0]; 11540 } 11541 putBytes(backing, bytes, 72, bytes.length); 11542 for (int i=bytes.length; i<256; i++) 11543 backing.put(i, (byte)0); // fill with zero 11544 } 11545 featureData_buf = ByteBuffer.allocateDirect(featureData.length*16).order(ByteOrder.nativeOrder()); 11546 for (int i=0, off=0; i<featureData.length; i++, off += 16) { 11547 featureData[i].setBuffer(featureData_buf, off); 11548 featureData[i].write(); 11549 } 11550 backing.putInt(332, featureData.length); 11551 putPointer(backing, 328, featureData_buf); 11552 calibratedPosition.write(); 11553 backing.putFloat(344, calibratedRotation); 11554 for (PointFloat it : calibratedCorner) { 11555 it.write(); 11556 } 11557 } 11558 public int size() { 11559 return 380; 11560 } 11561 } 11562 11563 public static class ClosedCurveFeature extends DisposedStruct { 11564 public PointFloat position; // The center of the closed curve feature. 11565 public double arcLength; // The arc length of the closed curve feature. 11566 11567 private void init() { 11568 position = new PointFloat(backing, 0); 11569 } 11570 public ClosedCurveFeature() { 11571 super(16); 11572 init(); 11573 } 11574 public ClosedCurveFeature(PointFloat position, double arcLength) { 11575 super(16); 11576 this.position = position; 11577 this.arcLength = arcLength; 11578 } 11579 protected ClosedCurveFeature(ByteBuffer backing, int offset) { 11580 super(backing, offset, 16); 11581 init(); 11582 } 11583 protected ClosedCurveFeature(long nativeObj, boolean owned) { 11584 super(nativeObj, owned, 16); 11585 init(); 11586 } 11587 protected void setBuffer(ByteBuffer backing, int offset) { 11588 super.setBuffer(backing, offset, 16); 11589 } 11590 public void read() { 11591 position.read(); 11592 arcLength = backing.getDouble(8); 11593 } 11594 public void write() { 11595 position.write(); 11596 backing.putDouble(8, arcLength); 11597 } 11598 public int size() { 11599 return 16; 11600 } 11601 } 11602 11603 public static class LineMatch extends DisposedStruct { 11604 public PointFloat startPoint; // The starting point of the matched line. 11605 public PointFloat endPoint; // The ending point of the matched line. 11606 public double length; // The length of the line measured in pixels from the start point to the end point. 11607 public double rotation; // The orientation of the matched line. 11608 public double score; // The score of the matched line. 11609 11610 private void init() { 11611 startPoint = new PointFloat(backing, 0); 11612 endPoint = new PointFloat(backing, 8); 11613 } 11614 public LineMatch() { 11615 super(40); 11616 init(); 11617 } 11618 public LineMatch(PointFloat startPoint, PointFloat endPoint, double length, double rotation, double score) { 11619 super(40); 11620 this.startPoint = startPoint; 11621 this.endPoint = endPoint; 11622 this.length = length; 11623 this.rotation = rotation; 11624 this.score = score; 11625 } 11626 protected LineMatch(ByteBuffer backing, int offset) { 11627 super(backing, offset, 40); 11628 init(); 11629 } 11630 protected LineMatch(long nativeObj, boolean owned) { 11631 super(nativeObj, owned, 40); 11632 init(); 11633 } 11634 protected void setBuffer(ByteBuffer backing, int offset) { 11635 super.setBuffer(backing, offset, 40); 11636 } 11637 public void read() { 11638 startPoint.read(); 11639 endPoint.read(); 11640 length = backing.getDouble(16); 11641 rotation = backing.getDouble(24); 11642 score = backing.getDouble(32); 11643 } 11644 public void write() { 11645 startPoint.write(); 11646 endPoint.write(); 11647 backing.putDouble(16, length); 11648 backing.putDouble(24, rotation); 11649 backing.putDouble(32, score); 11650 } 11651 public int size() { 11652 return 40; 11653 } 11654 } 11655 11656 public static class LineDescriptor extends DisposedStruct { 11657 public double minLength; // Specifies the minimum length of a line the function will return. 11658 public double maxLength; // Specifies the maximum length of a line the function will return. 11659 11660 private void init() { 11661 11662 } 11663 public LineDescriptor() { 11664 super(16); 11665 init(); 11666 } 11667 public LineDescriptor(double minLength, double maxLength) { 11668 super(16); 11669 this.minLength = minLength; 11670 this.maxLength = maxLength; 11671 } 11672 protected LineDescriptor(ByteBuffer backing, int offset) { 11673 super(backing, offset, 16); 11674 init(); 11675 } 11676 protected LineDescriptor(long nativeObj, boolean owned) { 11677 super(nativeObj, owned, 16); 11678 init(); 11679 } 11680 protected void setBuffer(ByteBuffer backing, int offset) { 11681 super.setBuffer(backing, offset, 16); 11682 } 11683 public void read() { 11684 minLength = backing.getDouble(0); 11685 maxLength = backing.getDouble(8); 11686 } 11687 public void write() { 11688 backing.putDouble(0, minLength); 11689 backing.putDouble(8, maxLength); 11690 } 11691 public int size() { 11692 return 16; 11693 } 11694 } 11695 11696 public static class RectangleDescriptor extends DisposedStruct { 11697 public double minWidth; // Specifies the minimum width of a rectangle the algorithm will return. 11698 public double maxWidth; // Specifies the maximum width of a rectangle the algorithm will return. 11699 public double minHeight; // Specifies the minimum height of a rectangle the algorithm will return. 11700 public double maxHeight; // Specifies the maximum height of a rectangle the algorithm will return. 11701 11702 private void init() { 11703 11704 } 11705 public RectangleDescriptor() { 11706 super(32); 11707 init(); 11708 } 11709 public RectangleDescriptor(double minWidth, double maxWidth, double minHeight, double maxHeight) { 11710 super(32); 11711 this.minWidth = minWidth; 11712 this.maxWidth = maxWidth; 11713 this.minHeight = minHeight; 11714 this.maxHeight = maxHeight; 11715 } 11716 protected RectangleDescriptor(ByteBuffer backing, int offset) { 11717 super(backing, offset, 32); 11718 init(); 11719 } 11720 protected RectangleDescriptor(long nativeObj, boolean owned) { 11721 super(nativeObj, owned, 32); 11722 init(); 11723 } 11724 protected void setBuffer(ByteBuffer backing, int offset) { 11725 super.setBuffer(backing, offset, 32); 11726 } 11727 public void read() { 11728 minWidth = backing.getDouble(0); 11729 maxWidth = backing.getDouble(8); 11730 minHeight = backing.getDouble(16); 11731 maxHeight = backing.getDouble(24); 11732 } 11733 public void write() { 11734 backing.putDouble(0, minWidth); 11735 backing.putDouble(8, maxWidth); 11736 backing.putDouble(16, minHeight); 11737 backing.putDouble(24, maxHeight); 11738 } 11739 public int size() { 11740 return 32; 11741 } 11742 } 11743 11744 public static class RectangleMatch extends DisposedStruct { 11745 public PointFloat[] corner; // The corners of the matched rectangle. 11746 public double rotation; // The orientation of the matched rectangle. 11747 public double width; // The width of the matched rectangle. 11748 public double height; // The height of the matched rectangle. 11749 public double score; // The score of the matched rectangle. 11750 11751 private void init() { 11752 corner = new PointFloat[4]; 11753 11754 for (int i=0, off=0; i<4; i++, off += 8) 11755 corner[i] = new PointFloat(backing, off); 11756 } 11757 public RectangleMatch() { 11758 super(64); 11759 init(); 11760 } 11761 public RectangleMatch(PointFloat[] corner, double rotation, double width, double height, double score) { 11762 super(64); 11763 this.corner = corner; 11764 this.rotation = rotation; 11765 this.width = width; 11766 this.height = height; 11767 this.score = score; 11768 } 11769 protected RectangleMatch(ByteBuffer backing, int offset) { 11770 super(backing, offset, 64); 11771 init(); 11772 } 11773 protected RectangleMatch(long nativeObj, boolean owned) { 11774 super(nativeObj, owned, 64); 11775 init(); 11776 } 11777 protected void setBuffer(ByteBuffer backing, int offset) { 11778 super.setBuffer(backing, offset, 64); 11779 } 11780 public void read() { 11781 for (PointFloat it : corner) { 11782 it.read(); 11783 } 11784 rotation = backing.getDouble(32); 11785 width = backing.getDouble(40); 11786 height = backing.getDouble(48); 11787 score = backing.getDouble(56); 11788 } 11789 public void write() { 11790 for (PointFloat it : corner) { 11791 it.write(); 11792 } 11793 backing.putDouble(32, rotation); 11794 backing.putDouble(40, width); 11795 backing.putDouble(48, height); 11796 backing.putDouble(56, score); 11797 } 11798 public int size() { 11799 return 64; 11800 } 11801 } 11802 11803 public static class EllipseDescriptor extends DisposedStruct { 11804 public double minMajorRadius; // Specifies the minimum length of the semi-major axis of an ellipse the function will return. 11805 public double maxMajorRadius; // Specifies the maximum length of the semi-major axis of an ellipse the function will return. 11806 public double minMinorRadius; // Specifies the minimum length of the semi-minor axis of an ellipse the function will return. 11807 public double maxMinorRadius; // Specifies the maximum length of the semi-minor axis of an ellipse the function will return. 11808 11809 private void init() { 11810 11811 } 11812 public EllipseDescriptor() { 11813 super(32); 11814 init(); 11815 } 11816 public EllipseDescriptor(double minMajorRadius, double maxMajorRadius, double minMinorRadius, double maxMinorRadius) { 11817 super(32); 11818 this.minMajorRadius = minMajorRadius; 11819 this.maxMajorRadius = maxMajorRadius; 11820 this.minMinorRadius = minMinorRadius; 11821 this.maxMinorRadius = maxMinorRadius; 11822 } 11823 protected EllipseDescriptor(ByteBuffer backing, int offset) { 11824 super(backing, offset, 32); 11825 init(); 11826 } 11827 protected EllipseDescriptor(long nativeObj, boolean owned) { 11828 super(nativeObj, owned, 32); 11829 init(); 11830 } 11831 protected void setBuffer(ByteBuffer backing, int offset) { 11832 super.setBuffer(backing, offset, 32); 11833 } 11834 public void read() { 11835 minMajorRadius = backing.getDouble(0); 11836 maxMajorRadius = backing.getDouble(8); 11837 minMinorRadius = backing.getDouble(16); 11838 maxMinorRadius = backing.getDouble(24); 11839 } 11840 public void write() { 11841 backing.putDouble(0, minMajorRadius); 11842 backing.putDouble(8, maxMajorRadius); 11843 backing.putDouble(16, minMinorRadius); 11844 backing.putDouble(24, maxMinorRadius); 11845 } 11846 public int size() { 11847 return 32; 11848 } 11849 } 11850 11851 public static class EllipseMatch extends DisposedStruct { 11852 public PointFloat position; // The location of the center of the matched ellipse. 11853 public double rotation; // The orientation of the matched ellipse. 11854 public double majorRadius; // The length of the semi-major axis of the matched ellipse. 11855 public double minorRadius; // The length of the semi-minor axis of the matched ellipse. 11856 public double score; // The score of the matched ellipse. 11857 11858 private void init() { 11859 position = new PointFloat(backing, 0); 11860 } 11861 public EllipseMatch() { 11862 super(40); 11863 init(); 11864 } 11865 public EllipseMatch(PointFloat position, double rotation, double majorRadius, double minorRadius, double score) { 11866 super(40); 11867 this.position = position; 11868 this.rotation = rotation; 11869 this.majorRadius = majorRadius; 11870 this.minorRadius = minorRadius; 11871 this.score = score; 11872 } 11873 protected EllipseMatch(ByteBuffer backing, int offset) { 11874 super(backing, offset, 40); 11875 init(); 11876 } 11877 protected EllipseMatch(long nativeObj, boolean owned) { 11878 super(nativeObj, owned, 40); 11879 init(); 11880 } 11881 protected void setBuffer(ByteBuffer backing, int offset) { 11882 super.setBuffer(backing, offset, 40); 11883 } 11884 public void read() { 11885 position.read(); 11886 rotation = backing.getDouble(8); 11887 majorRadius = backing.getDouble(16); 11888 minorRadius = backing.getDouble(24); 11889 score = backing.getDouble(32); 11890 } 11891 public void write() { 11892 position.write(); 11893 backing.putDouble(8, rotation); 11894 backing.putDouble(16, majorRadius); 11895 backing.putDouble(24, minorRadius); 11896 backing.putDouble(32, score); 11897 } 11898 public int size() { 11899 return 40; 11900 } 11901 } 11902 11903 public static class CircleMatch extends DisposedStruct { 11904 public PointFloat position; // The location of the center of the matched circle. 11905 public double radius; // The radius of the matched circle. 11906 public double score; // The score of the matched circle. 11907 11908 private void init() { 11909 position = new PointFloat(backing, 0); 11910 } 11911 public CircleMatch() { 11912 super(24); 11913 init(); 11914 } 11915 public CircleMatch(PointFloat position, double radius, double score) { 11916 super(24); 11917 this.position = position; 11918 this.radius = radius; 11919 this.score = score; 11920 } 11921 protected CircleMatch(ByteBuffer backing, int offset) { 11922 super(backing, offset, 24); 11923 init(); 11924 } 11925 protected CircleMatch(long nativeObj, boolean owned) { 11926 super(nativeObj, owned, 24); 11927 init(); 11928 } 11929 protected void setBuffer(ByteBuffer backing, int offset) { 11930 super.setBuffer(backing, offset, 24); 11931 } 11932 public void read() { 11933 position.read(); 11934 radius = backing.getDouble(8); 11935 score = backing.getDouble(16); 11936 } 11937 public void write() { 11938 position.write(); 11939 backing.putDouble(8, radius); 11940 backing.putDouble(16, score); 11941 } 11942 public int size() { 11943 return 24; 11944 } 11945 } 11946 11947 public static class CircleDescriptor extends DisposedStruct { 11948 public double minRadius; // Specifies the minimum radius of a circle the function will return. 11949 public double maxRadius; // Specifies the maximum radius of a circle the function will return. 11950 11951 private void init() { 11952 11953 } 11954 public CircleDescriptor() { 11955 super(16); 11956 init(); 11957 } 11958 public CircleDescriptor(double minRadius, double maxRadius) { 11959 super(16); 11960 this.minRadius = minRadius; 11961 this.maxRadius = maxRadius; 11962 } 11963 protected CircleDescriptor(ByteBuffer backing, int offset) { 11964 super(backing, offset, 16); 11965 init(); 11966 } 11967 protected CircleDescriptor(long nativeObj, boolean owned) { 11968 super(nativeObj, owned, 16); 11969 init(); 11970 } 11971 protected void setBuffer(ByteBuffer backing, int offset) { 11972 super.setBuffer(backing, offset, 16); 11973 } 11974 public void read() { 11975 minRadius = backing.getDouble(0); 11976 maxRadius = backing.getDouble(8); 11977 } 11978 public void write() { 11979 backing.putDouble(0, minRadius); 11980 backing.putDouble(8, maxRadius); 11981 } 11982 public int size() { 11983 return 16; 11984 } 11985 } 11986 11987 public static class ShapeDetectionOptions extends DisposedStruct { 11988 public int mode; // Specifies the method used when looking for the shape in the image. 11989 public RangeFloat[] angleRanges; // An array of angle ranges, in degrees, where each range specifies how much you expect the shape to be rotated in the image. 11990 public RangeFloat scaleRange; // A range that specifies the sizes of the shapes you expect to be in the image, expressed as a ratio percentage representing the size of the pattern in the image divided by size of the original pattern multiplied by 100. 11991 public double minMatchScore; 11992 private ByteBuffer angleRanges_buf; 11993 11994 private void init() { 11995 angleRanges = new RangeFloat[0]; 11996 scaleRange = new RangeFloat(backing, 12); 11997 } 11998 public ShapeDetectionOptions() { 11999 super(32); 12000 init(); 12001 } 12002 public ShapeDetectionOptions(int mode, RangeFloat[] angleRanges, RangeFloat scaleRange, double minMatchScore) { 12003 super(32); 12004 this.mode = mode; 12005 this.angleRanges = angleRanges; 12006 this.scaleRange = scaleRange; 12007 this.minMatchScore = minMatchScore; 12008 } 12009 protected ShapeDetectionOptions(ByteBuffer backing, int offset) { 12010 super(backing, offset, 32); 12011 init(); 12012 } 12013 protected ShapeDetectionOptions(long nativeObj, boolean owned) { 12014 super(nativeObj, owned, 32); 12015 init(); 12016 } 12017 protected void setBuffer(ByteBuffer backing, int offset) { 12018 super.setBuffer(backing, offset, 32); 12019 } 12020 public void read() { 12021 mode = backing.getInt(0); 12022 int angleRanges_numAngleRanges = backing.getInt(8); 12023 long angleRanges_addr = getPointer(backing, 4); 12024 angleRanges = new RangeFloat[angleRanges_numAngleRanges]; 12025 if (angleRanges_numAngleRanges > 0 && angleRanges_addr != 0) { 12026 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numAngleRanges*8); 12027 for (int i=0, off=0; i<angleRanges_numAngleRanges; i++, off += 8) { 12028 angleRanges[i] = new RangeFloat(bb, off); 12029 angleRanges[i].read(); 12030 } 12031 } 12032 scaleRange.read(); 12033 minMatchScore = backing.getDouble(24); 12034 } 12035 public void write() { 12036 backing.putInt(0, mode); 12037 angleRanges_buf = ByteBuffer.allocateDirect(angleRanges.length*8).order(ByteOrder.nativeOrder()); 12038 for (int i=0, off=0; i<angleRanges.length; i++, off += 8) { 12039 angleRanges[i].setBuffer(angleRanges_buf, off); 12040 angleRanges[i].write(); 12041 } 12042 backing.putInt(8, angleRanges.length); 12043 putPointer(backing, 4, angleRanges_buf); 12044 scaleRange.write(); 12045 backing.putDouble(24, minMatchScore); 12046 } 12047 public int size() { 12048 return 32; 12049 } 12050 } 12051 12052 public static class Curve extends DisposedStruct { 12053 public PointFloat[] points; // The points on the curve. 12054 public int closed; // This element is TRUE if the curve is closed and FALSE if the curve is open. 12055 public double curveLength; // The length of the curve. 12056 public double minEdgeStrength; // The lowest edge strength detected on the curve. 12057 public double maxEdgeStrength; // The highest edge strength detected on the curve. 12058 public double averageEdgeStrength; // The average of all edge strengths detected on the curve. 12059 private ByteBuffer points_buf; 12060 12061 private void init() { 12062 points = new PointFloat[0]; 12063 } 12064 public Curve() { 12065 super(48); 12066 init(); 12067 } 12068 public Curve(PointFloat[] points, int closed, double curveLength, double minEdgeStrength, double maxEdgeStrength, double averageEdgeStrength) { 12069 super(48); 12070 this.points = points; 12071 this.closed = closed; 12072 this.curveLength = curveLength; 12073 this.minEdgeStrength = minEdgeStrength; 12074 this.maxEdgeStrength = maxEdgeStrength; 12075 this.averageEdgeStrength = averageEdgeStrength; 12076 } 12077 protected Curve(ByteBuffer backing, int offset) { 12078 super(backing, offset, 48); 12079 init(); 12080 } 12081 protected Curve(long nativeObj, boolean owned) { 12082 super(nativeObj, owned, 48); 12083 init(); 12084 } 12085 protected void setBuffer(ByteBuffer backing, int offset) { 12086 super.setBuffer(backing, offset, 48); 12087 } 12088 public void read() { 12089 int points_numPoints = backing.getInt(4); 12090 long points_addr = getPointer(backing, 0); 12091 points = new PointFloat[points_numPoints]; 12092 if (points_numPoints > 0 && points_addr != 0) { 12093 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints*8); 12094 for (int i=0, off=0; i<points_numPoints; i++, off += 8) { 12095 points[i] = new PointFloat(bb, off); 12096 points[i].read(); 12097 } 12098 } 12099 closed = backing.getInt(8); 12100 curveLength = backing.getDouble(16); 12101 minEdgeStrength = backing.getDouble(24); 12102 maxEdgeStrength = backing.getDouble(32); 12103 averageEdgeStrength = backing.getDouble(40); 12104 } 12105 public void write() { 12106 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 12107 for (int i=0, off=0; i<points.length; i++, off += 8) { 12108 points[i].setBuffer(points_buf, off); 12109 points[i].write(); 12110 } 12111 backing.putInt(4, points.length); 12112 putPointer(backing, 0, points_buf); 12113 backing.putInt(8, closed); 12114 backing.putDouble(16, curveLength); 12115 backing.putDouble(24, minEdgeStrength); 12116 backing.putDouble(32, maxEdgeStrength); 12117 backing.putDouble(40, averageEdgeStrength); 12118 } 12119 public int size() { 12120 return 48; 12121 } 12122 } 12123 12124 public static class CurveOptions extends DisposedStruct { 12125 public ExtractionMode extractionMode; // Specifies the method the function uses to identify curves in the image. 12126 public int threshold; // Specifies the minimum contrast a seed point must have in order to begin a curve. 12127 public EdgeFilterSize filterSize; // Specifies the width of the edge filter the function uses to identify curves in the image. 12128 public int minLength; // Specifies the length, in pixels, of the smallest curve the function will extract. 12129 public int rowStepSize; // Specifies the distance, in the y direction, between lines the function inspects for curve seed points. 12130 public int columnStepSize; // Specifies the distance, in the x direction, between columns the function inspects for curve seed points. 12131 public int maxEndPointGap; // Specifies the maximum gap, in pixels, between the endpoints of a curve that the function identifies as a closed curve. 12132 public int onlyClosed; // Set this element to TRUE to specify that the function should only identify closed curves in the image. 12133 public int subpixelAccuracy; // Set this element to TRUE to specify that the function identifies the location of curves with subpixel accuracy by interpolating between points to find the crossing of threshold. 12134 12135 private void init() { 12136 12137 } 12138 public CurveOptions() { 12139 super(36); 12140 init(); 12141 } 12142 public CurveOptions(ExtractionMode extractionMode, int threshold, EdgeFilterSize filterSize, int minLength, int rowStepSize, int columnStepSize, int maxEndPointGap, int onlyClosed, int subpixelAccuracy) { 12143 super(36); 12144 this.extractionMode = extractionMode; 12145 this.threshold = threshold; 12146 this.filterSize = filterSize; 12147 this.minLength = minLength; 12148 this.rowStepSize = rowStepSize; 12149 this.columnStepSize = columnStepSize; 12150 this.maxEndPointGap = maxEndPointGap; 12151 this.onlyClosed = onlyClosed; 12152 this.subpixelAccuracy = subpixelAccuracy; 12153 } 12154 protected CurveOptions(ByteBuffer backing, int offset) { 12155 super(backing, offset, 36); 12156 init(); 12157 } 12158 protected CurveOptions(long nativeObj, boolean owned) { 12159 super(nativeObj, owned, 36); 12160 init(); 12161 } 12162 protected void setBuffer(ByteBuffer backing, int offset) { 12163 super.setBuffer(backing, offset, 36); 12164 } 12165 public void read() { 12166 extractionMode = ExtractionMode.fromValue(backing.getInt(0)); 12167 threshold = backing.getInt(4); 12168 filterSize = EdgeFilterSize.fromValue(backing.getInt(8)); 12169 minLength = backing.getInt(12); 12170 rowStepSize = backing.getInt(16); 12171 columnStepSize = backing.getInt(20); 12172 maxEndPointGap = backing.getInt(24); 12173 onlyClosed = backing.getInt(28); 12174 subpixelAccuracy = backing.getInt(32); 12175 } 12176 public void write() { 12177 if (extractionMode != null) 12178 backing.putInt(0, extractionMode.getValue()); 12179 backing.putInt(4, threshold); 12180 if (filterSize != null) 12181 backing.putInt(8, filterSize.getValue()); 12182 backing.putInt(12, minLength); 12183 backing.putInt(16, rowStepSize); 12184 backing.putInt(20, columnStepSize); 12185 backing.putInt(24, maxEndPointGap); 12186 backing.putInt(28, onlyClosed); 12187 backing.putInt(32, subpixelAccuracy); 12188 } 12189 public int size() { 12190 return 36; 12191 } 12192 } 12193 12194 public static class Barcode2DInfo extends DisposedStruct { 12195 public Barcode2DType type; // The type of the 2D barcode. 12196 public int binary; // This element is TRUE if the 2D barcode contains binary data and FALSE if the 2D barcode contains text data. 12197 public byte[] data; // The data encoded in the 2D barcode. 12198 public PointFloat[] boundingBox; // An array of four points describing the rectangle surrounding the 2D barcode. 12199 public int numErrorsCorrected; // The number of errors the function corrected when decoding the 2D barcode. 12200 public int numErasuresCorrected; // The number of erasures the function corrected when decoding the 2D barcode. 12201 public int rows; // The number of rows in the 2D barcode. 12202 public int columns; // The number of columns in the 2D barcode. 12203 private ByteBuffer data_buf; 12204 12205 private void init() { 12206 data = new byte[0]; 12207 boundingBox = new PointFloat[4]; 12208 12209 for (int i=0, off=16; i<4; i++, off += 8) 12210 boundingBox[i] = new PointFloat(backing, off); 12211 } 12212 public Barcode2DInfo() { 12213 super(64); 12214 init(); 12215 } 12216 public Barcode2DInfo(Barcode2DType type, int binary, byte[] data, PointFloat[] boundingBox, int numErrorsCorrected, int numErasuresCorrected, int rows, int columns) { 12217 super(64); 12218 this.type = type; 12219 this.binary = binary; 12220 this.data = data; 12221 this.boundingBox = boundingBox; 12222 this.numErrorsCorrected = numErrorsCorrected; 12223 this.numErasuresCorrected = numErasuresCorrected; 12224 this.rows = rows; 12225 this.columns = columns; 12226 } 12227 protected Barcode2DInfo(ByteBuffer backing, int offset) { 12228 super(backing, offset, 64); 12229 init(); 12230 } 12231 protected Barcode2DInfo(long nativeObj, boolean owned) { 12232 super(nativeObj, owned, 64); 12233 init(); 12234 } 12235 protected void setBuffer(ByteBuffer backing, int offset) { 12236 super.setBuffer(backing, offset, 64); 12237 } 12238 public void read() { 12239 type = Barcode2DType.fromValue(backing.getInt(0)); 12240 binary = backing.getInt(4); 12241 int data_dataLength = backing.getInt(12); 12242 long data_addr = getPointer(backing, 8); 12243 data = new byte[data_dataLength]; 12244 if (data_dataLength > 0 && data_addr != 0) { 12245 getBytes(newDirectByteBuffer(data_addr, data_dataLength), data, 0, data_dataLength); 12246 } 12247 for (PointFloat it : boundingBox) { 12248 it.read(); 12249 } 12250 numErrorsCorrected = backing.getInt(48); 12251 numErasuresCorrected = backing.getInt(52); 12252 rows = backing.getInt(56); 12253 columns = backing.getInt(60); 12254 } 12255 public void write() { 12256 if (type != null) 12257 backing.putInt(0, type.getValue()); 12258 backing.putInt(4, binary); 12259 data_buf = ByteBuffer.allocateDirect(data.length); 12260 putBytes(data_buf, data, 0, data.length); 12261 backing.putInt(12, data.length); 12262 putPointer(backing, 8, data_buf); 12263 for (PointFloat it : boundingBox) { 12264 it.write(); 12265 } 12266 backing.putInt(48, numErrorsCorrected); 12267 backing.putInt(52, numErasuresCorrected); 12268 backing.putInt(56, rows); 12269 backing.putInt(60, columns); 12270 } 12271 public int size() { 12272 return 64; 12273 } 12274 } 12275 12276 public static class DataMatrixOptions extends DisposedStruct { 12277 public Barcode2DSearchMode searchMode; // Specifies the mode the function uses to search for barcodes. 12278 public Barcode2DContrast contrast; // Specifies the contrast of the barcodes that the function searches for. 12279 public Barcode2DCellShape cellShape; // Specifies the shape of the barcode data cells, which affects how the function decodes the barcode. 12280 public Barcode2DShape barcodeShape; // Specifies the shape of the barcodes that the function searches for. 12281 public DataMatrixSubtype subtype; // Specifies the Data Matrix subtypes of the barcodes that the function searches for. 12282 12283 private void init() { 12284 12285 } 12286 public DataMatrixOptions() { 12287 super(20); 12288 init(); 12289 } 12290 public DataMatrixOptions(Barcode2DSearchMode searchMode, Barcode2DContrast contrast, Barcode2DCellShape cellShape, Barcode2DShape barcodeShape, DataMatrixSubtype subtype) { 12291 super(20); 12292 this.searchMode = searchMode; 12293 this.contrast = contrast; 12294 this.cellShape = cellShape; 12295 this.barcodeShape = barcodeShape; 12296 this.subtype = subtype; 12297 } 12298 protected DataMatrixOptions(ByteBuffer backing, int offset) { 12299 super(backing, offset, 20); 12300 init(); 12301 } 12302 protected DataMatrixOptions(long nativeObj, boolean owned) { 12303 super(nativeObj, owned, 20); 12304 init(); 12305 } 12306 protected void setBuffer(ByteBuffer backing, int offset) { 12307 super.setBuffer(backing, offset, 20); 12308 } 12309 public void read() { 12310 searchMode = Barcode2DSearchMode.fromValue(backing.getInt(0)); 12311 contrast = Barcode2DContrast.fromValue(backing.getInt(4)); 12312 cellShape = Barcode2DCellShape.fromValue(backing.getInt(8)); 12313 barcodeShape = Barcode2DShape.fromValue(backing.getInt(12)); 12314 subtype = DataMatrixSubtype.fromValue(backing.getInt(16)); 12315 } 12316 public void write() { 12317 if (searchMode != null) 12318 backing.putInt(0, searchMode.getValue()); 12319 if (contrast != null) 12320 backing.putInt(4, contrast.getValue()); 12321 if (cellShape != null) 12322 backing.putInt(8, cellShape.getValue()); 12323 if (barcodeShape != null) 12324 backing.putInt(12, barcodeShape.getValue()); 12325 if (subtype != null) 12326 backing.putInt(16, subtype.getValue()); 12327 } 12328 public int size() { 12329 return 20; 12330 } 12331 } 12332 12333 public static class ClassifierAccuracyReport extends DisposedStruct { 12334 public float accuracy; // The overall accuracy of the classifier, from 0 to 1000. 12335 public String[] classNames; // The names of the classes of this classifier. 12336 public double[] classAccuracy; // An array of size elements that contains accuracy information for each class. 12337 public double[] classPredictiveValue; // An array containing size elements that contains the predictive values of each class. 12338 private ByteBuffer classNames_buf; 12339 private ByteBuffer[] classNames_bufs; 12340 private ByteBuffer classAccuracy_buf; 12341 private ByteBuffer classPredictiveValue_buf; 12342 12343 private void init() { 12344 classNames = new String[0]; 12345 classAccuracy = new double[0]; 12346 classPredictiveValue = new double[0]; 12347 } 12348 public ClassifierAccuracyReport() { 12349 super(24); 12350 init(); 12351 } 12352 public ClassifierAccuracyReport(double accuracy, String[] classNames, double[] classAccuracy, double[] classPredictiveValue) { 12353 super(24); 12354 this.accuracy = (float)accuracy; 12355 this.classNames = classNames; 12356 this.classAccuracy = classAccuracy; 12357 this.classPredictiveValue = classPredictiveValue; 12358 } 12359 protected ClassifierAccuracyReport(ByteBuffer backing, int offset) { 12360 super(backing, offset, 24); 12361 init(); 12362 } 12363 protected ClassifierAccuracyReport(long nativeObj, boolean owned) { 12364 super(nativeObj, owned, 24); 12365 init(); 12366 } 12367 protected void setBuffer(ByteBuffer backing, int offset) { 12368 super.setBuffer(backing, offset, 24); 12369 } 12370 public void read() { 12371 accuracy = backing.getFloat(4); 12372 int classNames_size = backing.getInt(0); 12373 long classNames_addr = getPointer(backing, 8); 12374 classNames = new String[classNames_size]; 12375 if (classNames_size > 0 && classNames_addr != 0) { 12376 ByteBuffer bb = newDirectByteBuffer(classNames_addr, classNames_size*4); 12377 for (int i=0, off=0; i<classNames_size; i++, off += 4) { 12378 long addr = getPointer(bb, off); 12379 if (addr == 0) 12380 classNames[i] = null; 12381 else { 12382 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 12383 while (bb2.get() != 0) {} 12384 byte[] bytes = new byte[bb2.position()-1]; 12385 bb2.rewind(); 12386 getBytes(bb2, bytes, 0, bytes.length); 12387 try { 12388 classNames[i] = new String(bytes, "UTF-8"); 12389 } catch (UnsupportedEncodingException e) { 12390 classNames[i] = ""; 12391 } 12392 } 12393 } 12394 } 12395 int classAccuracy_size = backing.getInt(0); 12396 long classAccuracy_addr = getPointer(backing, 12); 12397 classAccuracy = new double[classAccuracy_size]; 12398 if (classAccuracy_size > 0 && classAccuracy_addr != 0) { 12399 newDirectByteBuffer(classAccuracy_addr, classAccuracy_size*8).asDoubleBuffer().get(classAccuracy); 12400 } 12401 int classPredictiveValue_size = backing.getInt(0); 12402 long classPredictiveValue_addr = getPointer(backing, 16); 12403 classPredictiveValue = new double[classPredictiveValue_size]; 12404 if (classPredictiveValue_size > 0 && classPredictiveValue_addr != 0) { 12405 newDirectByteBuffer(classPredictiveValue_addr, classPredictiveValue_size*8).asDoubleBuffer().get(classPredictiveValue); 12406 } 12407 } 12408 public void write() { 12409 backing.putFloat(4, accuracy); 12410 classNames_buf = ByteBuffer.allocateDirect(classNames.length*4).order(ByteOrder.nativeOrder()); 12411 for (int i=0, off=0; i<classNames.length; i++, off += 4) { 12412 if (classNames[i] == null) 12413 putPointer(classNames_buf, off, 0); 12414 else { 12415 byte[] bytes; 12416 try { 12417 bytes = classNames[i].getBytes("UTF-8"); 12418 } catch (UnsupportedEncodingException e) { 12419 bytes = new byte[0]; 12420 } 12421 classNames_bufs[i] = ByteBuffer.allocateDirect(bytes.length+1); 12422 putBytes(classNames_bufs[i], bytes, 0, bytes.length).put(bytes.length, (byte)0); 12423 putPointer(classNames_buf, off, getByteBufferAddress(classNames_bufs[i])); 12424 } 12425 } 12426 backing.putInt(0, classNames.length); 12427 putPointer(backing, 8, classNames_buf); 12428 classAccuracy_buf = ByteBuffer.allocateDirect(classAccuracy.length*8).order(ByteOrder.nativeOrder()); 12429 classAccuracy_buf.asDoubleBuffer().put(classAccuracy).rewind(); 12430 backing.putInt(0, classAccuracy.length); 12431 putPointer(backing, 12, classAccuracy_buf); 12432 classPredictiveValue_buf = ByteBuffer.allocateDirect(classPredictiveValue.length*8).order(ByteOrder.nativeOrder()); 12433 classPredictiveValue_buf.asDoubleBuffer().put(classPredictiveValue).rewind(); 12434 backing.putInt(0, classPredictiveValue.length); 12435 putPointer(backing, 16, classPredictiveValue_buf); 12436 } 12437 public int size() { 12438 return 24; 12439 } 12440 } 12441 12442 public static class NearestNeighborClassResult extends DisposedStruct { 12443 public String className; // The name of the class. 12444 public float standardDeviation; // The standard deviation of the members of this class. 12445 public int count; // The number of samples in this class. 12446 private ByteBuffer className_buf; 12447 12448 private void init() { 12449 12450 } 12451 public NearestNeighborClassResult() { 12452 super(12); 12453 init(); 12454 } 12455 public NearestNeighborClassResult(String className, double standardDeviation, int count) { 12456 super(12); 12457 this.className = className; 12458 this.standardDeviation = (float)standardDeviation; 12459 this.count = count; 12460 } 12461 protected NearestNeighborClassResult(ByteBuffer backing, int offset) { 12462 super(backing, offset, 12); 12463 init(); 12464 } 12465 protected NearestNeighborClassResult(long nativeObj, boolean owned) { 12466 super(nativeObj, owned, 12); 12467 init(); 12468 } 12469 protected void setBuffer(ByteBuffer backing, int offset) { 12470 super.setBuffer(backing, offset, 12); 12471 } 12472 public void read() { 12473 long className_addr = getPointer(backing, 0); 12474 if (className_addr == 0) 12475 className = null; 12476 else { 12477 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 12478 while (bb.get() != 0) {} 12479 byte[] bytes = new byte[bb.position()-1]; 12480 getBytes(bb, bytes, 0, bytes.length); 12481 try { 12482 className = new String(bytes, "UTF-8"); 12483 } catch (UnsupportedEncodingException e) { 12484 className = ""; 12485 } 12486 } 12487 12488 standardDeviation = backing.getFloat(4); 12489 count = backing.getInt(8); 12490 } 12491 public void write() { 12492 if (className != null) { 12493 byte[] className_bytes; 12494 try { 12495 className_bytes = className.getBytes("UTF-8"); 12496 } catch (UnsupportedEncodingException e) { 12497 className_bytes = new byte[0]; 12498 } 12499 className_buf = ByteBuffer.allocateDirect(className_bytes.length+1); 12500 putBytes(className_buf, className_bytes, 0, className_bytes.length).put(className_bytes.length, (byte)0); 12501 } 12502 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 12503 backing.putFloat(4, standardDeviation); 12504 backing.putInt(8, count); 12505 } 12506 public int size() { 12507 return 12; 12508 } 12509 } 12510 12511 public static class NearestNeighborTrainingReport extends DisposedStruct { 12512 public NearestNeighborClassResult[] allScores; // All classes and their scores. 12513 private ByteBuffer allScores_buf; 12514 12515 private void init() { 12516 allScores = new NearestNeighborClassResult[0]; 12517 } 12518 public NearestNeighborTrainingReport() { 12519 super(12); 12520 init(); 12521 } 12522 public NearestNeighborTrainingReport(NearestNeighborClassResult[] allScores) { 12523 super(12); 12524 this.allScores = allScores; 12525 } 12526 protected NearestNeighborTrainingReport(ByteBuffer backing, int offset) { 12527 super(backing, offset, 12); 12528 init(); 12529 } 12530 protected NearestNeighborTrainingReport(long nativeObj, boolean owned) { 12531 super(nativeObj, owned, 12); 12532 init(); 12533 } 12534 protected void setBuffer(ByteBuffer backing, int offset) { 12535 super.setBuffer(backing, offset, 12); 12536 } 12537 public void read() { 12538 int allScores_allScoresSize = backing.getInt(8); 12539 long allScores_addr = getPointer(backing, 4); 12540 allScores = new NearestNeighborClassResult[allScores_allScoresSize]; 12541 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 12542 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize*12); 12543 for (int i=0, off=0; i<allScores_allScoresSize; i++, off += 12) { 12544 allScores[i] = new NearestNeighborClassResult(bb, off); 12545 allScores[i].read(); 12546 } 12547 } 12548 } 12549 public void write() { 12550 allScores_buf = ByteBuffer.allocateDirect(allScores.length*12).order(ByteOrder.nativeOrder()); 12551 for (int i=0, off=0; i<allScores.length; i++, off += 12) { 12552 allScores[i].setBuffer(allScores_buf, off); 12553 allScores[i].write(); 12554 } 12555 backing.putInt(8, allScores.length); 12556 putPointer(backing, 4, allScores_buf); 12557 } 12558 public int size() { 12559 return 12; 12560 } 12561 } 12562 12563 public static class ParticleClassifierPreprocessingOptions extends DisposedStruct { 12564 public int manualThreshold; // Set this element to TRUE to specify the threshold range manually. 12565 public RangeFloat manualThresholdRange; // If a manual threshold is being done, the range of pixels to keep. 12566 public ThresholdMethod autoThresholdMethod; // If an automatic threshold is being done, the method used to calculate the threshold range. 12567 public RangeFloat limits; // The limits on the automatic threshold range. 12568 public ParticleType particleType; // Specifies what kind of particles to look for. 12569 public int rejectBorder; // Set this element to TRUE to reject border particles. 12570 public int numErosions; // The number of erosions to perform. 12571 12572 private void init() { 12573 manualThresholdRange = new RangeFloat(backing, 4); 12574 limits = new RangeFloat(backing, 16); 12575 } 12576 public ParticleClassifierPreprocessingOptions() { 12577 super(36); 12578 init(); 12579 } 12580 public ParticleClassifierPreprocessingOptions(int manualThreshold, RangeFloat manualThresholdRange, ThresholdMethod autoThresholdMethod, RangeFloat limits, ParticleType particleType, int rejectBorder, int numErosions) { 12581 super(36); 12582 this.manualThreshold = manualThreshold; 12583 this.manualThresholdRange = manualThresholdRange; 12584 this.autoThresholdMethod = autoThresholdMethod; 12585 this.limits = limits; 12586 this.particleType = particleType; 12587 this.rejectBorder = rejectBorder; 12588 this.numErosions = numErosions; 12589 } 12590 protected ParticleClassifierPreprocessingOptions(ByteBuffer backing, int offset) { 12591 super(backing, offset, 36); 12592 init(); 12593 } 12594 protected ParticleClassifierPreprocessingOptions(long nativeObj, boolean owned) { 12595 super(nativeObj, owned, 36); 12596 init(); 12597 } 12598 protected void setBuffer(ByteBuffer backing, int offset) { 12599 super.setBuffer(backing, offset, 36); 12600 } 12601 public void read() { 12602 manualThreshold = backing.getInt(0); 12603 manualThresholdRange.read(); 12604 autoThresholdMethod = ThresholdMethod.fromValue(backing.getInt(12)); 12605 limits.read(); 12606 particleType = ParticleType.fromValue(backing.getInt(24)); 12607 rejectBorder = backing.getInt(28); 12608 numErosions = backing.getInt(32); 12609 } 12610 public void write() { 12611 backing.putInt(0, manualThreshold); 12612 manualThresholdRange.write(); 12613 if (autoThresholdMethod != null) 12614 backing.putInt(12, autoThresholdMethod.getValue()); 12615 limits.write(); 12616 if (particleType != null) 12617 backing.putInt(24, particleType.getValue()); 12618 backing.putInt(28, rejectBorder); 12619 backing.putInt(32, numErosions); 12620 } 12621 public int size() { 12622 return 36; 12623 } 12624 } 12625 12626 public static class ClassifierSampleInfo extends DisposedStruct { 12627 public String className; // The name of the class this sample is in. 12628 public double[] featureVector; // The feature vector of this sample, or NULL if this is not a custom classifier session. 12629 public Image thumbnail; // A thumbnail image of this sample, or NULL if no image was specified. 12630 private ByteBuffer className_buf; 12631 private ByteBuffer featureVector_buf; 12632 12633 private void init() { 12634 featureVector = new double[0]; 12635 } 12636 public ClassifierSampleInfo() { 12637 super(16); 12638 init(); 12639 } 12640 public ClassifierSampleInfo(String className, double[] featureVector, Image thumbnail) { 12641 super(16); 12642 this.className = className; 12643 this.featureVector = featureVector; 12644 this.thumbnail = thumbnail; 12645 } 12646 protected ClassifierSampleInfo(ByteBuffer backing, int offset) { 12647 super(backing, offset, 16); 12648 init(); 12649 } 12650 protected ClassifierSampleInfo(long nativeObj, boolean owned) { 12651 super(nativeObj, owned, 16); 12652 init(); 12653 } 12654 protected void setBuffer(ByteBuffer backing, int offset) { 12655 super.setBuffer(backing, offset, 16); 12656 } 12657 public void read() { 12658 long className_addr = getPointer(backing, 0); 12659 if (className_addr == 0) 12660 className = null; 12661 else { 12662 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 12663 while (bb.get() != 0) {} 12664 byte[] bytes = new byte[bb.position()-1]; 12665 getBytes(bb, bytes, 0, bytes.length); 12666 try { 12667 className = new String(bytes, "UTF-8"); 12668 } catch (UnsupportedEncodingException e) { 12669 className = ""; 12670 } 12671 } 12672 12673 int featureVector_featureVectorSize = backing.getInt(8); 12674 long featureVector_addr = getPointer(backing, 4); 12675 featureVector = new double[featureVector_featureVectorSize]; 12676 if (featureVector_featureVectorSize > 0 && featureVector_addr != 0) { 12677 newDirectByteBuffer(featureVector_addr, featureVector_featureVectorSize*8).asDoubleBuffer().get(featureVector); 12678 } 12679 long thumbnail_addr = getPointer(backing, 12); 12680 if (thumbnail_addr == 0) 12681 thumbnail = null; 12682 else 12683 thumbnail = new Image(thumbnail_addr, false); 12684 } 12685 public void write() { 12686 if (className != null) { 12687 byte[] className_bytes; 12688 try { 12689 className_bytes = className.getBytes("UTF-8"); 12690 } catch (UnsupportedEncodingException e) { 12691 className_bytes = new byte[0]; 12692 } 12693 className_buf = ByteBuffer.allocateDirect(className_bytes.length+1); 12694 putBytes(className_buf, className_bytes, 0, className_bytes.length).put(className_bytes.length, (byte)0); 12695 } 12696 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 12697 featureVector_buf = ByteBuffer.allocateDirect(featureVector.length*8).order(ByteOrder.nativeOrder()); 12698 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 12699 backing.putInt(8, featureVector.length); 12700 putPointer(backing, 4, featureVector_buf); 12701 putPointer(backing, 12, thumbnail); 12702 } 12703 public int size() { 12704 return 16; 12705 } 12706 } 12707 12708 public static class ClassScore extends DisposedStruct { 12709 public String className; // The name of the class. 12710 public float distance; // The distance from the item to this class. 12711 private ByteBuffer className_buf; 12712 12713 private void init() { 12714 12715 } 12716 public ClassScore() { 12717 super(8); 12718 init(); 12719 } 12720 public ClassScore(String className, double distance) { 12721 super(8); 12722 this.className = className; 12723 this.distance = (float)distance; 12724 } 12725 protected ClassScore(ByteBuffer backing, int offset) { 12726 super(backing, offset, 8); 12727 init(); 12728 } 12729 protected ClassScore(long nativeObj, boolean owned) { 12730 super(nativeObj, owned, 8); 12731 init(); 12732 } 12733 protected void setBuffer(ByteBuffer backing, int offset) { 12734 super.setBuffer(backing, offset, 8); 12735 } 12736 public void read() { 12737 long className_addr = getPointer(backing, 0); 12738 if (className_addr == 0) 12739 className = null; 12740 else { 12741 ByteBuffer bb = newDirectByteBuffer(className_addr, 1000); // FIXME 12742 while (bb.get() != 0) {} 12743 byte[] bytes = new byte[bb.position()-1]; 12744 getBytes(bb, bytes, 0, bytes.length); 12745 try { 12746 className = new String(bytes, "UTF-8"); 12747 } catch (UnsupportedEncodingException e) { 12748 className = ""; 12749 } 12750 } 12751 12752 distance = backing.getFloat(4); 12753 } 12754 public void write() { 12755 if (className != null) { 12756 byte[] className_bytes; 12757 try { 12758 className_bytes = className.getBytes("UTF-8"); 12759 } catch (UnsupportedEncodingException e) { 12760 className_bytes = new byte[0]; 12761 } 12762 className_buf = ByteBuffer.allocateDirect(className_bytes.length+1); 12763 putBytes(className_buf, className_bytes, 0, className_bytes.length).put(className_bytes.length, (byte)0); 12764 } 12765 putPointer(backing, 0, className == null ? 0 : getByteBufferAddress(className_buf)); 12766 backing.putFloat(4, distance); 12767 } 12768 public int size() { 12769 return 8; 12770 } 12771 } 12772 12773 public static class ClassifierReport extends DisposedStruct { 12774 public String bestClassName; // The name of the best class for the sample. 12775 public float classificationScore; // The similarity of the sample and the two closest classes in the classifier. 12776 public float identificationScore; // The similarity of the sample and the assigned class. 12777 public ClassScore[] allScores; // All classes and their scores. 12778 private ByteBuffer bestClassName_buf; 12779 private ByteBuffer allScores_buf; 12780 12781 private void init() { 12782 allScores = new ClassScore[0]; 12783 } 12784 public ClassifierReport() { 12785 super(20); 12786 init(); 12787 } 12788 public ClassifierReport(String bestClassName, double classificationScore, double identificationScore, ClassScore[] allScores) { 12789 super(20); 12790 this.bestClassName = bestClassName; 12791 this.classificationScore = (float)classificationScore; 12792 this.identificationScore = (float)identificationScore; 12793 this.allScores = allScores; 12794 } 12795 protected ClassifierReport(ByteBuffer backing, int offset) { 12796 super(backing, offset, 20); 12797 init(); 12798 } 12799 protected ClassifierReport(long nativeObj, boolean owned) { 12800 super(nativeObj, owned, 20); 12801 init(); 12802 } 12803 protected void setBuffer(ByteBuffer backing, int offset) { 12804 super.setBuffer(backing, offset, 20); 12805 } 12806 public void read() { 12807 long bestClassName_addr = getPointer(backing, 0); 12808 if (bestClassName_addr == 0) 12809 bestClassName = null; 12810 else { 12811 ByteBuffer bb = newDirectByteBuffer(bestClassName_addr, 1000); // FIXME 12812 while (bb.get() != 0) {} 12813 byte[] bytes = new byte[bb.position()-1]; 12814 getBytes(bb, bytes, 0, bytes.length); 12815 try { 12816 bestClassName = new String(bytes, "UTF-8"); 12817 } catch (UnsupportedEncodingException e) { 12818 bestClassName = ""; 12819 } 12820 } 12821 12822 classificationScore = backing.getFloat(4); 12823 identificationScore = backing.getFloat(8); 12824 int allScores_allScoresSize = backing.getInt(16); 12825 long allScores_addr = getPointer(backing, 12); 12826 allScores = new ClassScore[allScores_allScoresSize]; 12827 if (allScores_allScoresSize > 0 && allScores_addr != 0) { 12828 ByteBuffer bb = newDirectByteBuffer(allScores_addr, allScores_allScoresSize*8); 12829 for (int i=0, off=0; i<allScores_allScoresSize; i++, off += 8) { 12830 allScores[i] = new ClassScore(bb, off); 12831 allScores[i].read(); 12832 } 12833 } 12834 } 12835 public void write() { 12836 if (bestClassName != null) { 12837 byte[] bestClassName_bytes; 12838 try { 12839 bestClassName_bytes = bestClassName.getBytes("UTF-8"); 12840 } catch (UnsupportedEncodingException e) { 12841 bestClassName_bytes = new byte[0]; 12842 } 12843 bestClassName_buf = ByteBuffer.allocateDirect(bestClassName_bytes.length+1); 12844 putBytes(bestClassName_buf, bestClassName_bytes, 0, bestClassName_bytes.length).put(bestClassName_bytes.length, (byte)0); 12845 } 12846 putPointer(backing, 0, bestClassName == null ? 0 : getByteBufferAddress(bestClassName_buf)); 12847 backing.putFloat(4, classificationScore); 12848 backing.putFloat(8, identificationScore); 12849 allScores_buf = ByteBuffer.allocateDirect(allScores.length*8).order(ByteOrder.nativeOrder()); 12850 for (int i=0, off=0; i<allScores.length; i++, off += 8) { 12851 allScores[i].setBuffer(allScores_buf, off); 12852 allScores[i].write(); 12853 } 12854 backing.putInt(16, allScores.length); 12855 putPointer(backing, 12, allScores_buf); 12856 } 12857 public int size() { 12858 return 20; 12859 } 12860 } 12861 12862 public static class NearestNeighborOptions extends DisposedStruct { 12863 public NearestNeighborMethod method; // The method to use. 12864 public NearestNeighborMetric metric; // The metric to use. 12865 public int k; // The value of k, if the IMAQ_K_NEAREST_NEIGHBOR method is used. 12866 12867 private void init() { 12868 12869 } 12870 public NearestNeighborOptions() { 12871 super(12); 12872 init(); 12873 } 12874 public NearestNeighborOptions(NearestNeighborMethod method, NearestNeighborMetric metric, int k) { 12875 super(12); 12876 this.method = method; 12877 this.metric = metric; 12878 this.k = k; 12879 } 12880 protected NearestNeighborOptions(ByteBuffer backing, int offset) { 12881 super(backing, offset, 12); 12882 init(); 12883 } 12884 protected NearestNeighborOptions(long nativeObj, boolean owned) { 12885 super(nativeObj, owned, 12); 12886 init(); 12887 } 12888 protected void setBuffer(ByteBuffer backing, int offset) { 12889 super.setBuffer(backing, offset, 12); 12890 } 12891 public void read() { 12892 method = NearestNeighborMethod.fromValue(backing.getInt(0)); 12893 metric = NearestNeighborMetric.fromValue(backing.getInt(4)); 12894 k = backing.getInt(8); 12895 } 12896 public void write() { 12897 if (method != null) 12898 backing.putInt(0, method.getValue()); 12899 if (metric != null) 12900 backing.putInt(4, metric.getValue()); 12901 backing.putInt(8, k); 12902 } 12903 public int size() { 12904 return 12; 12905 } 12906 } 12907 12908 public static class ParticleClassifierOptions extends DisposedStruct { 12909 public float scaleDependence; // The relative importance of scale when classifying particles. 12910 public float mirrorDependence; // The relative importance of mirror symmetry when classifying particles. 12911 12912 private void init() { 12913 12914 } 12915 public ParticleClassifierOptions() { 12916 super(8); 12917 init(); 12918 } 12919 public ParticleClassifierOptions(double scaleDependence, double mirrorDependence) { 12920 super(8); 12921 this.scaleDependence = (float)scaleDependence; 12922 this.mirrorDependence = (float)mirrorDependence; 12923 } 12924 protected ParticleClassifierOptions(ByteBuffer backing, int offset) { 12925 super(backing, offset, 8); 12926 init(); 12927 } 12928 protected ParticleClassifierOptions(long nativeObj, boolean owned) { 12929 super(nativeObj, owned, 8); 12930 init(); 12931 } 12932 protected void setBuffer(ByteBuffer backing, int offset) { 12933 super.setBuffer(backing, offset, 8); 12934 } 12935 public void read() { 12936 scaleDependence = backing.getFloat(0); 12937 mirrorDependence = backing.getFloat(4); 12938 } 12939 public void write() { 12940 backing.putFloat(0, scaleDependence); 12941 backing.putFloat(4, mirrorDependence); 12942 } 12943 public int size() { 12944 return 8; 12945 } 12946 } 12947 12948 public static class RGBU64Value extends DisposedStruct { 12949 public int B; // The blue value of the color. 12950 public int G; // The green value of the color. 12951 public int R; // The red value of the color. 12952 public int alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 12953 12954 private void init() { 12955 12956 } 12957 public RGBU64Value() { 12958 super(8); 12959 init(); 12960 } 12961 public RGBU64Value(int B, int G, int R, int alpha) { 12962 super(8); 12963 this.B = B; 12964 this.G = G; 12965 this.R = R; 12966 this.alpha = alpha; 12967 } 12968 protected RGBU64Value(ByteBuffer backing, int offset) { 12969 super(backing, offset, 8); 12970 init(); 12971 } 12972 protected RGBU64Value(long nativeObj, boolean owned) { 12973 super(nativeObj, owned, 8); 12974 init(); 12975 } 12976 protected void setBuffer(ByteBuffer backing, int offset) { 12977 super.setBuffer(backing, offset, 8); 12978 } 12979 public void read() { 12980 B = (int)(backing.getShort(0) & 0xffff); 12981 G = (int)(backing.getShort(2) & 0xffff); 12982 R = (int)(backing.getShort(4) & 0xffff); 12983 alpha = (int)(backing.getShort(6) & 0xffff); 12984 } 12985 public void write() { 12986 backing.putShort(0, (short)(B & 0xffff)); 12987 backing.putShort(2, (short)(G & 0xffff)); 12988 backing.putShort(4, (short)(R & 0xffff)); 12989 backing.putShort(6, (short)(alpha & 0xffff)); 12990 } 12991 public int size() { 12992 return 8; 12993 } 12994 } 12995 12996 public static class GeometricPatternMatch extends DisposedStruct { 12997 public PointFloat position; // The location of the origin of the template in the match. 12998 public float rotation; // The rotation of the match relative to the template image, in degrees. 12999 public float scale; // The size of the match relative to the size of the template image, expressed as a percentage. 13000 public float score; // The accuracy of the match. 13001 public PointFloat[] corner; // An array of four points describing the rectangle surrounding the template image. 13002 public int inverse; // This element is TRUE if the match is an inverse of the template image. 13003 public float occlusion; // The percentage of the match that is occluded. 13004 public float templateMatchCurveScore; // The accuracy of the match obtained by comparing the template curves to the curves in the match region. 13005 public float matchTemplateCurveScore; // The accuracy of the match obtained by comparing the curves in the match region to the template curves. 13006 public float correlationScore; // The accuracy of the match obtained by comparing the template image to the match region using a correlation metric that compares the two regions as a function of their pixel values. 13007 13008 private void init() { 13009 position = new PointFloat(backing, 0); 13010 corner = new PointFloat[4]; 13011 13012 for (int i=0, off=20; i<4; i++, off += 8) 13013 corner[i] = new PointFloat(backing, off); 13014 } 13015 public GeometricPatternMatch() { 13016 super(72); 13017 init(); 13018 } 13019 public GeometricPatternMatch(PointFloat position, double rotation, double scale, double score, PointFloat[] corner, int inverse, double occlusion, double templateMatchCurveScore, double matchTemplateCurveScore, double correlationScore) { 13020 super(72); 13021 this.position = position; 13022 this.rotation = (float)rotation; 13023 this.scale = (float)scale; 13024 this.score = (float)score; 13025 this.corner = corner; 13026 this.inverse = inverse; 13027 this.occlusion = (float)occlusion; 13028 this.templateMatchCurveScore = (float)templateMatchCurveScore; 13029 this.matchTemplateCurveScore = (float)matchTemplateCurveScore; 13030 this.correlationScore = (float)correlationScore; 13031 } 13032 protected GeometricPatternMatch(ByteBuffer backing, int offset) { 13033 super(backing, offset, 72); 13034 init(); 13035 } 13036 protected GeometricPatternMatch(long nativeObj, boolean owned) { 13037 super(nativeObj, owned, 72); 13038 init(); 13039 } 13040 protected void setBuffer(ByteBuffer backing, int offset) { 13041 super.setBuffer(backing, offset, 72); 13042 } 13043 public void read() { 13044 position.read(); 13045 rotation = backing.getFloat(8); 13046 scale = backing.getFloat(12); 13047 score = backing.getFloat(16); 13048 for (PointFloat it : corner) { 13049 it.read(); 13050 } 13051 inverse = backing.getInt(52); 13052 occlusion = backing.getFloat(56); 13053 templateMatchCurveScore = backing.getFloat(60); 13054 matchTemplateCurveScore = backing.getFloat(64); 13055 correlationScore = backing.getFloat(68); 13056 } 13057 public void write() { 13058 position.write(); 13059 backing.putFloat(8, rotation); 13060 backing.putFloat(12, scale); 13061 backing.putFloat(16, score); 13062 for (PointFloat it : corner) { 13063 it.write(); 13064 } 13065 backing.putInt(52, inverse); 13066 backing.putFloat(56, occlusion); 13067 backing.putFloat(60, templateMatchCurveScore); 13068 backing.putFloat(64, matchTemplateCurveScore); 13069 backing.putFloat(68, correlationScore); 13070 } 13071 public int size() { 13072 return 72; 13073 } 13074 } 13075 13076 public static class MatchGeometricPatternAdvancedOptions extends DisposedStruct { 13077 public int minFeaturesUsed; // Specifies the minimum number of features the function uses when matching. 13078 public int maxFeaturesUsed; // Specifies the maximum number of features the function uses when matching. 13079 public int subpixelIterations; // Specifies the maximum number of incremental improvements used to refine matches with subpixel information. 13080 public double subpixelTolerance; // Specifies the maximum amount of change, in pixels, between consecutive incremental improvements in the match position before the function stops refining the match position. 13081 public int initialMatchListLength; // Specifies the maximum size of the match list. 13082 public int matchTemplateCurveScore; // Set this element to TRUE to specify that the function should calculate the match curve to template curve score and return it for each match result. 13083 public int correlationScore; // Set this element to TRUE to specify that the function should calculate the correlation score and return it for each match result. 13084 public double minMatchSeparationDistance; // Specifies the minimum separation distance, in pixels, between the origins of two matches that have unique positions. 13085 public double minMatchSeparationAngle; // Specifies the minimum angular difference, in degrees, between two matches that have unique angles. 13086 public double minMatchSeparationScale; // Specifies the minimum difference in scale, expressed as a percentage, between two matches that have unique scales. 13087 public double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed as a percentage, allowed between the bounding rectangles of two unique matches. 13088 public int coarseResult; // Specifies whether you want the function to spend less time accurately estimating the location of a match. 13089 13090 private void init() { 13091 13092 } 13093 public MatchGeometricPatternAdvancedOptions() { 13094 super(80); 13095 init(); 13096 } 13097 public MatchGeometricPatternAdvancedOptions(int minFeaturesUsed, int maxFeaturesUsed, int subpixelIterations, double subpixelTolerance, int initialMatchListLength, int matchTemplateCurveScore, int correlationScore, double minMatchSeparationDistance, double minMatchSeparationAngle, double minMatchSeparationScale, double maxMatchOverlap, int coarseResult) { 13098 super(80); 13099 this.minFeaturesUsed = minFeaturesUsed; 13100 this.maxFeaturesUsed = maxFeaturesUsed; 13101 this.subpixelIterations = subpixelIterations; 13102 this.subpixelTolerance = subpixelTolerance; 13103 this.initialMatchListLength = initialMatchListLength; 13104 this.matchTemplateCurveScore = matchTemplateCurveScore; 13105 this.correlationScore = correlationScore; 13106 this.minMatchSeparationDistance = minMatchSeparationDistance; 13107 this.minMatchSeparationAngle = minMatchSeparationAngle; 13108 this.minMatchSeparationScale = minMatchSeparationScale; 13109 this.maxMatchOverlap = maxMatchOverlap; 13110 this.coarseResult = coarseResult; 13111 } 13112 protected MatchGeometricPatternAdvancedOptions(ByteBuffer backing, int offset) { 13113 super(backing, offset, 80); 13114 init(); 13115 } 13116 protected MatchGeometricPatternAdvancedOptions(long nativeObj, boolean owned) { 13117 super(nativeObj, owned, 80); 13118 init(); 13119 } 13120 protected void setBuffer(ByteBuffer backing, int offset) { 13121 super.setBuffer(backing, offset, 80); 13122 } 13123 public void read() { 13124 minFeaturesUsed = backing.getInt(0); 13125 maxFeaturesUsed = backing.getInt(4); 13126 subpixelIterations = backing.getInt(8); 13127 subpixelTolerance = backing.getDouble(16); 13128 initialMatchListLength = backing.getInt(24); 13129 matchTemplateCurveScore = backing.getInt(28); 13130 correlationScore = backing.getInt(32); 13131 minMatchSeparationDistance = backing.getDouble(40); 13132 minMatchSeparationAngle = backing.getDouble(48); 13133 minMatchSeparationScale = backing.getDouble(56); 13134 maxMatchOverlap = backing.getDouble(64); 13135 coarseResult = backing.getInt(72); 13136 } 13137 public void write() { 13138 backing.putInt(0, minFeaturesUsed); 13139 backing.putInt(4, maxFeaturesUsed); 13140 backing.putInt(8, subpixelIterations); 13141 backing.putDouble(16, subpixelTolerance); 13142 backing.putInt(24, initialMatchListLength); 13143 backing.putInt(28, matchTemplateCurveScore); 13144 backing.putInt(32, correlationScore); 13145 backing.putDouble(40, minMatchSeparationDistance); 13146 backing.putDouble(48, minMatchSeparationAngle); 13147 backing.putDouble(56, minMatchSeparationScale); 13148 backing.putDouble(64, maxMatchOverlap); 13149 backing.putInt(72, coarseResult); 13150 } 13151 public int size() { 13152 return 80; 13153 } 13154 } 13155 13156 public static class MatchGeometricPatternOptions extends DisposedStruct { 13157 public int mode; // Specifies the method imaqMatchGeometricPattern() uses when looking for the pattern in the image. 13158 public int subpixelAccuracy; // Set this element to TRUE to specify that the function should calculate match locations with subpixel accuracy. 13159 public RangeFloat[] angleRanges; // An array of angle ranges, in degrees, where each range specifies how much you expect the template to be rotated in the image. 13160 public RangeFloat scaleRange; // A range that specifies the sizes of the pattern you expect to be in the image, expressed as a ratio percentage representing the size of the pattern in the image divided by size of the original pattern multiplied by 100. 13161 public RangeFloat occlusionRange; // A range that specifies the percentage of the pattern you expect to be occluded in the image. 13162 public int numMatchesRequested; // Number of valid matches expected. 13163 public float minMatchScore; // The minimum score a match can have for the function to consider the match valid. 13164 private ByteBuffer angleRanges_buf; 13165 13166 private void init() { 13167 angleRanges = new RangeFloat[0]; 13168 scaleRange = new RangeFloat(backing, 16); 13169 occlusionRange = new RangeFloat(backing, 24); 13170 } 13171 public MatchGeometricPatternOptions() { 13172 super(40); 13173 init(); 13174 } 13175 public MatchGeometricPatternOptions(int mode, int subpixelAccuracy, RangeFloat[] angleRanges, RangeFloat scaleRange, RangeFloat occlusionRange, int numMatchesRequested, double minMatchScore) { 13176 super(40); 13177 this.mode = mode; 13178 this.subpixelAccuracy = subpixelAccuracy; 13179 this.angleRanges = angleRanges; 13180 this.scaleRange = scaleRange; 13181 this.occlusionRange = occlusionRange; 13182 this.numMatchesRequested = numMatchesRequested; 13183 this.minMatchScore = (float)minMatchScore; 13184 } 13185 protected MatchGeometricPatternOptions(ByteBuffer backing, int offset) { 13186 super(backing, offset, 40); 13187 init(); 13188 } 13189 protected MatchGeometricPatternOptions(long nativeObj, boolean owned) { 13190 super(nativeObj, owned, 40); 13191 init(); 13192 } 13193 protected void setBuffer(ByteBuffer backing, int offset) { 13194 super.setBuffer(backing, offset, 40); 13195 } 13196 public void read() { 13197 mode = backing.getInt(0); 13198 subpixelAccuracy = backing.getInt(4); 13199 int angleRanges_numAngleRanges = backing.getInt(12); 13200 long angleRanges_addr = getPointer(backing, 8); 13201 angleRanges = new RangeFloat[angleRanges_numAngleRanges]; 13202 if (angleRanges_numAngleRanges > 0 && angleRanges_addr != 0) { 13203 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numAngleRanges*8); 13204 for (int i=0, off=0; i<angleRanges_numAngleRanges; i++, off += 8) { 13205 angleRanges[i] = new RangeFloat(bb, off); 13206 angleRanges[i].read(); 13207 } 13208 } 13209 scaleRange.read(); 13210 occlusionRange.read(); 13211 numMatchesRequested = backing.getInt(32); 13212 minMatchScore = backing.getFloat(36); 13213 } 13214 public void write() { 13215 backing.putInt(0, mode); 13216 backing.putInt(4, subpixelAccuracy); 13217 angleRanges_buf = ByteBuffer.allocateDirect(angleRanges.length*8).order(ByteOrder.nativeOrder()); 13218 for (int i=0, off=0; i<angleRanges.length; i++, off += 8) { 13219 angleRanges[i].setBuffer(angleRanges_buf, off); 13220 angleRanges[i].write(); 13221 } 13222 backing.putInt(12, angleRanges.length); 13223 putPointer(backing, 8, angleRanges_buf); 13224 scaleRange.write(); 13225 occlusionRange.write(); 13226 backing.putInt(32, numMatchesRequested); 13227 backing.putFloat(36, minMatchScore); 13228 } 13229 public int size() { 13230 return 40; 13231 } 13232 } 13233 13234 public static class LearnGeometricPatternAdvancedOptions extends DisposedStruct { 13235 public int minRectLength; // Specifies the minimum length for each side of a rectangular feature. 13236 public double minRectAspectRatio; // Specifies the minimum aspect ratio of a rectangular feature. 13237 public int minRadius; // Specifies the minimum radius for a circular feature. 13238 public int minLineLength; // Specifies the minimum length for a linear feature. 13239 public double minFeatureStrength; // Specifies the minimum strength for a feature. 13240 public int maxFeaturesUsed; // Specifies the maximum number of features the function uses when learning. 13241 public int maxPixelDistanceFromLine; // Specifies the maximum number of pixels between an edge pixel and a linear feature for the function to consider that edge pixel as part of the linear feature. 13242 13243 private void init() { 13244 13245 } 13246 public LearnGeometricPatternAdvancedOptions() { 13247 super(40); 13248 init(); 13249 } 13250 public LearnGeometricPatternAdvancedOptions(int minRectLength, double minRectAspectRatio, int minRadius, int minLineLength, double minFeatureStrength, int maxFeaturesUsed, int maxPixelDistanceFromLine) { 13251 super(40); 13252 this.minRectLength = minRectLength; 13253 this.minRectAspectRatio = minRectAspectRatio; 13254 this.minRadius = minRadius; 13255 this.minLineLength = minLineLength; 13256 this.minFeatureStrength = minFeatureStrength; 13257 this.maxFeaturesUsed = maxFeaturesUsed; 13258 this.maxPixelDistanceFromLine = maxPixelDistanceFromLine; 13259 } 13260 protected LearnGeometricPatternAdvancedOptions(ByteBuffer backing, int offset) { 13261 super(backing, offset, 40); 13262 init(); 13263 } 13264 protected LearnGeometricPatternAdvancedOptions(long nativeObj, boolean owned) { 13265 super(nativeObj, owned, 40); 13266 init(); 13267 } 13268 protected void setBuffer(ByteBuffer backing, int offset) { 13269 super.setBuffer(backing, offset, 40); 13270 } 13271 public void read() { 13272 minRectLength = backing.getInt(0); 13273 minRectAspectRatio = backing.getDouble(8); 13274 minRadius = backing.getInt(16); 13275 minLineLength = backing.getInt(20); 13276 minFeatureStrength = backing.getDouble(24); 13277 maxFeaturesUsed = backing.getInt(32); 13278 maxPixelDistanceFromLine = backing.getInt(36); 13279 } 13280 public void write() { 13281 backing.putInt(0, minRectLength); 13282 backing.putDouble(8, minRectAspectRatio); 13283 backing.putInt(16, minRadius); 13284 backing.putInt(20, minLineLength); 13285 backing.putDouble(24, minFeatureStrength); 13286 backing.putInt(32, maxFeaturesUsed); 13287 backing.putInt(36, maxPixelDistanceFromLine); 13288 } 13289 public int size() { 13290 return 40; 13291 } 13292 } 13293 13294 public static class FitEllipseOptions extends DisposedStruct { 13295 public int rejectOutliers; // Whether to use every given point or only a subset of the points to fit the ellipse. 13296 public double minScore; // Specifies the required quality of the fitted ellipse. 13297 public double pixelRadius; // The acceptable distance, in pixels, that a point determined to belong to the ellipse can be from the circumference of the ellipse. 13298 public int maxIterations; // Specifies the number of refinement iterations you allow the function to perform on the initial subset of points. 13299 13300 private void init() { 13301 13302 } 13303 public FitEllipseOptions() { 13304 super(32); 13305 init(); 13306 } 13307 public FitEllipseOptions(int rejectOutliers, double minScore, double pixelRadius, int maxIterations) { 13308 super(32); 13309 this.rejectOutliers = rejectOutliers; 13310 this.minScore = minScore; 13311 this.pixelRadius = pixelRadius; 13312 this.maxIterations = maxIterations; 13313 } 13314 protected FitEllipseOptions(ByteBuffer backing, int offset) { 13315 super(backing, offset, 32); 13316 init(); 13317 } 13318 protected FitEllipseOptions(long nativeObj, boolean owned) { 13319 super(nativeObj, owned, 32); 13320 init(); 13321 } 13322 protected void setBuffer(ByteBuffer backing, int offset) { 13323 super.setBuffer(backing, offset, 32); 13324 } 13325 public void read() { 13326 rejectOutliers = backing.getInt(0); 13327 minScore = backing.getDouble(8); 13328 pixelRadius = backing.getDouble(16); 13329 maxIterations = backing.getInt(24); 13330 } 13331 public void write() { 13332 backing.putInt(0, rejectOutliers); 13333 backing.putDouble(8, minScore); 13334 backing.putDouble(16, pixelRadius); 13335 backing.putInt(24, maxIterations); 13336 } 13337 public int size() { 13338 return 32; 13339 } 13340 } 13341 13342 public static class FitCircleOptions extends DisposedStruct { 13343 public int rejectOutliers; // Whether to use every given point or only a subset of the points to fit the circle. 13344 public double minScore; // Specifies the required quality of the fitted circle. 13345 public double pixelRadius; // The acceptable distance, in pixels, that a point determined to belong to the circle can be from the circumference of the circle. 13346 public int maxIterations; // Specifies the number of refinement iterations you allow the function to perform on the initial subset of points. 13347 13348 private void init() { 13349 13350 } 13351 public FitCircleOptions() { 13352 super(32); 13353 init(); 13354 } 13355 public FitCircleOptions(int rejectOutliers, double minScore, double pixelRadius, int maxIterations) { 13356 super(32); 13357 this.rejectOutliers = rejectOutliers; 13358 this.minScore = minScore; 13359 this.pixelRadius = pixelRadius; 13360 this.maxIterations = maxIterations; 13361 } 13362 protected FitCircleOptions(ByteBuffer backing, int offset) { 13363 super(backing, offset, 32); 13364 init(); 13365 } 13366 protected FitCircleOptions(long nativeObj, boolean owned) { 13367 super(nativeObj, owned, 32); 13368 init(); 13369 } 13370 protected void setBuffer(ByteBuffer backing, int offset) { 13371 super.setBuffer(backing, offset, 32); 13372 } 13373 public void read() { 13374 rejectOutliers = backing.getInt(0); 13375 minScore = backing.getDouble(8); 13376 pixelRadius = backing.getDouble(16); 13377 maxIterations = backing.getInt(24); 13378 } 13379 public void write() { 13380 backing.putInt(0, rejectOutliers); 13381 backing.putDouble(8, minScore); 13382 backing.putDouble(16, pixelRadius); 13383 backing.putInt(24, maxIterations); 13384 } 13385 public int size() { 13386 return 32; 13387 } 13388 } 13389 13390 public static class ConstructROIOptions2 extends DisposedStruct { 13391 public int windowNumber; // The window number of the image window. 13392 public String windowTitle; // Specifies the message string that the function displays in the title bar of the window. 13393 public PaletteType type; // The palette type to use. 13394 public RGBValue[] palette; // If type is IMAQ_PALETTE_USER, this array is the palette of colors to use with the window. 13395 public int maxContours; // The maximum number of contours the user will be able to select. 13396 private ByteBuffer windowTitle_buf; 13397 private ByteBuffer palette_buf; 13398 13399 private void init() { 13400 palette = new RGBValue[0]; 13401 } 13402 public ConstructROIOptions2() { 13403 super(24); 13404 init(); 13405 } 13406 public ConstructROIOptions2(int windowNumber, String windowTitle, PaletteType type, RGBValue[] palette, int maxContours) { 13407 super(24); 13408 this.windowNumber = windowNumber; 13409 this.windowTitle = windowTitle; 13410 this.type = type; 13411 this.palette = palette; 13412 this.maxContours = maxContours; 13413 } 13414 protected ConstructROIOptions2(ByteBuffer backing, int offset) { 13415 super(backing, offset, 24); 13416 init(); 13417 } 13418 protected ConstructROIOptions2(long nativeObj, boolean owned) { 13419 super(nativeObj, owned, 24); 13420 init(); 13421 } 13422 protected void setBuffer(ByteBuffer backing, int offset) { 13423 super.setBuffer(backing, offset, 24); 13424 } 13425 public void read() { 13426 windowNumber = backing.getInt(0); 13427 long windowTitle_addr = getPointer(backing, 4); 13428 if (windowTitle_addr == 0) 13429 windowTitle = null; 13430 else { 13431 ByteBuffer bb = newDirectByteBuffer(windowTitle_addr, 1000); // FIXME 13432 while (bb.get() != 0) {} 13433 byte[] bytes = new byte[bb.position()-1]; 13434 getBytes(bb, bytes, 0, bytes.length); 13435 try { 13436 windowTitle = new String(bytes, "UTF-8"); 13437 } catch (UnsupportedEncodingException e) { 13438 windowTitle = ""; 13439 } 13440 } 13441 13442 type = PaletteType.fromValue(backing.getInt(8)); 13443 int palette_numColors = backing.getInt(16); 13444 long palette_addr = getPointer(backing, 12); 13445 palette = new RGBValue[palette_numColors]; 13446 if (palette_numColors > 0 && palette_addr != 0) { 13447 ByteBuffer bb = newDirectByteBuffer(palette_addr, palette_numColors*4); 13448 for (int i=0, off=0; i<palette_numColors; i++, off += 4) { 13449 palette[i] = new RGBValue(bb, off); 13450 palette[i].read(); 13451 } 13452 } 13453 maxContours = backing.getInt(20); 13454 } 13455 public void write() { 13456 backing.putInt(0, windowNumber); 13457 if (windowTitle != null) { 13458 byte[] windowTitle_bytes; 13459 try { 13460 windowTitle_bytes = windowTitle.getBytes("UTF-8"); 13461 } catch (UnsupportedEncodingException e) { 13462 windowTitle_bytes = new byte[0]; 13463 } 13464 windowTitle_buf = ByteBuffer.allocateDirect(windowTitle_bytes.length+1); 13465 putBytes(windowTitle_buf, windowTitle_bytes, 0, windowTitle_bytes.length).put(windowTitle_bytes.length, (byte)0); 13466 } 13467 putPointer(backing, 4, windowTitle == null ? 0 : getByteBufferAddress(windowTitle_buf)); 13468 if (type != null) 13469 backing.putInt(8, type.getValue()); 13470 palette_buf = ByteBuffer.allocateDirect(palette.length*4).order(ByteOrder.nativeOrder()); 13471 for (int i=0, off=0; i<palette.length; i++, off += 4) { 13472 palette[i].setBuffer(palette_buf, off); 13473 palette[i].write(); 13474 } 13475 backing.putInt(16, palette.length); 13476 putPointer(backing, 12, palette_buf); 13477 backing.putInt(20, maxContours); 13478 } 13479 public int size() { 13480 return 24; 13481 } 13482 } 13483 13484 public static class HSLValue extends DisposedStruct { 13485 public short L; // The color luminance. 13486 public short S; // The color saturation. 13487 public short H; // The color hue. 13488 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 13489 13490 private void init() { 13491 13492 } 13493 public HSLValue() { 13494 super(4); 13495 init(); 13496 } 13497 public HSLValue(int L, int S, int H, int alpha) { 13498 super(4); 13499 this.L = (short)L; 13500 this.S = (short)S; 13501 this.H = (short)H; 13502 this.alpha = (short)alpha; 13503 } 13504 protected HSLValue(ByteBuffer backing, int offset) { 13505 super(backing, offset, 4); 13506 init(); 13507 } 13508 protected HSLValue(long nativeObj, boolean owned) { 13509 super(nativeObj, owned, 4); 13510 init(); 13511 } 13512 protected void setBuffer(ByteBuffer backing, int offset) { 13513 super.setBuffer(backing, offset, 4); 13514 } 13515 public void read() { 13516 L = (short)(backing.get(0) & 0xff); 13517 S = (short)(backing.get(1) & 0xff); 13518 H = (short)(backing.get(2) & 0xff); 13519 alpha = (short)(backing.get(3) & 0xff); 13520 } 13521 public void write() { 13522 backing.put(0, (byte)(L & 0xff)); 13523 backing.put(1, (byte)(S & 0xff)); 13524 backing.put(2, (byte)(H & 0xff)); 13525 backing.put(3, (byte)(alpha & 0xff)); 13526 } 13527 public int size() { 13528 return 4; 13529 } 13530 } 13531 13532 public static class HSVValue extends DisposedStruct { 13533 public short V; // The color value. 13534 public short S; // The color saturation. 13535 public short H; // The color hue. 13536 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 13537 13538 private void init() { 13539 13540 } 13541 public HSVValue() { 13542 super(4); 13543 init(); 13544 } 13545 public HSVValue(int V, int S, int H, int alpha) { 13546 super(4); 13547 this.V = (short)V; 13548 this.S = (short)S; 13549 this.H = (short)H; 13550 this.alpha = (short)alpha; 13551 } 13552 protected HSVValue(ByteBuffer backing, int offset) { 13553 super(backing, offset, 4); 13554 init(); 13555 } 13556 protected HSVValue(long nativeObj, boolean owned) { 13557 super(nativeObj, owned, 4); 13558 init(); 13559 } 13560 protected void setBuffer(ByteBuffer backing, int offset) { 13561 super.setBuffer(backing, offset, 4); 13562 } 13563 public void read() { 13564 V = (short)(backing.get(0) & 0xff); 13565 S = (short)(backing.get(1) & 0xff); 13566 H = (short)(backing.get(2) & 0xff); 13567 alpha = (short)(backing.get(3) & 0xff); 13568 } 13569 public void write() { 13570 backing.put(0, (byte)(V & 0xff)); 13571 backing.put(1, (byte)(S & 0xff)); 13572 backing.put(2, (byte)(H & 0xff)); 13573 backing.put(3, (byte)(alpha & 0xff)); 13574 } 13575 public int size() { 13576 return 4; 13577 } 13578 } 13579 13580 public static class HSIValue extends DisposedStruct { 13581 public short I; // The color intensity. 13582 public short S; // The color saturation. 13583 public short H; // The color hue. 13584 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 13585 13586 private void init() { 13587 13588 } 13589 public HSIValue() { 13590 super(4); 13591 init(); 13592 } 13593 public HSIValue(int I, int S, int H, int alpha) { 13594 super(4); 13595 this.I = (short)I; 13596 this.S = (short)S; 13597 this.H = (short)H; 13598 this.alpha = (short)alpha; 13599 } 13600 protected HSIValue(ByteBuffer backing, int offset) { 13601 super(backing, offset, 4); 13602 init(); 13603 } 13604 protected HSIValue(long nativeObj, boolean owned) { 13605 super(nativeObj, owned, 4); 13606 init(); 13607 } 13608 protected void setBuffer(ByteBuffer backing, int offset) { 13609 super.setBuffer(backing, offset, 4); 13610 } 13611 public void read() { 13612 I = (short)(backing.get(0) & 0xff); 13613 S = (short)(backing.get(1) & 0xff); 13614 H = (short)(backing.get(2) & 0xff); 13615 alpha = (short)(backing.get(3) & 0xff); 13616 } 13617 public void write() { 13618 backing.put(0, (byte)(I & 0xff)); 13619 backing.put(1, (byte)(S & 0xff)); 13620 backing.put(2, (byte)(H & 0xff)); 13621 backing.put(3, (byte)(alpha & 0xff)); 13622 } 13623 public int size() { 13624 return 4; 13625 } 13626 } 13627 13628 public static class CIELabValue extends DisposedStruct { 13629 public double b; // The yellow/blue information of the color. 13630 public double a; // The red/green information of the color. 13631 public double L; // The color lightness. 13632 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 13633 13634 private void init() { 13635 13636 } 13637 public CIELabValue() { 13638 super(32); 13639 init(); 13640 } 13641 public CIELabValue(double b, double a, double L, int alpha) { 13642 super(32); 13643 this.b = b; 13644 this.a = a; 13645 this.L = L; 13646 this.alpha = (short)alpha; 13647 } 13648 protected CIELabValue(ByteBuffer backing, int offset) { 13649 super(backing, offset, 32); 13650 init(); 13651 } 13652 protected CIELabValue(long nativeObj, boolean owned) { 13653 super(nativeObj, owned, 32); 13654 init(); 13655 } 13656 protected void setBuffer(ByteBuffer backing, int offset) { 13657 super.setBuffer(backing, offset, 32); 13658 } 13659 public void read() { 13660 b = backing.getDouble(0); 13661 a = backing.getDouble(8); 13662 L = backing.getDouble(16); 13663 alpha = (short)(backing.get(24) & 0xff); 13664 } 13665 public void write() { 13666 backing.putDouble(0, b); 13667 backing.putDouble(8, a); 13668 backing.putDouble(16, L); 13669 backing.put(24, (byte)(alpha & 0xff)); 13670 } 13671 public int size() { 13672 return 32; 13673 } 13674 } 13675 13676 public static class CIEXYZValue extends DisposedStruct { 13677 public double Z; // The Z color information. 13678 public double Y; // The color luminance. 13679 public double X; // The X color information. 13680 public short alpha; // The alpha value of the color, which represents extra information about a color image, such as gamma correction. 13681 13682 private void init() { 13683 13684 } 13685 public CIEXYZValue() { 13686 super(32); 13687 init(); 13688 } 13689 public CIEXYZValue(double Z, double Y, double X, int alpha) { 13690 super(32); 13691 this.Z = Z; 13692 this.Y = Y; 13693 this.X = X; 13694 this.alpha = (short)alpha; 13695 } 13696 protected CIEXYZValue(ByteBuffer backing, int offset) { 13697 super(backing, offset, 32); 13698 init(); 13699 } 13700 protected CIEXYZValue(long nativeObj, boolean owned) { 13701 super(nativeObj, owned, 32); 13702 init(); 13703 } 13704 protected void setBuffer(ByteBuffer backing, int offset) { 13705 super.setBuffer(backing, offset, 32); 13706 } 13707 public void read() { 13708 Z = backing.getDouble(0); 13709 Y = backing.getDouble(8); 13710 X = backing.getDouble(16); 13711 alpha = (short)(backing.get(24) & 0xff); 13712 } 13713 public void write() { 13714 backing.putDouble(0, Z); 13715 backing.putDouble(8, Y); 13716 backing.putDouble(16, X); 13717 backing.put(24, (byte)(alpha & 0xff)); 13718 } 13719 public int size() { 13720 return 32; 13721 } 13722 } 13723 13724 public static class BestEllipse2 extends DisposedStruct { 13725 public PointFloat center; // The coordinate location of the center of the ellipse. 13726 public PointFloat majorAxisStart; // The coordinate location of the start of the major axis of the ellipse. 13727 public PointFloat majorAxisEnd; // The coordinate location of the end of the major axis of the ellipse. 13728 public PointFloat minorAxisStart; // The coordinate location of the start of the minor axis of the ellipse. 13729 public PointFloat minorAxisEnd; // The coordinate location of the end of the minor axis of the ellipse. 13730 public double area; // The area of the ellipse. 13731 public double perimeter; // The length of the perimeter of the ellipse. 13732 public double error; // Represents the least square error of the fitted ellipse to the entire set of points. 13733 public int valid; // This element is TRUE if the function achieved the minimum score within the number of allowed refinement iterations and FALSE if the function did not achieve the minimum score. 13734 public int[] pointsUsed; // An array of the indexes for the points array indicating which points the function used to fit the ellipse. 13735 private ByteBuffer pointsUsed_buf; 13736 13737 private void init() { 13738 center = new PointFloat(backing, 0); 13739 majorAxisStart = new PointFloat(backing, 8); 13740 majorAxisEnd = new PointFloat(backing, 16); 13741 minorAxisStart = new PointFloat(backing, 24); 13742 minorAxisEnd = new PointFloat(backing, 32); 13743 pointsUsed = new int[0]; 13744 } 13745 public BestEllipse2() { 13746 super(80); 13747 init(); 13748 } 13749 public BestEllipse2(PointFloat center, PointFloat majorAxisStart, PointFloat majorAxisEnd, PointFloat minorAxisStart, PointFloat minorAxisEnd, double area, double perimeter, double error, int valid, int[] pointsUsed) { 13750 super(80); 13751 this.center = center; 13752 this.majorAxisStart = majorAxisStart; 13753 this.majorAxisEnd = majorAxisEnd; 13754 this.minorAxisStart = minorAxisStart; 13755 this.minorAxisEnd = minorAxisEnd; 13756 this.area = area; 13757 this.perimeter = perimeter; 13758 this.error = error; 13759 this.valid = valid; 13760 this.pointsUsed = pointsUsed; 13761 } 13762 protected BestEllipse2(ByteBuffer backing, int offset) { 13763 super(backing, offset, 80); 13764 init(); 13765 } 13766 protected BestEllipse2(long nativeObj, boolean owned) { 13767 super(nativeObj, owned, 80); 13768 init(); 13769 } 13770 protected void setBuffer(ByteBuffer backing, int offset) { 13771 super.setBuffer(backing, offset, 80); 13772 } 13773 public void read() { 13774 center.read(); 13775 majorAxisStart.read(); 13776 majorAxisEnd.read(); 13777 minorAxisStart.read(); 13778 minorAxisEnd.read(); 13779 area = backing.getDouble(40); 13780 perimeter = backing.getDouble(48); 13781 error = backing.getDouble(56); 13782 valid = backing.getInt(64); 13783 int pointsUsed_numPointsUsed = backing.getInt(72); 13784 long pointsUsed_addr = getPointer(backing, 68); 13785 pointsUsed = new int[pointsUsed_numPointsUsed]; 13786 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 13787 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed*4).asIntBuffer().get(pointsUsed); 13788 } 13789 } 13790 public void write() { 13791 center.write(); 13792 majorAxisStart.write(); 13793 majorAxisEnd.write(); 13794 minorAxisStart.write(); 13795 minorAxisEnd.write(); 13796 backing.putDouble(40, area); 13797 backing.putDouble(48, perimeter); 13798 backing.putDouble(56, error); 13799 backing.putInt(64, valid); 13800 pointsUsed_buf = ByteBuffer.allocateDirect(pointsUsed.length*4).order(ByteOrder.nativeOrder()); 13801 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 13802 backing.putInt(72, pointsUsed.length); 13803 putPointer(backing, 68, pointsUsed_buf); 13804 } 13805 public int size() { 13806 return 80; 13807 } 13808 } 13809 13810 public static class LearnPatternAdvancedOptions extends DisposedStruct { 13811 public LearnPatternAdvancedShiftOptions shiftOptions; // Use this element to control the behavior of imaqLearnPattern2() during the shift-invariant learning phase. 13812 public LearnPatternAdvancedRotationOptions rotationOptions; // Use this element to control the behavior of imaqLearnPattern2()during the rotation-invariant learning phase. 13813 13814 private void init() { 13815 13816 } 13817 public LearnPatternAdvancedOptions() { 13818 super(8); 13819 init(); 13820 } 13821 public LearnPatternAdvancedOptions(LearnPatternAdvancedShiftOptions shiftOptions, LearnPatternAdvancedRotationOptions rotationOptions) { 13822 super(8); 13823 this.shiftOptions = shiftOptions; 13824 this.rotationOptions = rotationOptions; 13825 } 13826 protected LearnPatternAdvancedOptions(ByteBuffer backing, int offset) { 13827 super(backing, offset, 8); 13828 init(); 13829 } 13830 protected LearnPatternAdvancedOptions(long nativeObj, boolean owned) { 13831 super(nativeObj, owned, 8); 13832 init(); 13833 } 13834 protected void setBuffer(ByteBuffer backing, int offset) { 13835 super.setBuffer(backing, offset, 8); 13836 } 13837 public void read() { 13838 long shiftOptions_addr = getPointer(backing, 0); 13839 if (shiftOptions_addr == 0) 13840 shiftOptions = null; 13841 else 13842 shiftOptions = new LearnPatternAdvancedShiftOptions(shiftOptions_addr, false); 13843 long rotationOptions_addr = getPointer(backing, 4); 13844 if (rotationOptions_addr == 0) 13845 rotationOptions = null; 13846 else 13847 rotationOptions = new LearnPatternAdvancedRotationOptions(rotationOptions_addr, false); 13848 } 13849 public void write() { 13850 putPointer(backing, 0, shiftOptions); 13851 putPointer(backing, 4, rotationOptions); 13852 } 13853 public int size() { 13854 return 8; 13855 } 13856 } 13857 13858 public static class AVIInfo extends DisposedStruct { 13859 public int width; // The width of each frame. 13860 public int height; // The height of each frame. 13861 public ImageType imageType; // The type of images this AVI contains. 13862 public int numFrames; // The number of frames in the AVI. 13863 public int framesPerSecond; // The number of frames per second this AVI should be shown at. 13864 public String filterName; // The name of the compression filter used to create this AVI. 13865 public int hasData; // Specifies whether this AVI has data attached to each frame or not. 13866 public int maxDataSize; // If this AVI has data, the maximum size of the data in each frame. 13867 private ByteBuffer filterName_buf; 13868 13869 private void init() { 13870 13871 } 13872 public AVIInfo() { 13873 super(32); 13874 init(); 13875 } 13876 public AVIInfo(int width, int height, ImageType imageType, int numFrames, int framesPerSecond, String filterName, int hasData, int maxDataSize) { 13877 super(32); 13878 this.width = width; 13879 this.height = height; 13880 this.imageType = imageType; 13881 this.numFrames = numFrames; 13882 this.framesPerSecond = framesPerSecond; 13883 this.filterName = filterName; 13884 this.hasData = hasData; 13885 this.maxDataSize = maxDataSize; 13886 } 13887 protected AVIInfo(ByteBuffer backing, int offset) { 13888 super(backing, offset, 32); 13889 init(); 13890 } 13891 protected AVIInfo(long nativeObj, boolean owned) { 13892 super(nativeObj, owned, 32); 13893 init(); 13894 } 13895 protected void setBuffer(ByteBuffer backing, int offset) { 13896 super.setBuffer(backing, offset, 32); 13897 } 13898 public void read() { 13899 width = backing.getInt(0); 13900 height = backing.getInt(4); 13901 imageType = ImageType.fromValue(backing.getInt(8)); 13902 numFrames = backing.getInt(12); 13903 framesPerSecond = backing.getInt(16); 13904 long filterName_addr = getPointer(backing, 20); 13905 if (filterName_addr == 0) 13906 filterName = null; 13907 else { 13908 ByteBuffer bb = newDirectByteBuffer(filterName_addr, 1000); // FIXME 13909 while (bb.get() != 0) {} 13910 byte[] bytes = new byte[bb.position()-1]; 13911 getBytes(bb, bytes, 0, bytes.length); 13912 try { 13913 filterName = new String(bytes, "UTF-8"); 13914 } catch (UnsupportedEncodingException e) { 13915 filterName = ""; 13916 } 13917 } 13918 13919 hasData = backing.getInt(24); 13920 maxDataSize = backing.getInt(28); 13921 } 13922 public void write() { 13923 backing.putInt(0, width); 13924 backing.putInt(4, height); 13925 if (imageType != null) 13926 backing.putInt(8, imageType.getValue()); 13927 backing.putInt(12, numFrames); 13928 backing.putInt(16, framesPerSecond); 13929 if (filterName != null) { 13930 byte[] filterName_bytes; 13931 try { 13932 filterName_bytes = filterName.getBytes("UTF-8"); 13933 } catch (UnsupportedEncodingException e) { 13934 filterName_bytes = new byte[0]; 13935 } 13936 filterName_buf = ByteBuffer.allocateDirect(filterName_bytes.length+1); 13937 putBytes(filterName_buf, filterName_bytes, 0, filterName_bytes.length).put(filterName_bytes.length, (byte)0); 13938 } 13939 putPointer(backing, 20, filterName == null ? 0 : getByteBufferAddress(filterName_buf)); 13940 backing.putInt(24, hasData); 13941 backing.putInt(28, maxDataSize); 13942 } 13943 public int size() { 13944 return 32; 13945 } 13946 } 13947 13948 public static class LearnPatternAdvancedShiftOptions extends DisposedStruct { 13949 public int initialStepSize; // The largest number of image pixels to shift the sample across the inspection image during the initial phase of shift-invariant matching. 13950 public int initialSampleSize; // Specifies the number of template pixels that you want to include in a sample for the initial phase of shift-invariant matching. 13951 public double initialSampleSizeFactor; // Specifies the size of the sample for the initial phase of shift-invariant matching as a percent of the template size, in pixels. 13952 public int finalSampleSize; // Specifies the number of template pixels you want to add to initialSampleSize for the final phase of shift-invariant matching. 13953 public double finalSampleSizeFactor; // Specifies the size of the sample for the final phase of shift-invariant matching as a percent of the edge points in the template, in pixels. 13954 public int subpixelSampleSize; // Specifies the number of template pixels that you want to include in a sample for the subpixel phase of shift-invariant matching. 13955 public double subpixelSampleSizeFactor; // Specifies the size of the sample for the subpixel phase of shift-invariant matching as a percent of the template size, in pixels. 13956 13957 private void init() { 13958 13959 } 13960 public LearnPatternAdvancedShiftOptions() { 13961 super(48); 13962 init(); 13963 } 13964 public LearnPatternAdvancedShiftOptions(int initialStepSize, int initialSampleSize, double initialSampleSizeFactor, int finalSampleSize, double finalSampleSizeFactor, int subpixelSampleSize, double subpixelSampleSizeFactor) { 13965 super(48); 13966 this.initialStepSize = initialStepSize; 13967 this.initialSampleSize = initialSampleSize; 13968 this.initialSampleSizeFactor = initialSampleSizeFactor; 13969 this.finalSampleSize = finalSampleSize; 13970 this.finalSampleSizeFactor = finalSampleSizeFactor; 13971 this.subpixelSampleSize = subpixelSampleSize; 13972 this.subpixelSampleSizeFactor = subpixelSampleSizeFactor; 13973 } 13974 protected LearnPatternAdvancedShiftOptions(ByteBuffer backing, int offset) { 13975 super(backing, offset, 48); 13976 init(); 13977 } 13978 protected LearnPatternAdvancedShiftOptions(long nativeObj, boolean owned) { 13979 super(nativeObj, owned, 48); 13980 init(); 13981 } 13982 protected void setBuffer(ByteBuffer backing, int offset) { 13983 super.setBuffer(backing, offset, 48); 13984 } 13985 public void read() { 13986 initialStepSize = backing.getInt(0); 13987 initialSampleSize = backing.getInt(4); 13988 initialSampleSizeFactor = backing.getDouble(8); 13989 finalSampleSize = backing.getInt(16); 13990 finalSampleSizeFactor = backing.getDouble(24); 13991 subpixelSampleSize = backing.getInt(32); 13992 subpixelSampleSizeFactor = backing.getDouble(40); 13993 } 13994 public void write() { 13995 backing.putInt(0, initialStepSize); 13996 backing.putInt(4, initialSampleSize); 13997 backing.putDouble(8, initialSampleSizeFactor); 13998 backing.putInt(16, finalSampleSize); 13999 backing.putDouble(24, finalSampleSizeFactor); 14000 backing.putInt(32, subpixelSampleSize); 14001 backing.putDouble(40, subpixelSampleSizeFactor); 14002 } 14003 public int size() { 14004 return 48; 14005 } 14006 } 14007 14008 public static class LearnPatternAdvancedRotationOptions extends DisposedStruct { 14009 public SearchStrategy searchStrategySupport; // Specifies the aggressiveness of the rotation search strategy available during the matching phase. 14010 public int initialStepSize; // The largest number of image pixels to shift the sample across the inspection image during the initial phase of matching. 14011 public int initialSampleSize; // Specifies the number of template pixels that you want to include in a sample for the initial phase of rotation-invariant matching. 14012 public double initialSampleSizeFactor; // Specifies the size of the sample for the initial phase of rotation-invariant matching as a percent of the template size, in pixels. 14013 public int initialAngularAccuracy; // Sets the angle accuracy, in degrees, to use during the initial phase of rotation-invariant matching. 14014 public int finalSampleSize; // Specifies the number of template pixels you want to add to initialSampleSize for the final phase of rotation-invariant matching. 14015 public double finalSampleSizeFactor; // Specifies the size of the sample for the final phase of rotation-invariant matching as a percent of the edge points in the template, in pixels. 14016 public int finalAngularAccuracy; // Sets the angle accuracy, in degrees, to use during the final phase of the rotation-invariant matching. 14017 public int subpixelSampleSize; // Specifies the number of template pixels that you want to include in a sample for the subpixel phase of rotation-invariant matching. 14018 public double subpixelSampleSizeFactor; // Specifies the size of the sample for the subpixel phase of rotation-invariant matching as a percent of the template size, in pixels. 14019 14020 private void init() { 14021 14022 } 14023 public LearnPatternAdvancedRotationOptions() { 14024 super(56); 14025 init(); 14026 } 14027 public LearnPatternAdvancedRotationOptions(SearchStrategy searchStrategySupport, int initialStepSize, int initialSampleSize, double initialSampleSizeFactor, int initialAngularAccuracy, int finalSampleSize, double finalSampleSizeFactor, int finalAngularAccuracy, int subpixelSampleSize, double subpixelSampleSizeFactor) { 14028 super(56); 14029 this.searchStrategySupport = searchStrategySupport; 14030 this.initialStepSize = initialStepSize; 14031 this.initialSampleSize = initialSampleSize; 14032 this.initialSampleSizeFactor = initialSampleSizeFactor; 14033 this.initialAngularAccuracy = initialAngularAccuracy; 14034 this.finalSampleSize = finalSampleSize; 14035 this.finalSampleSizeFactor = finalSampleSizeFactor; 14036 this.finalAngularAccuracy = finalAngularAccuracy; 14037 this.subpixelSampleSize = subpixelSampleSize; 14038 this.subpixelSampleSizeFactor = subpixelSampleSizeFactor; 14039 } 14040 protected LearnPatternAdvancedRotationOptions(ByteBuffer backing, int offset) { 14041 super(backing, offset, 56); 14042 init(); 14043 } 14044 protected LearnPatternAdvancedRotationOptions(long nativeObj, boolean owned) { 14045 super(nativeObj, owned, 56); 14046 init(); 14047 } 14048 protected void setBuffer(ByteBuffer backing, int offset) { 14049 super.setBuffer(backing, offset, 56); 14050 } 14051 public void read() { 14052 searchStrategySupport = SearchStrategy.fromValue(backing.getInt(0)); 14053 initialStepSize = backing.getInt(4); 14054 initialSampleSize = backing.getInt(8); 14055 initialSampleSizeFactor = backing.getDouble(16); 14056 initialAngularAccuracy = backing.getInt(24); 14057 finalSampleSize = backing.getInt(28); 14058 finalSampleSizeFactor = backing.getDouble(32); 14059 finalAngularAccuracy = backing.getInt(40); 14060 subpixelSampleSize = backing.getInt(44); 14061 subpixelSampleSizeFactor = backing.getDouble(48); 14062 } 14063 public void write() { 14064 if (searchStrategySupport != null) 14065 backing.putInt(0, searchStrategySupport.getValue()); 14066 backing.putInt(4, initialStepSize); 14067 backing.putInt(8, initialSampleSize); 14068 backing.putDouble(16, initialSampleSizeFactor); 14069 backing.putInt(24, initialAngularAccuracy); 14070 backing.putInt(28, finalSampleSize); 14071 backing.putDouble(32, finalSampleSizeFactor); 14072 backing.putInt(40, finalAngularAccuracy); 14073 backing.putInt(44, subpixelSampleSize); 14074 backing.putDouble(48, subpixelSampleSizeFactor); 14075 } 14076 public int size() { 14077 return 56; 14078 } 14079 } 14080 14081 public static class MatchPatternAdvancedOptions extends DisposedStruct { 14082 public int subpixelIterations; // Defines the maximum number of incremental improvements used to refine matching using subpixel information. 14083 public double subpixelTolerance; // Defines the maximum amount of change, in pixels, between consecutive incremental improvements in the match position that you want to trigger the end of the refinement process. 14084 public int initialMatchListLength; // Specifies the maximum size of the match list. 14085 public int matchListReductionFactor; // Specifies the reduction of the match list as matches are refined. 14086 public int initialStepSize; // Specifies the number of pixels to shift the sample across the inspection image during the initial phase of shift-invariant matching. 14087 public SearchStrategy searchStrategy; // Specifies the aggressiveness of the rotation search strategy. 14088 public int intermediateAngularAccuracy; // Specifies the accuracy to use during the intermediate phase of rotation-invariant matching. 14089 14090 private void init() { 14091 14092 } 14093 public MatchPatternAdvancedOptions() { 14094 super(40); 14095 init(); 14096 } 14097 public MatchPatternAdvancedOptions(int subpixelIterations, double subpixelTolerance, int initialMatchListLength, int matchListReductionFactor, int initialStepSize, SearchStrategy searchStrategy, int intermediateAngularAccuracy) { 14098 super(40); 14099 this.subpixelIterations = subpixelIterations; 14100 this.subpixelTolerance = subpixelTolerance; 14101 this.initialMatchListLength = initialMatchListLength; 14102 this.matchListReductionFactor = matchListReductionFactor; 14103 this.initialStepSize = initialStepSize; 14104 this.searchStrategy = searchStrategy; 14105 this.intermediateAngularAccuracy = intermediateAngularAccuracy; 14106 } 14107 protected MatchPatternAdvancedOptions(ByteBuffer backing, int offset) { 14108 super(backing, offset, 40); 14109 init(); 14110 } 14111 protected MatchPatternAdvancedOptions(long nativeObj, boolean owned) { 14112 super(nativeObj, owned, 40); 14113 init(); 14114 } 14115 protected void setBuffer(ByteBuffer backing, int offset) { 14116 super.setBuffer(backing, offset, 40); 14117 } 14118 public void read() { 14119 subpixelIterations = backing.getInt(0); 14120 subpixelTolerance = backing.getDouble(8); 14121 initialMatchListLength = backing.getInt(16); 14122 matchListReductionFactor = backing.getInt(20); 14123 initialStepSize = backing.getInt(24); 14124 searchStrategy = SearchStrategy.fromValue(backing.getInt(28)); 14125 intermediateAngularAccuracy = backing.getInt(32); 14126 } 14127 public void write() { 14128 backing.putInt(0, subpixelIterations); 14129 backing.putDouble(8, subpixelTolerance); 14130 backing.putInt(16, initialMatchListLength); 14131 backing.putInt(20, matchListReductionFactor); 14132 backing.putInt(24, initialStepSize); 14133 if (searchStrategy != null) 14134 backing.putInt(28, searchStrategy.getValue()); 14135 backing.putInt(32, intermediateAngularAccuracy); 14136 } 14137 public int size() { 14138 return 40; 14139 } 14140 } 14141 14142 public static class ParticleFilterCriteria2 extends DisposedStruct { 14143 public MeasurementType parameter; // The morphological measurement that the function uses for filtering. 14144 public float lower; // The lower bound of the criteria range. 14145 public float upper; // The upper bound of the criteria range. 14146 public int calibrated; // Set this element to TRUE to take calibrated measurements. 14147 public int exclude; // Set this element to TRUE to indicate that a match occurs when the measurement is outside the criteria range. 14148 14149 private void init() { 14150 14151 } 14152 public ParticleFilterCriteria2() { 14153 super(20); 14154 init(); 14155 } 14156 public ParticleFilterCriteria2(MeasurementType parameter, double lower, double upper, int calibrated, int exclude) { 14157 super(20); 14158 this.parameter = parameter; 14159 this.lower = (float)lower; 14160 this.upper = (float)upper; 14161 this.calibrated = calibrated; 14162 this.exclude = exclude; 14163 } 14164 protected ParticleFilterCriteria2(ByteBuffer backing, int offset) { 14165 super(backing, offset, 20); 14166 init(); 14167 } 14168 protected ParticleFilterCriteria2(long nativeObj, boolean owned) { 14169 super(nativeObj, owned, 20); 14170 init(); 14171 } 14172 protected void setBuffer(ByteBuffer backing, int offset) { 14173 super.setBuffer(backing, offset, 20); 14174 } 14175 public void read() { 14176 parameter = MeasurementType.fromValue(backing.getInt(0)); 14177 lower = backing.getFloat(4); 14178 upper = backing.getFloat(8); 14179 calibrated = backing.getInt(12); 14180 exclude = backing.getInt(16); 14181 } 14182 public void write() { 14183 if (parameter != null) 14184 backing.putInt(0, parameter.getValue()); 14185 backing.putFloat(4, lower); 14186 backing.putFloat(8, upper); 14187 backing.putInt(12, calibrated); 14188 backing.putInt(16, exclude); 14189 } 14190 public int size() { 14191 return 20; 14192 } 14193 } 14194 14195 public static class BestCircle2 extends DisposedStruct { 14196 public PointFloat center; // The coordinate location of the center of the circle. 14197 public double radius; // The radius of the circle. 14198 public double area; // The area of the circle. 14199 public double perimeter; // The length of the perimeter of the circle. 14200 public double error; // Represents the least square error of the fitted circle to the entire set of points. 14201 public int valid; // This element is TRUE if the function achieved the minimum score within the number of allowed refinement iterations and FALSE if the function did not achieve the minimum score. 14202 public int[] pointsUsed; // An array of the indexes for the points array indicating which points the function used to fit the circle. 14203 private ByteBuffer pointsUsed_buf; 14204 14205 private void init() { 14206 center = new PointFloat(backing, 0); 14207 pointsUsed = new int[0]; 14208 } 14209 public BestCircle2() { 14210 super(56); 14211 init(); 14212 } 14213 public BestCircle2(PointFloat center, double radius, double area, double perimeter, double error, int valid, int[] pointsUsed) { 14214 super(56); 14215 this.center = center; 14216 this.radius = radius; 14217 this.area = area; 14218 this.perimeter = perimeter; 14219 this.error = error; 14220 this.valid = valid; 14221 this.pointsUsed = pointsUsed; 14222 } 14223 protected BestCircle2(ByteBuffer backing, int offset) { 14224 super(backing, offset, 56); 14225 init(); 14226 } 14227 protected BestCircle2(long nativeObj, boolean owned) { 14228 super(nativeObj, owned, 56); 14229 init(); 14230 } 14231 protected void setBuffer(ByteBuffer backing, int offset) { 14232 super.setBuffer(backing, offset, 56); 14233 } 14234 public void read() { 14235 center.read(); 14236 radius = backing.getDouble(8); 14237 area = backing.getDouble(16); 14238 perimeter = backing.getDouble(24); 14239 error = backing.getDouble(32); 14240 valid = backing.getInt(40); 14241 int pointsUsed_numPointsUsed = backing.getInt(48); 14242 long pointsUsed_addr = getPointer(backing, 44); 14243 pointsUsed = new int[pointsUsed_numPointsUsed]; 14244 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 14245 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed*4).asIntBuffer().get(pointsUsed); 14246 } 14247 } 14248 public void write() { 14249 center.write(); 14250 backing.putDouble(8, radius); 14251 backing.putDouble(16, area); 14252 backing.putDouble(24, perimeter); 14253 backing.putDouble(32, error); 14254 backing.putInt(40, valid); 14255 pointsUsed_buf = ByteBuffer.allocateDirect(pointsUsed.length*4).order(ByteOrder.nativeOrder()); 14256 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 14257 backing.putInt(48, pointsUsed.length); 14258 putPointer(backing, 44, pointsUsed_buf); 14259 } 14260 public int size() { 14261 return 56; 14262 } 14263 } 14264 14265 public static class OCRSpacingOptions extends DisposedStruct { 14266 public int minCharSpacing; // The minimum number of pixels that must be between two characters for NI Vision to train or read the characters separately. 14267 public int minCharSize; // The minimum number of pixels required for an object to be a potentially identifiable character. 14268 public int maxCharSize; // The maximum number of pixels required for an object to be a potentially identifiable character. 14269 public int maxHorizontalElementSpacing; // The maximum horizontal spacing, in pixels, allowed between character elements to train or read the character elements as a single character. 14270 public int maxVerticalElementSpacing; // The maximum vertical element spacing in pixels. 14271 public int minBoundingRectWidth; // The minimum possible width, in pixels, for a character bounding rectangle. 14272 public int maxBoundingRectWidth; // The maximum possible width, in pixels, for a character bounding rectangle. 14273 public int minBoundingRectHeight; // The minimum possible height, in pixels, for a character bounding rectangle. 14274 public int maxBoundingRectHeight; // The maximum possible height, in pixels, for a character bounding rectangle. 14275 public int autoSplit; // Set this element to TRUE to automatically adjust the location of the character bounding rectangle when characters overlap vertically. 14276 14277 private void init() { 14278 14279 } 14280 public OCRSpacingOptions() { 14281 super(40); 14282 init(); 14283 } 14284 public OCRSpacingOptions(int minCharSpacing, int minCharSize, int maxCharSize, int maxHorizontalElementSpacing, int maxVerticalElementSpacing, int minBoundingRectWidth, int maxBoundingRectWidth, int minBoundingRectHeight, int maxBoundingRectHeight, int autoSplit) { 14285 super(40); 14286 this.minCharSpacing = minCharSpacing; 14287 this.minCharSize = minCharSize; 14288 this.maxCharSize = maxCharSize; 14289 this.maxHorizontalElementSpacing = maxHorizontalElementSpacing; 14290 this.maxVerticalElementSpacing = maxVerticalElementSpacing; 14291 this.minBoundingRectWidth = minBoundingRectWidth; 14292 this.maxBoundingRectWidth = maxBoundingRectWidth; 14293 this.minBoundingRectHeight = minBoundingRectHeight; 14294 this.maxBoundingRectHeight = maxBoundingRectHeight; 14295 this.autoSplit = autoSplit; 14296 } 14297 protected OCRSpacingOptions(ByteBuffer backing, int offset) { 14298 super(backing, offset, 40); 14299 init(); 14300 } 14301 protected OCRSpacingOptions(long nativeObj, boolean owned) { 14302 super(nativeObj, owned, 40); 14303 init(); 14304 } 14305 protected void setBuffer(ByteBuffer backing, int offset) { 14306 super.setBuffer(backing, offset, 40); 14307 } 14308 public void read() { 14309 minCharSpacing = backing.getInt(0); 14310 minCharSize = backing.getInt(4); 14311 maxCharSize = backing.getInt(8); 14312 maxHorizontalElementSpacing = backing.getInt(12); 14313 maxVerticalElementSpacing = backing.getInt(16); 14314 minBoundingRectWidth = backing.getInt(20); 14315 maxBoundingRectWidth = backing.getInt(24); 14316 minBoundingRectHeight = backing.getInt(28); 14317 maxBoundingRectHeight = backing.getInt(32); 14318 autoSplit = backing.getInt(36); 14319 } 14320 public void write() { 14321 backing.putInt(0, minCharSpacing); 14322 backing.putInt(4, minCharSize); 14323 backing.putInt(8, maxCharSize); 14324 backing.putInt(12, maxHorizontalElementSpacing); 14325 backing.putInt(16, maxVerticalElementSpacing); 14326 backing.putInt(20, minBoundingRectWidth); 14327 backing.putInt(24, maxBoundingRectWidth); 14328 backing.putInt(28, minBoundingRectHeight); 14329 backing.putInt(32, maxBoundingRectHeight); 14330 backing.putInt(36, autoSplit); 14331 } 14332 public int size() { 14333 return 40; 14334 } 14335 } 14336 14337 public static class OCRProcessingOptions extends DisposedStruct { 14338 public ThresholdMode mode; // The thresholding mode. 14339 public int lowThreshold; // The low threshold value when you set mode to IMAQ_FIXED_RANGE. 14340 public int highThreshold; // The high threshold value when you set mode to IMAQ_FIXED_RANGE. 14341 public int blockCount; // The number of blocks for threshold calculation algorithms that require blocks. 14342 public int fastThreshold; // Set this element to TRUE to use a faster, less accurate threshold calculation algorithm. 14343 public int biModalCalculation; // Set this element to TRUE to calculate both the low and high threshold values when using the fast thresholding method. 14344 public int darkCharacters; // Set this element to TRUE to read or train dark characters on a light background. 14345 public int removeParticlesTouchingROI; // Set this element to TRUE to remove the particles touching the ROI. 14346 public int erosionCount; // The number of erosions to perform. 14347 14348 private void init() { 14349 14350 } 14351 public OCRProcessingOptions() { 14352 super(36); 14353 init(); 14354 } 14355 public OCRProcessingOptions(ThresholdMode mode, int lowThreshold, int highThreshold, int blockCount, int fastThreshold, int biModalCalculation, int darkCharacters, int removeParticlesTouchingROI, int erosionCount) { 14356 super(36); 14357 this.mode = mode; 14358 this.lowThreshold = lowThreshold; 14359 this.highThreshold = highThreshold; 14360 this.blockCount = blockCount; 14361 this.fastThreshold = fastThreshold; 14362 this.biModalCalculation = biModalCalculation; 14363 this.darkCharacters = darkCharacters; 14364 this.removeParticlesTouchingROI = removeParticlesTouchingROI; 14365 this.erosionCount = erosionCount; 14366 } 14367 protected OCRProcessingOptions(ByteBuffer backing, int offset) { 14368 super(backing, offset, 36); 14369 init(); 14370 } 14371 protected OCRProcessingOptions(long nativeObj, boolean owned) { 14372 super(nativeObj, owned, 36); 14373 init(); 14374 } 14375 protected void setBuffer(ByteBuffer backing, int offset) { 14376 super.setBuffer(backing, offset, 36); 14377 } 14378 public void read() { 14379 mode = ThresholdMode.fromValue(backing.getInt(0)); 14380 lowThreshold = backing.getInt(4); 14381 highThreshold = backing.getInt(8); 14382 blockCount = backing.getInt(12); 14383 fastThreshold = backing.getInt(16); 14384 biModalCalculation = backing.getInt(20); 14385 darkCharacters = backing.getInt(24); 14386 removeParticlesTouchingROI = backing.getInt(28); 14387 erosionCount = backing.getInt(32); 14388 } 14389 public void write() { 14390 if (mode != null) 14391 backing.putInt(0, mode.getValue()); 14392 backing.putInt(4, lowThreshold); 14393 backing.putInt(8, highThreshold); 14394 backing.putInt(12, blockCount); 14395 backing.putInt(16, fastThreshold); 14396 backing.putInt(20, biModalCalculation); 14397 backing.putInt(24, darkCharacters); 14398 backing.putInt(28, removeParticlesTouchingROI); 14399 backing.putInt(32, erosionCount); 14400 } 14401 public int size() { 14402 return 36; 14403 } 14404 } 14405 14406 public static class ReadTextOptions extends DisposedStruct { 14407 public String[] validChars; // An array of strings that specifies the valid characters. 14408 public byte substitutionChar; // The character to substitute for objects that the function cannot match with any of the trained characters. 14409 public ReadStrategy readStrategy; // The read strategy, which determines how closely the function analyzes images in the reading process to match objects with trained characters. 14410 public int acceptanceLevel; // The minimum acceptance level at which an object is considered a trained character. 14411 public int aspectRatio; // The maximum aspect ratio variance percentage for valid characters. 14412 public ReadResolution readResolution; // The read resolution, which determines how much of the trained character data the function uses to match objects to trained characters. 14413 private ByteBuffer validChars_buf; 14414 private ByteBuffer[] validChars_bufs; 14415 14416 private void init() { 14417 validChars = new String[0]; 14418 } 14419 public ReadTextOptions() { 14420 super(65304); 14421 init(); 14422 } 14423 public ReadTextOptions(String[] validChars, byte substitutionChar, ReadStrategy readStrategy, int acceptanceLevel, int aspectRatio, ReadResolution readResolution) { 14424 super(65304); 14425 this.validChars = validChars; 14426 this.substitutionChar = substitutionChar; 14427 this.readStrategy = readStrategy; 14428 this.acceptanceLevel = acceptanceLevel; 14429 this.aspectRatio = aspectRatio; 14430 this.readResolution = readResolution; 14431 } 14432 protected ReadTextOptions(ByteBuffer backing, int offset) { 14433 super(backing, offset, 65304); 14434 init(); 14435 } 14436 protected ReadTextOptions(long nativeObj, boolean owned) { 14437 super(nativeObj, owned, 65304); 14438 init(); 14439 } 14440 protected void setBuffer(ByteBuffer backing, int offset) { 14441 super.setBuffer(backing, offset, 65304); 14442 } 14443 public void read() { 14444 int validChars_numValidChars = backing.getInt(65280); 14445 long validChars_addr = getPointer(backing, 0); 14446 validChars = new String[validChars_numValidChars]; 14447 if (validChars_numValidChars > 0 && validChars_addr != 0) { 14448 ByteBuffer bb = newDirectByteBuffer(validChars_addr, validChars_numValidChars*4); 14449 for (int i=0, off=0; i<validChars_numValidChars; i++, off += 4) { 14450 long addr = getPointer(bb, off); 14451 if (addr == 0) 14452 validChars[i] = null; 14453 else { 14454 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 14455 while (bb2.get() != 0) {} 14456 byte[] bytes = new byte[bb2.position()-1]; 14457 bb2.rewind(); 14458 getBytes(bb2, bytes, 0, bytes.length); 14459 try { 14460 validChars[i] = new String(bytes, "UTF-8"); 14461 } catch (UnsupportedEncodingException e) { 14462 validChars[i] = ""; 14463 } 14464 } 14465 } 14466 } 14467 substitutionChar = backing.get(65284); 14468 readStrategy = ReadStrategy.fromValue(backing.getInt(65288)); 14469 acceptanceLevel = backing.getInt(65292); 14470 aspectRatio = backing.getInt(65296); 14471 readResolution = ReadResolution.fromValue(backing.getInt(65300)); 14472 } 14473 public void write() { 14474 validChars_buf = ByteBuffer.allocateDirect(validChars.length*4).order(ByteOrder.nativeOrder()); 14475 for (int i=0, off=0; i<validChars.length; i++, off += 4) { 14476 if (validChars[i] == null) 14477 putPointer(validChars_buf, off, 0); 14478 else { 14479 byte[] bytes; 14480 try { 14481 bytes = validChars[i].getBytes("UTF-8"); 14482 } catch (UnsupportedEncodingException e) { 14483 bytes = new byte[0]; 14484 } 14485 validChars_bufs[i] = ByteBuffer.allocateDirect(bytes.length+1); 14486 putBytes(validChars_bufs[i], bytes, 0, bytes.length).put(bytes.length, (byte)0); 14487 putPointer(validChars_buf, off, getByteBufferAddress(validChars_bufs[i])); 14488 } 14489 } 14490 backing.putInt(65280, validChars.length); 14491 putPointer(backing, 0, validChars_buf); 14492 backing.put(65284, substitutionChar); 14493 if (readStrategy != null) 14494 backing.putInt(65288, readStrategy.getValue()); 14495 backing.putInt(65292, acceptanceLevel); 14496 backing.putInt(65296, aspectRatio); 14497 if (readResolution != null) 14498 backing.putInt(65300, readResolution.getValue()); 14499 } 14500 public int size() { 14501 return 65304; 14502 } 14503 } 14504 14505 public static class CharInfo extends DisposedStruct { 14506 public String charValue; // Retrieves the character value of the corresponding character in the character set. 14507 public Image charImage; // The image you used to train this character. 14508 public Image internalImage; // The internal representation that NI Vision uses to match objects to this character. 14509 private ByteBuffer charValue_buf; 14510 14511 private void init() { 14512 14513 } 14514 public CharInfo() { 14515 super(12); 14516 init(); 14517 } 14518 public CharInfo(String charValue, Image charImage, Image internalImage) { 14519 super(12); 14520 this.charValue = charValue; 14521 this.charImage = charImage; 14522 this.internalImage = internalImage; 14523 } 14524 protected CharInfo(ByteBuffer backing, int offset) { 14525 super(backing, offset, 12); 14526 init(); 14527 } 14528 protected CharInfo(long nativeObj, boolean owned) { 14529 super(nativeObj, owned, 12); 14530 init(); 14531 } 14532 protected void setBuffer(ByteBuffer backing, int offset) { 14533 super.setBuffer(backing, offset, 12); 14534 } 14535 public void read() { 14536 long charValue_addr = getPointer(backing, 0); 14537 if (charValue_addr == 0) 14538 charValue = null; 14539 else { 14540 ByteBuffer bb = newDirectByteBuffer(charValue_addr, 1000); // FIXME 14541 while (bb.get() != 0) {} 14542 byte[] bytes = new byte[bb.position()-1]; 14543 getBytes(bb, bytes, 0, bytes.length); 14544 try { 14545 charValue = new String(bytes, "UTF-8"); 14546 } catch (UnsupportedEncodingException e) { 14547 charValue = ""; 14548 } 14549 } 14550 14551 long charImage_addr = getPointer(backing, 4); 14552 if (charImage_addr == 0) 14553 charImage = null; 14554 else 14555 charImage = new Image(charImage_addr, false); 14556 long internalImage_addr = getPointer(backing, 8); 14557 if (internalImage_addr == 0) 14558 internalImage = null; 14559 else 14560 internalImage = new Image(internalImage_addr, false); 14561 } 14562 public void write() { 14563 if (charValue != null) { 14564 byte[] charValue_bytes; 14565 try { 14566 charValue_bytes = charValue.getBytes("UTF-8"); 14567 } catch (UnsupportedEncodingException e) { 14568 charValue_bytes = new byte[0]; 14569 } 14570 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length+1); 14571 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put(charValue_bytes.length, (byte)0); 14572 } 14573 putPointer(backing, 0, charValue == null ? 0 : getByteBufferAddress(charValue_buf)); 14574 putPointer(backing, 4, charImage); 14575 putPointer(backing, 8, internalImage); 14576 } 14577 public int size() { 14578 return 12; 14579 } 14580 } 14581 14582 public static class Rect extends DisposedStruct { 14583 public int top; // Location of the top edge of the rectangle. 14584 public int left; // Location of the left edge of the rectangle. 14585 public int height; // Height of the rectangle. 14586 public int width; // Width of the rectangle. 14587 14588 private void init() { 14589 14590 } 14591 public Rect() { 14592 super(16); 14593 init(); 14594 } 14595 public Rect(int top, int left, int height, int width) { 14596 super(16); 14597 this.top = top; 14598 this.left = left; 14599 this.height = height; 14600 this.width = width; 14601 } 14602 protected Rect(ByteBuffer backing, int offset) { 14603 super(backing, offset, 16); 14604 init(); 14605 } 14606 protected Rect(long nativeObj, boolean owned) { 14607 super(nativeObj, owned, 16); 14608 init(); 14609 } 14610 protected void setBuffer(ByteBuffer backing, int offset) { 14611 super.setBuffer(backing, offset, 16); 14612 } 14613 public void read() { 14614 top = backing.getInt(0); 14615 left = backing.getInt(4); 14616 height = backing.getInt(8); 14617 width = backing.getInt(12); 14618 } 14619 public void write() { 14620 backing.putInt(0, top); 14621 backing.putInt(4, left); 14622 backing.putInt(8, height); 14623 backing.putInt(12, width); 14624 } 14625 public int size() { 14626 return 16; 14627 } 14628 } 14629 14630 public static class CharReport extends DisposedStruct { 14631 public String character; // The character value. 14632 public PointFloat[] corner; // An array of four points that describes the rectangle that surrounds the character. 14633 public int reserved; // This element is reserved. 14634 public int lowThreshold; // The minimum value of the threshold range used for this character. 14635 public int highThreshold; // The maximum value of the threshold range used for this character. 14636 private ByteBuffer character_buf; 14637 14638 private void init() { 14639 corner = new PointFloat[4]; 14640 14641 for (int i=0, off=4; i<4; i++, off += 8) 14642 corner[i] = new PointFloat(backing, off); 14643 } 14644 public CharReport() { 14645 super(48); 14646 init(); 14647 } 14648 public CharReport(String character, PointFloat[] corner, int reserved, int lowThreshold, int highThreshold) { 14649 super(48); 14650 this.character = character; 14651 this.corner = corner; 14652 this.reserved = reserved; 14653 this.lowThreshold = lowThreshold; 14654 this.highThreshold = highThreshold; 14655 } 14656 protected CharReport(ByteBuffer backing, int offset) { 14657 super(backing, offset, 48); 14658 init(); 14659 } 14660 protected CharReport(long nativeObj, boolean owned) { 14661 super(nativeObj, owned, 48); 14662 init(); 14663 } 14664 protected void setBuffer(ByteBuffer backing, int offset) { 14665 super.setBuffer(backing, offset, 48); 14666 } 14667 public void read() { 14668 long character_addr = getPointer(backing, 0); 14669 if (character_addr == 0) 14670 character = null; 14671 else { 14672 ByteBuffer bb = newDirectByteBuffer(character_addr, 1000); // FIXME 14673 while (bb.get() != 0) {} 14674 byte[] bytes = new byte[bb.position()-1]; 14675 getBytes(bb, bytes, 0, bytes.length); 14676 try { 14677 character = new String(bytes, "UTF-8"); 14678 } catch (UnsupportedEncodingException e) { 14679 character = ""; 14680 } 14681 } 14682 14683 for (PointFloat it : corner) { 14684 it.read(); 14685 } 14686 reserved = backing.getInt(36); 14687 lowThreshold = backing.getInt(40); 14688 highThreshold = backing.getInt(44); 14689 } 14690 public void write() { 14691 if (character != null) { 14692 byte[] character_bytes; 14693 try { 14694 character_bytes = character.getBytes("UTF-8"); 14695 } catch (UnsupportedEncodingException e) { 14696 character_bytes = new byte[0]; 14697 } 14698 character_buf = ByteBuffer.allocateDirect(character_bytes.length+1); 14699 putBytes(character_buf, character_bytes, 0, character_bytes.length).put(character_bytes.length, (byte)0); 14700 } 14701 putPointer(backing, 0, character == null ? 0 : getByteBufferAddress(character_buf)); 14702 for (PointFloat it : corner) { 14703 it.write(); 14704 } 14705 backing.putInt(36, reserved); 14706 backing.putInt(40, lowThreshold); 14707 backing.putInt(44, highThreshold); 14708 } 14709 public int size() { 14710 return 48; 14711 } 14712 } 14713 14714 public static class ReadTextReport extends DisposedStruct { 14715 public String readString; // The read string. 14716 public CharReport[] characterReport; // An array of reports describing the properties of each identified character. 14717 private ByteBuffer readString_buf; 14718 private ByteBuffer characterReport_buf; 14719 14720 private void init() { 14721 characterReport = new CharReport[0]; 14722 } 14723 public ReadTextReport() { 14724 super(12); 14725 init(); 14726 } 14727 public ReadTextReport(String readString, CharReport[] characterReport) { 14728 super(12); 14729 this.readString = readString; 14730 this.characterReport = characterReport; 14731 } 14732 protected ReadTextReport(ByteBuffer backing, int offset) { 14733 super(backing, offset, 12); 14734 init(); 14735 } 14736 protected ReadTextReport(long nativeObj, boolean owned) { 14737 super(nativeObj, owned, 12); 14738 init(); 14739 } 14740 protected void setBuffer(ByteBuffer backing, int offset) { 14741 super.setBuffer(backing, offset, 12); 14742 } 14743 public void read() { 14744 long readString_addr = getPointer(backing, 0); 14745 if (readString_addr == 0) 14746 readString = null; 14747 else { 14748 ByteBuffer bb = newDirectByteBuffer(readString_addr, 1000); // FIXME 14749 while (bb.get() != 0) {} 14750 byte[] bytes = new byte[bb.position()-1]; 14751 getBytes(bb, bytes, 0, bytes.length); 14752 try { 14753 readString = new String(bytes, "UTF-8"); 14754 } catch (UnsupportedEncodingException e) { 14755 readString = ""; 14756 } 14757 } 14758 14759 int characterReport_numCharacterReports = backing.getInt(8); 14760 long characterReport_addr = getPointer(backing, 4); 14761 characterReport = new CharReport[characterReport_numCharacterReports]; 14762 if (characterReport_numCharacterReports > 0 && characterReport_addr != 0) { 14763 ByteBuffer bb = newDirectByteBuffer(characterReport_addr, characterReport_numCharacterReports*48); 14764 for (int i=0, off=0; i<characterReport_numCharacterReports; i++, off += 48) { 14765 characterReport[i] = new CharReport(bb, off); 14766 characterReport[i].read(); 14767 } 14768 } 14769 } 14770 public void write() { 14771 if (readString != null) { 14772 byte[] readString_bytes; 14773 try { 14774 readString_bytes = readString.getBytes("UTF-8"); 14775 } catch (UnsupportedEncodingException e) { 14776 readString_bytes = new byte[0]; 14777 } 14778 readString_buf = ByteBuffer.allocateDirect(readString_bytes.length+1); 14779 putBytes(readString_buf, readString_bytes, 0, readString_bytes.length).put(readString_bytes.length, (byte)0); 14780 } 14781 putPointer(backing, 0, readString == null ? 0 : getByteBufferAddress(readString_buf)); 14782 characterReport_buf = ByteBuffer.allocateDirect(characterReport.length*48).order(ByteOrder.nativeOrder()); 14783 for (int i=0, off=0; i<characterReport.length; i++, off += 48) { 14784 characterReport[i].setBuffer(characterReport_buf, off); 14785 characterReport[i].write(); 14786 } 14787 backing.putInt(8, characterReport.length); 14788 putPointer(backing, 4, characterReport_buf); 14789 } 14790 public int size() { 14791 return 12; 14792 } 14793 } 14794 14795 public static class Point extends DisposedStruct { 14796 public int x; // The x-coordinate of the point. 14797 public int y; // The y-coordinate of the point. 14798 14799 private void init() { 14800 14801 } 14802 public Point() { 14803 super(8); 14804 init(); 14805 } 14806 public Point(int x, int y) { 14807 super(8); 14808 this.x = x; 14809 this.y = y; 14810 } 14811 protected Point(ByteBuffer backing, int offset) { 14812 super(backing, offset, 8); 14813 init(); 14814 } 14815 protected Point(long nativeObj, boolean owned) { 14816 super(nativeObj, owned, 8); 14817 init(); 14818 } 14819 protected void setBuffer(ByteBuffer backing, int offset) { 14820 super.setBuffer(backing, offset, 8); 14821 } 14822 public void read() { 14823 x = backing.getInt(0); 14824 y = backing.getInt(4); 14825 } 14826 public void write() { 14827 backing.putInt(0, x); 14828 backing.putInt(4, y); 14829 } 14830 public int size() { 14831 return 8; 14832 } 14833 } 14834 14835 public static class Annulus extends DisposedStruct { 14836 public Point center; // The coordinate location of the center of the annulus. 14837 public int innerRadius; // The internal radius of the annulus. 14838 public int outerRadius; // The external radius of the annulus. 14839 public double startAngle; // The start angle, in degrees, of the annulus. 14840 public double endAngle; // The end angle, in degrees, of the annulus. 14841 14842 private void init() { 14843 center = new Point(backing, 0); 14844 } 14845 public Annulus() { 14846 super(32); 14847 init(); 14848 } 14849 public Annulus(Point center, int innerRadius, int outerRadius, double startAngle, double endAngle) { 14850 super(32); 14851 this.center = center; 14852 this.innerRadius = innerRadius; 14853 this.outerRadius = outerRadius; 14854 this.startAngle = startAngle; 14855 this.endAngle = endAngle; 14856 } 14857 protected Annulus(ByteBuffer backing, int offset) { 14858 super(backing, offset, 32); 14859 init(); 14860 } 14861 protected Annulus(long nativeObj, boolean owned) { 14862 super(nativeObj, owned, 32); 14863 init(); 14864 } 14865 protected void setBuffer(ByteBuffer backing, int offset) { 14866 super.setBuffer(backing, offset, 32); 14867 } 14868 public void read() { 14869 center.read(); 14870 innerRadius = backing.getInt(8); 14871 outerRadius = backing.getInt(12); 14872 startAngle = backing.getDouble(16); 14873 endAngle = backing.getDouble(24); 14874 } 14875 public void write() { 14876 center.write(); 14877 backing.putInt(8, innerRadius); 14878 backing.putInt(12, outerRadius); 14879 backing.putDouble(16, startAngle); 14880 backing.putDouble(24, endAngle); 14881 } 14882 public int size() { 14883 return 32; 14884 } 14885 } 14886 14887 public static class EdgeLocationReport extends DisposedStruct { 14888 public PointFloat[] edges; // The coordinate location of all edges detected by the search line. 14889 private ByteBuffer edges_buf; 14890 14891 private void init() { 14892 edges = new PointFloat[0]; 14893 } 14894 public EdgeLocationReport() { 14895 super(8); 14896 init(); 14897 } 14898 public EdgeLocationReport(PointFloat[] edges) { 14899 super(8); 14900 this.edges = edges; 14901 } 14902 protected EdgeLocationReport(ByteBuffer backing, int offset) { 14903 super(backing, offset, 8); 14904 init(); 14905 } 14906 protected EdgeLocationReport(long nativeObj, boolean owned) { 14907 super(nativeObj, owned, 8); 14908 init(); 14909 } 14910 protected void setBuffer(ByteBuffer backing, int offset) { 14911 super.setBuffer(backing, offset, 8); 14912 } 14913 public void read() { 14914 int edges_numEdges = backing.getInt(4); 14915 long edges_addr = getPointer(backing, 0); 14916 edges = new PointFloat[edges_numEdges]; 14917 if (edges_numEdges > 0 && edges_addr != 0) { 14918 ByteBuffer bb = newDirectByteBuffer(edges_addr, edges_numEdges*8); 14919 for (int i=0, off=0; i<edges_numEdges; i++, off += 8) { 14920 edges[i] = new PointFloat(bb, off); 14921 edges[i].read(); 14922 } 14923 } 14924 } 14925 public void write() { 14926 edges_buf = ByteBuffer.allocateDirect(edges.length*8).order(ByteOrder.nativeOrder()); 14927 for (int i=0, off=0; i<edges.length; i++, off += 8) { 14928 edges[i].setBuffer(edges_buf, off); 14929 edges[i].write(); 14930 } 14931 backing.putInt(4, edges.length); 14932 putPointer(backing, 0, edges_buf); 14933 } 14934 public int size() { 14935 return 8; 14936 } 14937 } 14938 14939 public static class EdgeOptions extends DisposedStruct { 14940 public int threshold; // Specifies the threshold value for the contrast of the edge. 14941 public int width; // The number of pixels that the function averages to find the contrast at either side of the edge. 14942 public int steepness; // The span, in pixels, of the slope of the edge projected along the path specified by the input points. 14943 public InterpolationMethod subpixelType; // The method for interpolating. 14944 public int subpixelDivisions; // The number of samples the function obtains from a pixel. 14945 14946 private void init() { 14947 14948 } 14949 public EdgeOptions() { 14950 super(20); 14951 init(); 14952 } 14953 public EdgeOptions(int threshold, int width, int steepness, InterpolationMethod subpixelType, int subpixelDivisions) { 14954 super(20); 14955 this.threshold = threshold; 14956 this.width = width; 14957 this.steepness = steepness; 14958 this.subpixelType = subpixelType; 14959 this.subpixelDivisions = subpixelDivisions; 14960 } 14961 protected EdgeOptions(ByteBuffer backing, int offset) { 14962 super(backing, offset, 20); 14963 init(); 14964 } 14965 protected EdgeOptions(long nativeObj, boolean owned) { 14966 super(nativeObj, owned, 20); 14967 init(); 14968 } 14969 protected void setBuffer(ByteBuffer backing, int offset) { 14970 super.setBuffer(backing, offset, 20); 14971 } 14972 public void read() { 14973 threshold = backing.getInt(0); 14974 width = backing.getInt(4); 14975 steepness = backing.getInt(8); 14976 subpixelType = InterpolationMethod.fromValue(backing.getInt(12)); 14977 subpixelDivisions = backing.getInt(16); 14978 } 14979 public void write() { 14980 backing.putInt(0, threshold); 14981 backing.putInt(4, width); 14982 backing.putInt(8, steepness); 14983 if (subpixelType != null) 14984 backing.putInt(12, subpixelType.getValue()); 14985 backing.putInt(16, subpixelDivisions); 14986 } 14987 public int size() { 14988 return 20; 14989 } 14990 } 14991 14992 public static class EdgeReport extends DisposedStruct { 14993 public float location; // The location of the edge from the first point in the points array. 14994 public float contrast; // The contrast at the edge. 14995 public PolarityType polarity; // The polarity of the edge. 14996 public float reserved; // This element is reserved. 14997 public PointFloat coordinate; // The coordinates of the edge. 14998 14999 private void init() { 15000 coordinate = new PointFloat(backing, 20); 15001 } 15002 public EdgeReport() { 15003 super(32); 15004 init(); 15005 } 15006 public EdgeReport(double location, double contrast, PolarityType polarity, double reserved, PointFloat coordinate) { 15007 super(32); 15008 this.location = (float)location; 15009 this.contrast = (float)contrast; 15010 this.polarity = polarity; 15011 this.reserved = (float)reserved; 15012 this.coordinate = coordinate; 15013 } 15014 protected EdgeReport(ByteBuffer backing, int offset) { 15015 super(backing, offset, 32); 15016 init(); 15017 } 15018 protected EdgeReport(long nativeObj, boolean owned) { 15019 super(nativeObj, owned, 32); 15020 init(); 15021 } 15022 protected void setBuffer(ByteBuffer backing, int offset) { 15023 super.setBuffer(backing, offset, 32); 15024 } 15025 public void read() { 15026 location = backing.getFloat(0); 15027 contrast = backing.getFloat(4); 15028 polarity = PolarityType.fromValue(backing.getInt(8)); 15029 reserved = backing.getFloat(16); 15030 coordinate.read(); 15031 } 15032 public void write() { 15033 backing.putFloat(0, location); 15034 backing.putFloat(4, contrast); 15035 if (polarity != null) 15036 backing.putInt(8, polarity.getValue()); 15037 backing.putFloat(16, reserved); 15038 coordinate.write(); 15039 } 15040 public int size() { 15041 return 32; 15042 } 15043 } 15044 15045 public static class ExtremeReport extends DisposedStruct { 15046 public double location; // The locations of the extreme. 15047 public double amplitude; // The amplitude of the extreme. 15048 public double secondDerivative; // The second derivative of the extreme. 15049 15050 private void init() { 15051 15052 } 15053 public ExtremeReport() { 15054 super(24); 15055 init(); 15056 } 15057 public ExtremeReport(double location, double amplitude, double secondDerivative) { 15058 super(24); 15059 this.location = location; 15060 this.amplitude = amplitude; 15061 this.secondDerivative = secondDerivative; 15062 } 15063 protected ExtremeReport(ByteBuffer backing, int offset) { 15064 super(backing, offset, 24); 15065 init(); 15066 } 15067 protected ExtremeReport(long nativeObj, boolean owned) { 15068 super(nativeObj, owned, 24); 15069 init(); 15070 } 15071 protected void setBuffer(ByteBuffer backing, int offset) { 15072 super.setBuffer(backing, offset, 24); 15073 } 15074 public void read() { 15075 location = backing.getDouble(0); 15076 amplitude = backing.getDouble(8); 15077 secondDerivative = backing.getDouble(16); 15078 } 15079 public void write() { 15080 backing.putDouble(0, location); 15081 backing.putDouble(8, amplitude); 15082 backing.putDouble(16, secondDerivative); 15083 } 15084 public int size() { 15085 return 24; 15086 } 15087 } 15088 15089 public static class FitLineOptions extends DisposedStruct { 15090 public float minScore; // Specifies the required quality of the fitted line. 15091 public float pixelRadius; // Specifies the neighborhood pixel relationship for the initial subset of points being used. 15092 public int numRefinements; // Specifies the number of refinement iterations you allow the function to perform on the initial subset of points. 15093 15094 private void init() { 15095 15096 } 15097 public FitLineOptions() { 15098 super(12); 15099 init(); 15100 } 15101 public FitLineOptions(double minScore, double pixelRadius, int numRefinements) { 15102 super(12); 15103 this.minScore = (float)minScore; 15104 this.pixelRadius = (float)pixelRadius; 15105 this.numRefinements = numRefinements; 15106 } 15107 protected FitLineOptions(ByteBuffer backing, int offset) { 15108 super(backing, offset, 12); 15109 init(); 15110 } 15111 protected FitLineOptions(long nativeObj, boolean owned) { 15112 super(nativeObj, owned, 12); 15113 init(); 15114 } 15115 protected void setBuffer(ByteBuffer backing, int offset) { 15116 super.setBuffer(backing, offset, 12); 15117 } 15118 public void read() { 15119 minScore = backing.getFloat(0); 15120 pixelRadius = backing.getFloat(4); 15121 numRefinements = backing.getInt(8); 15122 } 15123 public void write() { 15124 backing.putFloat(0, minScore); 15125 backing.putFloat(4, pixelRadius); 15126 backing.putInt(8, numRefinements); 15127 } 15128 public int size() { 15129 return 12; 15130 } 15131 } 15132 15133 public static class DisplayMapping extends DisposedStruct { 15134 public MappingMethod method; // Describes the method for converting 16-bit pixels to 8-bit pixels. 15135 public int minimumValue; // When method is IMAQ_RANGE, minimumValue represents the value that is mapped to 0. 15136 public int maximumValue; // When method is IMAQ_RANGE, maximumValue represents the value that is mapped to 255. 15137 public int shiftCount; // When method is IMAQ_DOWNSHIFT, shiftCount represents the number of bits the function right-shifts the 16-bit pixel values. 15138 15139 private void init() { 15140 15141 } 15142 public DisplayMapping() { 15143 super(16); 15144 init(); 15145 } 15146 public DisplayMapping(MappingMethod method, int minimumValue, int maximumValue, int shiftCount) { 15147 super(16); 15148 this.method = method; 15149 this.minimumValue = minimumValue; 15150 this.maximumValue = maximumValue; 15151 this.shiftCount = shiftCount; 15152 } 15153 protected DisplayMapping(ByteBuffer backing, int offset) { 15154 super(backing, offset, 16); 15155 init(); 15156 } 15157 protected DisplayMapping(long nativeObj, boolean owned) { 15158 super(nativeObj, owned, 16); 15159 init(); 15160 } 15161 protected void setBuffer(ByteBuffer backing, int offset) { 15162 super.setBuffer(backing, offset, 16); 15163 } 15164 public void read() { 15165 method = MappingMethod.fromValue(backing.getInt(0)); 15166 minimumValue = backing.getInt(4); 15167 maximumValue = backing.getInt(8); 15168 shiftCount = backing.getInt(12); 15169 } 15170 public void write() { 15171 if (method != null) 15172 backing.putInt(0, method.getValue()); 15173 backing.putInt(4, minimumValue); 15174 backing.putInt(8, maximumValue); 15175 backing.putInt(12, shiftCount); 15176 } 15177 public int size() { 15178 return 16; 15179 } 15180 } 15181 15182 public static class DetectExtremesOptions extends DisposedStruct { 15183 public double threshold; // Defines which extremes are too small. 15184 public int width; // Specifies the number of consecutive data points the function uses in the quadratic least-squares fit. 15185 15186 private void init() { 15187 15188 } 15189 public DetectExtremesOptions() { 15190 super(16); 15191 init(); 15192 } 15193 public DetectExtremesOptions(double threshold, int width) { 15194 super(16); 15195 this.threshold = threshold; 15196 this.width = width; 15197 } 15198 protected DetectExtremesOptions(ByteBuffer backing, int offset) { 15199 super(backing, offset, 16); 15200 init(); 15201 } 15202 protected DetectExtremesOptions(long nativeObj, boolean owned) { 15203 super(nativeObj, owned, 16); 15204 init(); 15205 } 15206 protected void setBuffer(ByteBuffer backing, int offset) { 15207 super.setBuffer(backing, offset, 16); 15208 } 15209 public void read() { 15210 threshold = backing.getDouble(0); 15211 width = backing.getInt(8); 15212 } 15213 public void write() { 15214 backing.putDouble(0, threshold); 15215 backing.putInt(8, width); 15216 } 15217 public int size() { 15218 return 16; 15219 } 15220 } 15221 15222 public static class ImageInfo extends DisposedStruct { 15223 public CalibrationUnit imageUnit; // If you set calibration information with imaqSetSimpleCalibrationInfo(), imageUnit is the calibration unit. 15224 public float stepX; // If you set calibration information with imaqSetCalibrationInfo(), stepX is the distance in the calibration unit between two pixels in the x direction. 15225 public float stepY; // If you set calibration information with imaqSetCalibrationInfo(), stepY is the distance in the calibration unit between two pixels in the y direction. 15226 public ImageType imageType; // The type of the image. 15227 public int xRes; // The number of columns in the image. 15228 public int yRes; // The number of rows in the image. 15229 public int xOffset; // If you set mask offset information with imaqSetMaskOffset(), xOffset is the offset of the mask origin in the x direction. 15230 public int yOffset; // If you set mask offset information with imaqSetMaskOffset(), yOffset is the offset of the mask origin in the y direction. 15231 public int border; // The number of border pixels around the image. 15232 public int pixelsPerLine; // The number of pixels stored for each line of the image. 15233 15234 private void init() { 15235 15236 } 15237 public ImageInfo() { 15238 super(52); 15239 init(); 15240 } 15241 public ImageInfo(CalibrationUnit imageUnit, double stepX, double stepY, ImageType imageType, int xRes, int yRes, int xOffset, int yOffset, int border, int pixelsPerLine) { 15242 super(52); 15243 this.imageUnit = imageUnit; 15244 this.stepX = (float)stepX; 15245 this.stepY = (float)stepY; 15246 this.imageType = imageType; 15247 this.xRes = xRes; 15248 this.yRes = yRes; 15249 this.xOffset = xOffset; 15250 this.yOffset = yOffset; 15251 this.border = border; 15252 this.pixelsPerLine = pixelsPerLine; 15253 } 15254 protected ImageInfo(ByteBuffer backing, int offset) { 15255 super(backing, offset, 52); 15256 init(); 15257 } 15258 protected ImageInfo(long nativeObj, boolean owned) { 15259 super(nativeObj, owned, 52); 15260 init(); 15261 } 15262 protected void setBuffer(ByteBuffer backing, int offset) { 15263 super.setBuffer(backing, offset, 52); 15264 } 15265 public void read() { 15266 imageUnit = CalibrationUnit.fromValue(backing.getInt(0)); 15267 stepX = backing.getFloat(4); 15268 stepY = backing.getFloat(8); 15269 imageType = ImageType.fromValue(backing.getInt(12)); 15270 xRes = backing.getInt(16); 15271 yRes = backing.getInt(20); 15272 xOffset = backing.getInt(24); 15273 yOffset = backing.getInt(28); 15274 border = backing.getInt(32); 15275 pixelsPerLine = backing.getInt(36); 15276 } 15277 public void write() { 15278 if (imageUnit != null) 15279 backing.putInt(0, imageUnit.getValue()); 15280 backing.putFloat(4, stepX); 15281 backing.putFloat(8, stepY); 15282 if (imageType != null) 15283 backing.putInt(12, imageType.getValue()); 15284 backing.putInt(16, xRes); 15285 backing.putInt(20, yRes); 15286 backing.putInt(24, xOffset); 15287 backing.putInt(28, yOffset); 15288 backing.putInt(32, border); 15289 backing.putInt(36, pixelsPerLine); 15290 } 15291 public int size() { 15292 return 52; 15293 } 15294 } 15295 15296 public static class LCDOptions extends DisposedStruct { 15297 public int litSegments; // Set this parameter to TRUE if the segments are brighter than the background. 15298 public float threshold; // Determines whether a segment is ON or OFF. 15299 public int sign; // Indicates whether the function must read the sign of the indicator. 15300 public int decimalPoint; // Determines whether to look for a decimal separator after each digit. 15301 15302 private void init() { 15303 15304 } 15305 public LCDOptions() { 15306 super(16); 15307 init(); 15308 } 15309 public LCDOptions(int litSegments, double threshold, int sign, int decimalPoint) { 15310 super(16); 15311 this.litSegments = litSegments; 15312 this.threshold = (float)threshold; 15313 this.sign = sign; 15314 this.decimalPoint = decimalPoint; 15315 } 15316 protected LCDOptions(ByteBuffer backing, int offset) { 15317 super(backing, offset, 16); 15318 init(); 15319 } 15320 protected LCDOptions(long nativeObj, boolean owned) { 15321 super(nativeObj, owned, 16); 15322 init(); 15323 } 15324 protected void setBuffer(ByteBuffer backing, int offset) { 15325 super.setBuffer(backing, offset, 16); 15326 } 15327 public void read() { 15328 litSegments = backing.getInt(0); 15329 threshold = backing.getFloat(4); 15330 sign = backing.getInt(8); 15331 decimalPoint = backing.getInt(12); 15332 } 15333 public void write() { 15334 backing.putInt(0, litSegments); 15335 backing.putFloat(4, threshold); 15336 backing.putInt(8, sign); 15337 backing.putInt(12, decimalPoint); 15338 } 15339 public int size() { 15340 return 16; 15341 } 15342 } 15343 15344 public static class LCDReport extends DisposedStruct { 15345 public String text; // A string of the characters of the LCD. 15346 public LCDSegments[] segmentInfo; // An array of LCDSegment structures describing which segments of each digit are on. 15347 private ByteBuffer text_buf; 15348 private ByteBuffer segmentInfo_buf; 15349 15350 private void init() { 15351 segmentInfo = new LCDSegments[0]; 15352 } 15353 public LCDReport() { 15354 super(16); 15355 init(); 15356 } 15357 public LCDReport(String text, LCDSegments[] segmentInfo) { 15358 super(16); 15359 this.text = text; 15360 this.segmentInfo = segmentInfo; 15361 } 15362 protected LCDReport(ByteBuffer backing, int offset) { 15363 super(backing, offset, 16); 15364 init(); 15365 } 15366 protected LCDReport(long nativeObj, boolean owned) { 15367 super(nativeObj, owned, 16); 15368 init(); 15369 } 15370 protected void setBuffer(ByteBuffer backing, int offset) { 15371 super.setBuffer(backing, offset, 16); 15372 } 15373 public void read() { 15374 long text_addr = getPointer(backing, 0); 15375 if (text_addr == 0) 15376 text = null; 15377 else { 15378 ByteBuffer bb = newDirectByteBuffer(text_addr, 1000); // FIXME 15379 while (bb.get() != 0) {} 15380 byte[] bytes = new byte[bb.position()-1]; 15381 getBytes(bb, bytes, 0, bytes.length); 15382 try { 15383 text = new String(bytes, "UTF-8"); 15384 } catch (UnsupportedEncodingException e) { 15385 text = ""; 15386 } 15387 } 15388 15389 int segmentInfo_numCharacters = backing.getInt(8); 15390 long segmentInfo_addr = getPointer(backing, 4); 15391 segmentInfo = new LCDSegments[segmentInfo_numCharacters]; 15392 if (segmentInfo_numCharacters > 0 && segmentInfo_addr != 0) { 15393 ByteBuffer bb = newDirectByteBuffer(segmentInfo_addr, segmentInfo_numCharacters*4); 15394 for (int i=0, off=0; i<segmentInfo_numCharacters; i++, off += 4) { 15395 segmentInfo[i] = new LCDSegments(bb, off); 15396 segmentInfo[i].read(); 15397 } 15398 } 15399 } 15400 public void write() { 15401 if (text != null) { 15402 byte[] text_bytes; 15403 try { 15404 text_bytes = text.getBytes("UTF-8"); 15405 } catch (UnsupportedEncodingException e) { 15406 text_bytes = new byte[0]; 15407 } 15408 text_buf = ByteBuffer.allocateDirect(text_bytes.length+1); 15409 putBytes(text_buf, text_bytes, 0, text_bytes.length).put(text_bytes.length, (byte)0); 15410 } 15411 putPointer(backing, 0, text == null ? 0 : getByteBufferAddress(text_buf)); 15412 segmentInfo_buf = ByteBuffer.allocateDirect(segmentInfo.length*4).order(ByteOrder.nativeOrder()); 15413 for (int i=0, off=0; i<segmentInfo.length; i++, off += 4) { 15414 segmentInfo[i].setBuffer(segmentInfo_buf, off); 15415 segmentInfo[i].write(); 15416 } 15417 backing.putInt(8, segmentInfo.length); 15418 putPointer(backing, 4, segmentInfo_buf); 15419 } 15420 public int size() { 15421 return 16; 15422 } 15423 } 15424 15425 public static class LCDSegments extends DisposedStruct { 15426 15427 15428 private void init() { 15429 15430 } 15431 public LCDSegments() { 15432 super(4); 15433 init(); 15434 } 15435 protected LCDSegments(ByteBuffer backing, int offset) { 15436 super(backing, offset, 4); 15437 init(); 15438 } 15439 protected LCDSegments(long nativeObj, boolean owned) { 15440 super(nativeObj, owned, 4); 15441 init(); 15442 } 15443 protected void setBuffer(ByteBuffer backing, int offset) { 15444 super.setBuffer(backing, offset, 4); 15445 } 15446 public void read() { 15447 15448 } 15449 public void write() { 15450 15451 } 15452 public int size() { 15453 return 4; 15454 } 15455 } 15456 15457 public static class LearnCalibrationOptions extends DisposedStruct { 15458 public CalibrationMode mode; // Specifies the type of algorithm you want to use to reduce distortion in your image. 15459 public ScalingMethod method; // Defines the scaling method correction functions use to correct the image. 15460 public CalibrationROI roi; // Specifies the ROI correction functions use when correcting an image. 15461 public int learnMap; // Set this element to TRUE if you want the function to calculate and store an error map during the learning process. 15462 public int learnTable; // Set this element to TRUE if you want the function to calculate and store the correction table. 15463 15464 private void init() { 15465 15466 } 15467 public LearnCalibrationOptions() { 15468 super(20); 15469 init(); 15470 } 15471 public LearnCalibrationOptions(CalibrationMode mode, ScalingMethod method, CalibrationROI roi, int learnMap, int learnTable) { 15472 super(20); 15473 this.mode = mode; 15474 this.method = method; 15475 this.roi = roi; 15476 this.learnMap = learnMap; 15477 this.learnTable = learnTable; 15478 } 15479 protected LearnCalibrationOptions(ByteBuffer backing, int offset) { 15480 super(backing, offset, 20); 15481 init(); 15482 } 15483 protected LearnCalibrationOptions(long nativeObj, boolean owned) { 15484 super(nativeObj, owned, 20); 15485 init(); 15486 } 15487 protected void setBuffer(ByteBuffer backing, int offset) { 15488 super.setBuffer(backing, offset, 20); 15489 } 15490 public void read() { 15491 mode = CalibrationMode.fromValue(backing.getInt(0)); 15492 method = ScalingMethod.fromValue(backing.getInt(4)); 15493 roi = CalibrationROI.fromValue(backing.getInt(8)); 15494 learnMap = backing.getInt(12); 15495 learnTable = backing.getInt(16); 15496 } 15497 public void write() { 15498 if (mode != null) 15499 backing.putInt(0, mode.getValue()); 15500 if (method != null) 15501 backing.putInt(4, method.getValue()); 15502 if (roi != null) 15503 backing.putInt(8, roi.getValue()); 15504 backing.putInt(12, learnMap); 15505 backing.putInt(16, learnTable); 15506 } 15507 public int size() { 15508 return 20; 15509 } 15510 } 15511 15512 public static class LearnColorPatternOptions extends DisposedStruct { 15513 public LearningMode learnMode; // Specifies the invariance mode the function uses when learning the pattern. 15514 public ImageFeatureMode featureMode; // Specifies the features the function uses when learning the color pattern. 15515 public int threshold; // Specifies the saturation threshold the function uses to distinguish between two colors that have the same hue values. 15516 public ColorIgnoreMode ignoreMode; // Specifies whether the function excludes certain colors from the color features of the template image. 15517 public ColorInformation[] colorsToIgnore; // An array of ColorInformation structures providing a set of colors to exclude from the color features of the template image. 15518 private ByteBuffer colorsToIgnore_buf; 15519 15520 private void init() { 15521 colorsToIgnore = new ColorInformation[0]; 15522 } 15523 public LearnColorPatternOptions() { 15524 super(24); 15525 init(); 15526 } 15527 public LearnColorPatternOptions(LearningMode learnMode, ImageFeatureMode featureMode, int threshold, ColorIgnoreMode ignoreMode, ColorInformation[] colorsToIgnore) { 15528 super(24); 15529 this.learnMode = learnMode; 15530 this.featureMode = featureMode; 15531 this.threshold = threshold; 15532 this.ignoreMode = ignoreMode; 15533 this.colorsToIgnore = colorsToIgnore; 15534 } 15535 protected LearnColorPatternOptions(ByteBuffer backing, int offset) { 15536 super(backing, offset, 24); 15537 init(); 15538 } 15539 protected LearnColorPatternOptions(long nativeObj, boolean owned) { 15540 super(nativeObj, owned, 24); 15541 init(); 15542 } 15543 protected void setBuffer(ByteBuffer backing, int offset) { 15544 super.setBuffer(backing, offset, 24); 15545 } 15546 public void read() { 15547 learnMode = LearningMode.fromValue(backing.getInt(0)); 15548 featureMode = ImageFeatureMode.fromValue(backing.getInt(4)); 15549 threshold = backing.getInt(8); 15550 ignoreMode = ColorIgnoreMode.fromValue(backing.getInt(12)); 15551 int colorsToIgnore_numColorsToIgnore = backing.getInt(20); 15552 long colorsToIgnore_addr = getPointer(backing, 16); 15553 colorsToIgnore = new ColorInformation[colorsToIgnore_numColorsToIgnore]; 15554 if (colorsToIgnore_numColorsToIgnore > 0 && colorsToIgnore_addr != 0) { 15555 ByteBuffer bb = newDirectByteBuffer(colorsToIgnore_addr, colorsToIgnore_numColorsToIgnore*12); 15556 for (int i=0, off=0; i<colorsToIgnore_numColorsToIgnore; i++, off += 12) { 15557 colorsToIgnore[i] = new ColorInformation(bb, off); 15558 colorsToIgnore[i].read(); 15559 } 15560 } 15561 } 15562 public void write() { 15563 if (learnMode != null) 15564 backing.putInt(0, learnMode.getValue()); 15565 if (featureMode != null) 15566 backing.putInt(4, featureMode.getValue()); 15567 backing.putInt(8, threshold); 15568 if (ignoreMode != null) 15569 backing.putInt(12, ignoreMode.getValue()); 15570 colorsToIgnore_buf = ByteBuffer.allocateDirect(colorsToIgnore.length*12).order(ByteOrder.nativeOrder()); 15571 for (int i=0, off=0; i<colorsToIgnore.length; i++, off += 12) { 15572 colorsToIgnore[i].setBuffer(colorsToIgnore_buf, off); 15573 colorsToIgnore[i].write(); 15574 } 15575 backing.putInt(20, colorsToIgnore.length); 15576 putPointer(backing, 16, colorsToIgnore_buf); 15577 } 15578 public int size() { 15579 return 24; 15580 } 15581 } 15582 15583 public static class Line extends DisposedStruct { 15584 public Point start; // The coordinate location of the start of the line. 15585 public Point end; // The coordinate location of the end of the line. 15586 15587 private void init() { 15588 start = new Point(backing, 0); 15589 end = new Point(backing, 8); 15590 } 15591 public Line() { 15592 super(16); 15593 init(); 15594 } 15595 public Line(Point start, Point end) { 15596 super(16); 15597 this.start = start; 15598 this.end = end; 15599 } 15600 protected Line(ByteBuffer backing, int offset) { 15601 super(backing, offset, 16); 15602 init(); 15603 } 15604 protected Line(long nativeObj, boolean owned) { 15605 super(nativeObj, owned, 16); 15606 init(); 15607 } 15608 protected void setBuffer(ByteBuffer backing, int offset) { 15609 super.setBuffer(backing, offset, 16); 15610 } 15611 public void read() { 15612 start.read(); 15613 end.read(); 15614 } 15615 public void write() { 15616 start.write(); 15617 end.write(); 15618 } 15619 public int size() { 15620 return 16; 15621 } 15622 } 15623 15624 public static class LinearAverages extends DisposedStruct { 15625 public float[] columnAverages; // An array containing the mean pixel value of each column. 15626 public float[] rowAverages; // An array containing the mean pixel value of each row. 15627 public float[] risingDiagAverages; // An array containing the mean pixel value of each diagonal running from the lower left to the upper right of the inspected area of the image. 15628 public float[] fallingDiagAverages; // An array containing the mean pixel value of each diagonal running from the upper left to the lower right of the inspected area of the image. 15629 private ByteBuffer columnAverages_buf; 15630 private ByteBuffer rowAverages_buf; 15631 private ByteBuffer risingDiagAverages_buf; 15632 private ByteBuffer fallingDiagAverages_buf; 15633 15634 private void init() { 15635 columnAverages = new float[0]; 15636 rowAverages = new float[0]; 15637 risingDiagAverages = new float[0]; 15638 fallingDiagAverages = new float[0]; 15639 } 15640 public LinearAverages() { 15641 super(32); 15642 init(); 15643 } 15644 public LinearAverages(float[] columnAverages, float[] rowAverages, float[] risingDiagAverages, float[] fallingDiagAverages) { 15645 super(32); 15646 this.columnAverages = columnAverages; 15647 this.rowAverages = rowAverages; 15648 this.risingDiagAverages = risingDiagAverages; 15649 this.fallingDiagAverages = fallingDiagAverages; 15650 } 15651 protected LinearAverages(ByteBuffer backing, int offset) { 15652 super(backing, offset, 32); 15653 init(); 15654 } 15655 protected LinearAverages(long nativeObj, boolean owned) { 15656 super(nativeObj, owned, 32); 15657 init(); 15658 } 15659 protected void setBuffer(ByteBuffer backing, int offset) { 15660 super.setBuffer(backing, offset, 32); 15661 } 15662 public void read() { 15663 int columnAverages_columnCount = backing.getInt(4); 15664 long columnAverages_addr = getPointer(backing, 0); 15665 columnAverages = new float[columnAverages_columnCount]; 15666 if (columnAverages_columnCount > 0 && columnAverages_addr != 0) { 15667 newDirectByteBuffer(columnAverages_addr, columnAverages_columnCount*4).asFloatBuffer().get(columnAverages); 15668 } 15669 int rowAverages_rowCount = backing.getInt(12); 15670 long rowAverages_addr = getPointer(backing, 8); 15671 rowAverages = new float[rowAverages_rowCount]; 15672 if (rowAverages_rowCount > 0 && rowAverages_addr != 0) { 15673 newDirectByteBuffer(rowAverages_addr, rowAverages_rowCount*4).asFloatBuffer().get(rowAverages); 15674 } 15675 int risingDiagAverages_risingDiagCount = backing.getInt(20); 15676 long risingDiagAverages_addr = getPointer(backing, 16); 15677 risingDiagAverages = new float[risingDiagAverages_risingDiagCount]; 15678 if (risingDiagAverages_risingDiagCount > 0 && risingDiagAverages_addr != 0) { 15679 newDirectByteBuffer(risingDiagAverages_addr, risingDiagAverages_risingDiagCount*4).asFloatBuffer().get(risingDiagAverages); 15680 } 15681 int fallingDiagAverages_fallingDiagCount = backing.getInt(28); 15682 long fallingDiagAverages_addr = getPointer(backing, 24); 15683 fallingDiagAverages = new float[fallingDiagAverages_fallingDiagCount]; 15684 if (fallingDiagAverages_fallingDiagCount > 0 && fallingDiagAverages_addr != 0) { 15685 newDirectByteBuffer(fallingDiagAverages_addr, fallingDiagAverages_fallingDiagCount*4).asFloatBuffer().get(fallingDiagAverages); 15686 } 15687 } 15688 public void write() { 15689 columnAverages_buf = ByteBuffer.allocateDirect(columnAverages.length*4).order(ByteOrder.nativeOrder()); 15690 columnAverages_buf.asFloatBuffer().put(columnAverages).rewind(); 15691 backing.putInt(4, columnAverages.length); 15692 putPointer(backing, 0, columnAverages_buf); 15693 rowAverages_buf = ByteBuffer.allocateDirect(rowAverages.length*4).order(ByteOrder.nativeOrder()); 15694 rowAverages_buf.asFloatBuffer().put(rowAverages).rewind(); 15695 backing.putInt(12, rowAverages.length); 15696 putPointer(backing, 8, rowAverages_buf); 15697 risingDiagAverages_buf = ByteBuffer.allocateDirect(risingDiagAverages.length*4).order(ByteOrder.nativeOrder()); 15698 risingDiagAverages_buf.asFloatBuffer().put(risingDiagAverages).rewind(); 15699 backing.putInt(20, risingDiagAverages.length); 15700 putPointer(backing, 16, risingDiagAverages_buf); 15701 fallingDiagAverages_buf = ByteBuffer.allocateDirect(fallingDiagAverages.length*4).order(ByteOrder.nativeOrder()); 15702 fallingDiagAverages_buf.asFloatBuffer().put(fallingDiagAverages).rewind(); 15703 backing.putInt(28, fallingDiagAverages.length); 15704 putPointer(backing, 24, fallingDiagAverages_buf); 15705 } 15706 public int size() { 15707 return 32; 15708 } 15709 } 15710 15711 public static class LineProfile extends DisposedStruct { 15712 public float[] profileData; // An array containing the value of each pixel in the line. 15713 public Rect boundingBox; // The bounding rectangle of the line. 15714 public float min; // The smallest pixel value in the line profile. 15715 public float max; // The largest pixel value in the line profile. 15716 public float mean; // The mean value of the pixels in the line profile. 15717 public float stdDev; // The standard deviation of the line profile. 15718 private ByteBuffer profileData_buf; 15719 15720 private void init() { 15721 profileData = new float[0]; 15722 boundingBox = new Rect(backing, 4); 15723 } 15724 public LineProfile() { 15725 super(40); 15726 init(); 15727 } 15728 public LineProfile(float[] profileData, Rect boundingBox, double min, double max, double mean, double stdDev) { 15729 super(40); 15730 this.profileData = profileData; 15731 this.boundingBox = boundingBox; 15732 this.min = (float)min; 15733 this.max = (float)max; 15734 this.mean = (float)mean; 15735 this.stdDev = (float)stdDev; 15736 } 15737 protected LineProfile(ByteBuffer backing, int offset) { 15738 super(backing, offset, 40); 15739 init(); 15740 } 15741 protected LineProfile(long nativeObj, boolean owned) { 15742 super(nativeObj, owned, 40); 15743 init(); 15744 } 15745 protected void setBuffer(ByteBuffer backing, int offset) { 15746 super.setBuffer(backing, offset, 40); 15747 } 15748 public void read() { 15749 int profileData_dataCount = backing.getInt(36); 15750 long profileData_addr = getPointer(backing, 0); 15751 profileData = new float[profileData_dataCount]; 15752 if (profileData_dataCount > 0 && profileData_addr != 0) { 15753 newDirectByteBuffer(profileData_addr, profileData_dataCount*4).asFloatBuffer().get(profileData); 15754 } 15755 boundingBox.read(); 15756 min = backing.getFloat(20); 15757 max = backing.getFloat(24); 15758 mean = backing.getFloat(28); 15759 stdDev = backing.getFloat(32); 15760 } 15761 public void write() { 15762 profileData_buf = ByteBuffer.allocateDirect(profileData.length*4).order(ByteOrder.nativeOrder()); 15763 profileData_buf.asFloatBuffer().put(profileData).rewind(); 15764 backing.putInt(36, profileData.length); 15765 putPointer(backing, 0, profileData_buf); 15766 boundingBox.write(); 15767 backing.putFloat(20, min); 15768 backing.putFloat(24, max); 15769 backing.putFloat(28, mean); 15770 backing.putFloat(32, stdDev); 15771 } 15772 public int size() { 15773 return 40; 15774 } 15775 } 15776 15777 public static class MatchColorPatternOptions extends DisposedStruct { 15778 public MatchingMode matchMode; // Specifies the method to use when looking for the color pattern in the image. 15779 public ImageFeatureMode featureMode; // Specifies the features to use when looking for the color pattern in the image. 15780 public int minContrast; // Specifies the minimum contrast expected in the image. 15781 public int subpixelAccuracy; // Set this parameter to TRUE to return areas in the image that match the pattern area with subpixel accuracy. 15782 public RotationAngleRange[] angleRanges; // An array of angle ranges, in degrees, where each range specifies how much you expect the pattern to be rotated in the image. 15783 public double colorWeight; // Determines the percent contribution of the color score to the final color pattern matching score. 15784 public ColorSensitivity sensitivity; // Specifies the sensitivity of the color information in the image. 15785 public SearchStrategy strategy; // Specifies how the color features of the image are used during the search phase. 15786 public int numMatchesRequested; // Number of valid matches expected. 15787 public float minMatchScore; // The minimum score a match can have for the function to consider the match valid. 15788 private ByteBuffer angleRanges_buf; 15789 15790 private void init() { 15791 angleRanges = new RotationAngleRange[0]; 15792 } 15793 public MatchColorPatternOptions() { 15794 super(48); 15795 init(); 15796 } 15797 public MatchColorPatternOptions(MatchingMode matchMode, ImageFeatureMode featureMode, int minContrast, int subpixelAccuracy, RotationAngleRange[] angleRanges, double colorWeight, ColorSensitivity sensitivity, SearchStrategy strategy, int numMatchesRequested, double minMatchScore) { 15798 super(48); 15799 this.matchMode = matchMode; 15800 this.featureMode = featureMode; 15801 this.minContrast = minContrast; 15802 this.subpixelAccuracy = subpixelAccuracy; 15803 this.angleRanges = angleRanges; 15804 this.colorWeight = colorWeight; 15805 this.sensitivity = sensitivity; 15806 this.strategy = strategy; 15807 this.numMatchesRequested = numMatchesRequested; 15808 this.minMatchScore = (float)minMatchScore; 15809 } 15810 protected MatchColorPatternOptions(ByteBuffer backing, int offset) { 15811 super(backing, offset, 48); 15812 init(); 15813 } 15814 protected MatchColorPatternOptions(long nativeObj, boolean owned) { 15815 super(nativeObj, owned, 48); 15816 init(); 15817 } 15818 protected void setBuffer(ByteBuffer backing, int offset) { 15819 super.setBuffer(backing, offset, 48); 15820 } 15821 public void read() { 15822 matchMode = MatchingMode.fromValue(backing.getInt(0)); 15823 featureMode = ImageFeatureMode.fromValue(backing.getInt(4)); 15824 minContrast = backing.getInt(8); 15825 subpixelAccuracy = backing.getInt(12); 15826 int angleRanges_numRanges = backing.getInt(20); 15827 long angleRanges_addr = getPointer(backing, 16); 15828 angleRanges = new RotationAngleRange[angleRanges_numRanges]; 15829 if (angleRanges_numRanges > 0 && angleRanges_addr != 0) { 15830 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numRanges*8); 15831 for (int i=0, off=0; i<angleRanges_numRanges; i++, off += 8) { 15832 angleRanges[i] = new RotationAngleRange(bb, off); 15833 angleRanges[i].read(); 15834 } 15835 } 15836 colorWeight = backing.getDouble(24); 15837 sensitivity = ColorSensitivity.fromValue(backing.getInt(32)); 15838 strategy = SearchStrategy.fromValue(backing.getInt(36)); 15839 numMatchesRequested = backing.getInt(40); 15840 minMatchScore = backing.getFloat(44); 15841 } 15842 public void write() { 15843 if (matchMode != null) 15844 backing.putInt(0, matchMode.getValue()); 15845 if (featureMode != null) 15846 backing.putInt(4, featureMode.getValue()); 15847 backing.putInt(8, minContrast); 15848 backing.putInt(12, subpixelAccuracy); 15849 angleRanges_buf = ByteBuffer.allocateDirect(angleRanges.length*8).order(ByteOrder.nativeOrder()); 15850 for (int i=0, off=0; i<angleRanges.length; i++, off += 8) { 15851 angleRanges[i].setBuffer(angleRanges_buf, off); 15852 angleRanges[i].write(); 15853 } 15854 backing.putInt(20, angleRanges.length); 15855 putPointer(backing, 16, angleRanges_buf); 15856 backing.putDouble(24, colorWeight); 15857 if (sensitivity != null) 15858 backing.putInt(32, sensitivity.getValue()); 15859 if (strategy != null) 15860 backing.putInt(36, strategy.getValue()); 15861 backing.putInt(40, numMatchesRequested); 15862 backing.putFloat(44, minMatchScore); 15863 } 15864 public int size() { 15865 return 48; 15866 } 15867 } 15868 15869 public static class HistogramReport extends DisposedStruct { 15870 public int[] histogram; // An array describing the number of pixels that fell into each class. 15871 public float min; // The smallest pixel value that the function classified. 15872 public float max; // The largest pixel value that the function classified. 15873 public float start; // The smallest pixel value that fell into the first class. 15874 public float width; // The size of each class. 15875 public float mean; // The mean value of the pixels that the function classified. 15876 public float stdDev; // The standard deviation of the pixels that the function classified. 15877 public int numPixels; // The number of pixels that the function classified. 15878 private ByteBuffer histogram_buf; 15879 15880 private void init() { 15881 histogram = new int[0]; 15882 } 15883 public HistogramReport() { 15884 super(36); 15885 init(); 15886 } 15887 public HistogramReport(int[] histogram, double min, double max, double start, double width, double mean, double stdDev, int numPixels) { 15888 super(36); 15889 this.histogram = histogram; 15890 this.min = (float)min; 15891 this.max = (float)max; 15892 this.start = (float)start; 15893 this.width = (float)width; 15894 this.mean = (float)mean; 15895 this.stdDev = (float)stdDev; 15896 this.numPixels = numPixels; 15897 } 15898 protected HistogramReport(ByteBuffer backing, int offset) { 15899 super(backing, offset, 36); 15900 init(); 15901 } 15902 protected HistogramReport(long nativeObj, boolean owned) { 15903 super(nativeObj, owned, 36); 15904 init(); 15905 } 15906 protected void setBuffer(ByteBuffer backing, int offset) { 15907 super.setBuffer(backing, offset, 36); 15908 } 15909 public void read() { 15910 int histogram_histogramCount = backing.getInt(4); 15911 long histogram_addr = getPointer(backing, 0); 15912 histogram = new int[histogram_histogramCount]; 15913 if (histogram_histogramCount > 0 && histogram_addr != 0) { 15914 newDirectByteBuffer(histogram_addr, histogram_histogramCount*4).asIntBuffer().get(histogram); 15915 } 15916 min = backing.getFloat(8); 15917 max = backing.getFloat(12); 15918 start = backing.getFloat(16); 15919 width = backing.getFloat(20); 15920 mean = backing.getFloat(24); 15921 stdDev = backing.getFloat(28); 15922 numPixels = backing.getInt(32); 15923 } 15924 public void write() { 15925 histogram_buf = ByteBuffer.allocateDirect(histogram.length*4).order(ByteOrder.nativeOrder()); 15926 histogram_buf.asIntBuffer().put(histogram).rewind(); 15927 backing.putInt(4, histogram.length); 15928 putPointer(backing, 0, histogram_buf); 15929 backing.putFloat(8, min); 15930 backing.putFloat(12, max); 15931 backing.putFloat(16, start); 15932 backing.putFloat(20, width); 15933 backing.putFloat(24, mean); 15934 backing.putFloat(28, stdDev); 15935 backing.putInt(32, numPixels); 15936 } 15937 public int size() { 15938 return 36; 15939 } 15940 } 15941 15942 public static class ArcInfo extends DisposedStruct { 15943 public Rect boundingBox; // The coordinate location of the bounding box of the arc. 15944 public double startAngle; // The counterclockwise angle from the x-axis in degrees to the start of the arc. 15945 public double endAngle; // The counterclockwise angle from the x-axis in degrees to the end of the arc. 15946 15947 private void init() { 15948 boundingBox = new Rect(backing, 0); 15949 } 15950 public ArcInfo() { 15951 super(32); 15952 init(); 15953 } 15954 public ArcInfo(Rect boundingBox, double startAngle, double endAngle) { 15955 super(32); 15956 this.boundingBox = boundingBox; 15957 this.startAngle = startAngle; 15958 this.endAngle = endAngle; 15959 } 15960 protected ArcInfo(ByteBuffer backing, int offset) { 15961 super(backing, offset, 32); 15962 init(); 15963 } 15964 protected ArcInfo(long nativeObj, boolean owned) { 15965 super(nativeObj, owned, 32); 15966 init(); 15967 } 15968 protected void setBuffer(ByteBuffer backing, int offset) { 15969 super.setBuffer(backing, offset, 32); 15970 } 15971 public void read() { 15972 boundingBox.read(); 15973 startAngle = backing.getDouble(16); 15974 endAngle = backing.getDouble(24); 15975 } 15976 public void write() { 15977 boundingBox.write(); 15978 backing.putDouble(16, startAngle); 15979 backing.putDouble(24, endAngle); 15980 } 15981 public int size() { 15982 return 32; 15983 } 15984 } 15985 15986 public static class AxisReport extends DisposedStruct { 15987 public PointFloat origin; // The origin of the coordinate system, which is the intersection of the two axes of the coordinate system. 15988 public PointFloat mainAxisEnd; // The end of the main axis, which is the result of the computation of the intersection of the main axis with the rectangular search area. 15989 public PointFloat secondaryAxisEnd; // The end of the secondary axis, which is the result of the computation of the intersection of the secondary axis with the rectangular search area. 15990 15991 private void init() { 15992 origin = new PointFloat(backing, 0); 15993 mainAxisEnd = new PointFloat(backing, 8); 15994 secondaryAxisEnd = new PointFloat(backing, 16); 15995 } 15996 public AxisReport() { 15997 super(24); 15998 init(); 15999 } 16000 public AxisReport(PointFloat origin, PointFloat mainAxisEnd, PointFloat secondaryAxisEnd) { 16001 super(24); 16002 this.origin = origin; 16003 this.mainAxisEnd = mainAxisEnd; 16004 this.secondaryAxisEnd = secondaryAxisEnd; 16005 } 16006 protected AxisReport(ByteBuffer backing, int offset) { 16007 super(backing, offset, 24); 16008 init(); 16009 } 16010 protected AxisReport(long nativeObj, boolean owned) { 16011 super(nativeObj, owned, 24); 16012 init(); 16013 } 16014 protected void setBuffer(ByteBuffer backing, int offset) { 16015 super.setBuffer(backing, offset, 24); 16016 } 16017 public void read() { 16018 origin.read(); 16019 mainAxisEnd.read(); 16020 secondaryAxisEnd.read(); 16021 } 16022 public void write() { 16023 origin.write(); 16024 mainAxisEnd.write(); 16025 secondaryAxisEnd.write(); 16026 } 16027 public int size() { 16028 return 24; 16029 } 16030 } 16031 16032 public static class BarcodeInfo extends DisposedStruct { 16033 public String outputString; // A string containing the decoded barcode data. 16034 public int size; // The size of the output string. 16035 public byte outputChar1; // The contents of this character depend on the barcode type. 16036 public byte outputChar2; // The contents of this character depend on the barcode type. 16037 public double confidenceLevel; // A quality measure of the decoded barcode ranging from 0 to 100, with 100 being the best. 16038 public BarcodeType type; // The type of barcode. 16039 private ByteBuffer outputString_buf; 16040 16041 private void init() { 16042 16043 } 16044 public BarcodeInfo() { 16045 super(32); 16046 init(); 16047 } 16048 public BarcodeInfo(String outputString, int size, byte outputChar1, byte outputChar2, double confidenceLevel, BarcodeType type) { 16049 super(32); 16050 this.outputString = outputString; 16051 this.size = size; 16052 this.outputChar1 = outputChar1; 16053 this.outputChar2 = outputChar2; 16054 this.confidenceLevel = confidenceLevel; 16055 this.type = type; 16056 } 16057 protected BarcodeInfo(ByteBuffer backing, int offset) { 16058 super(backing, offset, 32); 16059 init(); 16060 } 16061 protected BarcodeInfo(long nativeObj, boolean owned) { 16062 super(nativeObj, owned, 32); 16063 init(); 16064 } 16065 protected void setBuffer(ByteBuffer backing, int offset) { 16066 super.setBuffer(backing, offset, 32); 16067 } 16068 public void read() { 16069 long outputString_addr = getPointer(backing, 0); 16070 if (outputString_addr == 0) 16071 outputString = null; 16072 else { 16073 ByteBuffer bb = newDirectByteBuffer(outputString_addr, 1000); // FIXME 16074 while (bb.get() != 0) {} 16075 byte[] bytes = new byte[bb.position()-1]; 16076 getBytes(bb, bytes, 0, bytes.length); 16077 try { 16078 outputString = new String(bytes, "UTF-8"); 16079 } catch (UnsupportedEncodingException e) { 16080 outputString = ""; 16081 } 16082 } 16083 16084 size = backing.getInt(4); 16085 outputChar1 = backing.get(8); 16086 outputChar2 = backing.get(9); 16087 confidenceLevel = backing.getDouble(16); 16088 type = BarcodeType.fromValue(backing.getInt(24)); 16089 } 16090 public void write() { 16091 if (outputString != null) { 16092 byte[] outputString_bytes; 16093 try { 16094 outputString_bytes = outputString.getBytes("UTF-8"); 16095 } catch (UnsupportedEncodingException e) { 16096 outputString_bytes = new byte[0]; 16097 } 16098 outputString_buf = ByteBuffer.allocateDirect(outputString_bytes.length+1); 16099 putBytes(outputString_buf, outputString_bytes, 0, outputString_bytes.length).put(outputString_bytes.length, (byte)0); 16100 } 16101 putPointer(backing, 0, outputString == null ? 0 : getByteBufferAddress(outputString_buf)); 16102 backing.putInt(4, size); 16103 backing.put(8, outputChar1); 16104 backing.put(9, outputChar2); 16105 backing.putDouble(16, confidenceLevel); 16106 if (type != null) 16107 backing.putInt(24, type.getValue()); 16108 } 16109 public int size() { 16110 return 32; 16111 } 16112 } 16113 16114 public static class BCGOptions extends DisposedStruct { 16115 public float brightness; // Adjusts the brightness of the image. 16116 public float contrast; // Adjusts the contrast of the image. 16117 public float gamma; // Performs gamma correction. 16118 16119 private void init() { 16120 16121 } 16122 public BCGOptions() { 16123 super(12); 16124 init(); 16125 } 16126 public BCGOptions(double brightness, double contrast, double gamma) { 16127 super(12); 16128 this.brightness = (float)brightness; 16129 this.contrast = (float)contrast; 16130 this.gamma = (float)gamma; 16131 } 16132 protected BCGOptions(ByteBuffer backing, int offset) { 16133 super(backing, offset, 12); 16134 init(); 16135 } 16136 protected BCGOptions(long nativeObj, boolean owned) { 16137 super(nativeObj, owned, 12); 16138 init(); 16139 } 16140 protected void setBuffer(ByteBuffer backing, int offset) { 16141 super.setBuffer(backing, offset, 12); 16142 } 16143 public void read() { 16144 brightness = backing.getFloat(0); 16145 contrast = backing.getFloat(4); 16146 gamma = backing.getFloat(8); 16147 } 16148 public void write() { 16149 backing.putFloat(0, brightness); 16150 backing.putFloat(4, contrast); 16151 backing.putFloat(8, gamma); 16152 } 16153 public int size() { 16154 return 12; 16155 } 16156 } 16157 16158 public static class BestCircle extends DisposedStruct { 16159 public PointFloat center; // The coordinate location of the center of the circle. 16160 public double radius; // The radius of the circle. 16161 public double area; // The area of the circle. 16162 public double perimeter; // The length of the perimeter of the circle. 16163 public double error; // Represents the least square error of the fitted circle to the entire set of points. 16164 16165 private void init() { 16166 center = new PointFloat(backing, 0); 16167 } 16168 public BestCircle() { 16169 super(40); 16170 init(); 16171 } 16172 public BestCircle(PointFloat center, double radius, double area, double perimeter, double error) { 16173 super(40); 16174 this.center = center; 16175 this.radius = radius; 16176 this.area = area; 16177 this.perimeter = perimeter; 16178 this.error = error; 16179 } 16180 protected BestCircle(ByteBuffer backing, int offset) { 16181 super(backing, offset, 40); 16182 init(); 16183 } 16184 protected BestCircle(long nativeObj, boolean owned) { 16185 super(nativeObj, owned, 40); 16186 init(); 16187 } 16188 protected void setBuffer(ByteBuffer backing, int offset) { 16189 super.setBuffer(backing, offset, 40); 16190 } 16191 public void read() { 16192 center.read(); 16193 radius = backing.getDouble(8); 16194 area = backing.getDouble(16); 16195 perimeter = backing.getDouble(24); 16196 error = backing.getDouble(32); 16197 } 16198 public void write() { 16199 center.write(); 16200 backing.putDouble(8, radius); 16201 backing.putDouble(16, area); 16202 backing.putDouble(24, perimeter); 16203 backing.putDouble(32, error); 16204 } 16205 public int size() { 16206 return 40; 16207 } 16208 } 16209 16210 public static class BestEllipse extends DisposedStruct { 16211 public PointFloat center; // The coordinate location of the center of the ellipse. 16212 public PointFloat majorAxisStart; // The coordinate location of the start of the major axis of the ellipse. 16213 public PointFloat majorAxisEnd; // The coordinate location of the end of the major axis of the ellipse. 16214 public PointFloat minorAxisStart; // The coordinate location of the start of the minor axis of the ellipse. 16215 public PointFloat minorAxisEnd; // The coordinate location of the end of the minor axis of the ellipse. 16216 public double area; // The area of the ellipse. 16217 public double perimeter; // The length of the perimeter of the ellipse. 16218 16219 private void init() { 16220 center = new PointFloat(backing, 0); 16221 majorAxisStart = new PointFloat(backing, 8); 16222 majorAxisEnd = new PointFloat(backing, 16); 16223 minorAxisStart = new PointFloat(backing, 24); 16224 minorAxisEnd = new PointFloat(backing, 32); 16225 } 16226 public BestEllipse() { 16227 super(56); 16228 init(); 16229 } 16230 public BestEllipse(PointFloat center, PointFloat majorAxisStart, PointFloat majorAxisEnd, PointFloat minorAxisStart, PointFloat minorAxisEnd, double area, double perimeter) { 16231 super(56); 16232 this.center = center; 16233 this.majorAxisStart = majorAxisStart; 16234 this.majorAxisEnd = majorAxisEnd; 16235 this.minorAxisStart = minorAxisStart; 16236 this.minorAxisEnd = minorAxisEnd; 16237 this.area = area; 16238 this.perimeter = perimeter; 16239 } 16240 protected BestEllipse(ByteBuffer backing, int offset) { 16241 super(backing, offset, 56); 16242 init(); 16243 } 16244 protected BestEllipse(long nativeObj, boolean owned) { 16245 super(nativeObj, owned, 56); 16246 init(); 16247 } 16248 protected void setBuffer(ByteBuffer backing, int offset) { 16249 super.setBuffer(backing, offset, 56); 16250 } 16251 public void read() { 16252 center.read(); 16253 majorAxisStart.read(); 16254 majorAxisEnd.read(); 16255 minorAxisStart.read(); 16256 minorAxisEnd.read(); 16257 area = backing.getDouble(40); 16258 perimeter = backing.getDouble(48); 16259 } 16260 public void write() { 16261 center.write(); 16262 majorAxisStart.write(); 16263 majorAxisEnd.write(); 16264 minorAxisStart.write(); 16265 minorAxisEnd.write(); 16266 backing.putDouble(40, area); 16267 backing.putDouble(48, perimeter); 16268 } 16269 public int size() { 16270 return 56; 16271 } 16272 } 16273 16274 public static class BestLine extends DisposedStruct { 16275 public PointFloat start; // The coordinate location of the start of the line. 16276 public PointFloat end; // The coordinate location of the end of the line. 16277 public LineEquation equation; // Defines the three coefficients of the equation of the best fit line. 16278 public int valid; // This element is TRUE if the function achieved the minimum score within the number of allowed refinement iterations and FALSE if the function did not achieve the minimum score. 16279 public double error; // Represents the least square error of the fitted line to the entire set of points. 16280 public int[] pointsUsed; // An array of the indexes for the points array indicating which points the function used to fit the line. 16281 private ByteBuffer pointsUsed_buf; 16282 16283 private void init() { 16284 start = new PointFloat(backing, 0); 16285 end = new PointFloat(backing, 8); 16286 equation = new LineEquation(backing, 16); 16287 pointsUsed = new int[0]; 16288 } 16289 public BestLine() { 16290 super(64); 16291 init(); 16292 } 16293 public BestLine(PointFloat start, PointFloat end, LineEquation equation, int valid, double error, int[] pointsUsed) { 16294 super(64); 16295 this.start = start; 16296 this.end = end; 16297 this.equation = equation; 16298 this.valid = valid; 16299 this.error = error; 16300 this.pointsUsed = pointsUsed; 16301 } 16302 protected BestLine(ByteBuffer backing, int offset) { 16303 super(backing, offset, 64); 16304 init(); 16305 } 16306 protected BestLine(long nativeObj, boolean owned) { 16307 super(nativeObj, owned, 64); 16308 init(); 16309 } 16310 protected void setBuffer(ByteBuffer backing, int offset) { 16311 super.setBuffer(backing, offset, 64); 16312 } 16313 public void read() { 16314 start.read(); 16315 end.read(); 16316 equation.read(); 16317 valid = backing.getInt(40); 16318 error = backing.getDouble(48); 16319 int pointsUsed_numPointsUsed = backing.getInt(60); 16320 long pointsUsed_addr = getPointer(backing, 56); 16321 pointsUsed = new int[pointsUsed_numPointsUsed]; 16322 if (pointsUsed_numPointsUsed > 0 && pointsUsed_addr != 0) { 16323 newDirectByteBuffer(pointsUsed_addr, pointsUsed_numPointsUsed*4).asIntBuffer().get(pointsUsed); 16324 } 16325 } 16326 public void write() { 16327 start.write(); 16328 end.write(); 16329 equation.write(); 16330 backing.putInt(40, valid); 16331 backing.putDouble(48, error); 16332 pointsUsed_buf = ByteBuffer.allocateDirect(pointsUsed.length*4).order(ByteOrder.nativeOrder()); 16333 pointsUsed_buf.asIntBuffer().put(pointsUsed).rewind(); 16334 backing.putInt(60, pointsUsed.length); 16335 putPointer(backing, 56, pointsUsed_buf); 16336 } 16337 public int size() { 16338 return 64; 16339 } 16340 } 16341 16342 public static class BrowserOptions extends DisposedStruct { 16343 public int width; // The width to make the browser. 16344 public int height; // The height to make the browser image. 16345 public int imagesPerLine; // The number of images to place on a single line. 16346 public RGBValue backgroundColor; // The background color of the browser. 16347 public int frameSize; // Specifies the number of pixels with which to border each thumbnail. 16348 public BrowserFrameStyle style; // The style for the frame around each thumbnail. 16349 public float ratio; // Specifies the width to height ratio of each thumbnail. 16350 public RGBValue focusColor; // The color to use to display focused cells. 16351 16352 private void init() { 16353 backgroundColor = new RGBValue(backing, 12); 16354 focusColor = new RGBValue(backing, 28); 16355 } 16356 public BrowserOptions() { 16357 super(32); 16358 init(); 16359 } 16360 public BrowserOptions(int width, int height, int imagesPerLine, RGBValue backgroundColor, int frameSize, BrowserFrameStyle style, double ratio, RGBValue focusColor) { 16361 super(32); 16362 this.width = width; 16363 this.height = height; 16364 this.imagesPerLine = imagesPerLine; 16365 this.backgroundColor = backgroundColor; 16366 this.frameSize = frameSize; 16367 this.style = style; 16368 this.ratio = (float)ratio; 16369 this.focusColor = focusColor; 16370 } 16371 protected BrowserOptions(ByteBuffer backing, int offset) { 16372 super(backing, offset, 32); 16373 init(); 16374 } 16375 protected BrowserOptions(long nativeObj, boolean owned) { 16376 super(nativeObj, owned, 32); 16377 init(); 16378 } 16379 protected void setBuffer(ByteBuffer backing, int offset) { 16380 super.setBuffer(backing, offset, 32); 16381 } 16382 public void read() { 16383 width = backing.getInt(0); 16384 height = backing.getInt(4); 16385 imagesPerLine = backing.getInt(8); 16386 backgroundColor.read(); 16387 frameSize = backing.getInt(16); 16388 style = BrowserFrameStyle.fromValue(backing.getInt(20)); 16389 ratio = backing.getFloat(24); 16390 focusColor.read(); 16391 } 16392 public void write() { 16393 backing.putInt(0, width); 16394 backing.putInt(4, height); 16395 backing.putInt(8, imagesPerLine); 16396 backgroundColor.write(); 16397 backing.putInt(16, frameSize); 16398 if (style != null) 16399 backing.putInt(20, style.getValue()); 16400 backing.putFloat(24, ratio); 16401 focusColor.write(); 16402 } 16403 public int size() { 16404 return 32; 16405 } 16406 } 16407 16408 public static class CoordinateSystem extends DisposedStruct { 16409 public PointFloat origin; // The origin of the coordinate system. 16410 public float angle; // The angle, in degrees, of the x-axis of the coordinate system relative to the image x-axis. 16411 public AxisOrientation axisOrientation; // The direction of the y-axis of the coordinate reference system. 16412 16413 private void init() { 16414 origin = new PointFloat(backing, 0); 16415 } 16416 public CoordinateSystem() { 16417 super(16); 16418 init(); 16419 } 16420 public CoordinateSystem(PointFloat origin, double angle, AxisOrientation axisOrientation) { 16421 super(16); 16422 this.origin = origin; 16423 this.angle = (float)angle; 16424 this.axisOrientation = axisOrientation; 16425 } 16426 protected CoordinateSystem(ByteBuffer backing, int offset) { 16427 super(backing, offset, 16); 16428 init(); 16429 } 16430 protected CoordinateSystem(long nativeObj, boolean owned) { 16431 super(nativeObj, owned, 16); 16432 init(); 16433 } 16434 protected void setBuffer(ByteBuffer backing, int offset) { 16435 super.setBuffer(backing, offset, 16); 16436 } 16437 public void read() { 16438 origin.read(); 16439 angle = backing.getFloat(8); 16440 axisOrientation = AxisOrientation.fromValue(backing.getInt(12)); 16441 } 16442 public void write() { 16443 origin.write(); 16444 backing.putFloat(8, angle); 16445 if (axisOrientation != null) 16446 backing.putInt(12, axisOrientation.getValue()); 16447 } 16448 public int size() { 16449 return 16; 16450 } 16451 } 16452 16453 public static class CalibrationInfo extends DisposedStruct { 16454 public int mapColumns; // The number of columns in the error map. 16455 public int mapRows; // The number of rows in the error map. 16456 public ROI userRoi; // Specifies the ROI the user provided when learning the calibration. 16457 public ROI calibrationRoi; // Specifies the ROI that corresponds to the region of the image where the calibration information is accurate. 16458 public LearnCalibrationOptions options; // Specifies the calibration options the user provided when learning the calibration. 16459 public GridDescriptor grid; // Specifies the scaling constants for the image. 16460 public CoordinateSystem system; // Specifies the coordinate system for the real world coordinates. 16461 public RangeFloat range; // The range of the grayscale the function used to represent the circles in the grid image. 16462 public float quality; // The quality score of the learning process, which is a value between 0-1000. 16463 16464 private void init() { 16465 options = new LearnCalibrationOptions(backing, 20); 16466 grid = new GridDescriptor(backing, 40); 16467 system = new CoordinateSystem(backing, 52); 16468 range = new RangeFloat(backing, 68); 16469 } 16470 public CalibrationInfo() { 16471 super(80); 16472 init(); 16473 } 16474 public CalibrationInfo(int mapColumns, int mapRows, ROI userRoi, ROI calibrationRoi, LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system, RangeFloat range, double quality) { 16475 super(80); 16476 this.mapColumns = mapColumns; 16477 this.mapRows = mapRows; 16478 this.userRoi = userRoi; 16479 this.calibrationRoi = calibrationRoi; 16480 this.options = options; 16481 this.grid = grid; 16482 this.system = system; 16483 this.range = range; 16484 this.quality = (float)quality; 16485 } 16486 protected CalibrationInfo(ByteBuffer backing, int offset) { 16487 super(backing, offset, 80); 16488 init(); 16489 } 16490 protected CalibrationInfo(long nativeObj, boolean owned) { 16491 super(nativeObj, owned, 80); 16492 init(); 16493 } 16494 protected void setBuffer(ByteBuffer backing, int offset) { 16495 super.setBuffer(backing, offset, 80); 16496 } 16497 public void read() { 16498 mapColumns = backing.getInt(4); 16499 mapRows = backing.getInt(8); 16500 long userRoi_addr = getPointer(backing, 12); 16501 if (userRoi_addr == 0) 16502 userRoi = null; 16503 else 16504 userRoi = new ROI(userRoi_addr, false); 16505 long calibrationRoi_addr = getPointer(backing, 16); 16506 if (calibrationRoi_addr == 0) 16507 calibrationRoi = null; 16508 else 16509 calibrationRoi = new ROI(calibrationRoi_addr, false); 16510 options.read(); 16511 grid.read(); 16512 system.read(); 16513 range.read(); 16514 quality = backing.getFloat(76); 16515 } 16516 public void write() { 16517 backing.putInt(4, mapColumns); 16518 backing.putInt(8, mapRows); 16519 putPointer(backing, 12, userRoi); 16520 putPointer(backing, 16, calibrationRoi); 16521 options.write(); 16522 grid.write(); 16523 system.write(); 16524 range.write(); 16525 backing.putFloat(76, quality); 16526 } 16527 public int size() { 16528 return 80; 16529 } 16530 } 16531 16532 public static class CalibrationPoints extends DisposedStruct { 16533 public PointFloat[] pixelCoordinates; // The array of pixel coordinates. 16534 public PointFloat[] realWorldCoordinates; // The array of corresponding real-world coordinates. 16535 private ByteBuffer pixelCoordinates_buf; 16536 private ByteBuffer realWorldCoordinates_buf; 16537 16538 private void init() { 16539 pixelCoordinates = new PointFloat[0]; 16540 realWorldCoordinates = new PointFloat[0]; 16541 } 16542 public CalibrationPoints() { 16543 super(12); 16544 init(); 16545 } 16546 public CalibrationPoints(PointFloat[] pixelCoordinates, PointFloat[] realWorldCoordinates) { 16547 super(12); 16548 this.pixelCoordinates = pixelCoordinates; 16549 this.realWorldCoordinates = realWorldCoordinates; 16550 } 16551 protected CalibrationPoints(ByteBuffer backing, int offset) { 16552 super(backing, offset, 12); 16553 init(); 16554 } 16555 protected CalibrationPoints(long nativeObj, boolean owned) { 16556 super(nativeObj, owned, 12); 16557 init(); 16558 } 16559 protected void setBuffer(ByteBuffer backing, int offset) { 16560 super.setBuffer(backing, offset, 12); 16561 } 16562 public void read() { 16563 int pixelCoordinates_numCoordinates = backing.getInt(8); 16564 long pixelCoordinates_addr = getPointer(backing, 0); 16565 pixelCoordinates = new PointFloat[pixelCoordinates_numCoordinates]; 16566 if (pixelCoordinates_numCoordinates > 0 && pixelCoordinates_addr != 0) { 16567 ByteBuffer bb = newDirectByteBuffer(pixelCoordinates_addr, pixelCoordinates_numCoordinates*8); 16568 for (int i=0, off=0; i<pixelCoordinates_numCoordinates; i++, off += 8) { 16569 pixelCoordinates[i] = new PointFloat(bb, off); 16570 pixelCoordinates[i].read(); 16571 } 16572 } 16573 int realWorldCoordinates_numCoordinates = backing.getInt(8); 16574 long realWorldCoordinates_addr = getPointer(backing, 4); 16575 realWorldCoordinates = new PointFloat[realWorldCoordinates_numCoordinates]; 16576 if (realWorldCoordinates_numCoordinates > 0 && realWorldCoordinates_addr != 0) { 16577 ByteBuffer bb = newDirectByteBuffer(realWorldCoordinates_addr, realWorldCoordinates_numCoordinates*8); 16578 for (int i=0, off=0; i<realWorldCoordinates_numCoordinates; i++, off += 8) { 16579 realWorldCoordinates[i] = new PointFloat(bb, off); 16580 realWorldCoordinates[i].read(); 16581 } 16582 } 16583 } 16584 public void write() { 16585 pixelCoordinates_buf = ByteBuffer.allocateDirect(pixelCoordinates.length*8).order(ByteOrder.nativeOrder()); 16586 for (int i=0, off=0; i<pixelCoordinates.length; i++, off += 8) { 16587 pixelCoordinates[i].setBuffer(pixelCoordinates_buf, off); 16588 pixelCoordinates[i].write(); 16589 } 16590 backing.putInt(8, pixelCoordinates.length); 16591 putPointer(backing, 0, pixelCoordinates_buf); 16592 realWorldCoordinates_buf = ByteBuffer.allocateDirect(realWorldCoordinates.length*8).order(ByteOrder.nativeOrder()); 16593 for (int i=0, off=0; i<realWorldCoordinates.length; i++, off += 8) { 16594 realWorldCoordinates[i].setBuffer(realWorldCoordinates_buf, off); 16595 realWorldCoordinates[i].write(); 16596 } 16597 backing.putInt(8, realWorldCoordinates.length); 16598 putPointer(backing, 4, realWorldCoordinates_buf); 16599 } 16600 public int size() { 16601 return 12; 16602 } 16603 } 16604 16605 public static class CaliperOptions extends DisposedStruct { 16606 public TwoEdgePolarityType polarity; // Specifies the edge polarity of the edge pairs. 16607 public float separation; // The distance between edge pairs. 16608 public float separationDeviation; // Sets the range around the separation value. 16609 16610 private void init() { 16611 16612 } 16613 public CaliperOptions() { 16614 super(12); 16615 init(); 16616 } 16617 public CaliperOptions(TwoEdgePolarityType polarity, double separation, double separationDeviation) { 16618 super(12); 16619 this.polarity = polarity; 16620 this.separation = (float)separation; 16621 this.separationDeviation = (float)separationDeviation; 16622 } 16623 protected CaliperOptions(ByteBuffer backing, int offset) { 16624 super(backing, offset, 12); 16625 init(); 16626 } 16627 protected CaliperOptions(long nativeObj, boolean owned) { 16628 super(nativeObj, owned, 12); 16629 init(); 16630 } 16631 protected void setBuffer(ByteBuffer backing, int offset) { 16632 super.setBuffer(backing, offset, 12); 16633 } 16634 public void read() { 16635 polarity = TwoEdgePolarityType.fromValue(backing.getInt(0)); 16636 separation = backing.getFloat(4); 16637 separationDeviation = backing.getFloat(8); 16638 } 16639 public void write() { 16640 if (polarity != null) 16641 backing.putInt(0, polarity.getValue()); 16642 backing.putFloat(4, separation); 16643 backing.putFloat(8, separationDeviation); 16644 } 16645 public int size() { 16646 return 12; 16647 } 16648 } 16649 16650 public static class CaliperReport extends DisposedStruct { 16651 public float edge1Contrast; // The contrast of the first edge. 16652 public PointFloat edge1Coord; // The coordinates of the first edge. 16653 public float edge2Contrast; // The contrast of the second edge. 16654 public PointFloat edge2Coord; // The coordinates of the second edge. 16655 public float separation; // The distance between the two edges. 16656 16657 private void init() { 16658 edge1Coord = new PointFloat(backing, 4); 16659 edge2Coord = new PointFloat(backing, 16); 16660 } 16661 public CaliperReport() { 16662 super(32); 16663 init(); 16664 } 16665 public CaliperReport(double edge1Contrast, PointFloat edge1Coord, double edge2Contrast, PointFloat edge2Coord, double separation) { 16666 super(32); 16667 this.edge1Contrast = (float)edge1Contrast; 16668 this.edge1Coord = edge1Coord; 16669 this.edge2Contrast = (float)edge2Contrast; 16670 this.edge2Coord = edge2Coord; 16671 this.separation = (float)separation; 16672 } 16673 protected CaliperReport(ByteBuffer backing, int offset) { 16674 super(backing, offset, 32); 16675 init(); 16676 } 16677 protected CaliperReport(long nativeObj, boolean owned) { 16678 super(nativeObj, owned, 32); 16679 init(); 16680 } 16681 protected void setBuffer(ByteBuffer backing, int offset) { 16682 super.setBuffer(backing, offset, 32); 16683 } 16684 public void read() { 16685 edge1Contrast = backing.getFloat(0); 16686 edge1Coord.read(); 16687 edge2Contrast = backing.getFloat(12); 16688 edge2Coord.read(); 16689 separation = backing.getFloat(24); 16690 } 16691 public void write() { 16692 backing.putFloat(0, edge1Contrast); 16693 edge1Coord.write(); 16694 backing.putFloat(12, edge2Contrast); 16695 edge2Coord.write(); 16696 backing.putFloat(24, separation); 16697 } 16698 public int size() { 16699 return 32; 16700 } 16701 } 16702 16703 public static class DrawTextOptions extends DisposedStruct { 16704 public String fontName; // The font name to use. 16705 public int fontSize; // The size of the font. 16706 public int bold; // Set this parameter to TRUE to bold text. 16707 public int italic; // Set this parameter to TRUE to italicize text. 16708 public int underline; // Set this parameter to TRUE to underline text. 16709 public int strikeout; // Set this parameter to TRUE to strikeout text. 16710 public TextAlignment textAlignment; // Sets the alignment of text. 16711 public FontColor fontColor; // Sets the font color. 16712 16713 private void init() { 16714 16715 } 16716 public DrawTextOptions() { 16717 super(60); 16718 init(); 16719 } 16720 public DrawTextOptions(String fontName, int fontSize, int bold, int italic, int underline, int strikeout, TextAlignment textAlignment, FontColor fontColor) { 16721 super(60); 16722 this.fontName = fontName; 16723 this.fontSize = fontSize; 16724 this.bold = bold; 16725 this.italic = italic; 16726 this.underline = underline; 16727 this.strikeout = strikeout; 16728 this.textAlignment = textAlignment; 16729 this.fontColor = fontColor; 16730 } 16731 protected DrawTextOptions(ByteBuffer backing, int offset) { 16732 super(backing, offset, 60); 16733 init(); 16734 } 16735 protected DrawTextOptions(long nativeObj, boolean owned) { 16736 super(nativeObj, owned, 60); 16737 init(); 16738 } 16739 protected void setBuffer(ByteBuffer backing, int offset) { 16740 super.setBuffer(backing, offset, 60); 16741 } 16742 public void read() { 16743 { 16744 byte[] bytes = new byte[32]; 16745 getBytes(backing, bytes, 0, 32); 16746 int len; 16747 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 16748 try { 16749 fontName = new String(bytes, 0, len, "UTF-8"); 16750 } catch (UnsupportedEncodingException e) { 16751 fontName = ""; 16752 } 16753 } 16754 fontSize = backing.getInt(32); 16755 bold = backing.getInt(36); 16756 italic = backing.getInt(40); 16757 underline = backing.getInt(44); 16758 strikeout = backing.getInt(48); 16759 textAlignment = TextAlignment.fromValue(backing.getInt(52)); 16760 fontColor = FontColor.fromValue(backing.getInt(56)); 16761 } 16762 public void write() { 16763 if (fontName != null) { 16764 byte[] bytes; 16765 try { 16766 bytes = fontName.getBytes("UTF-8"); 16767 } catch (UnsupportedEncodingException e) { 16768 bytes = new byte[0]; 16769 } 16770 putBytes(backing, bytes, 0, bytes.length); 16771 for (int i=bytes.length; i<32; i++) 16772 backing.put(i, (byte)0); // fill with zero 16773 } 16774 backing.putInt(32, fontSize); 16775 backing.putInt(36, bold); 16776 backing.putInt(40, italic); 16777 backing.putInt(44, underline); 16778 backing.putInt(48, strikeout); 16779 if (textAlignment != null) 16780 backing.putInt(52, textAlignment.getValue()); 16781 if (fontColor != null) 16782 backing.putInt(56, fontColor.getValue()); 16783 } 16784 public int size() { 16785 return 60; 16786 } 16787 } 16788 16789 public static class CircleReport extends DisposedStruct { 16790 public Point center; // The coordinate point of the center of the circle. 16791 public int radius; // The radius of the circle, in pixels. 16792 public int area; // The area of the circle, in pixels. 16793 16794 private void init() { 16795 center = new Point(backing, 0); 16796 } 16797 public CircleReport() { 16798 super(16); 16799 init(); 16800 } 16801 public CircleReport(Point center, int radius, int area) { 16802 super(16); 16803 this.center = center; 16804 this.radius = radius; 16805 this.area = area; 16806 } 16807 protected CircleReport(ByteBuffer backing, int offset) { 16808 super(backing, offset, 16); 16809 init(); 16810 } 16811 protected CircleReport(long nativeObj, boolean owned) { 16812 super(nativeObj, owned, 16); 16813 init(); 16814 } 16815 protected void setBuffer(ByteBuffer backing, int offset) { 16816 super.setBuffer(backing, offset, 16); 16817 } 16818 public void read() { 16819 center.read(); 16820 radius = backing.getInt(8); 16821 area = backing.getInt(12); 16822 } 16823 public void write() { 16824 center.write(); 16825 backing.putInt(8, radius); 16826 backing.putInt(12, area); 16827 } 16828 public int size() { 16829 return 16; 16830 } 16831 } 16832 16833 public static class ClosedContour extends DisposedStruct { 16834 public Point[] points; // The points that make up the closed contour. 16835 private ByteBuffer points_buf; 16836 16837 private void init() { 16838 points = new Point[0]; 16839 } 16840 public ClosedContour() { 16841 super(8); 16842 init(); 16843 } 16844 public ClosedContour(Point[] points) { 16845 super(8); 16846 this.points = points; 16847 } 16848 protected ClosedContour(ByteBuffer backing, int offset) { 16849 super(backing, offset, 8); 16850 init(); 16851 } 16852 protected ClosedContour(long nativeObj, boolean owned) { 16853 super(nativeObj, owned, 8); 16854 init(); 16855 } 16856 protected void setBuffer(ByteBuffer backing, int offset) { 16857 super.setBuffer(backing, offset, 8); 16858 } 16859 public void read() { 16860 int points_numPoints = backing.getInt(4); 16861 long points_addr = getPointer(backing, 0); 16862 points = new Point[points_numPoints]; 16863 if (points_numPoints > 0 && points_addr != 0) { 16864 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints*8); 16865 for (int i=0, off=0; i<points_numPoints; i++, off += 8) { 16866 points[i] = new Point(bb, off); 16867 points[i].read(); 16868 } 16869 } 16870 } 16871 public void write() { 16872 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 16873 for (int i=0, off=0; i<points.length; i++, off += 8) { 16874 points[i].setBuffer(points_buf, off); 16875 points[i].write(); 16876 } 16877 backing.putInt(4, points.length); 16878 putPointer(backing, 0, points_buf); 16879 } 16880 public int size() { 16881 return 8; 16882 } 16883 } 16884 16885 public static class ColorHistogramReport extends DisposedStruct { 16886 public HistogramReport plane1; // The histogram report of the first color plane. 16887 public HistogramReport plane2; // The histogram report of the second plane. 16888 public HistogramReport plane3; // The histogram report of the third plane. 16889 16890 private void init() { 16891 plane1 = new HistogramReport(backing, 0); 16892 plane2 = new HistogramReport(backing, 36); 16893 plane3 = new HistogramReport(backing, 72); 16894 } 16895 public ColorHistogramReport() { 16896 super(108); 16897 init(); 16898 } 16899 public ColorHistogramReport(HistogramReport plane1, HistogramReport plane2, HistogramReport plane3) { 16900 super(108); 16901 this.plane1 = plane1; 16902 this.plane2 = plane2; 16903 this.plane3 = plane3; 16904 } 16905 protected ColorHistogramReport(ByteBuffer backing, int offset) { 16906 super(backing, offset, 108); 16907 init(); 16908 } 16909 protected ColorHistogramReport(long nativeObj, boolean owned) { 16910 super(nativeObj, owned, 108); 16911 init(); 16912 } 16913 protected void setBuffer(ByteBuffer backing, int offset) { 16914 super.setBuffer(backing, offset, 108); 16915 } 16916 public void read() { 16917 plane1.read(); 16918 plane2.read(); 16919 plane3.read(); 16920 } 16921 public void write() { 16922 plane1.write(); 16923 plane2.write(); 16924 plane3.write(); 16925 } 16926 public int size() { 16927 return 108; 16928 } 16929 } 16930 16931 public static class ColorInformation extends DisposedStruct { 16932 public int saturation; // The saturation level the function uses to learn the color information. 16933 public double[] info; // An array of color information that represents the color spectrum analysis of a region of an image in a compact form. 16934 private ByteBuffer info_buf; 16935 16936 private void init() { 16937 info = new double[0]; 16938 } 16939 public ColorInformation() { 16940 super(12); 16941 init(); 16942 } 16943 public ColorInformation(int saturation, double[] info) { 16944 super(12); 16945 this.saturation = saturation; 16946 this.info = info; 16947 } 16948 protected ColorInformation(ByteBuffer backing, int offset) { 16949 super(backing, offset, 12); 16950 init(); 16951 } 16952 protected ColorInformation(long nativeObj, boolean owned) { 16953 super(nativeObj, owned, 12); 16954 init(); 16955 } 16956 protected void setBuffer(ByteBuffer backing, int offset) { 16957 super.setBuffer(backing, offset, 12); 16958 } 16959 public void read() { 16960 saturation = backing.getInt(4); 16961 int info_infoCount = backing.getInt(0); 16962 long info_addr = getPointer(backing, 8); 16963 info = new double[info_infoCount]; 16964 if (info_infoCount > 0 && info_addr != 0) { 16965 newDirectByteBuffer(info_addr, info_infoCount*8).asDoubleBuffer().get(info); 16966 } 16967 } 16968 public void write() { 16969 backing.putInt(4, saturation); 16970 info_buf = ByteBuffer.allocateDirect(info.length*8).order(ByteOrder.nativeOrder()); 16971 info_buf.asDoubleBuffer().put(info).rewind(); 16972 backing.putInt(0, info.length); 16973 putPointer(backing, 8, info_buf); 16974 } 16975 public int size() { 16976 return 12; 16977 } 16978 } 16979 16980 public static class Complex extends DisposedStruct { 16981 public float r; // The real part of the value. 16982 public float i; // The imaginary part of the value. 16983 16984 private void init() { 16985 16986 } 16987 public Complex() { 16988 super(8); 16989 init(); 16990 } 16991 public Complex(double r, double i) { 16992 super(8); 16993 this.r = (float)r; 16994 this.i = (float)i; 16995 } 16996 protected Complex(ByteBuffer backing, int offset) { 16997 super(backing, offset, 8); 16998 init(); 16999 } 17000 protected Complex(long nativeObj, boolean owned) { 17001 super(nativeObj, owned, 8); 17002 init(); 17003 } 17004 protected void setBuffer(ByteBuffer backing, int offset) { 17005 super.setBuffer(backing, offset, 8); 17006 } 17007 public void read() { 17008 r = backing.getFloat(0); 17009 i = backing.getFloat(4); 17010 } 17011 public void write() { 17012 backing.putFloat(0, r); 17013 backing.putFloat(4, i); 17014 } 17015 public int size() { 17016 return 8; 17017 } 17018 } 17019 17020 public static class ConcentricRakeReport extends DisposedStruct { 17021 public ArcInfo[] rakeArcs; // An array containing the location of each concentric arc line used for edge detection. 17022 public PointFloat[] firstEdges; // The coordinate location of all edges detected as first edges. 17023 public PointFloat[] lastEdges; // The coordinate location of all edges detected as last edges. 17024 public EdgeLocationReport[] allEdges; // An array of reports describing the location of the edges located by each concentric rake arc line. 17025 public int[] linesWithEdges; // An array of indices into the rakeArcs array indicating the concentric rake arc lines on which the function detected at least one edge. 17026 private ByteBuffer rakeArcs_buf; 17027 private ByteBuffer firstEdges_buf; 17028 private ByteBuffer lastEdges_buf; 17029 private ByteBuffer allEdges_buf; 17030 private ByteBuffer linesWithEdges_buf; 17031 17032 private void init() { 17033 rakeArcs = new ArcInfo[0]; 17034 firstEdges = new PointFloat[0]; 17035 lastEdges = new PointFloat[0]; 17036 allEdges = new EdgeLocationReport[0]; 17037 linesWithEdges = new int[0]; 17038 } 17039 public ConcentricRakeReport() { 17040 super(36); 17041 init(); 17042 } 17043 public ConcentricRakeReport(ArcInfo[] rakeArcs, PointFloat[] firstEdges, PointFloat[] lastEdges, EdgeLocationReport[] allEdges, int[] linesWithEdges) { 17044 super(36); 17045 this.rakeArcs = rakeArcs; 17046 this.firstEdges = firstEdges; 17047 this.lastEdges = lastEdges; 17048 this.allEdges = allEdges; 17049 this.linesWithEdges = linesWithEdges; 17050 } 17051 protected ConcentricRakeReport(ByteBuffer backing, int offset) { 17052 super(backing, offset, 36); 17053 init(); 17054 } 17055 protected ConcentricRakeReport(long nativeObj, boolean owned) { 17056 super(nativeObj, owned, 36); 17057 init(); 17058 } 17059 protected void setBuffer(ByteBuffer backing, int offset) { 17060 super.setBuffer(backing, offset, 36); 17061 } 17062 public void read() { 17063 int rakeArcs_numArcs = backing.getInt(4); 17064 long rakeArcs_addr = getPointer(backing, 0); 17065 rakeArcs = new ArcInfo[rakeArcs_numArcs]; 17066 if (rakeArcs_numArcs > 0 && rakeArcs_addr != 0) { 17067 ByteBuffer bb = newDirectByteBuffer(rakeArcs_addr, rakeArcs_numArcs*32); 17068 for (int i=0, off=0; i<rakeArcs_numArcs; i++, off += 32) { 17069 rakeArcs[i] = new ArcInfo(bb, off); 17070 rakeArcs[i].read(); 17071 } 17072 } 17073 int firstEdges_numFirstEdges = backing.getInt(12); 17074 long firstEdges_addr = getPointer(backing, 8); 17075 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 17076 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 17077 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*8); 17078 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 8) { 17079 firstEdges[i] = new PointFloat(bb, off); 17080 firstEdges[i].read(); 17081 } 17082 } 17083 int lastEdges_numLastEdges = backing.getInt(20); 17084 long lastEdges_addr = getPointer(backing, 16); 17085 lastEdges = new PointFloat[lastEdges_numLastEdges]; 17086 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 17087 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*8); 17088 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 8) { 17089 lastEdges[i] = new PointFloat(bb, off); 17090 lastEdges[i].read(); 17091 } 17092 } 17093 int allEdges_numLinesWithEdges = backing.getInt(32); 17094 long allEdges_addr = getPointer(backing, 24); 17095 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 17096 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 17097 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges*8); 17098 for (int i=0, off=0; i<allEdges_numLinesWithEdges; i++, off += 8) { 17099 allEdges[i] = new EdgeLocationReport(bb, off); 17100 allEdges[i].read(); 17101 } 17102 } 17103 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 17104 long linesWithEdges_addr = getPointer(backing, 28); 17105 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 17106 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 17107 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges*4).asIntBuffer().get(linesWithEdges); 17108 } 17109 } 17110 public void write() { 17111 rakeArcs_buf = ByteBuffer.allocateDirect(rakeArcs.length*32).order(ByteOrder.nativeOrder()); 17112 for (int i=0, off=0; i<rakeArcs.length; i++, off += 32) { 17113 rakeArcs[i].setBuffer(rakeArcs_buf, off); 17114 rakeArcs[i].write(); 17115 } 17116 backing.putInt(4, rakeArcs.length); 17117 putPointer(backing, 0, rakeArcs_buf); 17118 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*8).order(ByteOrder.nativeOrder()); 17119 for (int i=0, off=0; i<firstEdges.length; i++, off += 8) { 17120 firstEdges[i].setBuffer(firstEdges_buf, off); 17121 firstEdges[i].write(); 17122 } 17123 backing.putInt(12, firstEdges.length); 17124 putPointer(backing, 8, firstEdges_buf); 17125 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*8).order(ByteOrder.nativeOrder()); 17126 for (int i=0, off=0; i<lastEdges.length; i++, off += 8) { 17127 lastEdges[i].setBuffer(lastEdges_buf, off); 17128 lastEdges[i].write(); 17129 } 17130 backing.putInt(20, lastEdges.length); 17131 putPointer(backing, 16, lastEdges_buf); 17132 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length*8).order(ByteOrder.nativeOrder()); 17133 for (int i=0, off=0; i<allEdges.length; i++, off += 8) { 17134 allEdges[i].setBuffer(allEdges_buf, off); 17135 allEdges[i].write(); 17136 } 17137 backing.putInt(32, allEdges.length); 17138 putPointer(backing, 24, allEdges_buf); 17139 linesWithEdges_buf = ByteBuffer.allocateDirect(linesWithEdges.length*4).order(ByteOrder.nativeOrder()); 17140 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 17141 backing.putInt(32, linesWithEdges.length); 17142 putPointer(backing, 28, linesWithEdges_buf); 17143 } 17144 public int size() { 17145 return 36; 17146 } 17147 } 17148 17149 public static class ConstructROIOptions extends DisposedStruct { 17150 public int windowNumber; // The window number of the image window. 17151 public String windowTitle; // Specifies the message string that the function displays in the title bar of the window. 17152 public PaletteType type; // The palette type to use. 17153 public RGBValue[] palette; // If type is IMAQ_PALETTE_USER, this array is the palette of colors to use with the window. 17154 private ByteBuffer windowTitle_buf; 17155 private ByteBuffer palette_buf; 17156 17157 private void init() { 17158 palette = new RGBValue[0]; 17159 } 17160 public ConstructROIOptions() { 17161 super(20); 17162 init(); 17163 } 17164 public ConstructROIOptions(int windowNumber, String windowTitle, PaletteType type, RGBValue[] palette) { 17165 super(20); 17166 this.windowNumber = windowNumber; 17167 this.windowTitle = windowTitle; 17168 this.type = type; 17169 this.palette = palette; 17170 } 17171 protected ConstructROIOptions(ByteBuffer backing, int offset) { 17172 super(backing, offset, 20); 17173 init(); 17174 } 17175 protected ConstructROIOptions(long nativeObj, boolean owned) { 17176 super(nativeObj, owned, 20); 17177 init(); 17178 } 17179 protected void setBuffer(ByteBuffer backing, int offset) { 17180 super.setBuffer(backing, offset, 20); 17181 } 17182 public void read() { 17183 windowNumber = backing.getInt(0); 17184 long windowTitle_addr = getPointer(backing, 4); 17185 if (windowTitle_addr == 0) 17186 windowTitle = null; 17187 else { 17188 ByteBuffer bb = newDirectByteBuffer(windowTitle_addr, 1000); // FIXME 17189 while (bb.get() != 0) {} 17190 byte[] bytes = new byte[bb.position()-1]; 17191 getBytes(bb, bytes, 0, bytes.length); 17192 try { 17193 windowTitle = new String(bytes, "UTF-8"); 17194 } catch (UnsupportedEncodingException e) { 17195 windowTitle = ""; 17196 } 17197 } 17198 17199 type = PaletteType.fromValue(backing.getInt(8)); 17200 int palette_numColors = backing.getInt(16); 17201 long palette_addr = getPointer(backing, 12); 17202 palette = new RGBValue[palette_numColors]; 17203 if (palette_numColors > 0 && palette_addr != 0) { 17204 ByteBuffer bb = newDirectByteBuffer(palette_addr, palette_numColors*4); 17205 for (int i=0, off=0; i<palette_numColors; i++, off += 4) { 17206 palette[i] = new RGBValue(bb, off); 17207 palette[i].read(); 17208 } 17209 } 17210 } 17211 public void write() { 17212 backing.putInt(0, windowNumber); 17213 if (windowTitle != null) { 17214 byte[] windowTitle_bytes; 17215 try { 17216 windowTitle_bytes = windowTitle.getBytes("UTF-8"); 17217 } catch (UnsupportedEncodingException e) { 17218 windowTitle_bytes = new byte[0]; 17219 } 17220 windowTitle_buf = ByteBuffer.allocateDirect(windowTitle_bytes.length+1); 17221 putBytes(windowTitle_buf, windowTitle_bytes, 0, windowTitle_bytes.length).put(windowTitle_bytes.length, (byte)0); 17222 } 17223 putPointer(backing, 4, windowTitle == null ? 0 : getByteBufferAddress(windowTitle_buf)); 17224 if (type != null) 17225 backing.putInt(8, type.getValue()); 17226 palette_buf = ByteBuffer.allocateDirect(palette.length*4).order(ByteOrder.nativeOrder()); 17227 for (int i=0, off=0; i<palette.length; i++, off += 4) { 17228 palette[i].setBuffer(palette_buf, off); 17229 palette[i].write(); 17230 } 17231 backing.putInt(16, palette.length); 17232 putPointer(backing, 12, palette_buf); 17233 } 17234 public int size() { 17235 return 20; 17236 } 17237 } 17238 17239 public static class ContourInfo extends DisposedStruct { 17240 public ContourType type; // The contour type. 17241 public Point[] points; // The points describing the contour. 17242 public RGBValue contourColor; // The contour color. 17243 private ByteBuffer points_buf; 17244 17245 private void init() { 17246 points = new Point[0]; 17247 contourColor = new RGBValue(backing, 12); 17248 } 17249 public ContourInfo() { 17250 super(16); 17251 init(); 17252 } 17253 public ContourInfo(ContourType type, Point[] points, RGBValue contourColor) { 17254 super(16); 17255 this.type = type; 17256 this.points = points; 17257 this.contourColor = contourColor; 17258 } 17259 protected ContourInfo(ByteBuffer backing, int offset) { 17260 super(backing, offset, 16); 17261 init(); 17262 } 17263 protected ContourInfo(long nativeObj, boolean owned) { 17264 super(nativeObj, owned, 16); 17265 init(); 17266 } 17267 protected void setBuffer(ByteBuffer backing, int offset) { 17268 super.setBuffer(backing, offset, 16); 17269 } 17270 public void read() { 17271 type = ContourType.fromValue(backing.getInt(0)); 17272 int points_numPoints = backing.getInt(4); 17273 long points_addr = getPointer(backing, 8); 17274 points = new Point[points_numPoints]; 17275 if (points_numPoints > 0 && points_addr != 0) { 17276 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints*8); 17277 for (int i=0, off=0; i<points_numPoints; i++, off += 8) { 17278 points[i] = new Point(bb, off); 17279 points[i].read(); 17280 } 17281 } 17282 contourColor.read(); 17283 } 17284 public void write() { 17285 if (type != null) 17286 backing.putInt(0, type.getValue()); 17287 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 17288 for (int i=0, off=0; i<points.length; i++, off += 8) { 17289 points[i].setBuffer(points_buf, off); 17290 points[i].write(); 17291 } 17292 backing.putInt(4, points.length); 17293 putPointer(backing, 8, points_buf); 17294 contourColor.write(); 17295 } 17296 public int size() { 17297 return 16; 17298 } 17299 } 17300 17301 public static class ContourInfo2 extends DisposedStruct { 17302 public ContourType type; // The contour type. 17303 public RGBValue color; // The contour color. 17304 public Point point; // Use this member when the contour is of type IMAQ_POINT. 17305 public Line line; // Use this member when the contour is of type IMAQ_LINE. 17306 public Rect rect; // Use this member when the contour is of type IMAQ_RECT. 17307 public Rect ovalBoundingBox; // Use this member when the contour is of type IMAQ_OVAL. 17308 public ClosedContour closedContour; // Use this member when the contour is of type IMAQ_CLOSED_CONTOUR. 17309 public OpenContour openContour; // Use this member when the contour is of type IMAQ_OPEN_CONTOUR. 17310 public Annulus annulus; // Use this member when the contour is of type IMAQ_ANNULUS. 17311 public RotatedRect rotatedRect; // Use this member when the contour is of type IMAQ_ROTATED_RECT. 17312 17313 private void init() { 17314 color = new RGBValue(backing, 4); 17315 } 17316 public ContourInfo2() { 17317 super(12); 17318 init(); 17319 } 17320 public ContourInfo2(ContourType type, RGBValue color) { 17321 super(12); 17322 this.type = type; 17323 this.color = color; 17324 } 17325 protected ContourInfo2(ByteBuffer backing, int offset) { 17326 super(backing, offset, 12); 17327 init(); 17328 } 17329 protected ContourInfo2(long nativeObj, boolean owned) { 17330 super(nativeObj, owned, 12); 17331 init(); 17332 } 17333 protected void setBuffer(ByteBuffer backing, int offset) { 17334 super.setBuffer(backing, offset, 12); 17335 } 17336 public void read() { 17337 type = ContourType.fromValue(backing.getInt(0)); 17338 color.read(); 17339 if (type == ContourType.POINT) { 17340 long point_addr = getPointer(backing, 8); 17341 if (point_addr == 0) 17342 point = null; 17343 else 17344 point = new Point(point_addr, false); 17345 } 17346 if (type == ContourType.LINE) { 17347 long line_addr = getPointer(backing, 8); 17348 if (line_addr == 0) 17349 line = null; 17350 else 17351 line = new Line(line_addr, false); 17352 } 17353 if (type == ContourType.RECT) { 17354 long rect_addr = getPointer(backing, 8); 17355 if (rect_addr == 0) 17356 rect = null; 17357 else 17358 rect = new Rect(rect_addr, false); 17359 } 17360 if (type == ContourType.OVAL) { 17361 long ovalBoundingBox_addr = getPointer(backing, 8); 17362 if (ovalBoundingBox_addr == 0) 17363 ovalBoundingBox = null; 17364 else 17365 ovalBoundingBox = new Rect(ovalBoundingBox_addr, false); 17366 } 17367 if (type == ContourType.CLOSED_CONTOUR) { 17368 long closedContour_addr = getPointer(backing, 8); 17369 if (closedContour_addr == 0) 17370 closedContour = null; 17371 else 17372 closedContour = new ClosedContour(closedContour_addr, false); 17373 } 17374 if (type == ContourType.OPEN_CONTOUR) { 17375 long openContour_addr = getPointer(backing, 8); 17376 if (openContour_addr == 0) 17377 openContour = null; 17378 else 17379 openContour = new OpenContour(openContour_addr, false); 17380 } 17381 if (type == ContourType.ANNULUS) { 17382 long annulus_addr = getPointer(backing, 8); 17383 if (annulus_addr == 0) 17384 annulus = null; 17385 else 17386 annulus = new Annulus(annulus_addr, false); 17387 } 17388 if (type == ContourType.ROTATED_RECT) { 17389 long rotatedRect_addr = getPointer(backing, 8); 17390 if (rotatedRect_addr == 0) 17391 rotatedRect = null; 17392 else 17393 rotatedRect = new RotatedRect(rotatedRect_addr, false); 17394 } 17395 } 17396 public void write() { 17397 if (type != null) 17398 backing.putInt(0, type.getValue()); 17399 color.write(); 17400 if (type == ContourType.POINT) { 17401 putPointer(backing, 8, point); 17402 } 17403 if (type == ContourType.LINE) { 17404 putPointer(backing, 8, line); 17405 } 17406 if (type == ContourType.RECT) { 17407 putPointer(backing, 8, rect); 17408 } 17409 if (type == ContourType.OVAL) { 17410 putPointer(backing, 8, ovalBoundingBox); 17411 } 17412 if (type == ContourType.CLOSED_CONTOUR) { 17413 putPointer(backing, 8, closedContour); 17414 } 17415 if (type == ContourType.OPEN_CONTOUR) { 17416 putPointer(backing, 8, openContour); 17417 } 17418 if (type == ContourType.ANNULUS) { 17419 putPointer(backing, 8, annulus); 17420 } 17421 if (type == ContourType.ROTATED_RECT) { 17422 putPointer(backing, 8, rotatedRect); 17423 } 17424 } 17425 public int size() { 17426 return 12; 17427 } 17428 } 17429 17430 public static class ContourPoint extends DisposedStruct { 17431 public double x; // The x-coordinate value in the image. 17432 public double y; // The y-coordinate value in the image. 17433 public double curvature; // The change in slope at this edge point of the segment. 17434 public double xDisplacement; // The x displacement of the current edge pixel from a cubic spline fit of the current edge segment. 17435 public double yDisplacement; // The y displacement of the current edge pixel from a cubic spline fit of the current edge segment. 17436 17437 private void init() { 17438 17439 } 17440 public ContourPoint() { 17441 super(40); 17442 init(); 17443 } 17444 public ContourPoint(double x, double y, double curvature, double xDisplacement, double yDisplacement) { 17445 super(40); 17446 this.x = x; 17447 this.y = y; 17448 this.curvature = curvature; 17449 this.xDisplacement = xDisplacement; 17450 this.yDisplacement = yDisplacement; 17451 } 17452 protected ContourPoint(ByteBuffer backing, int offset) { 17453 super(backing, offset, 40); 17454 init(); 17455 } 17456 protected ContourPoint(long nativeObj, boolean owned) { 17457 super(nativeObj, owned, 40); 17458 init(); 17459 } 17460 protected void setBuffer(ByteBuffer backing, int offset) { 17461 super.setBuffer(backing, offset, 40); 17462 } 17463 public void read() { 17464 x = backing.getDouble(0); 17465 y = backing.getDouble(8); 17466 curvature = backing.getDouble(16); 17467 xDisplacement = backing.getDouble(24); 17468 yDisplacement = backing.getDouble(32); 17469 } 17470 public void write() { 17471 backing.putDouble(0, x); 17472 backing.putDouble(8, y); 17473 backing.putDouble(16, curvature); 17474 backing.putDouble(24, xDisplacement); 17475 backing.putDouble(32, yDisplacement); 17476 } 17477 public int size() { 17478 return 40; 17479 } 17480 } 17481 17482 public static class CoordinateTransform extends DisposedStruct { 17483 public Point initialOrigin; // The origin of the initial coordinate system. 17484 public float initialAngle; // The angle, in degrees, of the x-axis of the initial coordinate system relative to the image x-axis. 17485 public Point finalOrigin; // The origin of the final coordinate system. 17486 public float finalAngle; // The angle, in degrees, of the x-axis of the final coordinate system relative to the image x-axis. 17487 17488 private void init() { 17489 initialOrigin = new Point(backing, 0); 17490 finalOrigin = new Point(backing, 12); 17491 } 17492 public CoordinateTransform() { 17493 super(24); 17494 init(); 17495 } 17496 public CoordinateTransform(Point initialOrigin, double initialAngle, Point finalOrigin, double finalAngle) { 17497 super(24); 17498 this.initialOrigin = initialOrigin; 17499 this.initialAngle = (float)initialAngle; 17500 this.finalOrigin = finalOrigin; 17501 this.finalAngle = (float)finalAngle; 17502 } 17503 protected CoordinateTransform(ByteBuffer backing, int offset) { 17504 super(backing, offset, 24); 17505 init(); 17506 } 17507 protected CoordinateTransform(long nativeObj, boolean owned) { 17508 super(nativeObj, owned, 24); 17509 init(); 17510 } 17511 protected void setBuffer(ByteBuffer backing, int offset) { 17512 super.setBuffer(backing, offset, 24); 17513 } 17514 public void read() { 17515 initialOrigin.read(); 17516 initialAngle = backing.getFloat(8); 17517 finalOrigin.read(); 17518 finalAngle = backing.getFloat(20); 17519 } 17520 public void write() { 17521 initialOrigin.write(); 17522 backing.putFloat(8, initialAngle); 17523 finalOrigin.write(); 17524 backing.putFloat(20, finalAngle); 17525 } 17526 public int size() { 17527 return 24; 17528 } 17529 } 17530 17531 public static class CoordinateTransform2 extends DisposedStruct { 17532 public CoordinateSystem referenceSystem; // Defines the coordinate system for input coordinates. 17533 public CoordinateSystem measurementSystem; // Defines the coordinate system in which the function should perform measurements. 17534 17535 private void init() { 17536 referenceSystem = new CoordinateSystem(backing, 0); 17537 measurementSystem = new CoordinateSystem(backing, 16); 17538 } 17539 public CoordinateTransform2() { 17540 super(32); 17541 init(); 17542 } 17543 public CoordinateTransform2(CoordinateSystem referenceSystem, CoordinateSystem measurementSystem) { 17544 super(32); 17545 this.referenceSystem = referenceSystem; 17546 this.measurementSystem = measurementSystem; 17547 } 17548 protected CoordinateTransform2(ByteBuffer backing, int offset) { 17549 super(backing, offset, 32); 17550 init(); 17551 } 17552 protected CoordinateTransform2(long nativeObj, boolean owned) { 17553 super(nativeObj, owned, 32); 17554 init(); 17555 } 17556 protected void setBuffer(ByteBuffer backing, int offset) { 17557 super.setBuffer(backing, offset, 32); 17558 } 17559 public void read() { 17560 referenceSystem.read(); 17561 measurementSystem.read(); 17562 } 17563 public void write() { 17564 referenceSystem.write(); 17565 measurementSystem.write(); 17566 } 17567 public int size() { 17568 return 32; 17569 } 17570 } 17571 17572 public static class CannyOptions extends DisposedStruct { 17573 public float sigma; // The sigma of the Gaussian smoothing filter that the function applies to the image before edge detection. 17574 public float upperThreshold; // The upper fraction of pixel values in the image from which the function chooses a seed or starting point of an edge segment. 17575 public float lowerThreshold; // The function multiplies this value by upperThreshold to determine the lower threshold for all the pixels in an edge segment. 17576 public int windowSize; // The window size of the Gaussian filter that the function applies to the image. 17577 17578 private void init() { 17579 17580 } 17581 public CannyOptions() { 17582 super(16); 17583 init(); 17584 } 17585 public CannyOptions(double sigma, double upperThreshold, double lowerThreshold, int windowSize) { 17586 super(16); 17587 this.sigma = (float)sigma; 17588 this.upperThreshold = (float)upperThreshold; 17589 this.lowerThreshold = (float)lowerThreshold; 17590 this.windowSize = windowSize; 17591 } 17592 protected CannyOptions(ByteBuffer backing, int offset) { 17593 super(backing, offset, 16); 17594 init(); 17595 } 17596 protected CannyOptions(long nativeObj, boolean owned) { 17597 super(nativeObj, owned, 16); 17598 init(); 17599 } 17600 protected void setBuffer(ByteBuffer backing, int offset) { 17601 super.setBuffer(backing, offset, 16); 17602 } 17603 public void read() { 17604 sigma = backing.getFloat(0); 17605 upperThreshold = backing.getFloat(4); 17606 lowerThreshold = backing.getFloat(8); 17607 windowSize = backing.getInt(12); 17608 } 17609 public void write() { 17610 backing.putFloat(0, sigma); 17611 backing.putFloat(4, upperThreshold); 17612 backing.putFloat(8, lowerThreshold); 17613 backing.putInt(12, windowSize); 17614 } 17615 public int size() { 17616 return 16; 17617 } 17618 } 17619 17620 public static class Range extends DisposedStruct { 17621 public int minValue; // The minimum value of the range. 17622 public int maxValue; // The maximum value of the range. 17623 17624 private void init() { 17625 17626 } 17627 public Range() { 17628 super(8); 17629 init(); 17630 } 17631 public Range(int minValue, int maxValue) { 17632 super(8); 17633 this.minValue = minValue; 17634 this.maxValue = maxValue; 17635 } 17636 protected Range(ByteBuffer backing, int offset) { 17637 super(backing, offset, 8); 17638 init(); 17639 } 17640 protected Range(long nativeObj, boolean owned) { 17641 super(nativeObj, owned, 8); 17642 init(); 17643 } 17644 protected void setBuffer(ByteBuffer backing, int offset) { 17645 super.setBuffer(backing, offset, 8); 17646 } 17647 public void read() { 17648 minValue = backing.getInt(0); 17649 maxValue = backing.getInt(4); 17650 } 17651 public void write() { 17652 backing.putInt(0, minValue); 17653 backing.putInt(4, maxValue); 17654 } 17655 public int size() { 17656 return 8; 17657 } 17658 } 17659 17660 public static class UserPointSymbol extends DisposedStruct { 17661 public int cols; // Number of columns in the symbol. 17662 public int rows; // Number of rows in the symbol. 17663 17664 private void init() { 17665 17666 } 17667 public UserPointSymbol() { 17668 super(12); 17669 init(); 17670 } 17671 public UserPointSymbol(int cols, int rows) { 17672 super(12); 17673 this.cols = cols; 17674 this.rows = rows; 17675 } 17676 protected UserPointSymbol(ByteBuffer backing, int offset) { 17677 super(backing, offset, 12); 17678 init(); 17679 } 17680 protected UserPointSymbol(long nativeObj, boolean owned) { 17681 super(nativeObj, owned, 12); 17682 init(); 17683 } 17684 protected void setBuffer(ByteBuffer backing, int offset) { 17685 super.setBuffer(backing, offset, 12); 17686 } 17687 public void read() { 17688 cols = backing.getInt(0); 17689 rows = backing.getInt(4); 17690 } 17691 public void write() { 17692 backing.putInt(0, cols); 17693 backing.putInt(4, rows); 17694 } 17695 public int size() { 17696 return 12; 17697 } 17698 } 17699 17700 public static class View3DOptions extends DisposedStruct { 17701 public int sizeReduction; // A divisor the function uses when determining the final height and width of the 3D image. 17702 public int maxHeight; // Defines the maximum height of a pixel from the image source drawn in 3D. 17703 public Direction3D direction; // Defines the 3D orientation. 17704 public float alpha; // Determines the angle between the horizontal and the baseline. 17705 public float beta; // Determines the angle between the horizontal and the second baseline. 17706 public int border; // Defines the border size. 17707 public int background; // Defines the background color. 17708 public Plane3D plane; // Indicates the view a function uses to show complex images. 17709 17710 private void init() { 17711 17712 } 17713 public View3DOptions() { 17714 super(32); 17715 init(); 17716 } 17717 public View3DOptions(int sizeReduction, int maxHeight, Direction3D direction, double alpha, double beta, int border, int background, Plane3D plane) { 17718 super(32); 17719 this.sizeReduction = sizeReduction; 17720 this.maxHeight = maxHeight; 17721 this.direction = direction; 17722 this.alpha = (float)alpha; 17723 this.beta = (float)beta; 17724 this.border = border; 17725 this.background = background; 17726 this.plane = plane; 17727 } 17728 protected View3DOptions(ByteBuffer backing, int offset) { 17729 super(backing, offset, 32); 17730 init(); 17731 } 17732 protected View3DOptions(long nativeObj, boolean owned) { 17733 super(nativeObj, owned, 32); 17734 init(); 17735 } 17736 protected void setBuffer(ByteBuffer backing, int offset) { 17737 super.setBuffer(backing, offset, 32); 17738 } 17739 public void read() { 17740 sizeReduction = backing.getInt(0); 17741 maxHeight = backing.getInt(4); 17742 direction = Direction3D.fromValue(backing.getInt(8)); 17743 alpha = backing.getFloat(12); 17744 beta = backing.getFloat(16); 17745 border = backing.getInt(20); 17746 background = backing.getInt(24); 17747 plane = Plane3D.fromValue(backing.getInt(28)); 17748 } 17749 public void write() { 17750 backing.putInt(0, sizeReduction); 17751 backing.putInt(4, maxHeight); 17752 if (direction != null) 17753 backing.putInt(8, direction.getValue()); 17754 backing.putFloat(12, alpha); 17755 backing.putFloat(16, beta); 17756 backing.putInt(20, border); 17757 backing.putInt(24, background); 17758 if (plane != null) 17759 backing.putInt(28, plane.getValue()); 17760 } 17761 public int size() { 17762 return 32; 17763 } 17764 } 17765 17766 public static class MatchPatternOptions extends DisposedStruct { 17767 public MatchingMode mode; // Specifies the method to use when looking for the pattern in the image. 17768 public int minContrast; // Specifies the minimum contrast expected in the image. 17769 public int subpixelAccuracy; // Set this element to TRUE to return areas in the image that match the pattern area with subpixel accuracy. 17770 public RotationAngleRange[] angleRanges; // An array of angle ranges, in degrees, where each range specifies how much you expect the pattern to be rotated in the image. 17771 public int numMatchesRequested; // Number of valid matches expected. 17772 public int matchFactor; // Controls the number of potential matches that the function examines. 17773 public float minMatchScore; // The minimum score a match can have for the function to consider the match valid. 17774 private ByteBuffer angleRanges_buf; 17775 17776 private void init() { 17777 angleRanges = new RotationAngleRange[0]; 17778 } 17779 public MatchPatternOptions() { 17780 super(32); 17781 init(); 17782 } 17783 public MatchPatternOptions(MatchingMode mode, int minContrast, int subpixelAccuracy, RotationAngleRange[] angleRanges, int numMatchesRequested, int matchFactor, double minMatchScore) { 17784 super(32); 17785 this.mode = mode; 17786 this.minContrast = minContrast; 17787 this.subpixelAccuracy = subpixelAccuracy; 17788 this.angleRanges = angleRanges; 17789 this.numMatchesRequested = numMatchesRequested; 17790 this.matchFactor = matchFactor; 17791 this.minMatchScore = (float)minMatchScore; 17792 } 17793 protected MatchPatternOptions(ByteBuffer backing, int offset) { 17794 super(backing, offset, 32); 17795 init(); 17796 } 17797 protected MatchPatternOptions(long nativeObj, boolean owned) { 17798 super(nativeObj, owned, 32); 17799 init(); 17800 } 17801 protected void setBuffer(ByteBuffer backing, int offset) { 17802 super.setBuffer(backing, offset, 32); 17803 } 17804 public void read() { 17805 mode = MatchingMode.fromValue(backing.getInt(0)); 17806 minContrast = backing.getInt(4); 17807 subpixelAccuracy = backing.getInt(8); 17808 int angleRanges_numRanges = backing.getInt(16); 17809 long angleRanges_addr = getPointer(backing, 12); 17810 angleRanges = new RotationAngleRange[angleRanges_numRanges]; 17811 if (angleRanges_numRanges > 0 && angleRanges_addr != 0) { 17812 ByteBuffer bb = newDirectByteBuffer(angleRanges_addr, angleRanges_numRanges*8); 17813 for (int i=0, off=0; i<angleRanges_numRanges; i++, off += 8) { 17814 angleRanges[i] = new RotationAngleRange(bb, off); 17815 angleRanges[i].read(); 17816 } 17817 } 17818 numMatchesRequested = backing.getInt(20); 17819 matchFactor = backing.getInt(24); 17820 minMatchScore = backing.getFloat(28); 17821 } 17822 public void write() { 17823 if (mode != null) 17824 backing.putInt(0, mode.getValue()); 17825 backing.putInt(4, minContrast); 17826 backing.putInt(8, subpixelAccuracy); 17827 angleRanges_buf = ByteBuffer.allocateDirect(angleRanges.length*8).order(ByteOrder.nativeOrder()); 17828 for (int i=0, off=0; i<angleRanges.length; i++, off += 8) { 17829 angleRanges[i].setBuffer(angleRanges_buf, off); 17830 angleRanges[i].write(); 17831 } 17832 backing.putInt(16, angleRanges.length); 17833 putPointer(backing, 12, angleRanges_buf); 17834 backing.putInt(20, numMatchesRequested); 17835 backing.putInt(24, matchFactor); 17836 backing.putFloat(28, minMatchScore); 17837 } 17838 public int size() { 17839 return 32; 17840 } 17841 } 17842 17843 public static class TIFFFileOptions extends DisposedStruct { 17844 public int rowsPerStrip; // Indicates the number of rows that the function writes per strip. 17845 public PhotometricMode photoInterp; // Designates which photometric interpretation to use. 17846 public TIFFCompressionType compressionType; // Indicates the type of compression to use on the TIFF file. 17847 17848 private void init() { 17849 17850 } 17851 public TIFFFileOptions() { 17852 super(12); 17853 init(); 17854 } 17855 public TIFFFileOptions(int rowsPerStrip, PhotometricMode photoInterp, TIFFCompressionType compressionType) { 17856 super(12); 17857 this.rowsPerStrip = rowsPerStrip; 17858 this.photoInterp = photoInterp; 17859 this.compressionType = compressionType; 17860 } 17861 protected TIFFFileOptions(ByteBuffer backing, int offset) { 17862 super(backing, offset, 12); 17863 init(); 17864 } 17865 protected TIFFFileOptions(long nativeObj, boolean owned) { 17866 super(nativeObj, owned, 12); 17867 init(); 17868 } 17869 protected void setBuffer(ByteBuffer backing, int offset) { 17870 super.setBuffer(backing, offset, 12); 17871 } 17872 public void read() { 17873 rowsPerStrip = backing.getInt(0); 17874 photoInterp = PhotometricMode.fromValue(backing.getInt(4)); 17875 compressionType = TIFFCompressionType.fromValue(backing.getInt(8)); 17876 } 17877 public void write() { 17878 backing.putInt(0, rowsPerStrip); 17879 if (photoInterp != null) 17880 backing.putInt(4, photoInterp.getValue()); 17881 if (compressionType != null) 17882 backing.putInt(8, compressionType.getValue()); 17883 } 17884 public int size() { 17885 return 12; 17886 } 17887 } 17888 17889 public static class OpenContour extends DisposedStruct { 17890 public Point[] points; // The points that make up the open contour. 17891 private ByteBuffer points_buf; 17892 17893 private void init() { 17894 points = new Point[0]; 17895 } 17896 public OpenContour() { 17897 super(8); 17898 init(); 17899 } 17900 public OpenContour(Point[] points) { 17901 super(8); 17902 this.points = points; 17903 } 17904 protected OpenContour(ByteBuffer backing, int offset) { 17905 super(backing, offset, 8); 17906 init(); 17907 } 17908 protected OpenContour(long nativeObj, boolean owned) { 17909 super(nativeObj, owned, 8); 17910 init(); 17911 } 17912 protected void setBuffer(ByteBuffer backing, int offset) { 17913 super.setBuffer(backing, offset, 8); 17914 } 17915 public void read() { 17916 int points_numPoints = backing.getInt(4); 17917 long points_addr = getPointer(backing, 0); 17918 points = new Point[points_numPoints]; 17919 if (points_numPoints > 0 && points_addr != 0) { 17920 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints*8); 17921 for (int i=0, off=0; i<points_numPoints; i++, off += 8) { 17922 points[i] = new Point(bb, off); 17923 points[i].read(); 17924 } 17925 } 17926 } 17927 public void write() { 17928 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 17929 for (int i=0, off=0; i<points.length; i++, off += 8) { 17930 points[i].setBuffer(points_buf, off); 17931 points[i].write(); 17932 } 17933 backing.putInt(4, points.length); 17934 putPointer(backing, 0, points_buf); 17935 } 17936 public int size() { 17937 return 8; 17938 } 17939 } 17940 17941 public static class OverlayTextOptions extends DisposedStruct { 17942 public String fontName; // The name of the font to use. 17943 public int fontSize; // The size of the font. 17944 public int bold; // Set this element to TRUE to bold the text. 17945 public int italic; // Set this element to TRUE to italicize the text. 17946 public int underline; // Set this element to TRUE to underline the text. 17947 public int strikeout; // Set this element to TRUE to strikeout the text. 17948 public TextAlignment horizontalTextAlignment; // Sets the alignment of the text. 17949 public VerticalTextAlignment verticalTextAlignment; // Sets the vertical alignment for the text. 17950 public RGBValue backgroundColor; // Sets the color for the text background pixels. 17951 public double angle; // The counterclockwise angle, in degrees, of the text relative to the x-axis. 17952 private ByteBuffer fontName_buf; 17953 17954 private void init() { 17955 backgroundColor = new RGBValue(backing, 32); 17956 } 17957 public OverlayTextOptions() { 17958 super(48); 17959 init(); 17960 } 17961 public OverlayTextOptions(String fontName, int fontSize, int bold, int italic, int underline, int strikeout, TextAlignment horizontalTextAlignment, VerticalTextAlignment verticalTextAlignment, RGBValue backgroundColor, double angle) { 17962 super(48); 17963 this.fontName = fontName; 17964 this.fontSize = fontSize; 17965 this.bold = bold; 17966 this.italic = italic; 17967 this.underline = underline; 17968 this.strikeout = strikeout; 17969 this.horizontalTextAlignment = horizontalTextAlignment; 17970 this.verticalTextAlignment = verticalTextAlignment; 17971 this.backgroundColor = backgroundColor; 17972 this.angle = angle; 17973 } 17974 protected OverlayTextOptions(ByteBuffer backing, int offset) { 17975 super(backing, offset, 48); 17976 init(); 17977 } 17978 protected OverlayTextOptions(long nativeObj, boolean owned) { 17979 super(nativeObj, owned, 48); 17980 init(); 17981 } 17982 protected void setBuffer(ByteBuffer backing, int offset) { 17983 super.setBuffer(backing, offset, 48); 17984 } 17985 public void read() { 17986 long fontName_addr = getPointer(backing, 0); 17987 if (fontName_addr == 0) 17988 fontName = null; 17989 else { 17990 ByteBuffer bb = newDirectByteBuffer(fontName_addr, 1000); // FIXME 17991 while (bb.get() != 0) {} 17992 byte[] bytes = new byte[bb.position()-1]; 17993 getBytes(bb, bytes, 0, bytes.length); 17994 try { 17995 fontName = new String(bytes, "UTF-8"); 17996 } catch (UnsupportedEncodingException e) { 17997 fontName = ""; 17998 } 17999 } 18000 18001 fontSize = backing.getInt(4); 18002 bold = backing.getInt(8); 18003 italic = backing.getInt(12); 18004 underline = backing.getInt(16); 18005 strikeout = backing.getInt(20); 18006 horizontalTextAlignment = TextAlignment.fromValue(backing.getInt(24)); 18007 verticalTextAlignment = VerticalTextAlignment.fromValue(backing.getInt(28)); 18008 backgroundColor.read(); 18009 angle = backing.getDouble(40); 18010 } 18011 public void write() { 18012 if (fontName != null) { 18013 byte[] fontName_bytes; 18014 try { 18015 fontName_bytes = fontName.getBytes("UTF-8"); 18016 } catch (UnsupportedEncodingException e) { 18017 fontName_bytes = new byte[0]; 18018 } 18019 fontName_buf = ByteBuffer.allocateDirect(fontName_bytes.length+1); 18020 putBytes(fontName_buf, fontName_bytes, 0, fontName_bytes.length).put(fontName_bytes.length, (byte)0); 18021 } 18022 putPointer(backing, 0, fontName == null ? 0 : getByteBufferAddress(fontName_buf)); 18023 backing.putInt(4, fontSize); 18024 backing.putInt(8, bold); 18025 backing.putInt(12, italic); 18026 backing.putInt(16, underline); 18027 backing.putInt(20, strikeout); 18028 if (horizontalTextAlignment != null) 18029 backing.putInt(24, horizontalTextAlignment.getValue()); 18030 if (verticalTextAlignment != null) 18031 backing.putInt(28, verticalTextAlignment.getValue()); 18032 backgroundColor.write(); 18033 backing.putDouble(40, angle); 18034 } 18035 public int size() { 18036 return 48; 18037 } 18038 } 18039 18040 public static class ParticleFilterCriteria extends DisposedStruct { 18041 public MeasurementValue parameter; // The morphological measurement that the function uses for filtering. 18042 public float lower; // The lower bound of the criteria range. 18043 public float upper; // The upper bound of the criteria range. 18044 public int exclude; // Set this element to TRUE to indicate that a match occurs when the value is outside the criteria range. 18045 18046 private void init() { 18047 18048 } 18049 public ParticleFilterCriteria() { 18050 super(16); 18051 init(); 18052 } 18053 public ParticleFilterCriteria(MeasurementValue parameter, double lower, double upper, int exclude) { 18054 super(16); 18055 this.parameter = parameter; 18056 this.lower = (float)lower; 18057 this.upper = (float)upper; 18058 this.exclude = exclude; 18059 } 18060 protected ParticleFilterCriteria(ByteBuffer backing, int offset) { 18061 super(backing, offset, 16); 18062 init(); 18063 } 18064 protected ParticleFilterCriteria(long nativeObj, boolean owned) { 18065 super(nativeObj, owned, 16); 18066 init(); 18067 } 18068 protected void setBuffer(ByteBuffer backing, int offset) { 18069 super.setBuffer(backing, offset, 16); 18070 } 18071 public void read() { 18072 parameter = MeasurementValue.fromValue(backing.getInt(0)); 18073 lower = backing.getFloat(4); 18074 upper = backing.getFloat(8); 18075 exclude = backing.getInt(12); 18076 } 18077 public void write() { 18078 if (parameter != null) 18079 backing.putInt(0, parameter.getValue()); 18080 backing.putFloat(4, lower); 18081 backing.putFloat(8, upper); 18082 backing.putInt(12, exclude); 18083 } 18084 public int size() { 18085 return 16; 18086 } 18087 } 18088 18089 public static class ParticleReport extends DisposedStruct { 18090 public int area; // The number of pixels in the particle. 18091 public float calibratedArea; // The size of the particle, calibrated to the calibration information of the image. 18092 public float perimeter; // The length of the perimeter, calibrated to the calibration information of the image. 18093 public int numHoles; // The number of holes in the particle. 18094 public int areaOfHoles; // The total surface area, in pixels, of all the holes in a particle. 18095 public float perimeterOfHoles; // The length of the perimeter of all the holes in the particle calibrated to the calibration information of the image. 18096 public Rect boundingBox; // The smallest rectangle that encloses the particle. 18097 public float sigmaX; // The sum of the particle pixels on the x-axis. 18098 public float sigmaY; // The sum of the particle pixels on the y-axis. 18099 public float sigmaXX; // The sum of the particle pixels on the x-axis, squared. 18100 public float sigmaYY; // The sum of the particle pixels on the y-axis, squared. 18101 public float sigmaXY; // The sum of the particle pixels on the x-axis and y-axis. 18102 public int longestLength; // The length of the longest horizontal line segment. 18103 public Point longestPoint; // The location of the leftmost pixel of the longest segment in the particle. 18104 public int projectionX; // The length of the particle when projected onto the x-axis. 18105 public int projectionY; // The length of the particle when projected onto the y-axis. 18106 public int connect8; // This element is TRUE if the function used connectivity-8 to determine if particles are touching. 18107 18108 private void init() { 18109 boundingBox = new Rect(backing, 24); 18110 longestPoint = new Point(backing, 64); 18111 } 18112 public ParticleReport() { 18113 super(84); 18114 init(); 18115 } 18116 public ParticleReport(int area, double calibratedArea, double perimeter, int numHoles, int areaOfHoles, double perimeterOfHoles, Rect boundingBox, double sigmaX, double sigmaY, double sigmaXX, double sigmaYY, double sigmaXY, int longestLength, Point longestPoint, int projectionX, int projectionY, int connect8) { 18117 super(84); 18118 this.area = area; 18119 this.calibratedArea = (float)calibratedArea; 18120 this.perimeter = (float)perimeter; 18121 this.numHoles = numHoles; 18122 this.areaOfHoles = areaOfHoles; 18123 this.perimeterOfHoles = (float)perimeterOfHoles; 18124 this.boundingBox = boundingBox; 18125 this.sigmaX = (float)sigmaX; 18126 this.sigmaY = (float)sigmaY; 18127 this.sigmaXX = (float)sigmaXX; 18128 this.sigmaYY = (float)sigmaYY; 18129 this.sigmaXY = (float)sigmaXY; 18130 this.longestLength = longestLength; 18131 this.longestPoint = longestPoint; 18132 this.projectionX = projectionX; 18133 this.projectionY = projectionY; 18134 this.connect8 = connect8; 18135 } 18136 protected ParticleReport(ByteBuffer backing, int offset) { 18137 super(backing, offset, 84); 18138 init(); 18139 } 18140 protected ParticleReport(long nativeObj, boolean owned) { 18141 super(nativeObj, owned, 84); 18142 init(); 18143 } 18144 protected void setBuffer(ByteBuffer backing, int offset) { 18145 super.setBuffer(backing, offset, 84); 18146 } 18147 public void read() { 18148 area = backing.getInt(0); 18149 calibratedArea = backing.getFloat(4); 18150 perimeter = backing.getFloat(8); 18151 numHoles = backing.getInt(12); 18152 areaOfHoles = backing.getInt(16); 18153 perimeterOfHoles = backing.getFloat(20); 18154 boundingBox.read(); 18155 sigmaX = backing.getFloat(40); 18156 sigmaY = backing.getFloat(44); 18157 sigmaXX = backing.getFloat(48); 18158 sigmaYY = backing.getFloat(52); 18159 sigmaXY = backing.getFloat(56); 18160 longestLength = backing.getInt(60); 18161 longestPoint.read(); 18162 projectionX = backing.getInt(72); 18163 projectionY = backing.getInt(76); 18164 connect8 = backing.getInt(80); 18165 } 18166 public void write() { 18167 backing.putInt(0, area); 18168 backing.putFloat(4, calibratedArea); 18169 backing.putFloat(8, perimeter); 18170 backing.putInt(12, numHoles); 18171 backing.putInt(16, areaOfHoles); 18172 backing.putFloat(20, perimeterOfHoles); 18173 boundingBox.write(); 18174 backing.putFloat(40, sigmaX); 18175 backing.putFloat(44, sigmaY); 18176 backing.putFloat(48, sigmaXX); 18177 backing.putFloat(52, sigmaYY); 18178 backing.putFloat(56, sigmaXY); 18179 backing.putInt(60, longestLength); 18180 longestPoint.write(); 18181 backing.putInt(72, projectionX); 18182 backing.putInt(76, projectionY); 18183 backing.putInt(80, connect8); 18184 } 18185 public int size() { 18186 return 84; 18187 } 18188 } 18189 18190 public static class PatternMatch extends DisposedStruct { 18191 public PointFloat position; // The location of the center of the match. 18192 public float rotation; // The rotation of the match relative to the template image, in degrees. 18193 public float scale; // The size of the match relative to the size of the template image, expressed as a percentage. 18194 public float score; // The accuracy of the match. 18195 public PointFloat[] corner; // An array of four points describing the rectangle surrounding the template image. 18196 18197 private void init() { 18198 position = new PointFloat(backing, 0); 18199 corner = new PointFloat[4]; 18200 18201 for (int i=0, off=20; i<4; i++, off += 8) 18202 corner[i] = new PointFloat(backing, off); 18203 } 18204 public PatternMatch() { 18205 super(52); 18206 init(); 18207 } 18208 public PatternMatch(PointFloat position, double rotation, double scale, double score, PointFloat[] corner) { 18209 super(52); 18210 this.position = position; 18211 this.rotation = (float)rotation; 18212 this.scale = (float)scale; 18213 this.score = (float)score; 18214 this.corner = corner; 18215 } 18216 protected PatternMatch(ByteBuffer backing, int offset) { 18217 super(backing, offset, 52); 18218 init(); 18219 } 18220 protected PatternMatch(long nativeObj, boolean owned) { 18221 super(nativeObj, owned, 52); 18222 init(); 18223 } 18224 protected void setBuffer(ByteBuffer backing, int offset) { 18225 super.setBuffer(backing, offset, 52); 18226 } 18227 public void read() { 18228 position.read(); 18229 rotation = backing.getFloat(8); 18230 scale = backing.getFloat(12); 18231 score = backing.getFloat(16); 18232 for (PointFloat it : corner) { 18233 it.read(); 18234 } 18235 } 18236 public void write() { 18237 position.write(); 18238 backing.putFloat(8, rotation); 18239 backing.putFloat(12, scale); 18240 backing.putFloat(16, score); 18241 for (PointFloat it : corner) { 18242 it.write(); 18243 } 18244 } 18245 public int size() { 18246 return 52; 18247 } 18248 } 18249 18250 public static class QuantifyData extends DisposedStruct { 18251 public float mean; // The mean value of the pixel values. 18252 public float stdDev; // The standard deviation of the pixel values. 18253 public float min; // The smallest pixel value. 18254 public float max; // The largest pixel value. 18255 public float calibratedArea; // The area, calibrated to the calibration information of the image. 18256 public int pixelArea; // The area, in number of pixels. 18257 public float relativeSize; // The proportion, expressed as a percentage, of the associated region relative to the whole image. 18258 18259 private void init() { 18260 18261 } 18262 public QuantifyData() { 18263 super(28); 18264 init(); 18265 } 18266 public QuantifyData(double mean, double stdDev, double min, double max, double calibratedArea, int pixelArea, double relativeSize) { 18267 super(28); 18268 this.mean = (float)mean; 18269 this.stdDev = (float)stdDev; 18270 this.min = (float)min; 18271 this.max = (float)max; 18272 this.calibratedArea = (float)calibratedArea; 18273 this.pixelArea = pixelArea; 18274 this.relativeSize = (float)relativeSize; 18275 } 18276 protected QuantifyData(ByteBuffer backing, int offset) { 18277 super(backing, offset, 28); 18278 init(); 18279 } 18280 protected QuantifyData(long nativeObj, boolean owned) { 18281 super(nativeObj, owned, 28); 18282 init(); 18283 } 18284 protected void setBuffer(ByteBuffer backing, int offset) { 18285 super.setBuffer(backing, offset, 28); 18286 } 18287 public void read() { 18288 mean = backing.getFloat(0); 18289 stdDev = backing.getFloat(4); 18290 min = backing.getFloat(8); 18291 max = backing.getFloat(12); 18292 calibratedArea = backing.getFloat(16); 18293 pixelArea = backing.getInt(20); 18294 relativeSize = backing.getFloat(24); 18295 } 18296 public void write() { 18297 backing.putFloat(0, mean); 18298 backing.putFloat(4, stdDev); 18299 backing.putFloat(8, min); 18300 backing.putFloat(12, max); 18301 backing.putFloat(16, calibratedArea); 18302 backing.putInt(20, pixelArea); 18303 backing.putFloat(24, relativeSize); 18304 } 18305 public int size() { 18306 return 28; 18307 } 18308 } 18309 18310 public static class QuantifyReport extends DisposedStruct { 18311 public QuantifyData global; // Statistical data of the whole image. 18312 public QuantifyData[] regions; // An array of QuantifyData structures containing statistical data of each region of the image. 18313 private ByteBuffer regions_buf; 18314 18315 private void init() { 18316 global = new QuantifyData(backing, 0); 18317 regions = new QuantifyData[0]; 18318 } 18319 public QuantifyReport() { 18320 super(36); 18321 init(); 18322 } 18323 public QuantifyReport(QuantifyData global, QuantifyData[] regions) { 18324 super(36); 18325 this.global = global; 18326 this.regions = regions; 18327 } 18328 protected QuantifyReport(ByteBuffer backing, int offset) { 18329 super(backing, offset, 36); 18330 init(); 18331 } 18332 protected QuantifyReport(long nativeObj, boolean owned) { 18333 super(nativeObj, owned, 36); 18334 init(); 18335 } 18336 protected void setBuffer(ByteBuffer backing, int offset) { 18337 super.setBuffer(backing, offset, 36); 18338 } 18339 public void read() { 18340 global.read(); 18341 int regions_regionCount = backing.getInt(32); 18342 long regions_addr = getPointer(backing, 28); 18343 regions = new QuantifyData[regions_regionCount]; 18344 if (regions_regionCount > 0 && regions_addr != 0) { 18345 ByteBuffer bb = newDirectByteBuffer(regions_addr, regions_regionCount*28); 18346 for (int i=0, off=0; i<regions_regionCount; i++, off += 28) { 18347 regions[i] = new QuantifyData(bb, off); 18348 regions[i].read(); 18349 } 18350 } 18351 } 18352 public void write() { 18353 global.write(); 18354 regions_buf = ByteBuffer.allocateDirect(regions.length*28).order(ByteOrder.nativeOrder()); 18355 for (int i=0, off=0; i<regions.length; i++, off += 28) { 18356 regions[i].setBuffer(regions_buf, off); 18357 regions[i].write(); 18358 } 18359 backing.putInt(32, regions.length); 18360 putPointer(backing, 28, regions_buf); 18361 } 18362 public int size() { 18363 return 36; 18364 } 18365 } 18366 18367 public static class RakeOptions extends DisposedStruct { 18368 public int threshold; // Specifies the threshold value for the contrast of the edge. 18369 public int width; // The number of pixels that the function averages to find the contrast at either side of the edge. 18370 public int steepness; // The span, in pixels, of the slope of the edge projected along the path specified by the input points. 18371 public int subsamplingRatio; // Specifies the number of pixels that separate two consecutive search lines. 18372 public InterpolationMethod subpixelType; // The method for interpolating. 18373 public int subpixelDivisions; // The number of samples the function obtains from a pixel. 18374 18375 private void init() { 18376 18377 } 18378 public RakeOptions() { 18379 super(24); 18380 init(); 18381 } 18382 public RakeOptions(int threshold, int width, int steepness, int subsamplingRatio, InterpolationMethod subpixelType, int subpixelDivisions) { 18383 super(24); 18384 this.threshold = threshold; 18385 this.width = width; 18386 this.steepness = steepness; 18387 this.subsamplingRatio = subsamplingRatio; 18388 this.subpixelType = subpixelType; 18389 this.subpixelDivisions = subpixelDivisions; 18390 } 18391 protected RakeOptions(ByteBuffer backing, int offset) { 18392 super(backing, offset, 24); 18393 init(); 18394 } 18395 protected RakeOptions(long nativeObj, boolean owned) { 18396 super(nativeObj, owned, 24); 18397 init(); 18398 } 18399 protected void setBuffer(ByteBuffer backing, int offset) { 18400 super.setBuffer(backing, offset, 24); 18401 } 18402 public void read() { 18403 threshold = backing.getInt(0); 18404 width = backing.getInt(4); 18405 steepness = backing.getInt(8); 18406 subsamplingRatio = backing.getInt(12); 18407 subpixelType = InterpolationMethod.fromValue(backing.getInt(16)); 18408 subpixelDivisions = backing.getInt(20); 18409 } 18410 public void write() { 18411 backing.putInt(0, threshold); 18412 backing.putInt(4, width); 18413 backing.putInt(8, steepness); 18414 backing.putInt(12, subsamplingRatio); 18415 if (subpixelType != null) 18416 backing.putInt(16, subpixelType.getValue()); 18417 backing.putInt(20, subpixelDivisions); 18418 } 18419 public int size() { 18420 return 24; 18421 } 18422 } 18423 18424 public static class RakeReport extends DisposedStruct { 18425 public LineFloat[] rakeLines; // The coordinate location of each of the rake lines used by the function. 18426 public PointFloat[] firstEdges; // The coordinate location of all edges detected as first edges. 18427 public PointFloat[] lastEdges; // The coordinate location of all edges detected as last edges. 18428 public EdgeLocationReport[] allEdges; // An array of reports describing the location of the edges located by each rake line. 18429 public int[] linesWithEdges; // An array of indices into the rakeLines array indicating the rake lines on which the function detected at least one edge. 18430 private ByteBuffer rakeLines_buf; 18431 private ByteBuffer firstEdges_buf; 18432 private ByteBuffer lastEdges_buf; 18433 private ByteBuffer allEdges_buf; 18434 private ByteBuffer linesWithEdges_buf; 18435 18436 private void init() { 18437 rakeLines = new LineFloat[0]; 18438 firstEdges = new PointFloat[0]; 18439 lastEdges = new PointFloat[0]; 18440 allEdges = new EdgeLocationReport[0]; 18441 linesWithEdges = new int[0]; 18442 } 18443 public RakeReport() { 18444 super(36); 18445 init(); 18446 } 18447 public RakeReport(LineFloat[] rakeLines, PointFloat[] firstEdges, PointFloat[] lastEdges, EdgeLocationReport[] allEdges, int[] linesWithEdges) { 18448 super(36); 18449 this.rakeLines = rakeLines; 18450 this.firstEdges = firstEdges; 18451 this.lastEdges = lastEdges; 18452 this.allEdges = allEdges; 18453 this.linesWithEdges = linesWithEdges; 18454 } 18455 protected RakeReport(ByteBuffer backing, int offset) { 18456 super(backing, offset, 36); 18457 init(); 18458 } 18459 protected RakeReport(long nativeObj, boolean owned) { 18460 super(nativeObj, owned, 36); 18461 init(); 18462 } 18463 protected void setBuffer(ByteBuffer backing, int offset) { 18464 super.setBuffer(backing, offset, 36); 18465 } 18466 public void read() { 18467 int rakeLines_numRakeLines = backing.getInt(4); 18468 long rakeLines_addr = getPointer(backing, 0); 18469 rakeLines = new LineFloat[rakeLines_numRakeLines]; 18470 if (rakeLines_numRakeLines > 0 && rakeLines_addr != 0) { 18471 ByteBuffer bb = newDirectByteBuffer(rakeLines_addr, rakeLines_numRakeLines*16); 18472 for (int i=0, off=0; i<rakeLines_numRakeLines; i++, off += 16) { 18473 rakeLines[i] = new LineFloat(bb, off); 18474 rakeLines[i].read(); 18475 } 18476 } 18477 int firstEdges_numFirstEdges = backing.getInt(12); 18478 long firstEdges_addr = getPointer(backing, 8); 18479 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 18480 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 18481 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*8); 18482 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 8) { 18483 firstEdges[i] = new PointFloat(bb, off); 18484 firstEdges[i].read(); 18485 } 18486 } 18487 int lastEdges_numLastEdges = backing.getInt(20); 18488 long lastEdges_addr = getPointer(backing, 16); 18489 lastEdges = new PointFloat[lastEdges_numLastEdges]; 18490 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 18491 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*8); 18492 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 8) { 18493 lastEdges[i] = new PointFloat(bb, off); 18494 lastEdges[i].read(); 18495 } 18496 } 18497 int allEdges_numLinesWithEdges = backing.getInt(32); 18498 long allEdges_addr = getPointer(backing, 24); 18499 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 18500 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 18501 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges*8); 18502 for (int i=0, off=0; i<allEdges_numLinesWithEdges; i++, off += 8) { 18503 allEdges[i] = new EdgeLocationReport(bb, off); 18504 allEdges[i].read(); 18505 } 18506 } 18507 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 18508 long linesWithEdges_addr = getPointer(backing, 28); 18509 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 18510 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 18511 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges*4).asIntBuffer().get(linesWithEdges); 18512 } 18513 } 18514 public void write() { 18515 rakeLines_buf = ByteBuffer.allocateDirect(rakeLines.length*16).order(ByteOrder.nativeOrder()); 18516 for (int i=0, off=0; i<rakeLines.length; i++, off += 16) { 18517 rakeLines[i].setBuffer(rakeLines_buf, off); 18518 rakeLines[i].write(); 18519 } 18520 backing.putInt(4, rakeLines.length); 18521 putPointer(backing, 0, rakeLines_buf); 18522 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*8).order(ByteOrder.nativeOrder()); 18523 for (int i=0, off=0; i<firstEdges.length; i++, off += 8) { 18524 firstEdges[i].setBuffer(firstEdges_buf, off); 18525 firstEdges[i].write(); 18526 } 18527 backing.putInt(12, firstEdges.length); 18528 putPointer(backing, 8, firstEdges_buf); 18529 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*8).order(ByteOrder.nativeOrder()); 18530 for (int i=0, off=0; i<lastEdges.length; i++, off += 8) { 18531 lastEdges[i].setBuffer(lastEdges_buf, off); 18532 lastEdges[i].write(); 18533 } 18534 backing.putInt(20, lastEdges.length); 18535 putPointer(backing, 16, lastEdges_buf); 18536 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length*8).order(ByteOrder.nativeOrder()); 18537 for (int i=0, off=0; i<allEdges.length; i++, off += 8) { 18538 allEdges[i].setBuffer(allEdges_buf, off); 18539 allEdges[i].write(); 18540 } 18541 backing.putInt(32, allEdges.length); 18542 putPointer(backing, 24, allEdges_buf); 18543 linesWithEdges_buf = ByteBuffer.allocateDirect(linesWithEdges.length*4).order(ByteOrder.nativeOrder()); 18544 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 18545 backing.putInt(32, linesWithEdges.length); 18546 putPointer(backing, 28, linesWithEdges_buf); 18547 } 18548 public int size() { 18549 return 36; 18550 } 18551 } 18552 18553 public static class TransformReport extends DisposedStruct { 18554 public PointFloat[] points; // An array of transformed coordinates. 18555 public int[] validPoints; // An array of values that describe the validity of each of the coordinates according to the region of interest you calibrated using either imaqLearnCalibrationGrid() or imaqLearnCalibrationPoints(). 18556 private ByteBuffer points_buf; 18557 private ByteBuffer validPoints_buf; 18558 18559 private void init() { 18560 points = new PointFloat[0]; 18561 validPoints = new int[0]; 18562 } 18563 public TransformReport() { 18564 super(12); 18565 init(); 18566 } 18567 public TransformReport(PointFloat[] points, int[] validPoints) { 18568 super(12); 18569 this.points = points; 18570 this.validPoints = validPoints; 18571 } 18572 protected TransformReport(ByteBuffer backing, int offset) { 18573 super(backing, offset, 12); 18574 init(); 18575 } 18576 protected TransformReport(long nativeObj, boolean owned) { 18577 super(nativeObj, owned, 12); 18578 init(); 18579 } 18580 protected void setBuffer(ByteBuffer backing, int offset) { 18581 super.setBuffer(backing, offset, 12); 18582 } 18583 public void read() { 18584 int points_numPoints = backing.getInt(8); 18585 long points_addr = getPointer(backing, 0); 18586 points = new PointFloat[points_numPoints]; 18587 if (points_numPoints > 0 && points_addr != 0) { 18588 ByteBuffer bb = newDirectByteBuffer(points_addr, points_numPoints*8); 18589 for (int i=0, off=0; i<points_numPoints; i++, off += 8) { 18590 points[i] = new PointFloat(bb, off); 18591 points[i].read(); 18592 } 18593 } 18594 int validPoints_numPoints = backing.getInt(8); 18595 long validPoints_addr = getPointer(backing, 4); 18596 validPoints = new int[validPoints_numPoints]; 18597 if (validPoints_numPoints > 0 && validPoints_addr != 0) { 18598 newDirectByteBuffer(validPoints_addr, validPoints_numPoints*4).asIntBuffer().get(validPoints); 18599 } 18600 } 18601 public void write() { 18602 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 18603 for (int i=0, off=0; i<points.length; i++, off += 8) { 18604 points[i].setBuffer(points_buf, off); 18605 points[i].write(); 18606 } 18607 backing.putInt(8, points.length); 18608 putPointer(backing, 0, points_buf); 18609 validPoints_buf = ByteBuffer.allocateDirect(validPoints.length*4).order(ByteOrder.nativeOrder()); 18610 validPoints_buf.asIntBuffer().put(validPoints).rewind(); 18611 backing.putInt(8, validPoints.length); 18612 putPointer(backing, 4, validPoints_buf); 18613 } 18614 public int size() { 18615 return 12; 18616 } 18617 } 18618 18619 public static class ShapeReport extends DisposedStruct { 18620 public Rect coordinates; // The bounding rectangle of the object. 18621 public Point centroid; // The coordinate location of the centroid of the object. 18622 public int size; // The size, in pixels, of the object. 18623 public double score; // A value ranging between 1 and 1,000 that specifies how similar the object in the image is to the template. 18624 18625 private void init() { 18626 coordinates = new Rect(backing, 0); 18627 centroid = new Point(backing, 16); 18628 } 18629 public ShapeReport() { 18630 super(40); 18631 init(); 18632 } 18633 public ShapeReport(Rect coordinates, Point centroid, int size, double score) { 18634 super(40); 18635 this.coordinates = coordinates; 18636 this.centroid = centroid; 18637 this.size = size; 18638 this.score = score; 18639 } 18640 protected ShapeReport(ByteBuffer backing, int offset) { 18641 super(backing, offset, 40); 18642 init(); 18643 } 18644 protected ShapeReport(long nativeObj, boolean owned) { 18645 super(nativeObj, owned, 40); 18646 init(); 18647 } 18648 protected void setBuffer(ByteBuffer backing, int offset) { 18649 super.setBuffer(backing, offset, 40); 18650 } 18651 public void read() { 18652 coordinates.read(); 18653 centroid.read(); 18654 size = backing.getInt(24); 18655 score = backing.getDouble(32); 18656 } 18657 public void write() { 18658 coordinates.write(); 18659 centroid.write(); 18660 backing.putInt(24, size); 18661 backing.putDouble(32, score); 18662 } 18663 public int size() { 18664 return 40; 18665 } 18666 } 18667 18668 public static class MeterArc extends DisposedStruct { 18669 public PointFloat needleBase; // The coordinate location of the base of the meter needle. 18670 public PointFloat[] arcCoordPoints; // An array of points describing the coordinate location of the meter arc. 18671 public int needleColor; // This element is TRUE when the meter has a light-colored needle on a dark background. 18672 private ByteBuffer arcCoordPoints_buf; 18673 18674 private void init() { 18675 needleBase = new PointFloat(backing, 0); 18676 arcCoordPoints = new PointFloat[0]; 18677 } 18678 public MeterArc() { 18679 super(20); 18680 init(); 18681 } 18682 public MeterArc(PointFloat needleBase, PointFloat[] arcCoordPoints, int needleColor) { 18683 super(20); 18684 this.needleBase = needleBase; 18685 this.arcCoordPoints = arcCoordPoints; 18686 this.needleColor = needleColor; 18687 } 18688 protected MeterArc(ByteBuffer backing, int offset) { 18689 super(backing, offset, 20); 18690 init(); 18691 } 18692 protected MeterArc(long nativeObj, boolean owned) { 18693 super(nativeObj, owned, 20); 18694 init(); 18695 } 18696 protected void setBuffer(ByteBuffer backing, int offset) { 18697 super.setBuffer(backing, offset, 20); 18698 } 18699 public void read() { 18700 needleBase.read(); 18701 int arcCoordPoints_numOfArcCoordPoints = backing.getInt(12); 18702 long arcCoordPoints_addr = getPointer(backing, 8); 18703 arcCoordPoints = new PointFloat[arcCoordPoints_numOfArcCoordPoints]; 18704 if (arcCoordPoints_numOfArcCoordPoints > 0 && arcCoordPoints_addr != 0) { 18705 ByteBuffer bb = newDirectByteBuffer(arcCoordPoints_addr, arcCoordPoints_numOfArcCoordPoints*8); 18706 for (int i=0, off=0; i<arcCoordPoints_numOfArcCoordPoints; i++, off += 8) { 18707 arcCoordPoints[i] = new PointFloat(bb, off); 18708 arcCoordPoints[i].read(); 18709 } 18710 } 18711 needleColor = backing.getInt(16); 18712 } 18713 public void write() { 18714 needleBase.write(); 18715 arcCoordPoints_buf = ByteBuffer.allocateDirect(arcCoordPoints.length*8).order(ByteOrder.nativeOrder()); 18716 for (int i=0, off=0; i<arcCoordPoints.length; i++, off += 8) { 18717 arcCoordPoints[i].setBuffer(arcCoordPoints_buf, off); 18718 arcCoordPoints[i].write(); 18719 } 18720 backing.putInt(12, arcCoordPoints.length); 18721 putPointer(backing, 8, arcCoordPoints_buf); 18722 backing.putInt(16, needleColor); 18723 } 18724 public int size() { 18725 return 20; 18726 } 18727 } 18728 18729 public static class ThresholdData extends DisposedStruct { 18730 public float rangeMin; // The lower boundary of the range to keep. 18731 public float rangeMax; // The upper boundary of the range to keep. 18732 public float newValue; // If useNewValue is TRUE, newValue is the replacement value for pixels within the range. 18733 public int useNewValue; // If TRUE, the function sets pixel values within [rangeMin, rangeMax] to the value specified in newValue. 18734 18735 private void init() { 18736 18737 } 18738 public ThresholdData() { 18739 super(16); 18740 init(); 18741 } 18742 public ThresholdData(double rangeMin, double rangeMax, double newValue, int useNewValue) { 18743 super(16); 18744 this.rangeMin = (float)rangeMin; 18745 this.rangeMax = (float)rangeMax; 18746 this.newValue = (float)newValue; 18747 this.useNewValue = useNewValue; 18748 } 18749 protected ThresholdData(ByteBuffer backing, int offset) { 18750 super(backing, offset, 16); 18751 init(); 18752 } 18753 protected ThresholdData(long nativeObj, boolean owned) { 18754 super(nativeObj, owned, 16); 18755 init(); 18756 } 18757 protected void setBuffer(ByteBuffer backing, int offset) { 18758 super.setBuffer(backing, offset, 16); 18759 } 18760 public void read() { 18761 rangeMin = backing.getFloat(0); 18762 rangeMax = backing.getFloat(4); 18763 newValue = backing.getFloat(8); 18764 useNewValue = backing.getInt(12); 18765 } 18766 public void write() { 18767 backing.putFloat(0, rangeMin); 18768 backing.putFloat(4, rangeMax); 18769 backing.putFloat(8, newValue); 18770 backing.putInt(12, useNewValue); 18771 } 18772 public int size() { 18773 return 16; 18774 } 18775 } 18776 18777 public static class StructuringElement extends DisposedStruct { 18778 public int matrixCols; // Number of columns in the matrix. 18779 public int matrixRows; // Number of rows in the matrix. 18780 public int hexa; // Set this element to TRUE if you specify a hexagonal structuring element in kernel. 18781 18782 private void init() { 18783 18784 } 18785 public StructuringElement() { 18786 super(16); 18787 init(); 18788 } 18789 public StructuringElement(int matrixCols, int matrixRows, int hexa) { 18790 super(16); 18791 this.matrixCols = matrixCols; 18792 this.matrixRows = matrixRows; 18793 this.hexa = hexa; 18794 } 18795 protected StructuringElement(ByteBuffer backing, int offset) { 18796 super(backing, offset, 16); 18797 init(); 18798 } 18799 protected StructuringElement(long nativeObj, boolean owned) { 18800 super(nativeObj, owned, 16); 18801 init(); 18802 } 18803 protected void setBuffer(ByteBuffer backing, int offset) { 18804 super.setBuffer(backing, offset, 16); 18805 } 18806 public void read() { 18807 matrixCols = backing.getInt(0); 18808 matrixRows = backing.getInt(4); 18809 hexa = backing.getInt(8); 18810 } 18811 public void write() { 18812 backing.putInt(0, matrixCols); 18813 backing.putInt(4, matrixRows); 18814 backing.putInt(8, hexa); 18815 } 18816 public int size() { 18817 return 16; 18818 } 18819 } 18820 18821 public static class SpokeReport extends DisposedStruct { 18822 public LineFloat[] spokeLines; // The coordinate location of each of the spoke lines used by the function. 18823 public PointFloat[] firstEdges; // The coordinate location of all edges detected as first edges. 18824 public PointFloat[] lastEdges; // The coordinate location of all edges detected as last edges. 18825 public EdgeLocationReport[] allEdges; // An array of reports describing the location of the edges located by each spoke line. 18826 public int[] linesWithEdges; // An array of indices into the spokeLines array indicating the rake lines on which the function detected at least one edge. 18827 private ByteBuffer spokeLines_buf; 18828 private ByteBuffer firstEdges_buf; 18829 private ByteBuffer lastEdges_buf; 18830 private ByteBuffer allEdges_buf; 18831 private ByteBuffer linesWithEdges_buf; 18832 18833 private void init() { 18834 spokeLines = new LineFloat[0]; 18835 firstEdges = new PointFloat[0]; 18836 lastEdges = new PointFloat[0]; 18837 allEdges = new EdgeLocationReport[0]; 18838 linesWithEdges = new int[0]; 18839 } 18840 public SpokeReport() { 18841 super(36); 18842 init(); 18843 } 18844 public SpokeReport(LineFloat[] spokeLines, PointFloat[] firstEdges, PointFloat[] lastEdges, EdgeLocationReport[] allEdges, int[] linesWithEdges) { 18845 super(36); 18846 this.spokeLines = spokeLines; 18847 this.firstEdges = firstEdges; 18848 this.lastEdges = lastEdges; 18849 this.allEdges = allEdges; 18850 this.linesWithEdges = linesWithEdges; 18851 } 18852 protected SpokeReport(ByteBuffer backing, int offset) { 18853 super(backing, offset, 36); 18854 init(); 18855 } 18856 protected SpokeReport(long nativeObj, boolean owned) { 18857 super(nativeObj, owned, 36); 18858 init(); 18859 } 18860 protected void setBuffer(ByteBuffer backing, int offset) { 18861 super.setBuffer(backing, offset, 36); 18862 } 18863 public void read() { 18864 int spokeLines_numSpokeLines = backing.getInt(4); 18865 long spokeLines_addr = getPointer(backing, 0); 18866 spokeLines = new LineFloat[spokeLines_numSpokeLines]; 18867 if (spokeLines_numSpokeLines > 0 && spokeLines_addr != 0) { 18868 ByteBuffer bb = newDirectByteBuffer(spokeLines_addr, spokeLines_numSpokeLines*16); 18869 for (int i=0, off=0; i<spokeLines_numSpokeLines; i++, off += 16) { 18870 spokeLines[i] = new LineFloat(bb, off); 18871 spokeLines[i].read(); 18872 } 18873 } 18874 int firstEdges_numFirstEdges = backing.getInt(12); 18875 long firstEdges_addr = getPointer(backing, 8); 18876 firstEdges = new PointFloat[firstEdges_numFirstEdges]; 18877 if (firstEdges_numFirstEdges > 0 && firstEdges_addr != 0) { 18878 ByteBuffer bb = newDirectByteBuffer(firstEdges_addr, firstEdges_numFirstEdges*8); 18879 for (int i=0, off=0; i<firstEdges_numFirstEdges; i++, off += 8) { 18880 firstEdges[i] = new PointFloat(bb, off); 18881 firstEdges[i].read(); 18882 } 18883 } 18884 int lastEdges_numLastEdges = backing.getInt(20); 18885 long lastEdges_addr = getPointer(backing, 16); 18886 lastEdges = new PointFloat[lastEdges_numLastEdges]; 18887 if (lastEdges_numLastEdges > 0 && lastEdges_addr != 0) { 18888 ByteBuffer bb = newDirectByteBuffer(lastEdges_addr, lastEdges_numLastEdges*8); 18889 for (int i=0, off=0; i<lastEdges_numLastEdges; i++, off += 8) { 18890 lastEdges[i] = new PointFloat(bb, off); 18891 lastEdges[i].read(); 18892 } 18893 } 18894 int allEdges_numLinesWithEdges = backing.getInt(32); 18895 long allEdges_addr = getPointer(backing, 24); 18896 allEdges = new EdgeLocationReport[allEdges_numLinesWithEdges]; 18897 if (allEdges_numLinesWithEdges > 0 && allEdges_addr != 0) { 18898 ByteBuffer bb = newDirectByteBuffer(allEdges_addr, allEdges_numLinesWithEdges*8); 18899 for (int i=0, off=0; i<allEdges_numLinesWithEdges; i++, off += 8) { 18900 allEdges[i] = new EdgeLocationReport(bb, off); 18901 allEdges[i].read(); 18902 } 18903 } 18904 int linesWithEdges_numLinesWithEdges = backing.getInt(32); 18905 long linesWithEdges_addr = getPointer(backing, 28); 18906 linesWithEdges = new int[linesWithEdges_numLinesWithEdges]; 18907 if (linesWithEdges_numLinesWithEdges > 0 && linesWithEdges_addr != 0) { 18908 newDirectByteBuffer(linesWithEdges_addr, linesWithEdges_numLinesWithEdges*4).asIntBuffer().get(linesWithEdges); 18909 } 18910 } 18911 public void write() { 18912 spokeLines_buf = ByteBuffer.allocateDirect(spokeLines.length*16).order(ByteOrder.nativeOrder()); 18913 for (int i=0, off=0; i<spokeLines.length; i++, off += 16) { 18914 spokeLines[i].setBuffer(spokeLines_buf, off); 18915 spokeLines[i].write(); 18916 } 18917 backing.putInt(4, spokeLines.length); 18918 putPointer(backing, 0, spokeLines_buf); 18919 firstEdges_buf = ByteBuffer.allocateDirect(firstEdges.length*8).order(ByteOrder.nativeOrder()); 18920 for (int i=0, off=0; i<firstEdges.length; i++, off += 8) { 18921 firstEdges[i].setBuffer(firstEdges_buf, off); 18922 firstEdges[i].write(); 18923 } 18924 backing.putInt(12, firstEdges.length); 18925 putPointer(backing, 8, firstEdges_buf); 18926 lastEdges_buf = ByteBuffer.allocateDirect(lastEdges.length*8).order(ByteOrder.nativeOrder()); 18927 for (int i=0, off=0; i<lastEdges.length; i++, off += 8) { 18928 lastEdges[i].setBuffer(lastEdges_buf, off); 18929 lastEdges[i].write(); 18930 } 18931 backing.putInt(20, lastEdges.length); 18932 putPointer(backing, 16, lastEdges_buf); 18933 allEdges_buf = ByteBuffer.allocateDirect(allEdges.length*8).order(ByteOrder.nativeOrder()); 18934 for (int i=0, off=0; i<allEdges.length; i++, off += 8) { 18935 allEdges[i].setBuffer(allEdges_buf, off); 18936 allEdges[i].write(); 18937 } 18938 backing.putInt(32, allEdges.length); 18939 putPointer(backing, 24, allEdges_buf); 18940 linesWithEdges_buf = ByteBuffer.allocateDirect(linesWithEdges.length*4).order(ByteOrder.nativeOrder()); 18941 linesWithEdges_buf.asIntBuffer().put(linesWithEdges).rewind(); 18942 backing.putInt(32, linesWithEdges.length); 18943 putPointer(backing, 28, linesWithEdges_buf); 18944 } 18945 public int size() { 18946 return 36; 18947 } 18948 } 18949 18950 public static class SimpleEdgeOptions extends DisposedStruct { 18951 public LevelType type; // Determines how the function evaluates the threshold and hysteresis values. 18952 public int threshold; // The pixel value at which an edge occurs. 18953 public int hysteresis; // A value that helps determine edges in noisy images. 18954 public EdgeProcess process; // Determines which edges the function looks for. 18955 public int subpixel; // Set this element to TRUE to find edges with subpixel accuracy by interpolating between points to find the crossing of the given threshold. 18956 18957 private void init() { 18958 18959 } 18960 public SimpleEdgeOptions() { 18961 super(20); 18962 init(); 18963 } 18964 public SimpleEdgeOptions(LevelType type, int threshold, int hysteresis, EdgeProcess process, int subpixel) { 18965 super(20); 18966 this.type = type; 18967 this.threshold = threshold; 18968 this.hysteresis = hysteresis; 18969 this.process = process; 18970 this.subpixel = subpixel; 18971 } 18972 protected SimpleEdgeOptions(ByteBuffer backing, int offset) { 18973 super(backing, offset, 20); 18974 init(); 18975 } 18976 protected SimpleEdgeOptions(long nativeObj, boolean owned) { 18977 super(nativeObj, owned, 20); 18978 init(); 18979 } 18980 protected void setBuffer(ByteBuffer backing, int offset) { 18981 super.setBuffer(backing, offset, 20); 18982 } 18983 public void read() { 18984 type = LevelType.fromValue(backing.getInt(0)); 18985 threshold = backing.getInt(4); 18986 hysteresis = backing.getInt(8); 18987 process = EdgeProcess.fromValue(backing.getInt(12)); 18988 subpixel = backing.getInt(16); 18989 } 18990 public void write() { 18991 if (type != null) 18992 backing.putInt(0, type.getValue()); 18993 backing.putInt(4, threshold); 18994 backing.putInt(8, hysteresis); 18995 if (process != null) 18996 backing.putInt(12, process.getValue()); 18997 backing.putInt(16, subpixel); 18998 } 18999 public int size() { 19000 return 20; 19001 } 19002 } 19003 19004 public static class SelectParticleCriteria extends DisposedStruct { 19005 public MeasurementValue parameter; // The morphological measurement that the function uses for filtering. 19006 public float lower; // The lower boundary of the criteria range. 19007 public float upper; // The upper boundary of the criteria range. 19008 19009 private void init() { 19010 19011 } 19012 public SelectParticleCriteria() { 19013 super(12); 19014 init(); 19015 } 19016 public SelectParticleCriteria(MeasurementValue parameter, double lower, double upper) { 19017 super(12); 19018 this.parameter = parameter; 19019 this.lower = (float)lower; 19020 this.upper = (float)upper; 19021 } 19022 protected SelectParticleCriteria(ByteBuffer backing, int offset) { 19023 super(backing, offset, 12); 19024 init(); 19025 } 19026 protected SelectParticleCriteria(long nativeObj, boolean owned) { 19027 super(nativeObj, owned, 12); 19028 init(); 19029 } 19030 protected void setBuffer(ByteBuffer backing, int offset) { 19031 super.setBuffer(backing, offset, 12); 19032 } 19033 public void read() { 19034 parameter = MeasurementValue.fromValue(backing.getInt(0)); 19035 lower = backing.getFloat(4); 19036 upper = backing.getFloat(8); 19037 } 19038 public void write() { 19039 if (parameter != null) 19040 backing.putInt(0, parameter.getValue()); 19041 backing.putFloat(4, lower); 19042 backing.putFloat(8, upper); 19043 } 19044 public int size() { 19045 return 12; 19046 } 19047 } 19048 19049 public static class SegmentInfo extends DisposedStruct { 19050 public int numberOfPoints; // The number of points in the segment. 19051 public int isOpen; // If TRUE, the contour is open. 19052 public double weight; // The significance of the edge in terms of the gray values that constitute the edge. 19053 public ContourPoint points; // The points of the segment. 19054 19055 private void init() { 19056 19057 } 19058 public SegmentInfo() { 19059 super(24); 19060 init(); 19061 } 19062 public SegmentInfo(int numberOfPoints, int isOpen, double weight, ContourPoint points) { 19063 super(24); 19064 this.numberOfPoints = numberOfPoints; 19065 this.isOpen = isOpen; 19066 this.weight = weight; 19067 this.points = points; 19068 } 19069 protected SegmentInfo(ByteBuffer backing, int offset) { 19070 super(backing, offset, 24); 19071 init(); 19072 } 19073 protected SegmentInfo(long nativeObj, boolean owned) { 19074 super(nativeObj, owned, 24); 19075 init(); 19076 } 19077 protected void setBuffer(ByteBuffer backing, int offset) { 19078 super.setBuffer(backing, offset, 24); 19079 } 19080 public void read() { 19081 numberOfPoints = backing.getInt(0); 19082 isOpen = backing.getInt(4); 19083 weight = backing.getDouble(8); 19084 long points_addr = getPointer(backing, 16); 19085 if (points_addr == 0) 19086 points = null; 19087 else 19088 points = new ContourPoint(points_addr, false); 19089 } 19090 public void write() { 19091 backing.putInt(0, numberOfPoints); 19092 backing.putInt(4, isOpen); 19093 backing.putDouble(8, weight); 19094 putPointer(backing, 16, points); 19095 } 19096 public int size() { 19097 return 24; 19098 } 19099 } 19100 19101 public static class RotationAngleRange extends DisposedStruct { 19102 public float lower; // The lowest amount of rotation, in degrees, a valid pattern can have. 19103 public float upper; // The highest amount of rotation, in degrees, a valid pattern can have. 19104 19105 private void init() { 19106 19107 } 19108 public RotationAngleRange() { 19109 super(8); 19110 init(); 19111 } 19112 public RotationAngleRange(double lower, double upper) { 19113 super(8); 19114 this.lower = (float)lower; 19115 this.upper = (float)upper; 19116 } 19117 protected RotationAngleRange(ByteBuffer backing, int offset) { 19118 super(backing, offset, 8); 19119 init(); 19120 } 19121 protected RotationAngleRange(long nativeObj, boolean owned) { 19122 super(nativeObj, owned, 8); 19123 init(); 19124 } 19125 protected void setBuffer(ByteBuffer backing, int offset) { 19126 super.setBuffer(backing, offset, 8); 19127 } 19128 public void read() { 19129 lower = backing.getFloat(0); 19130 upper = backing.getFloat(4); 19131 } 19132 public void write() { 19133 backing.putFloat(0, lower); 19134 backing.putFloat(4, upper); 19135 } 19136 public int size() { 19137 return 8; 19138 } 19139 } 19140 19141 public static class RotatedRect extends DisposedStruct { 19142 public int top; // Location of the top edge of the rectangle before rotation. 19143 public int left; // Location of the left edge of the rectangle before rotation. 19144 public int height; // Height of the rectangle. 19145 public int width; // Width of the rectangle. 19146 public double angle; // The rotation, in degrees, of the rectangle. 19147 19148 private void init() { 19149 19150 } 19151 public RotatedRect() { 19152 super(24); 19153 init(); 19154 } 19155 public RotatedRect(int top, int left, int height, int width, double angle) { 19156 super(24); 19157 this.top = top; 19158 this.left = left; 19159 this.height = height; 19160 this.width = width; 19161 this.angle = angle; 19162 } 19163 protected RotatedRect(ByteBuffer backing, int offset) { 19164 super(backing, offset, 24); 19165 init(); 19166 } 19167 protected RotatedRect(long nativeObj, boolean owned) { 19168 super(nativeObj, owned, 24); 19169 init(); 19170 } 19171 protected void setBuffer(ByteBuffer backing, int offset) { 19172 super.setBuffer(backing, offset, 24); 19173 } 19174 public void read() { 19175 top = backing.getInt(0); 19176 left = backing.getInt(4); 19177 height = backing.getInt(8); 19178 width = backing.getInt(12); 19179 angle = backing.getDouble(16); 19180 } 19181 public void write() { 19182 backing.putInt(0, top); 19183 backing.putInt(4, left); 19184 backing.putInt(8, height); 19185 backing.putInt(12, width); 19186 backing.putDouble(16, angle); 19187 } 19188 public int size() { 19189 return 24; 19190 } 19191 } 19192 19193 public static class ROIProfile extends DisposedStruct { 19194 public LineProfile report; // Quantifying information about the points along the edge of each contour in the ROI. 19195 public Point pixels; // An array of the points along the edge of each contour in the ROI. 19196 19197 private void init() { 19198 report = new LineProfile(backing, 0); 19199 } 19200 public ROIProfile() { 19201 super(44); 19202 init(); 19203 } 19204 public ROIProfile(LineProfile report, Point pixels) { 19205 super(44); 19206 this.report = report; 19207 this.pixels = pixels; 19208 } 19209 protected ROIProfile(ByteBuffer backing, int offset) { 19210 super(backing, offset, 44); 19211 init(); 19212 } 19213 protected ROIProfile(long nativeObj, boolean owned) { 19214 super(nativeObj, owned, 44); 19215 init(); 19216 } 19217 protected void setBuffer(ByteBuffer backing, int offset) { 19218 super.setBuffer(backing, offset, 44); 19219 } 19220 public void read() { 19221 report.read(); 19222 long pixels_addr = getPointer(backing, 40); 19223 if (pixels_addr == 0) 19224 pixels = null; 19225 else 19226 pixels = new Point(pixels_addr, false); 19227 } 19228 public void write() { 19229 report.write(); 19230 putPointer(backing, 40, pixels); 19231 } 19232 public int size() { 19233 return 44; 19234 } 19235 } 19236 19237 public static class ToolWindowOptions extends DisposedStruct { 19238 public int showSelectionTool; // If TRUE, the selection tool becomes visible. 19239 public int showZoomTool; // If TRUE, the zoom tool becomes visible. 19240 public int showPointTool; // If TRUE, the point tool becomes visible. 19241 public int showLineTool; // If TRUE, the line tool becomes visible. 19242 public int showRectangleTool; // If TRUE, the rectangle tool becomes visible. 19243 public int showOvalTool; // If TRUE, the oval tool becomes visible. 19244 public int showPolygonTool; // If TRUE, the polygon tool becomes visible. 19245 public int showClosedFreehandTool; // If TRUE, the closed freehand tool becomes visible. 19246 public int showPolyLineTool; // If TRUE, the polyline tool becomes visible. 19247 public int showFreehandTool; // If TRUE, the freehand tool becomes visible. 19248 public int showAnnulusTool; // If TRUE, the annulus becomes visible. 19249 public int showRotatedRectangleTool; // If TRUE, the rotated rectangle tool becomes visible. 19250 public int showPanTool; // If TRUE, the pan tool becomes visible. 19251 public int showZoomOutTool; // If TRUE, the zoom out tool becomes visible. 19252 19253 private void init() { 19254 19255 } 19256 public ToolWindowOptions() { 19257 super(68); 19258 init(); 19259 } 19260 public ToolWindowOptions(int showSelectionTool, int showZoomTool, int showPointTool, int showLineTool, int showRectangleTool, int showOvalTool, int showPolygonTool, int showClosedFreehandTool, int showPolyLineTool, int showFreehandTool, int showAnnulusTool, int showRotatedRectangleTool, int showPanTool, int showZoomOutTool) { 19261 super(68); 19262 this.showSelectionTool = showSelectionTool; 19263 this.showZoomTool = showZoomTool; 19264 this.showPointTool = showPointTool; 19265 this.showLineTool = showLineTool; 19266 this.showRectangleTool = showRectangleTool; 19267 this.showOvalTool = showOvalTool; 19268 this.showPolygonTool = showPolygonTool; 19269 this.showClosedFreehandTool = showClosedFreehandTool; 19270 this.showPolyLineTool = showPolyLineTool; 19271 this.showFreehandTool = showFreehandTool; 19272 this.showAnnulusTool = showAnnulusTool; 19273 this.showRotatedRectangleTool = showRotatedRectangleTool; 19274 this.showPanTool = showPanTool; 19275 this.showZoomOutTool = showZoomOutTool; 19276 } 19277 protected ToolWindowOptions(ByteBuffer backing, int offset) { 19278 super(backing, offset, 68); 19279 init(); 19280 } 19281 protected ToolWindowOptions(long nativeObj, boolean owned) { 19282 super(nativeObj, owned, 68); 19283 init(); 19284 } 19285 protected void setBuffer(ByteBuffer backing, int offset) { 19286 super.setBuffer(backing, offset, 68); 19287 } 19288 public void read() { 19289 showSelectionTool = backing.getInt(0); 19290 showZoomTool = backing.getInt(4); 19291 showPointTool = backing.getInt(8); 19292 showLineTool = backing.getInt(12); 19293 showRectangleTool = backing.getInt(16); 19294 showOvalTool = backing.getInt(20); 19295 showPolygonTool = backing.getInt(24); 19296 showClosedFreehandTool = backing.getInt(28); 19297 showPolyLineTool = backing.getInt(32); 19298 showFreehandTool = backing.getInt(36); 19299 showAnnulusTool = backing.getInt(40); 19300 showRotatedRectangleTool = backing.getInt(44); 19301 showPanTool = backing.getInt(48); 19302 showZoomOutTool = backing.getInt(52); 19303 } 19304 public void write() { 19305 backing.putInt(0, showSelectionTool); 19306 backing.putInt(4, showZoomTool); 19307 backing.putInt(8, showPointTool); 19308 backing.putInt(12, showLineTool); 19309 backing.putInt(16, showRectangleTool); 19310 backing.putInt(20, showOvalTool); 19311 backing.putInt(24, showPolygonTool); 19312 backing.putInt(28, showClosedFreehandTool); 19313 backing.putInt(32, showPolyLineTool); 19314 backing.putInt(36, showFreehandTool); 19315 backing.putInt(40, showAnnulusTool); 19316 backing.putInt(44, showRotatedRectangleTool); 19317 backing.putInt(48, showPanTool); 19318 backing.putInt(52, showZoomOutTool); 19319 } 19320 public int size() { 19321 return 68; 19322 } 19323 } 19324 19325 public static class SpokeOptions extends DisposedStruct { 19326 public int threshold; // Specifies the threshold value for the contrast of the edge. 19327 public int width; // The number of pixels that the function averages to find the contrast at either side of the edge. 19328 public int steepness; // The span, in pixels, of the slope of the edge projected along the path specified by the input points. 19329 public double subsamplingRatio; // The angle, in degrees, between each radial search line in the spoke. 19330 public InterpolationMethod subpixelType; // The method for interpolating. 19331 public int subpixelDivisions; // The number of samples the function obtains from a pixel. 19332 19333 private void init() { 19334 19335 } 19336 public SpokeOptions() { 19337 super(32); 19338 init(); 19339 } 19340 public SpokeOptions(int threshold, int width, int steepness, double subsamplingRatio, InterpolationMethod subpixelType, int subpixelDivisions) { 19341 super(32); 19342 this.threshold = threshold; 19343 this.width = width; 19344 this.steepness = steepness; 19345 this.subsamplingRatio = subsamplingRatio; 19346 this.subpixelType = subpixelType; 19347 this.subpixelDivisions = subpixelDivisions; 19348 } 19349 protected SpokeOptions(ByteBuffer backing, int offset) { 19350 super(backing, offset, 32); 19351 init(); 19352 } 19353 protected SpokeOptions(long nativeObj, boolean owned) { 19354 super(nativeObj, owned, 32); 19355 init(); 19356 } 19357 protected void setBuffer(ByteBuffer backing, int offset) { 19358 super.setBuffer(backing, offset, 32); 19359 } 19360 public void read() { 19361 threshold = backing.getInt(0); 19362 width = backing.getInt(4); 19363 steepness = backing.getInt(8); 19364 subsamplingRatio = backing.getDouble(16); 19365 subpixelType = InterpolationMethod.fromValue(backing.getInt(24)); 19366 subpixelDivisions = backing.getInt(28); 19367 } 19368 public void write() { 19369 backing.putInt(0, threshold); 19370 backing.putInt(4, width); 19371 backing.putInt(8, steepness); 19372 backing.putDouble(16, subsamplingRatio); 19373 if (subpixelType != null) 19374 backing.putInt(24, subpixelType.getValue()); 19375 backing.putInt(28, subpixelDivisions); 19376 } 19377 public int size() { 19378 return 32; 19379 } 19380 } 19381 19382 /** 19383 * Globals 19384 */ 19385 public static final Rect NO_RECT = new Rect( 0, 0, 0x7FFFFFFF, 0x7FFFFFFF); 19386 public static final RotatedRect NO_ROTATED_RECT = new RotatedRect( 0, 0, 0x7FFFFFFF, 0x7FFFFFFF, 0); 19387 public static final Point NO_POINT = new Point( -1, -1); 19388 public static final PointFloat NO_POINT_FLOAT = new PointFloat( -1.0, -1.0 ); 19389 public static final PointFloat NO_OFFSET = new PointFloat( 0.0, 0.0 ); 19390 public static final RGBValue RGB_TRANSPARENT = new RGBValue(0, 0, 0, 1); 19391 public static final RGBValue RGB_RED = new RGBValue(0, 0, 255, 0); 19392 public static final RGBValue RGB_BLUE = new RGBValue(255, 0, 0, 0); 19393 public static final RGBValue RGB_GREEN = new RGBValue(0, 255, 0, 0); 19394 public static final RGBValue RGB_YELLOW = new RGBValue(0, 255, 255, 0); 19395 public static final RGBValue RGB_WHITE = new RGBValue(255, 255, 255, 0); 19396 public static final RGBValue RGB_BLACK = new RGBValue(0, 0, 0, 0); 19397 19398 /** 19399 * Logical functions 19400 */ 19401 19402 public static void imaqAnd(Image dest, Image sourceA, Image sourceB) { 19403 19404 _imaqAnd(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19405 19406 } 19407 private static native void _imaqAnd(long dest, long sourceA, long sourceB); 19408 19409 public static void imaqCompare(Image dest, Image source, Image compareImage, ComparisonFunction compare) { 19410 19411 _imaqCompare(dest.getAddress(), source.getAddress(), compareImage.getAddress(), compare.getValue()); 19412 19413 } 19414 private static native void _imaqCompare(long dest, long source, long compareImage, int compare); 19415 19416 public static void imaqLogicalDifference(Image dest, Image sourceA, Image sourceB) { 19417 19418 _imaqLogicalDifference(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19419 19420 } 19421 private static native void _imaqLogicalDifference(long dest, long sourceA, long sourceB); 19422 19423 public static void imaqNand(Image dest, Image sourceA, Image sourceB) { 19424 19425 _imaqNand(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19426 19427 } 19428 private static native void _imaqNand(long dest, long sourceA, long sourceB); 19429 19430 public static void imaqNor(Image dest, Image sourceA, Image sourceB) { 19431 19432 _imaqNor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19433 19434 } 19435 private static native void _imaqNor(long dest, long sourceA, long sourceB); 19436 19437 public static void imaqOr(Image dest, Image sourceA, Image sourceB) { 19438 19439 _imaqOr(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19440 19441 } 19442 private static native void _imaqOr(long dest, long sourceA, long sourceB); 19443 19444 public static void imaqXnor(Image dest, Image sourceA, Image sourceB) { 19445 19446 _imaqXnor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19447 19448 } 19449 private static native void _imaqXnor(long dest, long sourceA, long sourceB); 19450 19451 public static void imaqXor(Image dest, Image sourceA, Image sourceB) { 19452 19453 _imaqXor(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19454 19455 } 19456 private static native void _imaqXor(long dest, long sourceA, long sourceB); 19457 19458 /** 19459 * Particle Analysis functions 19460 */ 19461 19462 public static int imaqCountParticles(Image image, int connectivity8) { 19463 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19464 long rv_addr = getByteBufferAddress(rv_buf); 19465 _imaqCountParticles(image.getAddress(), connectivity8, rv_addr+0); 19466 int numParticles; 19467 numParticles = rv_buf.getInt(0); 19468 return numParticles; 19469 } 19470 private static native void _imaqCountParticles(long image, int connectivity8, long numParticles); 19471 19472 public static double imaqMeasureParticle(Image image, int particleNumber, int calibrated, MeasurementType measurement) { 19473 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19474 long rv_addr = getByteBufferAddress(rv_buf); 19475 _imaqMeasureParticle(image.getAddress(), particleNumber, calibrated, measurement.getValue(), rv_addr+0); 19476 double value; 19477 value = rv_buf.getDouble(0); 19478 return value; 19479 } 19480 private static native void _imaqMeasureParticle(long image, int particleNumber, int calibrated, int measurement, long value); 19481 19482 public static MeasureParticlesReport imaqMeasureParticles(Image image, MeasureParticlesCalibrationMode calibrationMode, MeasurementType[] measurements) { 19483 int numMeasurements = measurements.length; 19484 ByteBuffer measurements_buf = null; 19485 measurements_buf = ByteBuffer.allocateDirect(measurements.length*4).order(ByteOrder.nativeOrder()); 19486 for (int i=0, off=0; i<measurements.length; i++, off += 4) { 19487 if (measurements != null) 19488 measurements_buf.putInt(off, measurements[i].getValue()); 19489 } 19490 long jn_rv = _imaqMeasureParticles(image.getAddress(), calibrationMode.getValue(), getByteBufferAddress(measurements_buf), numMeasurements); 19491 19492 return new MeasureParticlesReport(jn_rv, true); 19493 } 19494 private static native long _imaqMeasureParticles(long image, int calibrationMode, long measurements, int numMeasurements); 19495 19496 public static int imaqParticleFilter4(Image dest, Image source, ParticleFilterCriteria2[] criteria, ParticleFilterOptions2 options, ROI roi) { 19497 int criteriaCount = criteria.length; 19498 ByteBuffer criteria_buf = null; 19499 criteria_buf = ByteBuffer.allocateDirect(criteria.length*20).order(ByteOrder.nativeOrder()); 19500 for (int i=0, off=0; i<criteria.length; i++, off += 20) { 19501 criteria[i].setBuffer(criteria_buf, off); 19502 criteria[i].write(); 19503 } 19504 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19505 long rv_addr = getByteBufferAddress(rv_buf); 19506 _imaqParticleFilter4(dest.getAddress(), source.getAddress(), getByteBufferAddress(criteria_buf), criteriaCount, options.getAddress(), roi == null ? 0 : roi.getAddress(), rv_addr+0); 19507 int numParticles; 19508 numParticles = rv_buf.getInt(0); 19509 return numParticles; 19510 } 19511 private static native void _imaqParticleFilter4(long dest, long source, long criteria, int criteriaCount, long options, long roi, long numParticles); 19512 19513 /** 19514 * Morphology functions 19515 */ 19516 19517 public static void imaqConvexHull(Image dest, Image source, int connectivity8) { 19518 19519 _imaqConvexHull(dest.getAddress(), source.getAddress(), connectivity8); 19520 19521 } 19522 private static native void _imaqConvexHull(long dest, long source, int connectivity8); 19523 19524 public static void imaqDanielssonDistance(Image dest, Image source) { 19525 19526 _imaqDanielssonDistance(dest.getAddress(), source.getAddress()); 19527 19528 } 19529 private static native void _imaqDanielssonDistance(long dest, long source); 19530 19531 public static void imaqFillHoles(Image dest, Image source, int connectivity8) { 19532 19533 _imaqFillHoles(dest.getAddress(), source.getAddress(), connectivity8); 19534 19535 } 19536 private static native void _imaqFillHoles(long dest, long source, int connectivity8); 19537 19538 public static class FindCirclesResult { 19539 public CircleReport[] array; 19540 private long array_addr; 19541 private FindCirclesResult(ByteBuffer rv_buf, long jn_rv) { 19542 array_addr = jn_rv; 19543 int array_numCircles; 19544 array_numCircles = rv_buf.getInt(0); 19545 array = new CircleReport[array_numCircles]; 19546 if (array_numCircles > 0 && array_addr != 0) { 19547 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCircles*16); 19548 for (int i=0, off=0; i<array_numCircles; i++, off += 16) { 19549 array[i] = new CircleReport(bb, off); 19550 array[i].read(); 19551 } 19552 } 19553 } 19554 19555 @Override 19556 protected void finalize() throws Throwable { 19557 imaqDispose(array_addr); 19558 super.finalize(); 19559 } 19560 } 19561 19562 public static FindCirclesResult imaqFindCircles(Image dest, Image source, float minRadius, float maxRadius) { 19563 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19564 long rv_addr = getByteBufferAddress(rv_buf); 19565 long jn_rv = _imaqFindCircles(dest.getAddress(), source.getAddress(), minRadius, maxRadius, rv_addr+0); 19566 FindCirclesResult rv = new FindCirclesResult(rv_buf, jn_rv); 19567 return rv; 19568 } 19569 private static native long _imaqFindCircles(long dest, long source, float minRadius, float maxRadius, long numCircles); 19570 19571 public static int imaqLabel2(Image dest, Image source, int connectivity8) { 19572 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19573 long rv_addr = getByteBufferAddress(rv_buf); 19574 _imaqLabel2(dest.getAddress(), source.getAddress(), connectivity8, rv_addr+0); 19575 int particleCount; 19576 particleCount = rv_buf.getInt(0); 19577 return particleCount; 19578 } 19579 private static native void _imaqLabel2(long dest, long source, int connectivity8, long particleCount); 19580 19581 public static void imaqMorphology(Image dest, Image source, MorphologyMethod method, StructuringElement structuringElement) { 19582 19583 _imaqMorphology(dest.getAddress(), source.getAddress(), method.getValue(), structuringElement == null ? 0 : structuringElement.getAddress()); 19584 19585 } 19586 private static native void _imaqMorphology(long dest, long source, int method, long structuringElement); 19587 19588 public static void imaqRejectBorder(Image dest, Image source, int connectivity8) { 19589 19590 _imaqRejectBorder(dest.getAddress(), source.getAddress(), connectivity8); 19591 19592 } 19593 private static native void _imaqRejectBorder(long dest, long source, int connectivity8); 19594 19595 public static void imaqSegmentation(Image dest, Image source) { 19596 19597 _imaqSegmentation(dest.getAddress(), source.getAddress()); 19598 19599 } 19600 private static native void _imaqSegmentation(long dest, long source); 19601 19602 public static void imaqSeparation(Image dest, Image source, int erosions, StructuringElement structuringElement) { 19603 19604 _imaqSeparation(dest.getAddress(), source.getAddress(), erosions, structuringElement == null ? 0 : structuringElement.getAddress()); 19605 19606 } 19607 private static native void _imaqSeparation(long dest, long source, int erosions, long structuringElement); 19608 19609 public static void imaqSimpleDistance(Image dest, Image source, StructuringElement structuringElement) { 19610 19611 _imaqSimpleDistance(dest.getAddress(), source.getAddress(), structuringElement == null ? 0 : structuringElement.getAddress()); 19612 19613 } 19614 private static native void _imaqSimpleDistance(long dest, long source, long structuringElement); 19615 19616 public static void imaqSizeFilter(Image dest, Image source, int connectivity8, int erosions, SizeType keepSize, StructuringElement structuringElement) { 19617 19618 _imaqSizeFilter(dest.getAddress(), source.getAddress(), connectivity8, erosions, keepSize.getValue(), structuringElement == null ? 0 : structuringElement.getAddress()); 19619 19620 } 19621 private static native void _imaqSizeFilter(long dest, long source, int connectivity8, int erosions, int keepSize, long structuringElement); 19622 19623 public static void imaqSkeleton(Image dest, Image source, SkeletonMethod method) { 19624 19625 _imaqSkeleton(dest.getAddress(), source.getAddress(), method.getValue()); 19626 19627 } 19628 private static native void _imaqSkeleton(long dest, long source, int method); 19629 19630 /** 19631 * Acquisition functions 19632 */ 19633 19634 /** 19635 * Arithmetic functions 19636 */ 19637 19638 public static void imaqAbsoluteDifference(Image dest, Image sourceA, Image sourceB) { 19639 19640 _imaqAbsoluteDifference(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19641 19642 } 19643 private static native void _imaqAbsoluteDifference(long dest, long sourceA, long sourceB); 19644 19645 public static void imaqAdd(Image dest, Image sourceA, Image sourceB) { 19646 19647 _imaqAdd(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19648 19649 } 19650 private static native void _imaqAdd(long dest, long sourceA, long sourceB); 19651 19652 public static void imaqAverage(Image dest, Image sourceA, Image sourceB) { 19653 19654 _imaqAverage(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19655 19656 } 19657 private static native void _imaqAverage(long dest, long sourceA, long sourceB); 19658 19659 public static void imaqDivide2(Image dest, Image sourceA, Image sourceB, RoundingMode roundingMode) { 19660 19661 _imaqDivide2(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress(), roundingMode.getValue()); 19662 19663 } 19664 private static native void _imaqDivide2(long dest, long sourceA, long sourceB, int roundingMode); 19665 19666 public static void imaqMax(Image dest, Image sourceA, Image sourceB) { 19667 19668 _imaqMax(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19669 19670 } 19671 private static native void _imaqMax(long dest, long sourceA, long sourceB); 19672 19673 public static void imaqMin(Image dest, Image sourceA, Image sourceB) { 19674 19675 _imaqMin(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19676 19677 } 19678 private static native void _imaqMin(long dest, long sourceA, long sourceB); 19679 19680 public static void imaqModulo(Image dest, Image sourceA, Image sourceB) { 19681 19682 _imaqModulo(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19683 19684 } 19685 private static native void _imaqModulo(long dest, long sourceA, long sourceB); 19686 19687 public static void imaqMulDiv(Image dest, Image sourceA, Image sourceB, float value) { 19688 19689 _imaqMulDiv(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress(), value); 19690 19691 } 19692 private static native void _imaqMulDiv(long dest, long sourceA, long sourceB, float value); 19693 19694 public static void imaqMultiply(Image dest, Image sourceA, Image sourceB) { 19695 19696 _imaqMultiply(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19697 19698 } 19699 private static native void _imaqMultiply(long dest, long sourceA, long sourceB); 19700 19701 public static void imaqSubtract(Image dest, Image sourceA, Image sourceB) { 19702 19703 _imaqSubtract(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 19704 19705 } 19706 private static native void _imaqSubtract(long dest, long sourceA, long sourceB); 19707 19708 /** 19709 * Caliper functions 19710 */ 19711 19712 public static class CaliperToolResult { 19713 public CaliperReport[] array; 19714 private long array_addr; 19715 private CaliperToolResult(ByteBuffer rv_buf, long jn_rv) { 19716 array_addr = jn_rv; 19717 int array_numEdgePairs; 19718 array_numEdgePairs = rv_buf.getInt(0); 19719 array = new CaliperReport[array_numEdgePairs]; 19720 if (array_numEdgePairs > 0 && array_addr != 0) { 19721 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numEdgePairs*32); 19722 for (int i=0, off=0; i<array_numEdgePairs; i++, off += 32) { 19723 array[i] = new CaliperReport(bb, off); 19724 array[i].read(); 19725 } 19726 } 19727 } 19728 19729 @Override 19730 protected void finalize() throws Throwable { 19731 imaqDispose(array_addr); 19732 super.finalize(); 19733 } 19734 } 19735 19736 public static CaliperToolResult imaqCaliperTool(Image image, Point[] points, EdgeOptions edgeOptions, CaliperOptions caliperOptions) { 19737 int numPoints = points.length; 19738 ByteBuffer points_buf = null; 19739 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 19740 for (int i=0, off=0; i<points.length; i++, off += 8) { 19741 points[i].setBuffer(points_buf, off); 19742 points[i].write(); 19743 } 19744 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19745 long rv_addr = getByteBufferAddress(rv_buf); 19746 long jn_rv = _imaqCaliperTool(image.getAddress(), getByteBufferAddress(points_buf), numPoints, edgeOptions.getAddress(), caliperOptions.getAddress(), rv_addr+0); 19747 CaliperToolResult rv = new CaliperToolResult(rv_buf, jn_rv); 19748 return rv; 19749 } 19750 private static native long _imaqCaliperTool(long image, long points, int numPoints, long edgeOptions, long caliperOptions, long numEdgePairs); 19751 19752 public static class ConcentricRake2Result { 19753 public EdgeOptions2 edgeOptions; 19754 public ConcentricRakeReport2 val; 19755 private ConcentricRake2Result(ByteBuffer rv_buf) { 19756 edgeOptions = new EdgeOptions2(rv_buf, 0); 19757 edgeOptions.read(); 19758 } 19759 } 19760 19761 public static ConcentricRake2Result imaqConcentricRake2(Image image, ROI roi, ConcentricRakeDirection direction, EdgeProcess process, int stepSize) { 19762 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19763 long rv_addr = getByteBufferAddress(rv_buf); 19764 long jn_rv = _imaqConcentricRake2(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), stepSize, rv_addr+0); 19765 ConcentricRake2Result rv = new ConcentricRake2Result(rv_buf); 19766 rv.val = new ConcentricRakeReport2(jn_rv, true); 19767 return rv; 19768 } 19769 private static native long _imaqConcentricRake2(long image, long roi, int direction, int process, int stepSize, long edgeOptions); 19770 19771 public static class DetectExtremesResult { 19772 public ExtremeReport[] array; 19773 private long array_addr; 19774 private DetectExtremesResult(ByteBuffer rv_buf, long jn_rv) { 19775 array_addr = jn_rv; 19776 int array_numExtremes; 19777 array_numExtremes = rv_buf.getInt(0); 19778 array = new ExtremeReport[array_numExtremes]; 19779 if (array_numExtremes > 0 && array_addr != 0) { 19780 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numExtremes*24); 19781 for (int i=0, off=0; i<array_numExtremes; i++, off += 24) { 19782 array[i] = new ExtremeReport(bb, off); 19783 array[i].read(); 19784 } 19785 } 19786 } 19787 19788 @Override 19789 protected void finalize() throws Throwable { 19790 imaqDispose(array_addr); 19791 super.finalize(); 19792 } 19793 } 19794 19795 public static DetectExtremesResult imaqDetectExtremes(double[] pixels, DetectionMode mode, DetectExtremesOptions options) { 19796 int numPixels = pixels.length; 19797 ByteBuffer pixels_buf = null; 19798 pixels_buf = ByteBuffer.allocateDirect(pixels.length*8).order(ByteOrder.nativeOrder()); 19799 pixels_buf.asDoubleBuffer().put(pixels).rewind(); 19800 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19801 long rv_addr = getByteBufferAddress(rv_buf); 19802 long jn_rv = _imaqDetectExtremes(getByteBufferAddress(pixels_buf), numPixels, mode.getValue(), options.getAddress(), rv_addr+0); 19803 DetectExtremesResult rv = new DetectExtremesResult(rv_buf, jn_rv); 19804 return rv; 19805 } 19806 private static native long _imaqDetectExtremes(long pixels, int numPixels, int mode, long options, long numExtremes); 19807 19808 public static double imaqDetectRotation(Image referenceImage, Image testImage, PointFloat referenceCenter, PointFloat testCenter, int radius, float precision) { 19809 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19810 long rv_addr = getByteBufferAddress(rv_buf); 19811 _imaqDetectRotation(referenceImage.getAddress(), testImage.getAddress(), referenceCenter.getAddress(), testCenter.getAddress(), radius, precision, rv_addr+0); 19812 double angle; 19813 angle = rv_buf.getDouble(0); 19814 return angle; 19815 } 19816 private static native void _imaqDetectRotation(long referenceImage, long testImage, long referenceCenter, long testCenter, int radius, float precision, long angle); 19817 19818 public static class EdgeTool4Result { 19819 public EdgeOptions2 edgeOptions; 19820 public EdgeReport2 val; 19821 private EdgeTool4Result(ByteBuffer rv_buf) { 19822 edgeOptions = new EdgeOptions2(rv_buf, 0); 19823 edgeOptions.read(); 19824 } 19825 } 19826 19827 public static EdgeTool4Result imaqEdgeTool4(Image image, ROI roi, EdgeProcess processType, int reverseDirection) { 19828 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19829 long rv_addr = getByteBufferAddress(rv_buf); 19830 long jn_rv = _imaqEdgeTool4(image.getAddress(), roi.getAddress(), processType.getValue(), rv_addr+0, reverseDirection); 19831 EdgeTool4Result rv = new EdgeTool4Result(rv_buf); 19832 rv.val = new EdgeReport2(jn_rv, true); 19833 return rv; 19834 } 19835 private static native long _imaqEdgeTool4(long image, long roi, int processType, long edgeOptions, int reverseDirection); 19836 19837 public static FindEdgeReport imaqFindEdge2(Image image, ROI roi, CoordinateSystem baseSystem, CoordinateSystem newSystem, FindEdgeOptions2 findEdgeOptions, StraightEdgeOptions straightEdgeOptions) { 19838 19839 long jn_rv = _imaqFindEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress(), findEdgeOptions.getAddress(), straightEdgeOptions.getAddress()); 19840 19841 return new FindEdgeReport(jn_rv, true); 19842 } 19843 private static native long _imaqFindEdge2(long image, long roi, long baseSystem, long newSystem, long findEdgeOptions, long straightEdgeOptions); 19844 19845 public static class FindTransformRect2Result { 19846 public CoordinateSystem baseSystem; 19847 public CoordinateSystem newSystem; 19848 public AxisReport axisReport; 19849 private FindTransformRect2Result(ByteBuffer rv_buf) { 19850 baseSystem = new CoordinateSystem(rv_buf, 0); 19851 baseSystem.read(); 19852 newSystem = new CoordinateSystem(rv_buf, 8); 19853 newSystem.read(); 19854 axisReport = new AxisReport(rv_buf, 16); 19855 axisReport.read(); 19856 } 19857 } 19858 19859 public static FindTransformRect2Result imaqFindTransformRect2(Image image, ROI roi, FindTransformMode mode, FindTransformRectOptions2 findTransformOptions, StraightEdgeOptions straightEdgeOptions) { 19860 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8).order(ByteOrder.nativeOrder()); 19861 long rv_addr = getByteBufferAddress(rv_buf); 19862 _imaqFindTransformRect2(image.getAddress(), roi.getAddress(), mode.getValue(), rv_addr+0, rv_addr+8, findTransformOptions.getAddress(), straightEdgeOptions.getAddress(), rv_addr+16); 19863 FindTransformRect2Result rv = new FindTransformRect2Result(rv_buf); 19864 return rv; 19865 } 19866 private static native void _imaqFindTransformRect2(long image, long roi, int mode, long baseSystem, long newSystem, long findTransformOptions, long straightEdgeOptions, long axisReport); 19867 19868 public static class FindTransformRects2Result { 19869 public CoordinateSystem baseSystem; 19870 public CoordinateSystem newSystem; 19871 public AxisReport axisReport; 19872 private FindTransformRects2Result(ByteBuffer rv_buf) { 19873 baseSystem = new CoordinateSystem(rv_buf, 0); 19874 baseSystem.read(); 19875 newSystem = new CoordinateSystem(rv_buf, 8); 19876 newSystem.read(); 19877 axisReport = new AxisReport(rv_buf, 16); 19878 axisReport.read(); 19879 } 19880 } 19881 19882 public static FindTransformRects2Result imaqFindTransformRects2(Image image, ROI primaryROI, ROI secondaryROI, FindTransformMode mode, FindTransformRectsOptions2 findTransformOptions, StraightEdgeOptions primaryStraightEdgeOptions, StraightEdgeOptions secondaryStraightEdgeOptions) { 19883 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8).order(ByteOrder.nativeOrder()); 19884 long rv_addr = getByteBufferAddress(rv_buf); 19885 _imaqFindTransformRects2(image.getAddress(), primaryROI.getAddress(), secondaryROI.getAddress(), mode.getValue(), rv_addr+0, rv_addr+8, findTransformOptions.getAddress(), primaryStraightEdgeOptions.getAddress(), secondaryStraightEdgeOptions.getAddress(), rv_addr+16); 19886 FindTransformRects2Result rv = new FindTransformRects2Result(rv_buf); 19887 return rv; 19888 } 19889 private static native void _imaqFindTransformRects2(long image, long primaryROI, long secondaryROI, int mode, long baseSystem, long newSystem, long findTransformOptions, long primaryStraightEdgeOptions, long secondaryStraightEdgeOptions, long axisReport); 19890 19891 public static float imaqLineGaugeTool2(Image image, Point start, Point end, LineGaugeMethod method, EdgeOptions edgeOptions, CoordinateTransform2 transform) { 19892 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19893 long rv_addr = getByteBufferAddress(rv_buf); 19894 _imaqLineGaugeTool2(image.getAddress(), start.getAddress(), end.getAddress(), method.getValue(), edgeOptions.getAddress(), transform.getAddress(), rv_addr+0); 19895 float distance; 19896 distance = rv_buf.getFloat(0); 19897 return distance; 19898 } 19899 private static native void _imaqLineGaugeTool2(long image, long start, long end, int method, long edgeOptions, long transform, long distance); 19900 19901 public static class Rake2Result { 19902 public EdgeOptions2 edgeOptions; 19903 public RakeReport2 val; 19904 private Rake2Result(ByteBuffer rv_buf) { 19905 edgeOptions = new EdgeOptions2(rv_buf, 0); 19906 edgeOptions.read(); 19907 } 19908 } 19909 19910 public static Rake2Result imaqRake2(Image image, ROI roi, RakeDirection direction, EdgeProcess process, int stepSize) { 19911 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19912 long rv_addr = getByteBufferAddress(rv_buf); 19913 long jn_rv = _imaqRake2(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), stepSize, rv_addr+0); 19914 Rake2Result rv = new Rake2Result(rv_buf); 19915 rv.val = new RakeReport2(jn_rv, true); 19916 return rv; 19917 } 19918 private static native long _imaqRake2(long image, long roi, int direction, int process, int stepSize, long edgeOptions); 19919 19920 public static class SimpleEdgeResult { 19921 public PointFloat[] array; 19922 private long array_addr; 19923 private SimpleEdgeResult(ByteBuffer rv_buf, long jn_rv) { 19924 array_addr = jn_rv; 19925 int array_numEdges; 19926 array_numEdges = rv_buf.getInt(0); 19927 array = new PointFloat[array_numEdges]; 19928 if (array_numEdges > 0 && array_addr != 0) { 19929 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numEdges*8); 19930 for (int i=0, off=0; i<array_numEdges; i++, off += 8) { 19931 array[i] = new PointFloat(bb, off); 19932 array[i].read(); 19933 } 19934 } 19935 } 19936 19937 @Override 19938 protected void finalize() throws Throwable { 19939 imaqDispose(array_addr); 19940 super.finalize(); 19941 } 19942 } 19943 19944 public static SimpleEdgeResult imaqSimpleEdge(Image image, Point[] points, SimpleEdgeOptions options) { 19945 int numPoints = points.length; 19946 ByteBuffer points_buf = null; 19947 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 19948 for (int i=0, off=0; i<points.length; i++, off += 8) { 19949 points[i].setBuffer(points_buf, off); 19950 points[i].write(); 19951 } 19952 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19953 long rv_addr = getByteBufferAddress(rv_buf); 19954 long jn_rv = _imaqSimpleEdge(image.getAddress(), getByteBufferAddress(points_buf), numPoints, options.getAddress(), rv_addr+0); 19955 SimpleEdgeResult rv = new SimpleEdgeResult(rv_buf, jn_rv); 19956 return rv; 19957 } 19958 private static native long _imaqSimpleEdge(long image, long points, int numPoints, long options, long numEdges); 19959 19960 public static class Spoke2Result { 19961 public EdgeOptions2 edgeOptions; 19962 public SpokeReport2 val; 19963 private Spoke2Result(ByteBuffer rv_buf) { 19964 edgeOptions = new EdgeOptions2(rv_buf, 0); 19965 edgeOptions.read(); 19966 } 19967 } 19968 19969 public static Spoke2Result imaqSpoke2(Image image, ROI roi, SpokeDirection direction, EdgeProcess process, int stepSize) { 19970 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 19971 long rv_addr = getByteBufferAddress(rv_buf); 19972 long jn_rv = _imaqSpoke2(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), stepSize, rv_addr+0); 19973 Spoke2Result rv = new Spoke2Result(rv_buf); 19974 rv.val = new SpokeReport2(jn_rv, true); 19975 return rv; 19976 } 19977 private static native long _imaqSpoke2(long image, long roi, int direction, int process, int stepSize, long edgeOptions); 19978 19979 public static StraightEdgeReport2 imaqStraightEdge(Image image, ROI roi, SearchDirection searchDirection, EdgeOptions2 edgeOptions, StraightEdgeOptions straightEdgeOptions) { 19980 19981 long jn_rv = _imaqStraightEdge(image.getAddress(), roi.getAddress(), searchDirection.getValue(), edgeOptions.getAddress(), straightEdgeOptions.getAddress()); 19982 19983 return new StraightEdgeReport2(jn_rv, true); 19984 } 19985 private static native long _imaqStraightEdge(long image, long roi, int searchDirection, long edgeOptions, long straightEdgeOptions); 19986 19987 public static StraightEdgeReport2 imaqStraightEdge2(Image image, ROI roi, SearchDirection searchDirection, EdgeOptions2 edgeOptions, StraightEdgeOptions straightEdgeOptions, int optimizedMode) { 19988 19989 long jn_rv = _imaqStraightEdge2(image.getAddress(), roi.getAddress(), searchDirection.getValue(), edgeOptions.getAddress(), straightEdgeOptions.getAddress(), optimizedMode); 19990 19991 return new StraightEdgeReport2(jn_rv, true); 19992 } 19993 private static native long _imaqStraightEdge2(long image, long roi, int searchDirection, long edgeOptions, long straightEdgeOptions, int optimizedMode); 19994 19995 /** 19996 * Spatial Filters functions 19997 */ 19998 19999 public static void imaqCannyEdgeFilter(Image dest, Image source, CannyOptions options) { 20000 20001 _imaqCannyEdgeFilter(dest.getAddress(), source.getAddress(), options == null ? 0 : options.getAddress()); 20002 20003 } 20004 private static native void _imaqCannyEdgeFilter(long dest, long source, long options); 20005 20006 public static void imaqCorrelate(Image dest, Image source, Image templateImage, Rect rect) { 20007 20008 _imaqCorrelate(dest.getAddress(), source.getAddress(), templateImage.getAddress(), rect.getAddress()); 20009 20010 } 20011 private static native void _imaqCorrelate(long dest, long source, long templateImage, long rect); 20012 20013 public static void imaqEdgeFilter(Image dest, Image source, OutlineMethod method, Image mask) { 20014 20015 _imaqEdgeFilter(dest.getAddress(), source.getAddress(), method.getValue(), mask == null ? 0 : mask.getAddress()); 20016 20017 } 20018 private static native void _imaqEdgeFilter(long dest, long source, int method, long mask); 20019 20020 public static void imaqLowPass(Image dest, Image source, int width, int height, float tolerance, Image mask) { 20021 20022 _imaqLowPass(dest.getAddress(), source.getAddress(), width, height, tolerance, mask == null ? 0 : mask.getAddress()); 20023 20024 } 20025 private static native void _imaqLowPass(long dest, long source, int width, int height, float tolerance, long mask); 20026 20027 public static void imaqMedianFilter(Image dest, Image source, int width, int height, Image mask) { 20028 20029 _imaqMedianFilter(dest.getAddress(), source.getAddress(), width, height, mask == null ? 0 : mask.getAddress()); 20030 20031 } 20032 private static native void _imaqMedianFilter(long dest, long source, int width, int height, long mask); 20033 20034 public static void imaqNthOrderFilter(Image dest, Image source, int width, int height, int n, Image mask) { 20035 20036 _imaqNthOrderFilter(dest.getAddress(), source.getAddress(), width, height, n, mask == null ? 0 : mask.getAddress()); 20037 20038 } 20039 private static native void _imaqNthOrderFilter(long dest, long source, int width, int height, int n, long mask); 20040 20041 /** 20042 * Drawing functions 20043 */ 20044 20045 public static void imaqDrawLineOnImage(Image dest, Image source, DrawMode mode, Point start, Point end, float newPixelValue) { 20046 20047 _imaqDrawLineOnImage(dest.getAddress(), source.getAddress(), mode.getValue(), start.getAddress(), end.getAddress(), newPixelValue); 20048 20049 } 20050 private static native void _imaqDrawLineOnImage(long dest, long source, int mode, long start, long end, float newPixelValue); 20051 20052 public static void imaqDrawShapeOnImage(Image dest, Image source, Rect rect, DrawMode mode, ShapeMode shape, float newPixelValue) { 20053 20054 _imaqDrawShapeOnImage(dest.getAddress(), source.getAddress(), rect.getAddress(), mode.getValue(), shape.getValue(), newPixelValue); 20055 20056 } 20057 private static native void _imaqDrawShapeOnImage(long dest, long source, long rect, int mode, int shape, float newPixelValue); 20058 20059 /** 20060 * Interlacing functions 20061 */ 20062 20063 public static void imaqInterlaceCombine(Image frame, Image odd, Image even) { 20064 20065 _imaqInterlaceCombine(frame.getAddress(), odd.getAddress(), even.getAddress()); 20066 20067 } 20068 private static native void _imaqInterlaceCombine(long frame, long odd, long even); 20069 20070 public static void imaqInterlaceSeparate(Image frame, Image odd, Image even) { 20071 20072 _imaqInterlaceSeparate(frame.getAddress(), odd == null ? 0 : odd.getAddress(), even == null ? 0 : even.getAddress()); 20073 20074 } 20075 private static native void _imaqInterlaceSeparate(long frame, long odd, long even); 20076 20077 /** 20078 * Image Information functions 20079 */ 20080 20081 public static class EnumerateCustomKeysResult { 20082 public String[] array; 20083 private long array_addr; 20084 private EnumerateCustomKeysResult(ByteBuffer rv_buf, long jn_rv) { 20085 array_addr = jn_rv; 20086 int array_size; 20087 array_size = rv_buf.getInt(0); 20088 array = new String[array_size]; 20089 if (array_size > 0 && array_addr != 0) { 20090 ByteBuffer bb = newDirectByteBuffer(array_addr, array_size*4); 20091 for (int i=0, off=0; i<array_size; i++, off += 4) { 20092 long addr = getPointer(bb, off); 20093 if (addr == 0) 20094 array[i] = null; 20095 else { 20096 ByteBuffer bb2 = newDirectByteBuffer(addr, 1000); // FIXME 20097 while (bb2.get() != 0) {} 20098 byte[] bytes = new byte[bb2.position()-1]; 20099 bb2.rewind(); 20100 getBytes(bb2, bytes, 0, bytes.length); 20101 try { 20102 array[i] = new String(bytes, "UTF-8"); 20103 } catch (UnsupportedEncodingException e) { 20104 array[i] = ""; 20105 } 20106 } 20107 } 20108 } 20109 } 20110 20111 @Override 20112 protected void finalize() throws Throwable { 20113 imaqDispose(array_addr); 20114 super.finalize(); 20115 } 20116 } 20117 20118 public static EnumerateCustomKeysResult imaqEnumerateCustomKeys(Image image) { 20119 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20120 long rv_addr = getByteBufferAddress(rv_buf); 20121 long jn_rv = _imaqEnumerateCustomKeys(image.getAddress(), rv_addr+0); 20122 EnumerateCustomKeysResult rv = new EnumerateCustomKeysResult(rv_buf, jn_rv); 20123 return rv; 20124 } 20125 private static native long _imaqEnumerateCustomKeys(long image, long size); 20126 20127 public static int imaqGetBitDepth(Image image) { 20128 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20129 long rv_addr = getByteBufferAddress(rv_buf); 20130 _imaqGetBitDepth(image.getAddress(), rv_addr+0); 20131 int bitDepth; 20132 bitDepth = rv_buf.getInt(0); 20133 return bitDepth; 20134 } 20135 private static native void _imaqGetBitDepth(long image, long bitDepth); 20136 20137 public static int imaqGetBytesPerPixel(Image image) { 20138 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20139 long rv_addr = getByteBufferAddress(rv_buf); 20140 _imaqGetBytesPerPixel(image.getAddress(), rv_addr+0); 20141 int byteCount; 20142 byteCount = rv_buf.getInt(0); 20143 return byteCount; 20144 } 20145 private static native void _imaqGetBytesPerPixel(long image, long byteCount); 20146 20147 public static ImageInfo imaqGetImageInfo(Image image) { 20148 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20149 long rv_addr = getByteBufferAddress(rv_buf); 20150 _imaqGetImageInfo(image.getAddress(), rv_addr+0); 20151 ImageInfo info; 20152 info = new ImageInfo(rv_buf, 0); 20153 info.read(); 20154 return info; 20155 } 20156 private static native void _imaqGetImageInfo(long image, long info); 20157 20158 public static class GetImageSizeResult { 20159 public int width; 20160 public int height; 20161 private GetImageSizeResult(ByteBuffer rv_buf) { 20162 width = rv_buf.getInt(0); 20163 height = rv_buf.getInt(8); 20164 } 20165 } 20166 20167 public static GetImageSizeResult imaqGetImageSize(Image image) { 20168 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 20169 long rv_addr = getByteBufferAddress(rv_buf); 20170 _imaqGetImageSize(image.getAddress(), rv_addr+0, rv_addr+8); 20171 GetImageSizeResult rv = new GetImageSizeResult(rv_buf); 20172 return rv; 20173 } 20174 private static native void _imaqGetImageSize(long image, long width, long height); 20175 20176 public static ImageType imaqGetImageType(Image image) { 20177 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20178 long rv_addr = getByteBufferAddress(rv_buf); 20179 _imaqGetImageType(image.getAddress(), rv_addr+0); 20180 ImageType type; 20181 type = ImageType.fromValue(rv_buf.getInt(0)); 20182 return type; 20183 } 20184 private static native void _imaqGetImageType(long image, long type); 20185 20186 public static Point imaqGetMaskOffset(Image image) { 20187 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20188 long rv_addr = getByteBufferAddress(rv_buf); 20189 _imaqGetMaskOffset(image.getAddress(), rv_addr+0); 20190 Point offset; 20191 offset = new Point(rv_buf, 0); 20192 offset.read(); 20193 return offset; 20194 } 20195 private static native void _imaqGetMaskOffset(long image, long offset); 20196 20197 public static int imaqGetVisionInfoTypes(Image image) { 20198 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20199 long rv_addr = getByteBufferAddress(rv_buf); 20200 _imaqGetVisionInfoTypes(image.getAddress(), rv_addr+0); 20201 int present; 20202 present = rv_buf.getInt(0); 20203 return present; 20204 } 20205 private static native void _imaqGetVisionInfoTypes(long image, long present); 20206 20207 public static int imaqIsImageEmpty(Image image) { 20208 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20209 long rv_addr = getByteBufferAddress(rv_buf); 20210 _imaqIsImageEmpty(image.getAddress(), rv_addr+0); 20211 int empty; 20212 empty = rv_buf.getInt(0); 20213 return empty; 20214 } 20215 private static native void _imaqIsImageEmpty(long image, long empty); 20216 20217 public static RawData imaqReadCustomData(Image image, String key) { 20218 ByteBuffer key_buf = null; 20219 if (key != null) { 20220 byte[] key_bytes; 20221 try { 20222 key_bytes = key.getBytes("UTF-8"); 20223 } catch (UnsupportedEncodingException e) { 20224 key_bytes = new byte[0]; 20225 } 20226 key_buf = ByteBuffer.allocateDirect(key_bytes.length+1); 20227 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte)0); 20228 } 20229 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20230 long rv_addr = getByteBufferAddress(rv_buf); 20231 long jn_rv = _imaqReadCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf), rv_addr+0); 20232 int size; 20233 RawData val; 20234 size = rv_buf.getInt(0); 20235 val = new RawData(jn_rv, false, size); 20236 return val; 20237 } 20238 private static native long _imaqReadCustomData(long image, long key, long size); 20239 20240 public static void imaqRemoveCustomData(Image image, String key) { 20241 ByteBuffer key_buf = null; 20242 if (key != null) { 20243 byte[] key_bytes; 20244 try { 20245 key_bytes = key.getBytes("UTF-8"); 20246 } catch (UnsupportedEncodingException e) { 20247 key_bytes = new byte[0]; 20248 } 20249 key_buf = ByteBuffer.allocateDirect(key_bytes.length+1); 20250 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte)0); 20251 } 20252 _imaqRemoveCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf)); 20253 20254 } 20255 private static native void _imaqRemoveCustomData(long image, long key); 20256 20257 public static void imaqRemoveVisionInfo2(Image image, int info) { 20258 20259 _imaqRemoveVisionInfo2(image.getAddress(), info); 20260 20261 } 20262 private static native void _imaqRemoveVisionInfo2(long image, int info); 20263 20264 public static void imaqSetBitDepth(Image image, int bitDepth) { 20265 20266 _imaqSetBitDepth(image.getAddress(), bitDepth); 20267 20268 } 20269 private static native void _imaqSetBitDepth(long image, int bitDepth); 20270 20271 public static void imaqSetImageSize(Image image, int width, int height) { 20272 20273 _imaqSetImageSize(image.getAddress(), width, height); 20274 20275 } 20276 private static native void _imaqSetImageSize(long image, int width, int height); 20277 20278 public static void imaqSetMaskOffset(Image image, Point offset) { 20279 20280 _imaqSetMaskOffset(image.getAddress(), offset.getAddress()); 20281 20282 } 20283 private static native void _imaqSetMaskOffset(long image, long offset); 20284 20285 public static void imaqWriteCustomData(Image image, String key, RawData data, int size) { 20286 ByteBuffer key_buf = null; 20287 if (key != null) { 20288 byte[] key_bytes; 20289 try { 20290 key_bytes = key.getBytes("UTF-8"); 20291 } catch (UnsupportedEncodingException e) { 20292 key_bytes = new byte[0]; 20293 } 20294 key_buf = ByteBuffer.allocateDirect(key_bytes.length+1); 20295 putBytes(key_buf, key_bytes, 0, key_bytes.length).put(key_bytes.length, (byte)0); 20296 } 20297 _imaqWriteCustomData(image.getAddress(), key == null ? 0 : getByteBufferAddress(key_buf), data.getAddress(), size); 20298 20299 } 20300 private static native void _imaqWriteCustomData(long image, long key, long data, int size); 20301 20302 /** 20303 * Display functions 20304 */ 20305 20306 /** 20307 * Image Manipulation functions 20308 */ 20309 20310 public static void imaqCopyRect(Image dest, Image source, Rect rect, Point destLoc) { 20311 20312 _imaqCopyRect(dest.getAddress(), source.getAddress(), rect.getAddress(), destLoc.getAddress()); 20313 20314 } 20315 private static native void _imaqCopyRect(long dest, long source, long rect, long destLoc); 20316 20317 public static void imaqDuplicate(Image dest, Image source) { 20318 20319 _imaqDuplicate(dest.getAddress(), source.getAddress()); 20320 20321 } 20322 private static native void _imaqDuplicate(long dest, long source); 20323 20324 public static RawData imaqFlatten(Image image, FlattenType type, CompressionType compression, int quality) { 20325 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20326 long rv_addr = getByteBufferAddress(rv_buf); 20327 long jn_rv = _imaqFlatten(image.getAddress(), type.getValue(), compression.getValue(), quality, rv_addr+0); 20328 int size; 20329 RawData val; 20330 size = rv_buf.getInt(0); 20331 val = new RawData(jn_rv, true, size); 20332 return val; 20333 } 20334 private static native long _imaqFlatten(long image, int type, int compression, int quality, long size); 20335 20336 public static void imaqFlip(Image dest, Image source, FlipAxis axis) { 20337 20338 _imaqFlip(dest.getAddress(), source.getAddress(), axis.getValue()); 20339 20340 } 20341 private static native void _imaqFlip(long dest, long source, int axis); 20342 20343 public static void imaqMask(Image dest, Image source, Image mask) { 20344 20345 _imaqMask(dest.getAddress(), source.getAddress(), mask.getAddress()); 20346 20347 } 20348 private static native void _imaqMask(long dest, long source, long mask); 20349 20350 public static void imaqResample(Image dest, Image source, int newWidth, int newHeight, InterpolationMethod method, Rect rect) { 20351 20352 _imaqResample(dest.getAddress(), source.getAddress(), newWidth, newHeight, method.getValue(), rect.getAddress()); 20353 20354 } 20355 private static native void _imaqResample(long dest, long source, int newWidth, int newHeight, int method, long rect); 20356 20357 public static void imaqScale(Image dest, Image source, int xScale, int yScale, ScalingMode scaleMode, Rect rect) { 20358 20359 _imaqScale(dest.getAddress(), source.getAddress(), xScale, yScale, scaleMode.getValue(), rect.getAddress()); 20360 20361 } 20362 private static native void _imaqScale(long dest, long source, int xScale, int yScale, int scaleMode, long rect); 20363 20364 public static void imaqTranspose(Image dest, Image source) { 20365 20366 _imaqTranspose(dest.getAddress(), source.getAddress()); 20367 20368 } 20369 private static native void _imaqTranspose(long dest, long source); 20370 20371 public static void imaqUnflatten(Image image, RawData data, int size) { 20372 20373 _imaqUnflatten(image.getAddress(), data.getAddress(), size); 20374 20375 } 20376 private static native void _imaqUnflatten(long image, long data, int size); 20377 20378 public static void imaqUnwrapImage(Image dest, Image source, Annulus annulus, RectOrientation orientation, InterpolationMethod method) { 20379 20380 _imaqUnwrapImage(dest.getAddress(), source.getAddress(), annulus.getAddress(), orientation.getValue(), method.getValue()); 20381 20382 } 20383 private static native void _imaqUnwrapImage(long dest, long source, long annulus, int orientation, int method); 20384 20385 public static void imaqView3D(Image dest, Image source, View3DOptions options) { 20386 20387 _imaqView3D(dest.getAddress(), source.getAddress(), options.getAddress()); 20388 20389 } 20390 private static native void _imaqView3D(long dest, long source, long options); 20391 20392 /** 20393 * File I/O functions 20394 */ 20395 20396 public static class GetFileInfoResult { 20397 public CalibrationUnit calibrationUnit; 20398 public float calibrationX; 20399 public float calibrationY; 20400 public int width; 20401 public int height; 20402 public ImageType imageType; 20403 private GetFileInfoResult(ByteBuffer rv_buf) { 20404 calibrationUnit = CalibrationUnit.fromValue(rv_buf.getInt(0)); 20405 calibrationX = rv_buf.getFloat(8); 20406 calibrationY = rv_buf.getFloat(16); 20407 width = rv_buf.getInt(24); 20408 height = rv_buf.getInt(32); 20409 imageType = ImageType.fromValue(rv_buf.getInt(40)); 20410 } 20411 } 20412 20413 public static GetFileInfoResult imaqGetFileInfo(String fileName) { 20414 ByteBuffer fileName_buf = null; 20415 if (fileName != null) { 20416 byte[] fileName_bytes; 20417 try { 20418 fileName_bytes = fileName.getBytes("UTF-8"); 20419 } catch (UnsupportedEncodingException e) { 20420 fileName_bytes = new byte[0]; 20421 } 20422 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20423 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20424 } 20425 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8+8+8+8).order(ByteOrder.nativeOrder()); 20426 long rv_addr = getByteBufferAddress(rv_buf); 20427 _imaqGetFileInfo(fileName == null ? 0 : getByteBufferAddress(fileName_buf), rv_addr+0, rv_addr+8, rv_addr+16, rv_addr+24, rv_addr+32, rv_addr+40); 20428 GetFileInfoResult rv = new GetFileInfoResult(rv_buf); 20429 return rv; 20430 } 20431 private static native void _imaqGetFileInfo(long fileName, long calibrationUnit, long calibrationX, long calibrationY, long width, long height, long imageType); 20432 20433 public static void imaqReadFile(Image image, String fileName) { 20434 ByteBuffer fileName_buf; 20435 byte[] fileName_bytes; 20436 try { 20437 fileName_bytes = fileName.getBytes("UTF-8"); 20438 } catch (UnsupportedEncodingException e) { 20439 fileName_bytes = new byte[0]; 20440 } 20441 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20442 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20443 _imaqReadFile(image.getAddress(), getByteBufferAddress(fileName_buf), 0, 0); 20444 } 20445 private static native void _imaqReadFile(long image, long fileName, long colorTable, long numColors); 20446 20447 public static class ReadVisionFileResult { 20448 public RGBValue colorTable; 20449 public int numColors; 20450 private ReadVisionFileResult(ByteBuffer rv_buf) { 20451 colorTable = new RGBValue(rv_buf, 0); 20452 colorTable.read(); 20453 numColors = rv_buf.getInt(8); 20454 } 20455 } 20456 20457 public static ReadVisionFileResult imaqReadVisionFile(Image image, String fileName) { 20458 ByteBuffer fileName_buf = null; 20459 if (fileName != null) { 20460 byte[] fileName_bytes; 20461 try { 20462 fileName_bytes = fileName.getBytes("UTF-8"); 20463 } catch (UnsupportedEncodingException e) { 20464 fileName_bytes = new byte[0]; 20465 } 20466 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20467 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20468 } 20469 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 20470 long rv_addr = getByteBufferAddress(rv_buf); 20471 _imaqReadVisionFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), rv_addr+0, rv_addr+8); 20472 ReadVisionFileResult rv = new ReadVisionFileResult(rv_buf); 20473 return rv; 20474 } 20475 private static native void _imaqReadVisionFile(long image, long fileName, long colorTable, long numColors); 20476 20477 public static void imaqWriteBMPFile(Image image, String fileName, int compress, RGBValue colorTable) { 20478 ByteBuffer fileName_buf = null; 20479 if (fileName != null) { 20480 byte[] fileName_bytes; 20481 try { 20482 fileName_bytes = fileName.getBytes("UTF-8"); 20483 } catch (UnsupportedEncodingException e) { 20484 fileName_bytes = new byte[0]; 20485 } 20486 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20487 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20488 } 20489 _imaqWriteBMPFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), compress, colorTable == null ? 0 : colorTable.getAddress()); 20490 20491 } 20492 private static native void _imaqWriteBMPFile(long image, long fileName, int compress, long colorTable); 20493 20494 public static void imaqWriteFile(Image image, String fileName, RGBValue colorTable) { 20495 ByteBuffer fileName_buf = null; 20496 if (fileName != null) { 20497 byte[] fileName_bytes; 20498 try { 20499 fileName_bytes = fileName.getBytes("UTF-8"); 20500 } catch (UnsupportedEncodingException e) { 20501 fileName_bytes = new byte[0]; 20502 } 20503 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20504 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20505 } 20506 _imaqWriteFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), colorTable == null ? 0 : colorTable.getAddress()); 20507 20508 } 20509 private static native void _imaqWriteFile(long image, long fileName, long colorTable); 20510 20511 public static void imaqWriteJPEGFile(Image image, String fileName, int quality, RawData colorTable) { 20512 ByteBuffer fileName_buf = null; 20513 if (fileName != null) { 20514 byte[] fileName_bytes; 20515 try { 20516 fileName_bytes = fileName.getBytes("UTF-8"); 20517 } catch (UnsupportedEncodingException e) { 20518 fileName_bytes = new byte[0]; 20519 } 20520 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20521 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20522 } 20523 _imaqWriteJPEGFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), quality, colorTable == null ? 0 : colorTable.getAddress()); 20524 20525 } 20526 private static native void _imaqWriteJPEGFile(long image, long fileName, int quality, long colorTable); 20527 20528 public static void imaqWritePNGFile2(Image image, String fileName, int compressionSpeed, RGBValue colorTable, int useBitDepth) { 20529 ByteBuffer fileName_buf = null; 20530 if (fileName != null) { 20531 byte[] fileName_bytes; 20532 try { 20533 fileName_bytes = fileName.getBytes("UTF-8"); 20534 } catch (UnsupportedEncodingException e) { 20535 fileName_bytes = new byte[0]; 20536 } 20537 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20538 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20539 } 20540 _imaqWritePNGFile2(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), compressionSpeed, colorTable == null ? 0 : colorTable.getAddress(), useBitDepth); 20541 20542 } 20543 private static native void _imaqWritePNGFile2(long image, long fileName, int compressionSpeed, long colorTable, int useBitDepth); 20544 20545 public static void imaqWriteTIFFFile(Image image, String fileName, TIFFFileOptions options, RGBValue colorTable) { 20546 ByteBuffer fileName_buf = null; 20547 if (fileName != null) { 20548 byte[] fileName_bytes; 20549 try { 20550 fileName_bytes = fileName.getBytes("UTF-8"); 20551 } catch (UnsupportedEncodingException e) { 20552 fileName_bytes = new byte[0]; 20553 } 20554 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20555 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20556 } 20557 _imaqWriteTIFFFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), options == null ? 0 : options.getAddress(), colorTable == null ? 0 : colorTable.getAddress()); 20558 20559 } 20560 private static native void _imaqWriteTIFFFile(long image, long fileName, long options, long colorTable); 20561 20562 public static void imaqWriteVisionFile(Image image, String fileName, RGBValue colorTable) { 20563 ByteBuffer fileName_buf = null; 20564 if (fileName != null) { 20565 byte[] fileName_bytes; 20566 try { 20567 fileName_bytes = fileName.getBytes("UTF-8"); 20568 } catch (UnsupportedEncodingException e) { 20569 fileName_bytes = new byte[0]; 20570 } 20571 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 20572 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 20573 } 20574 _imaqWriteVisionFile(image.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), colorTable.getAddress()); 20575 20576 } 20577 private static native void _imaqWriteVisionFile(long image, long fileName, long colorTable); 20578 20579 /** 20580 * Analytic Geometry functions 20581 */ 20582 20583 public static CoordinateSystem imaqBuildCoordinateSystem(Point points, ReferenceMode mode, AxisOrientation orientation) { 20584 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20585 long rv_addr = getByteBufferAddress(rv_buf); 20586 _imaqBuildCoordinateSystem(points.getAddress(), mode.getValue(), orientation.getValue(), rv_addr+0); 20587 CoordinateSystem system; 20588 system = new CoordinateSystem(rv_buf, 0); 20589 system.read(); 20590 return system; 20591 } 20592 private static native void _imaqBuildCoordinateSystem(long points, int mode, int orientation, long system); 20593 20594 public static BestCircle2 imaqFitCircle2(PointFloat[] points, FitCircleOptions options) { 20595 int numPoints = points.length; 20596 ByteBuffer points_buf = null; 20597 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 20598 for (int i=0, off=0; i<points.length; i++, off += 8) { 20599 points[i].setBuffer(points_buf, off); 20600 points[i].write(); 20601 } 20602 long jn_rv = _imaqFitCircle2(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 20603 20604 return new BestCircle2(jn_rv, true); 20605 } 20606 private static native long _imaqFitCircle2(long points, int numPoints, long options); 20607 20608 public static BestEllipse2 imaqFitEllipse2(PointFloat[] points, FitEllipseOptions options) { 20609 int numPoints = points.length; 20610 ByteBuffer points_buf = null; 20611 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 20612 for (int i=0, off=0; i<points.length; i++, off += 8) { 20613 points[i].setBuffer(points_buf, off); 20614 points[i].write(); 20615 } 20616 long jn_rv = _imaqFitEllipse2(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 20617 20618 return new BestEllipse2(jn_rv, true); 20619 } 20620 private static native long _imaqFitEllipse2(long points, int numPoints, long options); 20621 20622 public static BestLine imaqFitLine(PointFloat[] points, FitLineOptions options) { 20623 int numPoints = points.length; 20624 ByteBuffer points_buf = null; 20625 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 20626 for (int i=0, off=0; i<points.length; i++, off += 8) { 20627 points[i].setBuffer(points_buf, off); 20628 points[i].write(); 20629 } 20630 long jn_rv = _imaqFitLine(getByteBufferAddress(points_buf), numPoints, options.getAddress()); 20631 20632 return new BestLine(jn_rv, true); 20633 } 20634 private static native long _imaqFitLine(long points, int numPoints, long options); 20635 20636 public static float imaqGetAngle(PointFloat start1, PointFloat end1, PointFloat start2, PointFloat end2) { 20637 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20638 long rv_addr = getByteBufferAddress(rv_buf); 20639 _imaqGetAngle(start1.getAddress(), end1.getAddress(), start2.getAddress(), end2.getAddress(), rv_addr+0); 20640 float angle; 20641 angle = rv_buf.getFloat(0); 20642 return angle; 20643 } 20644 private static native void _imaqGetAngle(long start1, long end1, long start2, long end2, long angle); 20645 20646 public static class GetBisectingLineResult { 20647 public PointFloat bisectStart; 20648 public PointFloat bisectEnd; 20649 private GetBisectingLineResult(ByteBuffer rv_buf) { 20650 bisectStart = new PointFloat(rv_buf, 0); 20651 bisectStart.read(); 20652 bisectEnd = new PointFloat(rv_buf, 8); 20653 bisectEnd.read(); 20654 } 20655 } 20656 20657 public static GetBisectingLineResult imaqGetBisectingLine(PointFloat start1, PointFloat end1, PointFloat start2, PointFloat end2) { 20658 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 20659 long rv_addr = getByteBufferAddress(rv_buf); 20660 _imaqGetBisectingLine(start1.getAddress(), end1.getAddress(), start2.getAddress(), end2.getAddress(), rv_addr+0, rv_addr+8); 20661 GetBisectingLineResult rv = new GetBisectingLineResult(rv_buf); 20662 return rv; 20663 } 20664 private static native void _imaqGetBisectingLine(long start1, long end1, long start2, long end2, long bisectStart, long bisectEnd); 20665 20666 public static float imaqGetDistance(PointFloat point1, PointFloat point2) { 20667 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20668 long rv_addr = getByteBufferAddress(rv_buf); 20669 _imaqGetDistance(point1.getAddress(), point2.getAddress(), rv_addr+0); 20670 float distance; 20671 distance = rv_buf.getFloat(0); 20672 return distance; 20673 } 20674 private static native void _imaqGetDistance(long point1, long point2, long distance); 20675 20676 public static PointFloat imaqGetIntersection(PointFloat start1, PointFloat end1, PointFloat start2, PointFloat end2) { 20677 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20678 long rv_addr = getByteBufferAddress(rv_buf); 20679 _imaqGetIntersection(start1.getAddress(), end1.getAddress(), start2.getAddress(), end2.getAddress(), rv_addr+0); 20680 PointFloat intersection; 20681 intersection = new PointFloat(rv_buf, 0); 20682 intersection.read(); 20683 return intersection; 20684 } 20685 private static native void _imaqGetIntersection(long start1, long end1, long start2, long end2, long intersection); 20686 20687 public static class GetMidLineResult { 20688 public PointFloat midLineStart; 20689 public PointFloat midLineEnd; 20690 private GetMidLineResult(ByteBuffer rv_buf) { 20691 midLineStart = new PointFloat(rv_buf, 0); 20692 midLineStart.read(); 20693 midLineEnd = new PointFloat(rv_buf, 8); 20694 midLineEnd.read(); 20695 } 20696 } 20697 20698 public static GetMidLineResult imaqGetMidLine(PointFloat refLineStart, PointFloat refLineEnd, PointFloat point) { 20699 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 20700 long rv_addr = getByteBufferAddress(rv_buf); 20701 _imaqGetMidLine(refLineStart.getAddress(), refLineEnd.getAddress(), point.getAddress(), rv_addr+0, rv_addr+8); 20702 GetMidLineResult rv = new GetMidLineResult(rv_buf); 20703 return rv; 20704 } 20705 private static native void _imaqGetMidLine(long refLineStart, long refLineEnd, long point, long midLineStart, long midLineEnd); 20706 20707 public static class GetPerpendicularLineResult { 20708 public PointFloat perpLineStart; 20709 public PointFloat perpLineEnd; 20710 public double distance; 20711 private GetPerpendicularLineResult(ByteBuffer rv_buf) { 20712 perpLineStart = new PointFloat(rv_buf, 0); 20713 perpLineStart.read(); 20714 perpLineEnd = new PointFloat(rv_buf, 8); 20715 perpLineEnd.read(); 20716 distance = rv_buf.getDouble(16); 20717 } 20718 } 20719 20720 public static GetPerpendicularLineResult imaqGetPerpendicularLine(PointFloat refLineStart, PointFloat refLineEnd, PointFloat point) { 20721 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8).order(ByteOrder.nativeOrder()); 20722 long rv_addr = getByteBufferAddress(rv_buf); 20723 _imaqGetPerpendicularLine(refLineStart.getAddress(), refLineEnd.getAddress(), point.getAddress(), rv_addr+0, rv_addr+8, rv_addr+16); 20724 GetPerpendicularLineResult rv = new GetPerpendicularLineResult(rv_buf); 20725 return rv; 20726 } 20727 private static native void _imaqGetPerpendicularLine(long refLineStart, long refLineEnd, long point, long perpLineStart, long perpLineEnd, long distance); 20728 20729 public static class GetPointsOnContourResult { 20730 public SegmentInfo[] array; 20731 private long array_addr; 20732 private GetPointsOnContourResult(ByteBuffer rv_buf, long jn_rv) { 20733 array_addr = jn_rv; 20734 int array_numSegments; 20735 array_numSegments = rv_buf.getInt(0); 20736 array = new SegmentInfo[array_numSegments]; 20737 if (array_numSegments > 0 && array_addr != 0) { 20738 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numSegments*24); 20739 for (int i=0, off=0; i<array_numSegments; i++, off += 24) { 20740 array[i] = new SegmentInfo(bb, off); 20741 array[i].read(); 20742 } 20743 } 20744 } 20745 20746 @Override 20747 protected void finalize() throws Throwable { 20748 imaqDispose(array_addr); 20749 super.finalize(); 20750 } 20751 } 20752 20753 public static GetPointsOnContourResult imaqGetPointsOnContour(Image image) { 20754 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20755 long rv_addr = getByteBufferAddress(rv_buf); 20756 long jn_rv = _imaqGetPointsOnContour(image.getAddress(), rv_addr+0); 20757 GetPointsOnContourResult rv = new GetPointsOnContourResult(rv_buf, jn_rv); 20758 return rv; 20759 } 20760 private static native long _imaqGetPointsOnContour(long image, long numSegments); 20761 20762 public static class GetPointsOnLineResult { 20763 public Point[] array; 20764 private long array_addr; 20765 private GetPointsOnLineResult(ByteBuffer rv_buf, long jn_rv) { 20766 array_addr = jn_rv; 20767 int array_numPoints; 20768 array_numPoints = rv_buf.getInt(0); 20769 array = new Point[array_numPoints]; 20770 if (array_numPoints > 0 && array_addr != 0) { 20771 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numPoints*8); 20772 for (int i=0, off=0; i<array_numPoints; i++, off += 8) { 20773 array[i] = new Point(bb, off); 20774 array[i].read(); 20775 } 20776 } 20777 } 20778 20779 @Override 20780 protected void finalize() throws Throwable { 20781 imaqDispose(array_addr); 20782 super.finalize(); 20783 } 20784 } 20785 20786 public static GetPointsOnLineResult imaqGetPointsOnLine(Point start, Point end) { 20787 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20788 long rv_addr = getByteBufferAddress(rv_buf); 20789 long jn_rv = _imaqGetPointsOnLine(start.getAddress(), end.getAddress(), rv_addr+0); 20790 GetPointsOnLineResult rv = new GetPointsOnLineResult(rv_buf, jn_rv); 20791 return rv; 20792 } 20793 private static native long _imaqGetPointsOnLine(long start, long end, long numPoints); 20794 20795 public static float imaqGetPolygonArea(PointFloat points, int numPoints) { 20796 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20797 long rv_addr = getByteBufferAddress(rv_buf); 20798 _imaqGetPolygonArea(points.getAddress(), numPoints, rv_addr+0); 20799 float area; 20800 area = rv_buf.getFloat(0); 20801 return area; 20802 } 20803 private static native void _imaqGetPolygonArea(long points, int numPoints, long area); 20804 20805 public static class InterpolatePointsResult { 20806 public float[] array; 20807 private long array_addr; 20808 private InterpolatePointsResult(ByteBuffer rv_buf, long jn_rv) { 20809 array_addr = jn_rv; 20810 int array_interpCount; 20811 array_interpCount = rv_buf.getInt(0); 20812 array = new float[array_interpCount]; 20813 if (array_interpCount > 0 && array_addr != 0) { 20814 newDirectByteBuffer(array_addr, array_interpCount*4).asFloatBuffer().get(array); 20815 } 20816 } 20817 20818 @Override 20819 protected void finalize() throws Throwable { 20820 imaqDispose(array_addr); 20821 super.finalize(); 20822 } 20823 } 20824 20825 public static InterpolatePointsResult imaqInterpolatePoints(Image image, Point[] points, InterpolationMethod method, int subpixel) { 20826 int numPoints = points.length; 20827 ByteBuffer points_buf = null; 20828 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 20829 for (int i=0, off=0; i<points.length; i++, off += 8) { 20830 points[i].setBuffer(points_buf, off); 20831 points[i].write(); 20832 } 20833 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20834 long rv_addr = getByteBufferAddress(rv_buf); 20835 long jn_rv = _imaqInterpolatePoints(image.getAddress(), getByteBufferAddress(points_buf), numPoints, method.getValue(), subpixel, rv_addr+0); 20836 InterpolatePointsResult rv = new InterpolatePointsResult(rv_buf, jn_rv); 20837 return rv; 20838 } 20839 private static native long _imaqInterpolatePoints(long image, long points, int numPoints, int method, int subpixel, long interpCount); 20840 20841 /** 20842 * Clipboard functions 20843 */ 20844 20845 /** 20846 * Border functions 20847 */ 20848 20849 public static void imaqFillBorder(Image image, BorderMethod method) { 20850 20851 _imaqFillBorder(image.getAddress(), method.getValue()); 20852 20853 } 20854 private static native void _imaqFillBorder(long image, int method); 20855 20856 public static int imaqGetBorderSize(Image image) { 20857 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20858 long rv_addr = getByteBufferAddress(rv_buf); 20859 _imaqGetBorderSize(image.getAddress(), rv_addr+0); 20860 int borderSize; 20861 borderSize = rv_buf.getInt(0); 20862 return borderSize; 20863 } 20864 private static native void _imaqGetBorderSize(long image, long borderSize); 20865 20866 public static void imaqSetBorderSize(Image image, int size) { 20867 20868 _imaqSetBorderSize(image.getAddress(), size); 20869 20870 } 20871 private static native void _imaqSetBorderSize(long image, int size); 20872 20873 /** 20874 * Image Management functions 20875 */ 20876 20877 public static void imaqArrayToImage(Image image, RawData array, int numCols, int numRows) { 20878 20879 _imaqArrayToImage(image.getAddress(), array.getAddress(), numCols, numRows); 20880 20881 } 20882 private static native void _imaqArrayToImage(long image, long array, int numCols, int numRows); 20883 20884 public static Image imaqCreateImage(ImageType type, int borderSize) { 20885 20886 long jn_rv = _imaqCreateImage(type.getValue(), borderSize); 20887 20888 return new Image(jn_rv, true); 20889 } 20890 private static native long _imaqCreateImage(int type, int borderSize); 20891 20892 /** 20893 * Color Processing functions 20894 */ 20895 20896 public static void imaqColorBCGTransform(Image dest, Image source, BCGOptions redOptions, BCGOptions greenOptions, BCGOptions blueOptions, Image mask) { 20897 20898 _imaqColorBCGTransform(dest.getAddress(), source.getAddress(), redOptions == null ? 0 : redOptions.getAddress(), greenOptions == null ? 0 : greenOptions.getAddress(), blueOptions == null ? 0 : blueOptions.getAddress(), mask == null ? 0 : mask.getAddress()); 20899 20900 } 20901 private static native void _imaqColorBCGTransform(long dest, long source, long redOptions, long greenOptions, long blueOptions, long mask); 20902 20903 public static void imaqColorEqualize(Image dest, Image source, int colorEqualization) { 20904 20905 _imaqColorEqualize(dest.getAddress(), source.getAddress(), colorEqualization); 20906 20907 } 20908 private static native void _imaqColorEqualize(long dest, long source, int colorEqualization); 20909 20910 public static ColorHistogramReport imaqColorHistogram2(Image image, int numClasses, ColorMode mode, CIEXYZValue whiteReference, Image mask) { 20911 20912 long jn_rv = _imaqColorHistogram2(image.getAddress(), numClasses, mode.getValue(), whiteReference.getAddress(), mask == null ? 0 : mask.getAddress()); 20913 20914 return new ColorHistogramReport(jn_rv, true); 20915 } 20916 private static native long _imaqColorHistogram2(long image, int numClasses, int mode, long whiteReference, long mask); 20917 20918 public static void imaqColorThreshold(Image dest, Image source, int replaceValue, ColorMode mode, Range plane1Range, Range plane2Range, Range plane3Range) { 20919 20920 _imaqColorThreshold(dest.getAddress(), source.getAddress(), replaceValue, mode.getValue(), plane1Range == null ? 0 : plane1Range.getAddress(), plane2Range == null ? 0 : plane2Range.getAddress(), plane3Range == null ? 0 : plane3Range.getAddress()); 20921 20922 } 20923 private static native void _imaqColorThreshold(long dest, long source, int replaceValue, int mode, long plane1Range, long plane2Range, long plane3Range); 20924 20925 public static SupervisedColorSegmentationReport imaqSupervisedColorSegmentation(ClassifierSession session, Image labelImage, Image srcImage, ROI roi, ROILabel labelIn, int numLabelIn, int maxDistance, int minIdentificationScore, ColorSegmenationOptions segmentOptions) { 20926 20927 long jn_rv = _imaqSupervisedColorSegmentation(session.getAddress(), labelImage.getAddress(), srcImage.getAddress(), roi.getAddress(), labelIn.getAddress(), numLabelIn, maxDistance, minIdentificationScore, segmentOptions.getAddress()); 20928 20929 return new SupervisedColorSegmentationReport(jn_rv, true); 20930 } 20931 private static native long _imaqSupervisedColorSegmentation(long session, long labelImage, long srcImage, long roi, long labelIn, int numLabelIn, int maxDistance, int minIdentificationScore, long segmentOptions); 20932 20933 public static int imaqGetColorSegmentationMaxDistance(ClassifierSession session, ColorSegmenationOptions segmentOptions, SegmentationDistanceLevel distLevel) { 20934 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20935 long rv_addr = getByteBufferAddress(rv_buf); 20936 _imaqGetColorSegmentationMaxDistance(session.getAddress(), segmentOptions.getAddress(), distLevel.getValue(), rv_addr+0); 20937 int maxDistance; 20938 maxDistance = rv_buf.getInt(0); 20939 return maxDistance; 20940 } 20941 private static native void _imaqGetColorSegmentationMaxDistance(long session, long segmentOptions, int distLevel, long maxDistance); 20942 20943 /** 20944 * Transform functions 20945 */ 20946 20947 public static void imaqBCGTransform(Image dest, Image source, BCGOptions options, Image mask) { 20948 20949 _imaqBCGTransform(dest.getAddress(), source.getAddress(), options.getAddress(), mask == null ? 0 : mask.getAddress()); 20950 20951 } 20952 private static native void _imaqBCGTransform(long dest, long source, long options, long mask); 20953 20954 public static void imaqEqualize(Image dest, Image source, float min, float max, Image mask) { 20955 20956 _imaqEqualize(dest.getAddress(), source.getAddress(), min, max, mask == null ? 0 : mask.getAddress()); 20957 20958 } 20959 private static native void _imaqEqualize(long dest, long source, float min, float max, long mask); 20960 20961 public static void imaqInverse(Image dest, Image source, Image mask) { 20962 20963 _imaqInverse(dest.getAddress(), source.getAddress(), mask == null ? 0 : mask.getAddress()); 20964 20965 } 20966 private static native void _imaqInverse(long dest, long source, long mask); 20967 20968 public static void imaqMathTransform(Image dest, Image source, MathTransformMethod method, float rangeMin, float rangeMax, float power, Image mask) { 20969 20970 _imaqMathTransform(dest.getAddress(), source.getAddress(), method.getValue(), rangeMin, rangeMax, power, mask == null ? 0 : mask.getAddress()); 20971 20972 } 20973 private static native void _imaqMathTransform(long dest, long source, int method, float rangeMin, float rangeMax, float power, long mask); 20974 20975 public static int imaqWatershedTransform(Image dest, Image source, int connectivity8) { 20976 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20977 long rv_addr = getByteBufferAddress(rv_buf); 20978 _imaqWatershedTransform(dest.getAddress(), source.getAddress(), connectivity8, rv_addr+0); 20979 int zoneCount; 20980 zoneCount = rv_buf.getInt(0); 20981 return zoneCount; 20982 } 20983 private static native void _imaqWatershedTransform(long dest, long source, int connectivity8, long zoneCount); 20984 20985 /** 20986 * Window Management functions 20987 */ 20988 20989 /** 20990 * Utilities functions 20991 */ 20992 20993 public static int imaqMulticoreOptions(MulticoreOperation operation) { 20994 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 20995 long rv_addr = getByteBufferAddress(rv_buf); 20996 _imaqMulticoreOptions(operation.getValue(), rv_addr+0); 20997 int customNumCores; 20998 customNumCores = rv_buf.getInt(0); 20999 return customNumCores; 21000 } 21001 private static native void _imaqMulticoreOptions(int operation, long customNumCores); 21002 21003 /** 21004 * Tool Window functions 21005 */ 21006 21007 /** 21008 * Meter functions 21009 */ 21010 21011 public static MeterArc imaqGetMeterArc(int lightNeedle, MeterArcMode mode, ROI roi, PointFloat base, PointFloat start, PointFloat end) { 21012 21013 long jn_rv = _imaqGetMeterArc(lightNeedle, mode.getValue(), roi.getAddress(), base.getAddress(), start.getAddress(), end.getAddress()); 21014 21015 return new MeterArc(jn_rv, true); 21016 } 21017 private static native long _imaqGetMeterArc(int lightNeedle, int mode, long roi, long base, long start, long end); 21018 21019 public static class ReadMeterResult { 21020 public double percentage; 21021 public PointFloat endOfNeedle; 21022 private ReadMeterResult(ByteBuffer rv_buf) { 21023 percentage = rv_buf.getDouble(0); 21024 endOfNeedle = new PointFloat(rv_buf, 8); 21025 endOfNeedle.read(); 21026 } 21027 } 21028 21029 public static ReadMeterResult imaqReadMeter(Image image, MeterArc arcInfo) { 21030 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 21031 long rv_addr = getByteBufferAddress(rv_buf); 21032 _imaqReadMeter(image.getAddress(), arcInfo.getAddress(), rv_addr+0, rv_addr+8); 21033 ReadMeterResult rv = new ReadMeterResult(rv_buf); 21034 return rv; 21035 } 21036 private static native void _imaqReadMeter(long image, long arcInfo, long percentage, long endOfNeedle); 21037 21038 /** 21039 * Calibration functions 21040 */ 21041 21042 public static void imaqCopyCalibrationInfo2(Image dest, Image source, Point offset) { 21043 21044 _imaqCopyCalibrationInfo2(dest.getAddress(), source.getAddress(), offset.getAddress()); 21045 21046 } 21047 private static native void _imaqCopyCalibrationInfo2(long dest, long source, long offset); 21048 21049 public static CalibrationInfo imaqGetCalibrationInfo2(Image image) { 21050 21051 long jn_rv = _imaqGetCalibrationInfo2(image.getAddress()); 21052 21053 return new CalibrationInfo(jn_rv, true); 21054 } 21055 private static native long _imaqGetCalibrationInfo2(long image); 21056 21057 public static CalibrationInfo imaqGetCalibrationInfo3(Image image, int isGetErrorMap) { 21058 21059 long jn_rv = _imaqGetCalibrationInfo3(image.getAddress(), isGetErrorMap); 21060 21061 return new CalibrationInfo(jn_rv, true); 21062 } 21063 private static native long _imaqGetCalibrationInfo3(long image, int isGetErrorMap); 21064 21065 public static float imaqLearnCalibrationGrid(Image image, ROI roi, LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system, RangeFloat range) { 21066 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21067 long rv_addr = getByteBufferAddress(rv_buf); 21068 _imaqLearnCalibrationGrid(image.getAddress(), roi.getAddress(), options.getAddress(), grid.getAddress(), system.getAddress(), range.getAddress(), rv_addr+0); 21069 float quality; 21070 quality = rv_buf.getFloat(0); 21071 return quality; 21072 } 21073 private static native void _imaqLearnCalibrationGrid(long image, long roi, long options, long grid, long system, long range, long quality); 21074 21075 public static float imaqLearnCalibrationPoints(Image image, CalibrationPoints points, ROI roi, LearnCalibrationOptions options, GridDescriptor grid, CoordinateSystem system) { 21076 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21077 long rv_addr = getByteBufferAddress(rv_buf); 21078 _imaqLearnCalibrationPoints(image.getAddress(), points.getAddress(), roi.getAddress(), options.getAddress(), grid.getAddress(), system.getAddress(), rv_addr+0); 21079 float quality; 21080 quality = rv_buf.getFloat(0); 21081 return quality; 21082 } 21083 private static native void _imaqLearnCalibrationPoints(long image, long points, long roi, long options, long grid, long system, long quality); 21084 21085 public static void imaqSetCoordinateSystem(Image image, CoordinateSystem system) { 21086 21087 _imaqSetCoordinateSystem(image.getAddress(), system.getAddress()); 21088 21089 } 21090 private static native void _imaqSetCoordinateSystem(long image, long system); 21091 21092 public static void imaqSetSimpleCalibration(Image image, ScalingMethod method, int learnTable, GridDescriptor grid, CoordinateSystem system) { 21093 21094 _imaqSetSimpleCalibration(image.getAddress(), method.getValue(), learnTable, grid.getAddress(), system.getAddress()); 21095 21096 } 21097 private static native void _imaqSetSimpleCalibration(long image, int method, int learnTable, long grid, long system); 21098 21099 public static TransformReport imaqTransformPixelToRealWorld(Image image, PointFloat[] pixelCoordinates) { 21100 int numCoordinates = pixelCoordinates.length; 21101 ByteBuffer pixelCoordinates_buf = null; 21102 pixelCoordinates_buf = ByteBuffer.allocateDirect(pixelCoordinates.length*8).order(ByteOrder.nativeOrder()); 21103 for (int i=0, off=0; i<pixelCoordinates.length; i++, off += 8) { 21104 pixelCoordinates[i].setBuffer(pixelCoordinates_buf, off); 21105 pixelCoordinates[i].write(); 21106 } 21107 long jn_rv = _imaqTransformPixelToRealWorld(image.getAddress(), getByteBufferAddress(pixelCoordinates_buf), numCoordinates); 21108 21109 return new TransformReport(jn_rv, true); 21110 } 21111 private static native long _imaqTransformPixelToRealWorld(long image, long pixelCoordinates, int numCoordinates); 21112 21113 public static TransformReport imaqTransformRealWorldToPixel(Image image, PointFloat[] realWorldCoordinates) { 21114 int numCoordinates = realWorldCoordinates.length; 21115 ByteBuffer realWorldCoordinates_buf = null; 21116 realWorldCoordinates_buf = ByteBuffer.allocateDirect(realWorldCoordinates.length*8).order(ByteOrder.nativeOrder()); 21117 for (int i=0, off=0; i<realWorldCoordinates.length; i++, off += 8) { 21118 realWorldCoordinates[i].setBuffer(realWorldCoordinates_buf, off); 21119 realWorldCoordinates[i].write(); 21120 } 21121 long jn_rv = _imaqTransformRealWorldToPixel(image.getAddress(), getByteBufferAddress(realWorldCoordinates_buf), numCoordinates); 21122 21123 return new TransformReport(jn_rv, true); 21124 } 21125 private static native long _imaqTransformRealWorldToPixel(long image, long realWorldCoordinates, int numCoordinates); 21126 21127 public static void imaqSetSimpleCalibration2(Image image, GridDescriptor gridDescriptor) { 21128 21129 _imaqSetSimpleCalibration2(image.getAddress(), gridDescriptor.getAddress()); 21130 21131 } 21132 private static native void _imaqSetSimpleCalibration2(long image, long gridDescriptor); 21133 21134 public static CoordinateSystem imaqCalibrationSetAxisInfo(Image image) { 21135 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21136 long rv_addr = getByteBufferAddress(rv_buf); 21137 _imaqCalibrationSetAxisInfo(image.getAddress(), rv_addr+0); 21138 CoordinateSystem axisInfo; 21139 axisInfo = new CoordinateSystem(rv_buf, 0); 21140 axisInfo.read(); 21141 return axisInfo; 21142 } 21143 private static native void _imaqCalibrationSetAxisInfo(long image, long axisInfo); 21144 21145 public static void imaqCalibrationGetThumbnailImage(Image templateImage, Image image, CalibrationThumbnailType type, int index) { 21146 21147 _imaqCalibrationGetThumbnailImage(templateImage.getAddress(), image.getAddress(), type.getValue(), index); 21148 21149 } 21150 private static native void _imaqCalibrationGetThumbnailImage(long templateImage, long image, int type, int index); 21151 21152 public static GetCalibrationInfoReport imaqCalibrationGetCalibrationInfo(Image image, int isGetErrorMap) { 21153 21154 long jn_rv = _imaqCalibrationGetCalibrationInfo(image.getAddress(), isGetErrorMap); 21155 21156 return new GetCalibrationInfoReport(jn_rv, true); 21157 } 21158 private static native long _imaqCalibrationGetCalibrationInfo(long image, int isGetErrorMap); 21159 21160 public static GetCameraParametersReport imaqCalibrationGetCameraParameters(Image templateImage) { 21161 21162 long jn_rv = _imaqCalibrationGetCameraParameters(templateImage.getAddress()); 21163 21164 return new GetCameraParametersReport(jn_rv, true); 21165 } 21166 private static native long _imaqCalibrationGetCameraParameters(long templateImage); 21167 21168 public static void imaqCalibrationCompactInformation(Image image) { 21169 21170 _imaqCalibrationCompactInformation(image.getAddress()); 21171 21172 } 21173 private static native void _imaqCalibrationCompactInformation(long image); 21174 21175 /** 21176 * Pixel Manipulation functions 21177 */ 21178 21179 public static void imaqExtractColorPlanes(Image image, ColorMode mode, Image plane1, Image plane2, Image plane3) { 21180 21181 _imaqExtractColorPlanes(image.getAddress(), mode.getValue(), plane1 == null ? 0 : plane1.getAddress(), plane2 == null ? 0 : plane2.getAddress(), plane3 == null ? 0 : plane3.getAddress()); 21182 21183 } 21184 private static native void _imaqExtractColorPlanes(long image, int mode, long plane1, long plane2, long plane3); 21185 21186 public static void imaqExtractComplexPlane(Image dest, Image source, ComplexPlane plane) { 21187 21188 _imaqExtractComplexPlane(dest.getAddress(), source.getAddress(), plane.getValue()); 21189 21190 } 21191 private static native void _imaqExtractComplexPlane(long dest, long source, int plane); 21192 21193 public static void imaqReplaceColorPlanes(Image dest, Image source, ColorMode mode, Image plane1, Image plane2, Image plane3) { 21194 21195 _imaqReplaceColorPlanes(dest.getAddress(), source.getAddress(), mode.getValue(), plane1 == null ? 0 : plane1.getAddress(), plane2 == null ? 0 : plane2.getAddress(), plane3 == null ? 0 : plane3.getAddress()); 21196 21197 } 21198 private static native void _imaqReplaceColorPlanes(long dest, long source, int mode, long plane1, long plane2, long plane3); 21199 21200 public static void imaqReplaceComplexPlane(Image dest, Image source, Image newValues, ComplexPlane plane) { 21201 21202 _imaqReplaceComplexPlane(dest.getAddress(), source.getAddress(), newValues.getAddress(), plane.getValue()); 21203 21204 } 21205 private static native void _imaqReplaceComplexPlane(long dest, long source, long newValues, int plane); 21206 21207 /** 21208 * Color Matching functions 21209 */ 21210 21211 public static ColorInformation imaqLearnColor(Image image, ROI roi, ColorSensitivity sensitivity, int saturation) { 21212 21213 long jn_rv = _imaqLearnColor(image.getAddress(), roi == null ? 0 : roi.getAddress(), sensitivity.getValue(), saturation); 21214 21215 return new ColorInformation(jn_rv, true); 21216 } 21217 private static native long _imaqLearnColor(long image, long roi, int sensitivity, int saturation); 21218 21219 public static class MatchColorResult { 21220 public int[] array; 21221 private long array_addr; 21222 private MatchColorResult(ByteBuffer rv_buf, long jn_rv) { 21223 array_addr = jn_rv; 21224 int array_numScores; 21225 array_numScores = rv_buf.getInt(0); 21226 array = new int[array_numScores]; 21227 if (array_numScores > 0 && array_addr != 0) { 21228 newDirectByteBuffer(array_addr, array_numScores*4).asIntBuffer().get(array); 21229 } 21230 } 21231 21232 @Override 21233 protected void finalize() throws Throwable { 21234 imaqDispose(array_addr); 21235 super.finalize(); 21236 } 21237 } 21238 21239 public static MatchColorResult imaqMatchColor(Image image, ColorInformation info, ROI roi) { 21240 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21241 long rv_addr = getByteBufferAddress(rv_buf); 21242 long jn_rv = _imaqMatchColor(image.getAddress(), info.getAddress(), roi == null ? 0 : roi.getAddress(), rv_addr+0); 21243 MatchColorResult rv = new MatchColorResult(rv_buf, jn_rv); 21244 return rv; 21245 } 21246 private static native long _imaqMatchColor(long image, long info, long roi, long numScores); 21247 21248 /** 21249 * Frequency Domain Analysis functions 21250 */ 21251 21252 public static void imaqAttenuate(Image dest, Image source, AttenuateMode highlow) { 21253 21254 _imaqAttenuate(dest.getAddress(), source.getAddress(), highlow.getValue()); 21255 21256 } 21257 private static native void _imaqAttenuate(long dest, long source, int highlow); 21258 21259 public static void imaqConjugate(Image dest, Image source) { 21260 21261 _imaqConjugate(dest.getAddress(), source.getAddress()); 21262 21263 } 21264 private static native void _imaqConjugate(long dest, long source); 21265 21266 public static void imaqFFT(Image dest, Image source) { 21267 21268 _imaqFFT(dest.getAddress(), source.getAddress()); 21269 21270 } 21271 private static native void _imaqFFT(long dest, long source); 21272 21273 public static void imaqFlipFrequencies(Image dest, Image source) { 21274 21275 _imaqFlipFrequencies(dest.getAddress(), source.getAddress()); 21276 21277 } 21278 private static native void _imaqFlipFrequencies(long dest, long source); 21279 21280 public static void imaqInverseFFT(Image dest, Image source) { 21281 21282 _imaqInverseFFT(dest.getAddress(), source.getAddress()); 21283 21284 } 21285 private static native void _imaqInverseFFT(long dest, long source); 21286 21287 public static void imaqTruncate(Image dest, Image source, TruncateMode highlow, float ratioToKeep) { 21288 21289 _imaqTruncate(dest.getAddress(), source.getAddress(), highlow.getValue(), ratioToKeep); 21290 21291 } 21292 private static native void _imaqTruncate(long dest, long source, int highlow, float ratioToKeep); 21293 21294 /** 21295 * Barcode I/O functions 21296 */ 21297 21298 public static AIMGradeReport imaqGradeDataMatrixBarcodeAIM(Image image) { 21299 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21300 long rv_addr = getByteBufferAddress(rv_buf); 21301 _imaqGradeDataMatrixBarcodeAIM(image.getAddress(), rv_addr+0); 21302 AIMGradeReport report; 21303 report = new AIMGradeReport(rv_buf, 0); 21304 report.read(); 21305 return report; 21306 } 21307 private static native void _imaqGradeDataMatrixBarcodeAIM(long image, long report); 21308 21309 public static BarcodeInfo imaqReadBarcode(Image image, BarcodeType type, ROI roi, int validate) { 21310 21311 long jn_rv = _imaqReadBarcode(image.getAddress(), type.getValue(), roi == null ? 0 : roi.getAddress(), validate); 21312 21313 return new BarcodeInfo(jn_rv, true); 21314 } 21315 private static native long _imaqReadBarcode(long image, int type, long roi, int validate); 21316 21317 public static DataMatrixReport imaqReadDataMatrixBarcode2(Image image, ROI roi, DataMatrixGradingMode prepareForGrading, DataMatrixDescriptionOptions descriptionOptions, DataMatrixSizeOptions sizeOptions, DataMatrixSearchOptions searchOptions) { 21318 21319 long jn_rv = _imaqReadDataMatrixBarcode2(image.getAddress(), roi.getAddress(), prepareForGrading.getValue(), descriptionOptions.getAddress(), sizeOptions.getAddress(), searchOptions.getAddress()); 21320 21321 return new DataMatrixReport(jn_rv, true); 21322 } 21323 private static native long _imaqReadDataMatrixBarcode2(long image, long roi, int prepareForGrading, long descriptionOptions, long sizeOptions, long searchOptions); 21324 21325 public static class ReadPDF417BarcodeResult { 21326 public Barcode2DInfo[] array; 21327 private long array_addr; 21328 private ReadPDF417BarcodeResult(ByteBuffer rv_buf, long jn_rv) { 21329 array_addr = jn_rv; 21330 int array_numBarcodes; 21331 array_numBarcodes = rv_buf.getInt(0); 21332 array = new Barcode2DInfo[array_numBarcodes]; 21333 if (array_numBarcodes > 0 && array_addr != 0) { 21334 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numBarcodes*64); 21335 for (int i=0, off=0; i<array_numBarcodes; i++, off += 64) { 21336 array[i] = new Barcode2DInfo(bb, off); 21337 array[i].read(); 21338 } 21339 } 21340 } 21341 21342 @Override 21343 protected void finalize() throws Throwable { 21344 imaqDispose(array_addr); 21345 super.finalize(); 21346 } 21347 } 21348 21349 public static ReadPDF417BarcodeResult imaqReadPDF417Barcode(Image image, ROI roi, Barcode2DSearchMode searchMode) { 21350 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21351 long rv_addr = getByteBufferAddress(rv_buf); 21352 long jn_rv = _imaqReadPDF417Barcode(image.getAddress(), roi.getAddress(), searchMode.getValue(), rv_addr+0); 21353 ReadPDF417BarcodeResult rv = new ReadPDF417BarcodeResult(rv_buf, jn_rv); 21354 return rv; 21355 } 21356 private static native long _imaqReadPDF417Barcode(long image, long roi, int searchMode, long numBarcodes); 21357 21358 public static QRCodeReport imaqReadQRCode(Image image, ROI roi, QRGradingMode reserved, QRCodeDescriptionOptions descriptionOptions, QRCodeSizeOptions sizeOptions, QRCodeSearchOptions searchOptions) { 21359 21360 long jn_rv = _imaqReadQRCode(image.getAddress(), roi.getAddress(), reserved.getValue(), descriptionOptions.getAddress(), sizeOptions.getAddress(), searchOptions.getAddress()); 21361 21362 return new QRCodeReport(jn_rv, true); 21363 } 21364 private static native long _imaqReadQRCode(long image, long roi, int reserved, long descriptionOptions, long sizeOptions, long searchOptions); 21365 21366 /** 21367 * LCD functions 21368 */ 21369 21370 public static void imaqFindLCDSegments(ROI roi, Image image, LCDOptions options) { 21371 21372 _imaqFindLCDSegments(roi.getAddress(), image.getAddress(), options == null ? 0 : options.getAddress()); 21373 21374 } 21375 private static native void _imaqFindLCDSegments(long roi, long image, long options); 21376 21377 public static LCDReport imaqReadLCD(Image image, ROI roi, LCDOptions options) { 21378 21379 long jn_rv = _imaqReadLCD(image.getAddress(), roi.getAddress(), options == null ? 0 : options.getAddress()); 21380 21381 return new LCDReport(jn_rv, true); 21382 } 21383 private static native long _imaqReadLCD(long image, long roi, long options); 21384 21385 /** 21386 * Shape Matching functions 21387 */ 21388 21389 public static class MatchShapeResult { 21390 public ShapeReport[] array; 21391 private long array_addr; 21392 private MatchShapeResult(ByteBuffer rv_buf, long jn_rv) { 21393 array_addr = jn_rv; 21394 int array_numMatches; 21395 array_numMatches = rv_buf.getInt(0); 21396 array = new ShapeReport[array_numMatches]; 21397 if (array_numMatches > 0 && array_addr != 0) { 21398 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*40); 21399 for (int i=0, off=0; i<array_numMatches; i++, off += 40) { 21400 array[i] = new ShapeReport(bb, off); 21401 array[i].read(); 21402 } 21403 } 21404 } 21405 21406 @Override 21407 protected void finalize() throws Throwable { 21408 imaqDispose(array_addr); 21409 super.finalize(); 21410 } 21411 } 21412 21413 public static MatchShapeResult imaqMatchShape(Image dest, Image source, Image templateImage, int scaleInvariant, int connectivity8, double tolerance) { 21414 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21415 long rv_addr = getByteBufferAddress(rv_buf); 21416 long jn_rv = _imaqMatchShape(dest.getAddress(), source.getAddress(), templateImage.getAddress(), scaleInvariant, connectivity8, tolerance, rv_addr+0); 21417 MatchShapeResult rv = new MatchShapeResult(rv_buf, jn_rv); 21418 return rv; 21419 } 21420 private static native long _imaqMatchShape(long dest, long source, long templateImage, int scaleInvariant, int connectivity8, double tolerance, long numMatches); 21421 21422 /** 21423 * Contours functions 21424 */ 21425 21426 public static int imaqAddAnnulusContour(ROI roi, Annulus annulus) { 21427 21428 int jn_rv = _imaqAddAnnulusContour(roi.getAddress(), annulus.getAddress()); 21429 21430 return jn_rv; 21431 } 21432 private static native int _imaqAddAnnulusContour(long roi, long annulus); 21433 21434 public static int imaqAddClosedContour(ROI roi, Point[] points) { 21435 int numPoints = points.length; 21436 ByteBuffer points_buf = null; 21437 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 21438 for (int i=0, off=0; i<points.length; i++, off += 8) { 21439 points[i].setBuffer(points_buf, off); 21440 points[i].write(); 21441 } 21442 int jn_rv = _imaqAddClosedContour(roi.getAddress(), getByteBufferAddress(points_buf), numPoints); 21443 21444 return jn_rv; 21445 } 21446 private static native int _imaqAddClosedContour(long roi, long points, int numPoints); 21447 21448 public static int imaqAddLineContour(ROI roi, Point start, Point end) { 21449 21450 int jn_rv = _imaqAddLineContour(roi.getAddress(), start.getAddress(), end.getAddress()); 21451 21452 return jn_rv; 21453 } 21454 private static native int _imaqAddLineContour(long roi, long start, long end); 21455 21456 public static int imaqAddOpenContour(ROI roi, Point[] points) { 21457 int numPoints = points.length; 21458 ByteBuffer points_buf = null; 21459 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 21460 for (int i=0, off=0; i<points.length; i++, off += 8) { 21461 points[i].setBuffer(points_buf, off); 21462 points[i].write(); 21463 } 21464 int jn_rv = _imaqAddOpenContour(roi.getAddress(), getByteBufferAddress(points_buf), numPoints); 21465 21466 return jn_rv; 21467 } 21468 private static native int _imaqAddOpenContour(long roi, long points, int numPoints); 21469 21470 public static int imaqAddOvalContour(ROI roi, Rect boundingBox) { 21471 21472 int jn_rv = _imaqAddOvalContour(roi.getAddress(), boundingBox.getAddress()); 21473 21474 return jn_rv; 21475 } 21476 private static native int _imaqAddOvalContour(long roi, long boundingBox); 21477 21478 public static int imaqAddPointContour(ROI roi, Point point) { 21479 21480 int jn_rv = _imaqAddPointContour(roi.getAddress(), point.getAddress()); 21481 21482 return jn_rv; 21483 } 21484 private static native int _imaqAddPointContour(long roi, long point); 21485 21486 public static int imaqAddRectContour(ROI roi, Rect rect) { 21487 21488 int jn_rv = _imaqAddRectContour(roi.getAddress(), rect.getAddress()); 21489 21490 return jn_rv; 21491 } 21492 private static native int _imaqAddRectContour(long roi, long rect); 21493 21494 public static int imaqAddRotatedRectContour2(ROI roi, RotatedRect rect) { 21495 21496 int jn_rv = _imaqAddRotatedRectContour2(roi.getAddress(), rect.getAddress()); 21497 21498 return jn_rv; 21499 } 21500 private static native int _imaqAddRotatedRectContour2(long roi, long rect); 21501 21502 public static int imaqCopyContour(ROI destRoi, ROI sourceRoi, int id) { 21503 21504 int jn_rv = _imaqCopyContour(destRoi.getAddress(), sourceRoi.getAddress(), id); 21505 21506 return jn_rv; 21507 } 21508 private static native int _imaqCopyContour(long destRoi, long sourceRoi, int id); 21509 21510 public static int imaqGetContour(ROI roi, int index) { 21511 21512 int jn_rv = _imaqGetContour(roi.getAddress(), index); 21513 21514 return jn_rv; 21515 } 21516 private static native int _imaqGetContour(long roi, int index); 21517 21518 public static RGBValue imaqGetContourColor(ROI roi, int id) { 21519 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21520 long rv_addr = getByteBufferAddress(rv_buf); 21521 _imaqGetContourColor(roi.getAddress(), id, rv_addr+0); 21522 RGBValue contourColor; 21523 contourColor = new RGBValue(rv_buf, 0); 21524 contourColor.read(); 21525 return contourColor; 21526 } 21527 private static native void _imaqGetContourColor(long roi, int id, long contourColor); 21528 21529 public static void imaqGetContourCount(ROI roi) { 21530 21531 _imaqGetContourCount(roi.getAddress()); 21532 21533 } 21534 private static native void _imaqGetContourCount(long roi); 21535 21536 public static ContourInfo2 imaqGetContourInfo2(ROI roi, int id) { 21537 21538 long jn_rv = _imaqGetContourInfo2(roi.getAddress(), id); 21539 21540 return new ContourInfo2(jn_rv, true); 21541 } 21542 private static native long _imaqGetContourInfo2(long roi, int id); 21543 21544 public static void imaqMoveContour(ROI roi, int id, int deltaX, int deltaY) { 21545 21546 _imaqMoveContour(roi.getAddress(), id, deltaX, deltaY); 21547 21548 } 21549 private static native void _imaqMoveContour(long roi, int id, int deltaX, int deltaY); 21550 21551 public static void imaqRemoveContour(ROI roi, int id) { 21552 21553 _imaqRemoveContour(roi.getAddress(), id); 21554 21555 } 21556 private static native void _imaqRemoveContour(long roi, int id); 21557 21558 public static void imaqSetContourColor(ROI roi, int id, RGBValue color) { 21559 21560 _imaqSetContourColor(roi.getAddress(), id, color.getAddress()); 21561 21562 } 21563 private static native void _imaqSetContourColor(long roi, int id, long color); 21564 21565 /** 21566 * Regions of Interest functions 21567 */ 21568 21569 public static ROI imaqCreateROI() { 21570 21571 long jn_rv = _imaqCreateROI(); 21572 21573 return new ROI(jn_rv, true); 21574 } 21575 private static native long _imaqCreateROI(); 21576 21577 public static Rect imaqGetROIBoundingBox(ROI roi) { 21578 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21579 long rv_addr = getByteBufferAddress(rv_buf); 21580 _imaqGetROIBoundingBox(roi.getAddress(), rv_addr+0); 21581 Rect boundingBox; 21582 boundingBox = new Rect(rv_buf, 0); 21583 boundingBox.read(); 21584 return boundingBox; 21585 } 21586 private static native void _imaqGetROIBoundingBox(long roi, long boundingBox); 21587 21588 public static RGBValue imaqGetROIColor(ROI roi) { 21589 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21590 long rv_addr = getByteBufferAddress(rv_buf); 21591 _imaqGetROIColor(roi.getAddress(), rv_addr+0); 21592 RGBValue roiColor; 21593 roiColor = new RGBValue(rv_buf, 0); 21594 roiColor.read(); 21595 return roiColor; 21596 } 21597 private static native void _imaqGetROIColor(long roi, long roiColor); 21598 21599 public static void imaqSetROIColor(ROI roi, RGBValue color) { 21600 21601 _imaqSetROIColor(roi.getAddress(), color.getAddress()); 21602 21603 } 21604 private static native void _imaqSetROIColor(long roi, long color); 21605 21606 /** 21607 * Image Analysis functions 21608 */ 21609 21610 public static PointFloat imaqCentroid(Image image, Image mask) { 21611 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21612 long rv_addr = getByteBufferAddress(rv_buf); 21613 _imaqCentroid(image.getAddress(), rv_addr+0, mask.getAddress()); 21614 PointFloat centroid; 21615 centroid = new PointFloat(rv_buf, 0); 21616 centroid.read(); 21617 return centroid; 21618 } 21619 private static native void _imaqCentroid(long image, long centroid, long mask); 21620 21621 public static class ExtractCurvesResult { 21622 public Curve[] array; 21623 private long array_addr; 21624 private ExtractCurvesResult(ByteBuffer rv_buf, long jn_rv) { 21625 array_addr = jn_rv; 21626 int array_numCurves; 21627 array_numCurves = rv_buf.getInt(0); 21628 array = new Curve[array_numCurves]; 21629 if (array_numCurves > 0 && array_addr != 0) { 21630 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCurves*48); 21631 for (int i=0, off=0; i<array_numCurves; i++, off += 48) { 21632 array[i] = new Curve(bb, off); 21633 array[i].read(); 21634 } 21635 } 21636 } 21637 21638 @Override 21639 protected void finalize() throws Throwable { 21640 imaqDispose(array_addr); 21641 super.finalize(); 21642 } 21643 } 21644 21645 public static ExtractCurvesResult imaqExtractCurves(Image image, ROI roi, CurveOptions curveOptions) { 21646 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21647 long rv_addr = getByteBufferAddress(rv_buf); 21648 long jn_rv = _imaqExtractCurves(image.getAddress(), roi.getAddress(), curveOptions.getAddress(), rv_addr+0); 21649 ExtractCurvesResult rv = new ExtractCurvesResult(rv_buf, jn_rv); 21650 return rv; 21651 } 21652 private static native long _imaqExtractCurves(long image, long roi, long curveOptions, long numCurves); 21653 21654 public static HistogramReport imaqHistogram(Image image, int numClasses, float min, float max, Image mask) { 21655 21656 long jn_rv = _imaqHistogram(image.getAddress(), numClasses, min, max, mask == null ? 0 : mask.getAddress()); 21657 21658 return new HistogramReport(jn_rv, true); 21659 } 21660 private static native long _imaqHistogram(long image, int numClasses, float min, float max, long mask); 21661 21662 public static LinearAverages imaqLinearAverages2(Image image, LinearAveragesMode mode, Rect rect) { 21663 21664 long jn_rv = _imaqLinearAverages2(image.getAddress(), mode.getValue(), rect.getAddress()); 21665 21666 return new LinearAverages(jn_rv, true); 21667 } 21668 private static native long _imaqLinearAverages2(long image, int mode, long rect); 21669 21670 public static LineProfile imaqLineProfile(Image image, Point start, Point end) { 21671 21672 long jn_rv = _imaqLineProfile(image.getAddress(), start.getAddress(), end.getAddress()); 21673 21674 return new LineProfile(jn_rv, true); 21675 } 21676 private static native long _imaqLineProfile(long image, long start, long end); 21677 21678 public static QuantifyReport imaqQuantify(Image image, Image mask) { 21679 21680 long jn_rv = _imaqQuantify(image.getAddress(), mask == null ? 0 : mask.getAddress()); 21681 21682 return new QuantifyReport(jn_rv, true); 21683 } 21684 private static native long _imaqQuantify(long image, long mask); 21685 21686 /** 21687 * Threshold functions 21688 */ 21689 21690 public static ThresholdData imaqAutoThreshold2(Image dest, Image source, int numClasses, ThresholdMethod method, Image mask) { 21691 21692 long jn_rv = _imaqAutoThreshold2(dest.getAddress(), source.getAddress(), numClasses, method.getValue(), mask.getAddress()); 21693 21694 return new ThresholdData(jn_rv, true); 21695 } 21696 private static native long _imaqAutoThreshold2(long dest, long source, int numClasses, int method, long mask); 21697 21698 public static void imaqLocalThreshold(Image dest, Image source, int windowWidth, int windowHeight, LocalThresholdMethod method, double deviationWeight, ObjectType type, float replaceValue) { 21699 21700 _imaqLocalThreshold(dest.getAddress(), source.getAddress(), windowWidth, windowHeight, method.getValue(), deviationWeight, type.getValue(), replaceValue); 21701 21702 } 21703 private static native void _imaqLocalThreshold(long dest, long source, int windowWidth, int windowHeight, int method, double deviationWeight, int type, float replaceValue); 21704 21705 public static void imaqMagicWand(Image dest, Image source, Point coord, float tolerance, int connectivity8, float replaceValue) { 21706 21707 _imaqMagicWand(dest.getAddress(), source.getAddress(), coord.getAddress(), tolerance, connectivity8, replaceValue); 21708 21709 } 21710 private static native void _imaqMagicWand(long dest, long source, long coord, float tolerance, int connectivity8, float replaceValue); 21711 21712 public static void imaqMultithreshold(Image dest, Image source, ThresholdData[] ranges) { 21713 int numRanges = ranges.length; 21714 ByteBuffer ranges_buf = null; 21715 ranges_buf = ByteBuffer.allocateDirect(ranges.length*16).order(ByteOrder.nativeOrder()); 21716 for (int i=0, off=0; i<ranges.length; i++, off += 16) { 21717 ranges[i].setBuffer(ranges_buf, off); 21718 ranges[i].write(); 21719 } 21720 _imaqMultithreshold(dest.getAddress(), source.getAddress(), getByteBufferAddress(ranges_buf), numRanges); 21721 21722 } 21723 private static native void _imaqMultithreshold(long dest, long source, long ranges, int numRanges); 21724 21725 public static void imaqThreshold(Image dest, Image source, float rangeMin, float rangeMax, int useNewValue, float newValue) { 21726 21727 _imaqThreshold(dest.getAddress(), source.getAddress(), rangeMin, rangeMax, useNewValue, newValue); 21728 21729 } 21730 private static native void _imaqThreshold(long dest, long source, float rangeMin, float rangeMax, int useNewValue, float newValue); 21731 21732 /** 21733 * Memory Management functions 21734 */ 21735 21736 /** 21737 * Pattern Matching functions 21738 */ 21739 21740 public static class DetectCirclesResult { 21741 public CircleMatch[] array; 21742 private long array_addr; 21743 private DetectCirclesResult(ByteBuffer rv_buf, long jn_rv) { 21744 array_addr = jn_rv; 21745 int array_numMatchesReturned; 21746 array_numMatchesReturned = rv_buf.getInt(0); 21747 array = new CircleMatch[array_numMatchesReturned]; 21748 if (array_numMatchesReturned > 0 && array_addr != 0) { 21749 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned*24); 21750 for (int i=0, off=0; i<array_numMatchesReturned; i++, off += 24) { 21751 array[i] = new CircleMatch(bb, off); 21752 array[i].read(); 21753 } 21754 } 21755 } 21756 21757 @Override 21758 protected void finalize() throws Throwable { 21759 imaqDispose(array_addr); 21760 super.finalize(); 21761 } 21762 } 21763 21764 public static DetectCirclesResult imaqDetectCircles(Image image, CircleDescriptor circleDescriptor, CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 21765 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21766 long rv_addr = getByteBufferAddress(rv_buf); 21767 long jn_rv = _imaqDetectCircles(image.getAddress(), circleDescriptor.getAddress(), curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), rv_addr+0); 21768 DetectCirclesResult rv = new DetectCirclesResult(rv_buf, jn_rv); 21769 return rv; 21770 } 21771 private static native long _imaqDetectCircles(long image, long circleDescriptor, long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 21772 21773 public static class DetectEllipsesResult { 21774 public EllipseMatch[] array; 21775 private long array_addr; 21776 private DetectEllipsesResult(ByteBuffer rv_buf, long jn_rv) { 21777 array_addr = jn_rv; 21778 int array_numMatchesReturned; 21779 array_numMatchesReturned = rv_buf.getInt(0); 21780 array = new EllipseMatch[array_numMatchesReturned]; 21781 if (array_numMatchesReturned > 0 && array_addr != 0) { 21782 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned*40); 21783 for (int i=0, off=0; i<array_numMatchesReturned; i++, off += 40) { 21784 array[i] = new EllipseMatch(bb, off); 21785 array[i].read(); 21786 } 21787 } 21788 } 21789 21790 @Override 21791 protected void finalize() throws Throwable { 21792 imaqDispose(array_addr); 21793 super.finalize(); 21794 } 21795 } 21796 21797 public static DetectEllipsesResult imaqDetectEllipses(Image image, EllipseDescriptor ellipseDescriptor, CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 21798 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21799 long rv_addr = getByteBufferAddress(rv_buf); 21800 long jn_rv = _imaqDetectEllipses(image.getAddress(), ellipseDescriptor.getAddress(), curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), rv_addr+0); 21801 DetectEllipsesResult rv = new DetectEllipsesResult(rv_buf, jn_rv); 21802 return rv; 21803 } 21804 private static native long _imaqDetectEllipses(long image, long ellipseDescriptor, long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 21805 21806 public static class DetectLinesResult { 21807 public LineMatch[] array; 21808 private long array_addr; 21809 private DetectLinesResult(ByteBuffer rv_buf, long jn_rv) { 21810 array_addr = jn_rv; 21811 int array_numMatchesReturned; 21812 array_numMatchesReturned = rv_buf.getInt(0); 21813 array = new LineMatch[array_numMatchesReturned]; 21814 if (array_numMatchesReturned > 0 && array_addr != 0) { 21815 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned*40); 21816 for (int i=0, off=0; i<array_numMatchesReturned; i++, off += 40) { 21817 array[i] = new LineMatch(bb, off); 21818 array[i].read(); 21819 } 21820 } 21821 } 21822 21823 @Override 21824 protected void finalize() throws Throwable { 21825 imaqDispose(array_addr); 21826 super.finalize(); 21827 } 21828 } 21829 21830 public static DetectLinesResult imaqDetectLines(Image image, LineDescriptor lineDescriptor, CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 21831 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21832 long rv_addr = getByteBufferAddress(rv_buf); 21833 long jn_rv = _imaqDetectLines(image.getAddress(), lineDescriptor.getAddress(), curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), rv_addr+0); 21834 DetectLinesResult rv = new DetectLinesResult(rv_buf, jn_rv); 21835 return rv; 21836 } 21837 private static native long _imaqDetectLines(long image, long lineDescriptor, long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 21838 21839 public static class DetectRectanglesResult { 21840 public RectangleMatch[] array; 21841 private long array_addr; 21842 private DetectRectanglesResult(ByteBuffer rv_buf, long jn_rv) { 21843 array_addr = jn_rv; 21844 int array_numMatchesReturned; 21845 array_numMatchesReturned = rv_buf.getInt(0); 21846 array = new RectangleMatch[array_numMatchesReturned]; 21847 if (array_numMatchesReturned > 0 && array_addr != 0) { 21848 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatchesReturned*64); 21849 for (int i=0, off=0; i<array_numMatchesReturned; i++, off += 64) { 21850 array[i] = new RectangleMatch(bb, off); 21851 array[i].read(); 21852 } 21853 } 21854 } 21855 21856 @Override 21857 protected void finalize() throws Throwable { 21858 imaqDispose(array_addr); 21859 super.finalize(); 21860 } 21861 } 21862 21863 public static DetectRectanglesResult imaqDetectRectangles(Image image, RectangleDescriptor rectangleDescriptor, CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, ROI roi) { 21864 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21865 long rv_addr = getByteBufferAddress(rv_buf); 21866 long jn_rv = _imaqDetectRectangles(image.getAddress(), rectangleDescriptor.getAddress(), curveOptions.getAddress(), shapeDetectionOptions.getAddress(), roi.getAddress(), rv_addr+0); 21867 DetectRectanglesResult rv = new DetectRectanglesResult(rv_buf, jn_rv); 21868 return rv; 21869 } 21870 private static native long _imaqDetectRectangles(long image, long rectangleDescriptor, long curveOptions, long shapeDetectionOptions, long roi, long numMatchesReturned); 21871 21872 public static class GetGeometricFeaturesFromCurvesResult { 21873 public FeatureData[] array; 21874 private long array_addr; 21875 private GetGeometricFeaturesFromCurvesResult(ByteBuffer rv_buf, long jn_rv) { 21876 array_addr = jn_rv; 21877 int array_numFeatures; 21878 array_numFeatures = rv_buf.getInt(0); 21879 array = new FeatureData[array_numFeatures]; 21880 if (array_numFeatures > 0 && array_addr != 0) { 21881 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numFeatures*16); 21882 for (int i=0, off=0; i<array_numFeatures; i++, off += 16) { 21883 array[i] = new FeatureData(bb, off); 21884 array[i].read(); 21885 } 21886 } 21887 } 21888 21889 @Override 21890 protected void finalize() throws Throwable { 21891 imaqDispose(array_addr); 21892 super.finalize(); 21893 } 21894 } 21895 21896 public static GetGeometricFeaturesFromCurvesResult imaqGetGeometricFeaturesFromCurves(Curve[] curves, FeatureType[] featureTypes) { 21897 int numCurves = curves.length; 21898 ByteBuffer curves_buf = null; 21899 curves_buf = ByteBuffer.allocateDirect(curves.length*48).order(ByteOrder.nativeOrder()); 21900 for (int i=0, off=0; i<curves.length; i++, off += 48) { 21901 curves[i].setBuffer(curves_buf, off); 21902 curves[i].write(); 21903 } 21904 int numFeatureTypes = featureTypes.length; 21905 ByteBuffer featureTypes_buf = null; 21906 featureTypes_buf = ByteBuffer.allocateDirect(featureTypes.length*4).order(ByteOrder.nativeOrder()); 21907 for (int i=0, off=0; i<featureTypes.length; i++, off += 4) { 21908 if (featureTypes != null) 21909 featureTypes_buf.putInt(off, featureTypes[i].getValue()); 21910 } 21911 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21912 long rv_addr = getByteBufferAddress(rv_buf); 21913 long jn_rv = _imaqGetGeometricFeaturesFromCurves(getByteBufferAddress(curves_buf), numCurves, getByteBufferAddress(featureTypes_buf), numFeatureTypes, rv_addr+0); 21914 GetGeometricFeaturesFromCurvesResult rv = new GetGeometricFeaturesFromCurvesResult(rv_buf, jn_rv); 21915 return rv; 21916 } 21917 private static native long _imaqGetGeometricFeaturesFromCurves(long curves, int numCurves, long featureTypes, int numFeatureTypes, long numFeatures); 21918 21919 public static class GetGeometricTemplateFeatureInfoResult { 21920 public FeatureData[] array; 21921 private long array_addr; 21922 private GetGeometricTemplateFeatureInfoResult(ByteBuffer rv_buf, long jn_rv) { 21923 array_addr = jn_rv; 21924 int array_numFeatures; 21925 array_numFeatures = rv_buf.getInt(0); 21926 array = new FeatureData[array_numFeatures]; 21927 if (array_numFeatures > 0 && array_addr != 0) { 21928 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numFeatures*16); 21929 for (int i=0, off=0; i<array_numFeatures; i++, off += 16) { 21930 array[i] = new FeatureData(bb, off); 21931 array[i].read(); 21932 } 21933 } 21934 } 21935 21936 @Override 21937 protected void finalize() throws Throwable { 21938 imaqDispose(array_addr); 21939 super.finalize(); 21940 } 21941 } 21942 21943 public static GetGeometricTemplateFeatureInfoResult imaqGetGeometricTemplateFeatureInfo(Image pattern) { 21944 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21945 long rv_addr = getByteBufferAddress(rv_buf); 21946 long jn_rv = _imaqGetGeometricTemplateFeatureInfo(pattern.getAddress(), rv_addr+0); 21947 GetGeometricTemplateFeatureInfoResult rv = new GetGeometricTemplateFeatureInfoResult(rv_buf, jn_rv); 21948 return rv; 21949 } 21950 private static native long _imaqGetGeometricTemplateFeatureInfo(long pattern, long numFeatures); 21951 21952 public static void imaqLearnColorPattern(Image image, LearnColorPatternOptions options) { 21953 21954 _imaqLearnColorPattern(image.getAddress(), options.getAddress()); 21955 21956 } 21957 private static native void _imaqLearnColorPattern(long image, long options); 21958 21959 public static void imaqLearnGeometricPattern(Image image, PointFloat originOffset, CurveOptions curveOptions, LearnGeometricPatternAdvancedOptions advancedLearnOptions, Image mask) { 21960 21961 _imaqLearnGeometricPattern(image.getAddress(), originOffset.getAddress(), curveOptions.getAddress(), advancedLearnOptions.getAddress(), mask.getAddress()); 21962 21963 } 21964 private static native void _imaqLearnGeometricPattern(long image, long originOffset, long curveOptions, long advancedLearnOptions, long mask); 21965 21966 public static LearnPatternAdvancedOptions imaqLearnPattern3(Image image, LearningMode learningMode, Image mask) { 21967 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 21968 long rv_addr = getByteBufferAddress(rv_buf); 21969 _imaqLearnPattern3(image.getAddress(), learningMode.getValue(), rv_addr+0, mask.getAddress()); 21970 LearnPatternAdvancedOptions advancedOptions; 21971 advancedOptions = new LearnPatternAdvancedOptions(rv_buf, 0); 21972 advancedOptions.read(); 21973 return advancedOptions; 21974 } 21975 private static native void _imaqLearnPattern3(long image, int learningMode, long advancedOptions, long mask); 21976 21977 public static class MatchColorPatternResult { 21978 public PatternMatch[] array; 21979 private long array_addr; 21980 private MatchColorPatternResult(ByteBuffer rv_buf, long jn_rv) { 21981 array_addr = jn_rv; 21982 int array_numMatches; 21983 array_numMatches = rv_buf.getInt(0); 21984 array = new PatternMatch[array_numMatches]; 21985 if (array_numMatches > 0 && array_addr != 0) { 21986 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*52); 21987 for (int i=0, off=0; i<array_numMatches; i++, off += 52) { 21988 array[i] = new PatternMatch(bb, off); 21989 array[i].read(); 21990 } 21991 } 21992 } 21993 21994 @Override 21995 protected void finalize() throws Throwable { 21996 imaqDispose(array_addr); 21997 super.finalize(); 21998 } 21999 } 22000 22001 public static MatchColorPatternResult imaqMatchColorPattern(Image image, Image pattern, MatchColorPatternOptions options, Rect searchRect) { 22002 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22003 long rv_addr = getByteBufferAddress(rv_buf); 22004 long jn_rv = _imaqMatchColorPattern(image.getAddress(), pattern.getAddress(), options.getAddress(), searchRect.getAddress(), rv_addr+0); 22005 MatchColorPatternResult rv = new MatchColorPatternResult(rv_buf, jn_rv); 22006 return rv; 22007 } 22008 private static native long _imaqMatchColorPattern(long image, long pattern, long options, long searchRect, long numMatches); 22009 22010 public static class MatchGeometricPattern2Result { 22011 public GeometricPatternMatch2[] array; 22012 private long array_addr; 22013 private MatchGeometricPattern2Result(ByteBuffer rv_buf, long jn_rv) { 22014 array_addr = jn_rv; 22015 int array_numMatches; 22016 array_numMatches = rv_buf.getInt(0); 22017 array = new GeometricPatternMatch2[array_numMatches]; 22018 if (array_numMatches > 0 && array_addr != 0) { 22019 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*380); 22020 for (int i=0, off=0; i<array_numMatches; i++, off += 380) { 22021 array[i] = new GeometricPatternMatch2(bb, off); 22022 array[i].read(); 22023 } 22024 } 22025 } 22026 22027 @Override 22028 protected void finalize() throws Throwable { 22029 imaqDispose(array_addr); 22030 super.finalize(); 22031 } 22032 } 22033 22034 public static MatchGeometricPattern2Result imaqMatchGeometricPattern2(Image image, Image pattern, CurveOptions curveOptions, MatchGeometricPatternOptions matchOptions, MatchGeometricPatternAdvancedOptions2 advancedMatchOptions, ROI roi) { 22035 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22036 long rv_addr = getByteBufferAddress(rv_buf); 22037 long jn_rv = _imaqMatchGeometricPattern2(image.getAddress(), pattern.getAddress(), curveOptions.getAddress(), matchOptions.getAddress(), advancedMatchOptions.getAddress(), roi.getAddress(), rv_addr+0); 22038 MatchGeometricPattern2Result rv = new MatchGeometricPattern2Result(rv_buf, jn_rv); 22039 return rv; 22040 } 22041 private static native long _imaqMatchGeometricPattern2(long image, long pattern, long curveOptions, long matchOptions, long advancedMatchOptions, long roi, long numMatches); 22042 22043 public static class MatchMultipleGeometricPatternsResult { 22044 public GeometricPatternMatch2[] array; 22045 private long array_addr; 22046 private MatchMultipleGeometricPatternsResult(ByteBuffer rv_buf, long jn_rv) { 22047 array_addr = jn_rv; 22048 int array_numMatches; 22049 array_numMatches = rv_buf.getInt(0); 22050 array = new GeometricPatternMatch2[array_numMatches]; 22051 if (array_numMatches > 0 && array_addr != 0) { 22052 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*380); 22053 for (int i=0, off=0; i<array_numMatches; i++, off += 380) { 22054 array[i] = new GeometricPatternMatch2(bb, off); 22055 array[i].read(); 22056 } 22057 } 22058 } 22059 22060 @Override 22061 protected void finalize() throws Throwable { 22062 imaqDispose(array_addr); 22063 super.finalize(); 22064 } 22065 } 22066 22067 public static MatchMultipleGeometricPatternsResult imaqMatchMultipleGeometricPatterns(Image image, MultipleGeometricPattern multiplePattern, ROI roi) { 22068 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22069 long rv_addr = getByteBufferAddress(rv_buf); 22070 long jn_rv = _imaqMatchMultipleGeometricPatterns(image.getAddress(), multiplePattern.getAddress(), roi.getAddress(), rv_addr+0); 22071 MatchMultipleGeometricPatternsResult rv = new MatchMultipleGeometricPatternsResult(rv_buf, jn_rv); 22072 return rv; 22073 } 22074 private static native long _imaqMatchMultipleGeometricPatterns(long image, long multiplePattern, long roi, long numMatches); 22075 22076 public static MultipleGeometricPattern imaqReadMultipleGeometricPatternFile(String fileName, String description) { 22077 ByteBuffer fileName_buf = null; 22078 if (fileName != null) { 22079 byte[] fileName_bytes; 22080 try { 22081 fileName_bytes = fileName.getBytes("UTF-8"); 22082 } catch (UnsupportedEncodingException e) { 22083 fileName_bytes = new byte[0]; 22084 } 22085 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 22086 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 22087 } 22088 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 22089 if (description != null) { 22090 byte[] bytes; 22091 try { 22092 bytes = description.getBytes("UTF-8"); 22093 } catch (UnsupportedEncodingException e) { 22094 bytes = new byte[0]; 22095 } 22096 putBytes(description_buf, bytes, 0, bytes.length); 22097 for (int i=bytes.length; i<256; i++) 22098 description_buf.put(i, (byte)0); // fill with zero 22099 } 22100 long jn_rv = _imaqReadMultipleGeometricPatternFile(fileName == null ? 0 : getByteBufferAddress(fileName_buf), description == null ? 0 : getByteBufferAddress(description_buf)); 22101 22102 return new MultipleGeometricPattern(jn_rv, true); 22103 } 22104 private static native long _imaqReadMultipleGeometricPatternFile(long fileName, long description); 22105 22106 public static class RefineMatchesResult { 22107 public MatchPatternOptions options; 22108 public MatchPatternAdvancedOptions advancedOptions; 22109 public PatternMatch[] array; 22110 private long array_addr; 22111 private RefineMatchesResult(ByteBuffer rv_buf, long jn_rv) { 22112 array_addr = jn_rv; 22113 options = new MatchPatternOptions(rv_buf, 0); 22114 options.read(); 22115 advancedOptions = new MatchPatternAdvancedOptions(rv_buf, 8); 22116 advancedOptions.read(); 22117 int array_numCandidatesOut; 22118 array_numCandidatesOut = rv_buf.getInt(16); 22119 array = new PatternMatch[array_numCandidatesOut]; 22120 if (array_numCandidatesOut > 0 && array_addr != 0) { 22121 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numCandidatesOut*52); 22122 for (int i=0, off=0; i<array_numCandidatesOut; i++, off += 52) { 22123 array[i] = new PatternMatch(bb, off); 22124 array[i].read(); 22125 } 22126 } 22127 } 22128 22129 @Override 22130 protected void finalize() throws Throwable { 22131 imaqDispose(array_addr); 22132 super.finalize(); 22133 } 22134 } 22135 22136 public static RefineMatchesResult imaqRefineMatches(Image image, Image pattern, PatternMatch[] candidatesIn) { 22137 int numCandidatesIn = candidatesIn.length; 22138 ByteBuffer candidatesIn_buf = null; 22139 candidatesIn_buf = ByteBuffer.allocateDirect(candidatesIn.length*52).order(ByteOrder.nativeOrder()); 22140 for (int i=0, off=0; i<candidatesIn.length; i++, off += 52) { 22141 candidatesIn[i].setBuffer(candidatesIn_buf, off); 22142 candidatesIn[i].write(); 22143 } 22144 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8).order(ByteOrder.nativeOrder()); 22145 long rv_addr = getByteBufferAddress(rv_buf); 22146 long jn_rv = _imaqRefineMatches(image.getAddress(), pattern.getAddress(), getByteBufferAddress(candidatesIn_buf), numCandidatesIn, rv_addr+0, rv_addr+8, rv_addr+16); 22147 RefineMatchesResult rv = new RefineMatchesResult(rv_buf, jn_rv); 22148 return rv; 22149 } 22150 private static native long _imaqRefineMatches(long image, long pattern, long candidatesIn, int numCandidatesIn, long options, long advancedOptions, long numCandidatesOut); 22151 22152 public static void imaqSetMultipleGeometricPatternsOptions(MultipleGeometricPattern multiplePattern, String label, CurveOptions curveOptions, MatchGeometricPatternOptions matchOptions, MatchGeometricPatternAdvancedOptions2 advancedMatchOptions) { 22153 ByteBuffer label_buf = null; 22154 if (label != null) { 22155 byte[] label_bytes; 22156 try { 22157 label_bytes = label.getBytes("UTF-8"); 22158 } catch (UnsupportedEncodingException e) { 22159 label_bytes = new byte[0]; 22160 } 22161 label_buf = ByteBuffer.allocateDirect(label_bytes.length+1); 22162 putBytes(label_buf, label_bytes, 0, label_bytes.length).put(label_bytes.length, (byte)0); 22163 } 22164 _imaqSetMultipleGeometricPatternsOptions(multiplePattern.getAddress(), label == null ? 0 : getByteBufferAddress(label_buf), curveOptions.getAddress(), matchOptions.getAddress(), advancedMatchOptions.getAddress()); 22165 22166 } 22167 private static native void _imaqSetMultipleGeometricPatternsOptions(long multiplePattern, long label, long curveOptions, long matchOptions, long advancedMatchOptions); 22168 22169 public static void imaqWriteMultipleGeometricPatternFile(MultipleGeometricPattern multiplePattern, String fileName, String description) { 22170 ByteBuffer fileName_buf = null; 22171 if (fileName != null) { 22172 byte[] fileName_bytes; 22173 try { 22174 fileName_bytes = fileName.getBytes("UTF-8"); 22175 } catch (UnsupportedEncodingException e) { 22176 fileName_bytes = new byte[0]; 22177 } 22178 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 22179 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 22180 } 22181 ByteBuffer description_buf = null; 22182 if (description != null) { 22183 byte[] description_bytes; 22184 try { 22185 description_bytes = description.getBytes("UTF-8"); 22186 } catch (UnsupportedEncodingException e) { 22187 description_bytes = new byte[0]; 22188 } 22189 description_buf = ByteBuffer.allocateDirect(description_bytes.length+1); 22190 putBytes(description_buf, description_bytes, 0, description_bytes.length).put(description_bytes.length, (byte)0); 22191 } 22192 _imaqWriteMultipleGeometricPatternFile(multiplePattern.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), description == null ? 0 : getByteBufferAddress(description_buf)); 22193 22194 } 22195 private static native void _imaqWriteMultipleGeometricPatternFile(long multiplePattern, long fileName, long description); 22196 22197 public static class MatchGeometricPattern3Result { 22198 public GeometricPatternMatch3[] array; 22199 private long array_addr; 22200 private MatchGeometricPattern3Result(ByteBuffer rv_buf, long jn_rv) { 22201 array_addr = jn_rv; 22202 int array_numMatches; 22203 array_numMatches = rv_buf.getInt(0); 22204 array = new GeometricPatternMatch3[array_numMatches]; 22205 if (array_numMatches > 0 && array_addr != 0) { 22206 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*116); 22207 for (int i=0, off=0; i<array_numMatches; i++, off += 116) { 22208 array[i] = new GeometricPatternMatch3(bb, off); 22209 array[i].read(); 22210 } 22211 } 22212 } 22213 22214 @Override 22215 protected void finalize() throws Throwable { 22216 imaqDispose(array_addr); 22217 super.finalize(); 22218 } 22219 } 22220 22221 public static MatchGeometricPattern3Result imaqMatchGeometricPattern3(Image image, Image pattern, CurveOptions curveOptions, MatchGeometricPatternOptions matchOptions, MatchGeometricPatternAdvancedOptions3 advancedMatchOptions, ROI roi) { 22222 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22223 long rv_addr = getByteBufferAddress(rv_buf); 22224 long jn_rv = _imaqMatchGeometricPattern3(image.getAddress(), pattern.getAddress(), curveOptions.getAddress(), matchOptions.getAddress(), advancedMatchOptions.getAddress(), roi.getAddress(), rv_addr+0); 22225 MatchGeometricPattern3Result rv = new MatchGeometricPattern3Result(rv_buf, jn_rv); 22226 return rv; 22227 } 22228 private static native long _imaqMatchGeometricPattern3(long image, long pattern, long curveOptions, long matchOptions, long advancedMatchOptions, long roi, long numMatches); 22229 22230 public static void imaqLearnGeometricPattern2(Image image, PointFloat originOffset, double angleOffset, CurveOptions curveOptions, LearnGeometricPatternAdvancedOptions2 advancedLearnOptions, Image mask) { 22231 22232 _imaqLearnGeometricPattern2(image.getAddress(), originOffset.getAddress(), angleOffset, curveOptions.getAddress(), advancedLearnOptions.getAddress(), mask.getAddress()); 22233 22234 } 22235 private static native void _imaqLearnGeometricPattern2(long image, long originOffset, double angleOffset, long curveOptions, long advancedLearnOptions, long mask); 22236 22237 public static class MatchPattern3Result { 22238 public PatternMatch[] array; 22239 private long array_addr; 22240 private MatchPattern3Result(ByteBuffer rv_buf, long jn_rv) { 22241 array_addr = jn_rv; 22242 int array_numMatches; 22243 array_numMatches = rv_buf.getInt(0); 22244 array = new PatternMatch[array_numMatches]; 22245 if (array_numMatches > 0 && array_addr != 0) { 22246 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*52); 22247 for (int i=0, off=0; i<array_numMatches; i++, off += 52) { 22248 array[i] = new PatternMatch(bb, off); 22249 array[i].read(); 22250 } 22251 } 22252 } 22253 22254 @Override 22255 protected void finalize() throws Throwable { 22256 imaqDispose(array_addr); 22257 super.finalize(); 22258 } 22259 } 22260 22261 public static MatchPattern3Result imaqMatchPattern3(Image image, Image pattern, MatchPatternOptions options, MatchPatternAdvancedOptions advancedOptions, ROI roi) { 22262 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22263 long rv_addr = getByteBufferAddress(rv_buf); 22264 long jn_rv = _imaqMatchPattern3(image.getAddress(), pattern.getAddress(), options == null ? 0 : options.getAddress(), advancedOptions.getAddress(), roi.getAddress(), rv_addr+0); 22265 MatchPattern3Result rv = new MatchPattern3Result(rv_buf, jn_rv); 22266 return rv; 22267 } 22268 private static native long _imaqMatchPattern3(long image, long pattern, long options, long advancedOptions, long roi, long numMatches); 22269 22270 /** 22271 * Overlay functions 22272 */ 22273 22274 public static void imaqClearOverlay(Image image, String group) { 22275 ByteBuffer group_buf = null; 22276 if (group != null) { 22277 byte[] group_bytes; 22278 try { 22279 group_bytes = group.getBytes("UTF-8"); 22280 } catch (UnsupportedEncodingException e) { 22281 group_bytes = new byte[0]; 22282 } 22283 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22284 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22285 } 22286 _imaqClearOverlay(image.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22287 22288 } 22289 private static native void _imaqClearOverlay(long image, long group); 22290 22291 public static void imaqCopyOverlay(Image dest, Image source, String group) { 22292 ByteBuffer group_buf = null; 22293 if (group != null) { 22294 byte[] group_bytes; 22295 try { 22296 group_bytes = group.getBytes("UTF-8"); 22297 } catch (UnsupportedEncodingException e) { 22298 group_bytes = new byte[0]; 22299 } 22300 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22301 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22302 } 22303 _imaqCopyOverlay(dest.getAddress(), source.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22304 22305 } 22306 private static native void _imaqCopyOverlay(long dest, long source, long group); 22307 22308 public static TransformBehaviors imaqGetOverlayProperties(Image image, String group) { 22309 ByteBuffer group_buf = null; 22310 if (group != null) { 22311 byte[] group_bytes; 22312 try { 22313 group_bytes = group.getBytes("UTF-8"); 22314 } catch (UnsupportedEncodingException e) { 22315 group_bytes = new byte[0]; 22316 } 22317 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22318 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22319 } 22320 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22321 long rv_addr = getByteBufferAddress(rv_buf); 22322 _imaqGetOverlayProperties(image.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf), rv_addr+0); 22323 TransformBehaviors transformBehaviors; 22324 transformBehaviors = new TransformBehaviors(rv_buf, 0); 22325 transformBehaviors.read(); 22326 return transformBehaviors; 22327 } 22328 private static native void _imaqGetOverlayProperties(long image, long group, long transformBehaviors); 22329 22330 public static void imaqMergeOverlay(Image dest, Image source, RGBValue[] palette, String group) { 22331 int numColors = palette.length; 22332 ByteBuffer palette_buf = null; 22333 palette_buf = ByteBuffer.allocateDirect(palette.length*4).order(ByteOrder.nativeOrder()); 22334 for (int i=0, off=0; i<palette.length; i++, off += 4) { 22335 palette[i].setBuffer(palette_buf, off); 22336 palette[i].write(); 22337 } 22338 ByteBuffer group_buf = null; 22339 if (group != null) { 22340 byte[] group_bytes; 22341 try { 22342 group_bytes = group.getBytes("UTF-8"); 22343 } catch (UnsupportedEncodingException e) { 22344 group_bytes = new byte[0]; 22345 } 22346 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22347 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22348 } 22349 _imaqMergeOverlay(dest.getAddress(), source.getAddress(), getByteBufferAddress(palette_buf), numColors, group == null ? 0 : getByteBufferAddress(group_buf)); 22350 22351 } 22352 private static native void _imaqMergeOverlay(long dest, long source, long palette, int numColors, long group); 22353 22354 public static void imaqOverlayArc(Image image, ArcInfo arc, RGBValue color, DrawMode drawMode, String group) { 22355 ByteBuffer group_buf = null; 22356 if (group != null) { 22357 byte[] group_bytes; 22358 try { 22359 group_bytes = group.getBytes("UTF-8"); 22360 } catch (UnsupportedEncodingException e) { 22361 group_bytes = new byte[0]; 22362 } 22363 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22364 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22365 } 22366 _imaqOverlayArc(image.getAddress(), arc.getAddress(), color.getAddress(), drawMode.getValue(), group == null ? 0 : getByteBufferAddress(group_buf)); 22367 22368 } 22369 private static native void _imaqOverlayArc(long image, long arc, long color, int drawMode, long group); 22370 22371 public static void imaqOverlayBitmap(Image image, Point destLoc, RGBValue bitmap, int numCols, int numRows, String group) { 22372 ByteBuffer group_buf = null; 22373 if (group != null) { 22374 byte[] group_bytes; 22375 try { 22376 group_bytes = group.getBytes("UTF-8"); 22377 } catch (UnsupportedEncodingException e) { 22378 group_bytes = new byte[0]; 22379 } 22380 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22381 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22382 } 22383 _imaqOverlayBitmap(image.getAddress(), destLoc.getAddress(), bitmap.getAddress(), numCols, numRows, group == null ? 0 : getByteBufferAddress(group_buf)); 22384 22385 } 22386 private static native void _imaqOverlayBitmap(long image, long destLoc, long bitmap, int numCols, int numRows, long group); 22387 22388 public static void imaqOverlayClosedContour(Image image, Point[] points, RGBValue color, DrawMode drawMode, String group) { 22389 int numPoints = points.length; 22390 ByteBuffer points_buf = null; 22391 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 22392 for (int i=0, off=0; i<points.length; i++, off += 8) { 22393 points[i].setBuffer(points_buf, off); 22394 points[i].write(); 22395 } 22396 ByteBuffer group_buf = null; 22397 if (group != null) { 22398 byte[] group_bytes; 22399 try { 22400 group_bytes = group.getBytes("UTF-8"); 22401 } catch (UnsupportedEncodingException e) { 22402 group_bytes = new byte[0]; 22403 } 22404 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22405 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22406 } 22407 _imaqOverlayClosedContour(image.getAddress(), getByteBufferAddress(points_buf), numPoints, color.getAddress(), drawMode.getValue(), group == null ? 0 : getByteBufferAddress(group_buf)); 22408 22409 } 22410 private static native void _imaqOverlayClosedContour(long image, long points, int numPoints, long color, int drawMode, long group); 22411 22412 public static void imaqOverlayLine(Image image, Point start, Point end, RGBValue color, String group) { 22413 ByteBuffer group_buf = null; 22414 if (group != null) { 22415 byte[] group_bytes; 22416 try { 22417 group_bytes = group.getBytes("UTF-8"); 22418 } catch (UnsupportedEncodingException e) { 22419 group_bytes = new byte[0]; 22420 } 22421 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22422 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22423 } 22424 _imaqOverlayLine(image.getAddress(), start.getAddress(), end.getAddress(), color.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22425 22426 } 22427 private static native void _imaqOverlayLine(long image, long start, long end, long color, long group); 22428 22429 public static void imaqOverlayOpenContour(Image image, Point[] points, RGBValue color, String group) { 22430 int numPoints = points.length; 22431 ByteBuffer points_buf = null; 22432 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 22433 for (int i=0, off=0; i<points.length; i++, off += 8) { 22434 points[i].setBuffer(points_buf, off); 22435 points[i].write(); 22436 } 22437 ByteBuffer group_buf = null; 22438 if (group != null) { 22439 byte[] group_bytes; 22440 try { 22441 group_bytes = group.getBytes("UTF-8"); 22442 } catch (UnsupportedEncodingException e) { 22443 group_bytes = new byte[0]; 22444 } 22445 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22446 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22447 } 22448 _imaqOverlayOpenContour(image.getAddress(), getByteBufferAddress(points_buf), numPoints, color.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22449 22450 } 22451 private static native void _imaqOverlayOpenContour(long image, long points, int numPoints, long color, long group); 22452 22453 public static byte imaqOverlayOval(Image image, Rect boundingBox, RGBValue color, DrawMode drawMode) { 22454 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22455 long rv_addr = getByteBufferAddress(rv_buf); 22456 _imaqOverlayOval(image.getAddress(), boundingBox.getAddress(), color.getAddress(), drawMode.getValue(), rv_addr+0); 22457 byte group; 22458 group = rv_buf.get(0); 22459 return group; 22460 } 22461 private static native void _imaqOverlayOval(long image, long boundingBox, long color, int drawMode, long group); 22462 22463 public static void imaqOverlayPoints(Image image, Point[] points, RGBValue[] colors, PointSymbol symbol, UserPointSymbol userSymbol, String group) { 22464 int numPoints = points.length; 22465 ByteBuffer points_buf = null; 22466 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 22467 for (int i=0, off=0; i<points.length; i++, off += 8) { 22468 points[i].setBuffer(points_buf, off); 22469 points[i].write(); 22470 } 22471 int numColors = colors.length; 22472 ByteBuffer colors_buf = null; 22473 colors_buf = ByteBuffer.allocateDirect(colors.length*4).order(ByteOrder.nativeOrder()); 22474 for (int i=0, off=0; i<colors.length; i++, off += 4) { 22475 colors[i].setBuffer(colors_buf, off); 22476 colors[i].write(); 22477 } 22478 ByteBuffer group_buf = null; 22479 if (group != null) { 22480 byte[] group_bytes; 22481 try { 22482 group_bytes = group.getBytes("UTF-8"); 22483 } catch (UnsupportedEncodingException e) { 22484 group_bytes = new byte[0]; 22485 } 22486 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22487 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22488 } 22489 _imaqOverlayPoints(image.getAddress(), getByteBufferAddress(points_buf), numPoints, getByteBufferAddress(colors_buf), numColors, symbol.getValue(), userSymbol.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22490 22491 } 22492 private static native void _imaqOverlayPoints(long image, long points, int numPoints, long colors, int numColors, int symbol, long userSymbol, long group); 22493 22494 public static void imaqOverlayRect(Image image, Rect rect, RGBValue color, DrawMode drawMode, String group) { 22495 ByteBuffer group_buf = null; 22496 if (group != null) { 22497 byte[] group_bytes; 22498 try { 22499 group_bytes = group.getBytes("UTF-8"); 22500 } catch (UnsupportedEncodingException e) { 22501 group_bytes = new byte[0]; 22502 } 22503 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22504 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22505 } 22506 _imaqOverlayRect(image.getAddress(), rect.getAddress(), color.getAddress(), drawMode.getValue(), group == null ? 0 : getByteBufferAddress(group_buf)); 22507 22508 } 22509 private static native void _imaqOverlayRect(long image, long rect, long color, int drawMode, long group); 22510 22511 public static void imaqOverlayROI(Image image, ROI roi, PointSymbol symbol, UserPointSymbol userSymbol, String group) { 22512 ByteBuffer group_buf = null; 22513 if (group != null) { 22514 byte[] group_bytes; 22515 try { 22516 group_bytes = group.getBytes("UTF-8"); 22517 } catch (UnsupportedEncodingException e) { 22518 group_bytes = new byte[0]; 22519 } 22520 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22521 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22522 } 22523 _imaqOverlayROI(image.getAddress(), roi.getAddress(), symbol.getValue(), userSymbol.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22524 22525 } 22526 private static native void _imaqOverlayROI(long image, long roi, int symbol, long userSymbol, long group); 22527 22528 public static void imaqOverlayText(Image image, Point origin, String text, RGBValue color, OverlayTextOptions options, String group) { 22529 ByteBuffer text_buf = null; 22530 if (text != null) { 22531 byte[] text_bytes; 22532 try { 22533 text_bytes = text.getBytes("UTF-8"); 22534 } catch (UnsupportedEncodingException e) { 22535 text_bytes = new byte[0]; 22536 } 22537 text_buf = ByteBuffer.allocateDirect(text_bytes.length+1); 22538 putBytes(text_buf, text_bytes, 0, text_bytes.length).put(text_bytes.length, (byte)0); 22539 } 22540 ByteBuffer group_buf = null; 22541 if (group != null) { 22542 byte[] group_bytes; 22543 try { 22544 group_bytes = group.getBytes("UTF-8"); 22545 } catch (UnsupportedEncodingException e) { 22546 group_bytes = new byte[0]; 22547 } 22548 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22549 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22550 } 22551 _imaqOverlayText(image.getAddress(), origin.getAddress(), text == null ? 0 : getByteBufferAddress(text_buf), color.getAddress(), options.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf)); 22552 22553 } 22554 private static native void _imaqOverlayText(long image, long origin, long text, long color, long options, long group); 22555 22556 public static TransformBehaviors imaqSetOverlayProperties(Image image, String group) { 22557 ByteBuffer group_buf = null; 22558 if (group != null) { 22559 byte[] group_bytes; 22560 try { 22561 group_bytes = group.getBytes("UTF-8"); 22562 } catch (UnsupportedEncodingException e) { 22563 group_bytes = new byte[0]; 22564 } 22565 group_buf = ByteBuffer.allocateDirect(group_bytes.length+1); 22566 putBytes(group_buf, group_bytes, 0, group_bytes.length).put(group_bytes.length, (byte)0); 22567 } 22568 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22569 long rv_addr = getByteBufferAddress(rv_buf); 22570 _imaqSetOverlayProperties(image.getAddress(), group == null ? 0 : getByteBufferAddress(group_buf), rv_addr+0); 22571 TransformBehaviors transformBehaviors; 22572 transformBehaviors = new TransformBehaviors(rv_buf, 0); 22573 transformBehaviors.read(); 22574 return transformBehaviors; 22575 } 22576 private static native void _imaqSetOverlayProperties(long image, long group, long transformBehaviors); 22577 22578 /** 22579 * OCR functions 22580 */ 22581 22582 public static CharSet imaqCreateCharSet() { 22583 22584 long jn_rv = _imaqCreateCharSet(); 22585 22586 return new CharSet(jn_rv, true); 22587 } 22588 private static native long _imaqCreateCharSet(); 22589 22590 public static void imaqDeleteChar(CharSet set, int index) { 22591 22592 _imaqDeleteChar(set.getAddress(), index); 22593 22594 } 22595 private static native void _imaqDeleteChar(long set, int index); 22596 22597 public static void imaqGetCharCount(CharSet set) { 22598 22599 _imaqGetCharCount(set.getAddress()); 22600 22601 } 22602 private static native void _imaqGetCharCount(long set); 22603 22604 public static CharInfo2 imaqGetCharInfo2(CharSet set, int index) { 22605 22606 long jn_rv = _imaqGetCharInfo2(set.getAddress(), index); 22607 22608 return new CharInfo2(jn_rv, true); 22609 } 22610 private static native long _imaqGetCharInfo2(long set, int index); 22611 22612 public static class ReadOCRFileResult { 22613 public ReadTextOptions readOptions; 22614 public OCRProcessingOptions processingOptions; 22615 public OCRSpacingOptions spacingOptions; 22616 private ReadOCRFileResult(ByteBuffer rv_buf) { 22617 readOptions = new ReadTextOptions(rv_buf, 0); 22618 readOptions.read(); 22619 processingOptions = new OCRProcessingOptions(rv_buf, 8); 22620 processingOptions.read(); 22621 spacingOptions = new OCRSpacingOptions(rv_buf, 16); 22622 spacingOptions.read(); 22623 } 22624 } 22625 22626 public static ReadOCRFileResult imaqReadOCRFile(String fileName, CharSet set, String setDescription) { 22627 ByteBuffer fileName_buf = null; 22628 if (fileName != null) { 22629 byte[] fileName_bytes; 22630 try { 22631 fileName_bytes = fileName.getBytes("UTF-8"); 22632 } catch (UnsupportedEncodingException e) { 22633 fileName_bytes = new byte[0]; 22634 } 22635 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 22636 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 22637 } 22638 ByteBuffer setDescription_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 22639 if (setDescription != null) { 22640 byte[] bytes; 22641 try { 22642 bytes = setDescription.getBytes("UTF-8"); 22643 } catch (UnsupportedEncodingException e) { 22644 bytes = new byte[0]; 22645 } 22646 putBytes(setDescription_buf, bytes, 0, bytes.length); 22647 for (int i=bytes.length; i<256; i++) 22648 setDescription_buf.put(i, (byte)0); // fill with zero 22649 } 22650 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8+8).order(ByteOrder.nativeOrder()); 22651 long rv_addr = getByteBufferAddress(rv_buf); 22652 _imaqReadOCRFile(fileName == null ? 0 : getByteBufferAddress(fileName_buf), set.getAddress(), setDescription == null ? 0 : getByteBufferAddress(setDescription_buf), rv_addr+0, rv_addr+8, rv_addr+16); 22653 ReadOCRFileResult rv = new ReadOCRFileResult(rv_buf); 22654 return rv; 22655 } 22656 private static native void _imaqReadOCRFile(long fileName, long set, long setDescription, long readOptions, long processingOptions, long spacingOptions); 22657 22658 public static ReadTextReport3 imaqReadText3(Image image, CharSet set, ROI roi, ReadTextOptions readOptions, OCRProcessingOptions processingOptions, OCRSpacingOptions spacingOptions) { 22659 22660 long jn_rv = _imaqReadText3(image.getAddress(), set.getAddress(), roi.getAddress(), readOptions.getAddress(), processingOptions.getAddress(), spacingOptions.getAddress()); 22661 22662 return new ReadTextReport3(jn_rv, true); 22663 } 22664 private static native long _imaqReadText3(long image, long set, long roi, long readOptions, long processingOptions, long spacingOptions); 22665 22666 public static void imaqRenameChar(CharSet set, int index, String newCharValue) { 22667 ByteBuffer newCharValue_buf = null; 22668 if (newCharValue != null) { 22669 byte[] newCharValue_bytes; 22670 try { 22671 newCharValue_bytes = newCharValue.getBytes("UTF-8"); 22672 } catch (UnsupportedEncodingException e) { 22673 newCharValue_bytes = new byte[0]; 22674 } 22675 newCharValue_buf = ByteBuffer.allocateDirect(newCharValue_bytes.length+1); 22676 putBytes(newCharValue_buf, newCharValue_bytes, 0, newCharValue_bytes.length).put(newCharValue_bytes.length, (byte)0); 22677 } 22678 _imaqRenameChar(set.getAddress(), index, newCharValue == null ? 0 : getByteBufferAddress(newCharValue_buf)); 22679 22680 } 22681 private static native void _imaqRenameChar(long set, int index, long newCharValue); 22682 22683 public static void imaqSetReferenceChar(CharSet set, int index, int isReferenceChar) { 22684 22685 _imaqSetReferenceChar(set.getAddress(), index, isReferenceChar); 22686 22687 } 22688 private static native void _imaqSetReferenceChar(long set, int index, int isReferenceChar); 22689 22690 public static void imaqTrainChars(Image image, CharSet set, int index, String charValue, ROI roi, OCRProcessingOptions processingOptions, OCRSpacingOptions spacingOptions) { 22691 ByteBuffer charValue_buf = null; 22692 if (charValue != null) { 22693 byte[] charValue_bytes; 22694 try { 22695 charValue_bytes = charValue.getBytes("UTF-8"); 22696 } catch (UnsupportedEncodingException e) { 22697 charValue_bytes = new byte[0]; 22698 } 22699 charValue_buf = ByteBuffer.allocateDirect(charValue_bytes.length+1); 22700 putBytes(charValue_buf, charValue_bytes, 0, charValue_bytes.length).put(charValue_bytes.length, (byte)0); 22701 } 22702 _imaqTrainChars(image.getAddress(), set.getAddress(), index, charValue == null ? 0 : getByteBufferAddress(charValue_buf), roi.getAddress(), processingOptions.getAddress(), spacingOptions.getAddress()); 22703 22704 } 22705 private static native void _imaqTrainChars(long image, long set, int index, long charValue, long roi, long processingOptions, long spacingOptions); 22706 22707 public static class VerifyTextResult { 22708 public int[] array; 22709 private long array_addr; 22710 private VerifyTextResult(ByteBuffer rv_buf, long jn_rv) { 22711 array_addr = jn_rv; 22712 int array_numScores; 22713 array_numScores = rv_buf.getInt(0); 22714 array = new int[array_numScores]; 22715 if (array_numScores > 0 && array_addr != 0) { 22716 newDirectByteBuffer(array_addr, array_numScores*4).asIntBuffer().get(array); 22717 } 22718 } 22719 22720 @Override 22721 protected void finalize() throws Throwable { 22722 imaqDispose(array_addr); 22723 super.finalize(); 22724 } 22725 } 22726 22727 public static VerifyTextResult imaqVerifyText(Image image, CharSet set, String expectedString, ROI roi) { 22728 ByteBuffer expectedString_buf = null; 22729 if (expectedString != null) { 22730 byte[] expectedString_bytes; 22731 try { 22732 expectedString_bytes = expectedString.getBytes("UTF-8"); 22733 } catch (UnsupportedEncodingException e) { 22734 expectedString_bytes = new byte[0]; 22735 } 22736 expectedString_buf = ByteBuffer.allocateDirect(expectedString_bytes.length+1); 22737 putBytes(expectedString_buf, expectedString_bytes, 0, expectedString_bytes.length).put(expectedString_bytes.length, (byte)0); 22738 } 22739 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22740 long rv_addr = getByteBufferAddress(rv_buf); 22741 long jn_rv = _imaqVerifyText(image.getAddress(), set.getAddress(), expectedString == null ? 0 : getByteBufferAddress(expectedString_buf), roi.getAddress(), rv_addr+0); 22742 VerifyTextResult rv = new VerifyTextResult(rv_buf, jn_rv); 22743 return rv; 22744 } 22745 private static native long _imaqVerifyText(long image, long set, long expectedString, long roi, long numScores); 22746 22747 public static void imaqWriteOCRFile(String fileName, CharSet set, String setDescription, ReadTextOptions readOptions, OCRProcessingOptions processingOptions, OCRSpacingOptions spacingOptions) { 22748 ByteBuffer fileName_buf = null; 22749 if (fileName != null) { 22750 byte[] fileName_bytes; 22751 try { 22752 fileName_bytes = fileName.getBytes("UTF-8"); 22753 } catch (UnsupportedEncodingException e) { 22754 fileName_bytes = new byte[0]; 22755 } 22756 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 22757 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 22758 } 22759 ByteBuffer setDescription_buf = null; 22760 if (setDescription != null) { 22761 byte[] setDescription_bytes; 22762 try { 22763 setDescription_bytes = setDescription.getBytes("UTF-8"); 22764 } catch (UnsupportedEncodingException e) { 22765 setDescription_bytes = new byte[0]; 22766 } 22767 setDescription_buf = ByteBuffer.allocateDirect(setDescription_bytes.length+1); 22768 putBytes(setDescription_buf, setDescription_bytes, 0, setDescription_bytes.length).put(setDescription_bytes.length, (byte)0); 22769 } 22770 _imaqWriteOCRFile(fileName == null ? 0 : getByteBufferAddress(fileName_buf), set.getAddress(), setDescription == null ? 0 : getByteBufferAddress(setDescription_buf), readOptions.getAddress(), processingOptions.getAddress(), spacingOptions.getAddress()); 22771 22772 } 22773 private static native void _imaqWriteOCRFile(long fileName, long set, long setDescription, long readOptions, long processingOptions, long spacingOptions); 22774 22775 /** 22776 * Geometric Matching functions 22777 */ 22778 22779 public static class ExtractContourResult { 22780 public CurveParameters curveParams; 22781 public ExtractContourReport val; 22782 private ExtractContourResult(ByteBuffer rv_buf) { 22783 curveParams = new CurveParameters(rv_buf, 0); 22784 curveParams.read(); 22785 } 22786 } 22787 22788 public static ExtractContourResult imaqExtractContour(Image image, ROI roi, ExtractContourDirection direction, ConnectionConstraint connectionConstraintParams, int numOfConstraints, ExtractContourSelection selection, Image contourImage) { 22789 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22790 long rv_addr = getByteBufferAddress(rv_buf); 22791 long jn_rv = _imaqExtractContour(image.getAddress(), roi.getAddress(), direction.getValue(), rv_addr+0, connectionConstraintParams.getAddress(), numOfConstraints, selection.getValue(), contourImage.getAddress()); 22792 ExtractContourResult rv = new ExtractContourResult(rv_buf); 22793 rv.val = new ExtractContourReport(jn_rv, true); 22794 return rv; 22795 } 22796 private static native long _imaqExtractContour(long image, long roi, int direction, long curveParams, long connectionConstraintParams, int numOfConstraints, int selection, long contourImage); 22797 22798 public static void imaqContourOverlay(Image image, Image contourImage, ContourOverlaySettings pointsSettings, ContourOverlaySettings eqnSettings, String groupName) { 22799 ByteBuffer groupName_buf = null; 22800 if (groupName != null) { 22801 byte[] groupName_bytes; 22802 try { 22803 groupName_bytes = groupName.getBytes("UTF-8"); 22804 } catch (UnsupportedEncodingException e) { 22805 groupName_bytes = new byte[0]; 22806 } 22807 groupName_buf = ByteBuffer.allocateDirect(groupName_bytes.length+1); 22808 putBytes(groupName_buf, groupName_bytes, 0, groupName_bytes.length).put(groupName_bytes.length, (byte)0); 22809 } 22810 _imaqContourOverlay(image.getAddress(), contourImage.getAddress(), pointsSettings.getAddress(), eqnSettings.getAddress(), groupName == null ? 0 : getByteBufferAddress(groupName_buf)); 22811 22812 } 22813 private static native void _imaqContourOverlay(long image, long contourImage, long pointsSettings, long eqnSettings, long groupName); 22814 22815 public static ContourComputeCurvatureReport imaqContourComputeCurvature(Image contourImage, int kernel) { 22816 22817 long jn_rv = _imaqContourComputeCurvature(contourImage.getAddress(), kernel); 22818 22819 return new ContourComputeCurvatureReport(jn_rv, true); 22820 } 22821 private static native long _imaqContourComputeCurvature(long contourImage, int kernel); 22822 22823 public static CurvatureAnalysisReport imaqContourClassifyCurvature(Image contourImage, int kernel, RangeLabel[] curvatureClasses) { 22824 int numCurvatureClasses = curvatureClasses.length; 22825 ByteBuffer curvatureClasses_buf = null; 22826 curvatureClasses_buf = ByteBuffer.allocateDirect(curvatureClasses.length*24).order(ByteOrder.nativeOrder()); 22827 for (int i=0, off=0; i<curvatureClasses.length; i++, off += 24) { 22828 curvatureClasses[i].setBuffer(curvatureClasses_buf, off); 22829 curvatureClasses[i].write(); 22830 } 22831 long jn_rv = _imaqContourClassifyCurvature(contourImage.getAddress(), kernel, getByteBufferAddress(curvatureClasses_buf), numCurvatureClasses); 22832 22833 return new CurvatureAnalysisReport(jn_rv, true); 22834 } 22835 private static native long _imaqContourClassifyCurvature(long contourImage, int kernel, long curvatureClasses, int numCurvatureClasses); 22836 22837 public static ComputeDistancesReport imaqContourComputeDistances(Image targetImage, Image templateImage, SetupMatchPatternData matchSetupData, int smoothingKernel) { 22838 22839 long jn_rv = _imaqContourComputeDistances(targetImage.getAddress(), templateImage.getAddress(), matchSetupData.getAddress(), smoothingKernel); 22840 22841 return new ComputeDistancesReport(jn_rv, true); 22842 } 22843 private static native long _imaqContourComputeDistances(long targetImage, long templateImage, long matchSetupData, int smoothingKernel); 22844 22845 public static ClassifyDistancesReport imaqContourClassifyDistances(Image targetImage, Image templateImage, SetupMatchPatternData matchSetupData, int smoothingKernel, RangeLabel[] distanceRanges) { 22846 int numDistanceRanges = distanceRanges.length; 22847 ByteBuffer distanceRanges_buf = null; 22848 distanceRanges_buf = ByteBuffer.allocateDirect(distanceRanges.length*24).order(ByteOrder.nativeOrder()); 22849 for (int i=0, off=0; i<distanceRanges.length; i++, off += 24) { 22850 distanceRanges[i].setBuffer(distanceRanges_buf, off); 22851 distanceRanges[i].write(); 22852 } 22853 long jn_rv = _imaqContourClassifyDistances(targetImage.getAddress(), templateImage.getAddress(), matchSetupData.getAddress(), smoothingKernel, getByteBufferAddress(distanceRanges_buf), numDistanceRanges); 22854 22855 return new ClassifyDistancesReport(jn_rv, true); 22856 } 22857 private static native long _imaqContourClassifyDistances(long targetImage, long templateImage, long matchSetupData, int smoothingKernel, long distanceRanges, int numDistanceRanges); 22858 22859 public static ContourInfoReport imaqContourInfo(Image contourImage) { 22860 22861 long jn_rv = _imaqContourInfo(contourImage.getAddress()); 22862 22863 return new ContourInfoReport(jn_rv, true); 22864 } 22865 private static native long _imaqContourInfo(long contourImage); 22866 22867 public static class ContourSetupMatchPatternResult { 22868 public MatchMode matchMode; 22869 public CurveParameters curveParams; 22870 public SetupMatchPatternData val; 22871 private ContourSetupMatchPatternResult(ByteBuffer rv_buf) { 22872 matchMode = new MatchMode(rv_buf, 0); 22873 matchMode.read(); 22874 curveParams = new CurveParameters(rv_buf, 8); 22875 curveParams.read(); 22876 } 22877 } 22878 22879 public static ContourSetupMatchPatternResult imaqContourSetupMatchPattern(int enableSubPixelAccuracy, int useLearnCurveParameters, RangeSettingDouble[] rangeSettings) { 22880 int numRangeSettings = rangeSettings.length; 22881 ByteBuffer rangeSettings_buf = null; 22882 rangeSettings_buf = ByteBuffer.allocateDirect(rangeSettings.length*24).order(ByteOrder.nativeOrder()); 22883 for (int i=0, off=0; i<rangeSettings.length; i++, off += 24) { 22884 rangeSettings[i].setBuffer(rangeSettings_buf, off); 22885 rangeSettings[i].write(); 22886 } 22887 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 22888 long rv_addr = getByteBufferAddress(rv_buf); 22889 long jn_rv = _imaqContourSetupMatchPattern(rv_addr+0, enableSubPixelAccuracy, rv_addr+8, useLearnCurveParameters, getByteBufferAddress(rangeSettings_buf), numRangeSettings); 22890 ContourSetupMatchPatternResult rv = new ContourSetupMatchPatternResult(rv_buf); 22891 rv.val = new SetupMatchPatternData(jn_rv, true); 22892 return rv; 22893 } 22894 private static native long _imaqContourSetupMatchPattern(long matchMode, int enableSubPixelAccuracy, long curveParams, int useLearnCurveParameters, long rangeSettings, int numRangeSettings); 22895 22896 public static SetupMatchPatternData imaqContourAdvancedSetupMatchPattern(GeometricAdvancedSetupDataOption[] geometricOptions) { 22897 int numGeometricOptions = geometricOptions.length; 22898 ByteBuffer geometricOptions_buf = null; 22899 geometricOptions_buf = ByteBuffer.allocateDirect(geometricOptions.length*16).order(ByteOrder.nativeOrder()); 22900 for (int i=0, off=0; i<geometricOptions.length; i++, off += 16) { 22901 geometricOptions[i].setBuffer(geometricOptions_buf, off); 22902 geometricOptions[i].write(); 22903 } 22904 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 22905 long rv_addr = getByteBufferAddress(rv_buf); 22906 _imaqContourAdvancedSetupMatchPattern(rv_addr+0, getByteBufferAddress(geometricOptions_buf), numGeometricOptions); 22907 SetupMatchPatternData matchSetupData; 22908 matchSetupData = new SetupMatchPatternData(rv_buf, 0); 22909 matchSetupData.read(); 22910 return matchSetupData; 22911 } 22912 private static native void _imaqContourAdvancedSetupMatchPattern(long matchSetupData, long geometricOptions, int numGeometricOptions); 22913 22914 public static ContourFitLineReport imaqContourFitLine(Image image, double pixelRadius) { 22915 22916 long jn_rv = _imaqContourFitLine(image.getAddress(), pixelRadius); 22917 22918 return new ContourFitLineReport(jn_rv, true); 22919 } 22920 private static native long _imaqContourFitLine(long image, double pixelRadius); 22921 22922 public static PartialCircle imaqContourFitCircle(Image image, double pixelRadius, int rejectOutliers) { 22923 22924 long jn_rv = _imaqContourFitCircle(image.getAddress(), pixelRadius, rejectOutliers); 22925 22926 return new PartialCircle(jn_rv, true); 22927 } 22928 private static native long _imaqContourFitCircle(long image, double pixelRadius, int rejectOutliers); 22929 22930 public static PartialEllipse imaqContourFitEllipse(Image image, double pixelRadius, int rejectOutliers) { 22931 22932 long jn_rv = _imaqContourFitEllipse(image.getAddress(), pixelRadius, rejectOutliers); 22933 22934 return new PartialEllipse(jn_rv, true); 22935 } 22936 private static native long _imaqContourFitEllipse(long image, double pixelRadius, int rejectOutliers); 22937 22938 public static ContourFitSplineReport imaqContourFitSpline(Image image, int degree, int numberOfControlPoints) { 22939 22940 long jn_rv = _imaqContourFitSpline(image.getAddress(), degree, numberOfControlPoints); 22941 22942 return new ContourFitSplineReport(jn_rv, true); 22943 } 22944 private static native long _imaqContourFitSpline(long image, int degree, int numberOfControlPoints); 22945 22946 public static ContourFitPolynomialReport imaqContourFitPolynomial(Image image, int order) { 22947 22948 long jn_rv = _imaqContourFitPolynomial(image.getAddress(), order); 22949 22950 return new ContourFitPolynomialReport(jn_rv, true); 22951 } 22952 private static native long _imaqContourFitPolynomial(long image, int order); 22953 22954 /** 22955 * Edge Detection functions 22956 */ 22957 22958 public static FindCircularEdgeReport imaqFindCircularEdge2(Image image, ROI roi, CoordinateSystem baseSystem, CoordinateSystem newSystem, FindCircularEdgeOptions edgeOptions, CircleFitOptions circleFitOptions) { 22959 22960 long jn_rv = _imaqFindCircularEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress(), edgeOptions.getAddress(), circleFitOptions.getAddress()); 22961 22962 return new FindCircularEdgeReport(jn_rv, true); 22963 } 22964 private static native long _imaqFindCircularEdge2(long image, long roi, long baseSystem, long newSystem, long edgeOptions, long circleFitOptions); 22965 22966 public static FindConcentricEdgeReport imaqFindConcentricEdge2(Image image, ROI roi, CoordinateSystem baseSystem, CoordinateSystem newSystem, FindConcentricEdgeOptions edgeOptions, ConcentricEdgeFitOptions concentricEdgeFitOptions) { 22967 22968 long jn_rv = _imaqFindConcentricEdge2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress(), edgeOptions.getAddress(), concentricEdgeFitOptions.getAddress()); 22969 22970 return new FindConcentricEdgeReport(jn_rv, true); 22971 } 22972 private static native long _imaqFindConcentricEdge2(long image, long roi, long baseSystem, long newSystem, long edgeOptions, long concentricEdgeFitOptions); 22973 22974 /** 22975 * Morphology Reconstruction functions 22976 */ 22977 22978 public static void imaqGrayMorphologyReconstruct(Image dstImage, Image srcImage, Image markerImage, PointFloat[] points, MorphologyReconstructOperation operation, StructuringElement structuringElement, ROI roi) { 22979 int numOfPoints = points.length; 22980 ByteBuffer points_buf = null; 22981 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 22982 for (int i=0, off=0; i<points.length; i++, off += 8) { 22983 points[i].setBuffer(points_buf, off); 22984 points[i].write(); 22985 } 22986 _imaqGrayMorphologyReconstruct(dstImage.getAddress(), srcImage.getAddress(), markerImage.getAddress(), getByteBufferAddress(points_buf), numOfPoints, operation.getValue(), structuringElement.getAddress(), roi.getAddress()); 22987 22988 } 22989 private static native void _imaqGrayMorphologyReconstruct(long dstImage, long srcImage, long markerImage, long points, int numOfPoints, int operation, long structuringElement, long roi); 22990 22991 public static void imaqMorphologyReconstruct(Image dstImage, Image srcImage, Image markerImage, PointFloat[] points, MorphologyReconstructOperation operation, Connectivity connectivity, ROI roi) { 22992 int numOfPoints = points.length; 22993 ByteBuffer points_buf = null; 22994 points_buf = ByteBuffer.allocateDirect(points.length*8).order(ByteOrder.nativeOrder()); 22995 for (int i=0, off=0; i<points.length; i++, off += 8) { 22996 points[i].setBuffer(points_buf, off); 22997 points[i].write(); 22998 } 22999 _imaqMorphologyReconstruct(dstImage.getAddress(), srcImage.getAddress(), markerImage.getAddress(), getByteBufferAddress(points_buf), numOfPoints, operation.getValue(), connectivity.getValue(), roi.getAddress()); 23000 23001 } 23002 private static native void _imaqMorphologyReconstruct(long dstImage, long srcImage, long markerImage, long points, int numOfPoints, int operation, int connectivity, long roi); 23003 23004 /** 23005 * Texture functions 23006 */ 23007 23008 public static void imaqDetectTextureDefect(ClassifierSession session, Image destImage, Image srcImage, ROI roi, int initialStepSize, int finalStepSize, short defectPixelValue, double minClassificationScore) { 23009 23010 _imaqDetectTextureDefect(session.getAddress(), destImage.getAddress(), srcImage.getAddress(), roi.getAddress(), initialStepSize, finalStepSize, defectPixelValue, minClassificationScore); 23011 23012 } 23013 private static native void _imaqDetectTextureDefect(long session, long destImage, long srcImage, long roi, int initialStepSize, int finalStepSize, short defectPixelValue, double minClassificationScore); 23014 23015 /** 23016 * Regions of Interest Manipulation functions 23017 */ 23018 23019 public static class MaskToROIResult { 23020 public int withinLimit; 23021 public ROI val; 23022 private MaskToROIResult(ByteBuffer rv_buf) { 23023 withinLimit = rv_buf.getInt(0); 23024 } 23025 } 23026 23027 public static MaskToROIResult imaqMaskToROI(Image mask) { 23028 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23029 long rv_addr = getByteBufferAddress(rv_buf); 23030 long jn_rv = _imaqMaskToROI(mask.getAddress(), rv_addr+0); 23031 MaskToROIResult rv = new MaskToROIResult(rv_buf); 23032 rv.val = new ROI(jn_rv, true); 23033 return rv; 23034 } 23035 private static native long _imaqMaskToROI(long mask, long withinLimit); 23036 23037 public static ROIProfile imaqROIProfile(Image image, ROI roi) { 23038 23039 long jn_rv = _imaqROIProfile(image.getAddress(), roi.getAddress()); 23040 23041 return new ROIProfile(jn_rv, true); 23042 } 23043 private static native long _imaqROIProfile(long image, long roi); 23044 23045 public static int imaqROIToMask(Image mask, ROI roi, int fillValue, Image imageModel) { 23046 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23047 long rv_addr = getByteBufferAddress(rv_buf); 23048 _imaqROIToMask(mask.getAddress(), roi.getAddress(), fillValue, imageModel == null ? 0 : imageModel.getAddress(), rv_addr+0); 23049 int inSpace; 23050 inSpace = rv_buf.getInt(0); 23051 return inSpace; 23052 } 23053 private static native void _imaqROIToMask(long mask, long roi, int fillValue, long imageModel, long inSpace); 23054 23055 public static void imaqTransformROI2(ROI roi, CoordinateSystem baseSystem, CoordinateSystem newSystem) { 23056 23057 _imaqTransformROI2(roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress()); 23058 23059 } 23060 private static native void _imaqTransformROI2(long roi, long baseSystem, long newSystem); 23061 23062 public static LabelToROIReport imaqLabelToROI(Image image, int[] labelsIn, int maxNumVectors, int isExternelEdges) { 23063 int numLabelsIn = labelsIn.length; 23064 ByteBuffer labelsIn_buf = null; 23065 labelsIn_buf = ByteBuffer.allocateDirect(labelsIn.length*4).order(ByteOrder.nativeOrder()); 23066 labelsIn_buf.asIntBuffer().put(labelsIn).rewind(); 23067 long jn_rv = _imaqLabelToROI(image.getAddress(), getByteBufferAddress(labelsIn_buf), numLabelsIn, maxNumVectors, isExternelEdges); 23068 23069 return new LabelToROIReport(jn_rv, true); 23070 } 23071 private static native long _imaqLabelToROI(long image, long labelsIn, int numLabelsIn, int maxNumVectors, int isExternelEdges); 23072 23073 /** 23074 * Morphology functions 23075 */ 23076 23077 public static void imaqGrayMorphology(Image dest, Image source, MorphologyMethod method, StructuringElement structuringElement) { 23078 23079 _imaqGrayMorphology(dest.getAddress(), source.getAddress(), method.getValue(), structuringElement == null ? 0 : structuringElement.getAddress()); 23080 23081 } 23082 private static native void _imaqGrayMorphology(long dest, long source, int method, long structuringElement); 23083 23084 /** 23085 * Classification functions 23086 */ 23087 23088 public static void imaqAddClassifierSample(Image image, ClassifierSession session, ROI roi, String sampleClass, double[] featureVector) { 23089 ByteBuffer sampleClass_buf = null; 23090 if (sampleClass != null) { 23091 byte[] sampleClass_bytes; 23092 try { 23093 sampleClass_bytes = sampleClass.getBytes("UTF-8"); 23094 } catch (UnsupportedEncodingException e) { 23095 sampleClass_bytes = new byte[0]; 23096 } 23097 sampleClass_buf = ByteBuffer.allocateDirect(sampleClass_bytes.length+1); 23098 putBytes(sampleClass_buf, sampleClass_bytes, 0, sampleClass_bytes.length).put(sampleClass_bytes.length, (byte)0); 23099 } 23100 int vectorSize = featureVector.length; 23101 ByteBuffer featureVector_buf = null; 23102 featureVector_buf = ByteBuffer.allocateDirect(featureVector.length*8).order(ByteOrder.nativeOrder()); 23103 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 23104 _imaqAddClassifierSample(image.getAddress(), session.getAddress(), roi.getAddress(), sampleClass == null ? 0 : getByteBufferAddress(sampleClass_buf), getByteBufferAddress(featureVector_buf), vectorSize); 23105 23106 } 23107 private static native void _imaqAddClassifierSample(long image, long session, long roi, long sampleClass, long featureVector, int vectorSize); 23108 23109 public static ClassifierReportAdvanced imaqAdvanceClassify(Image image, ClassifierSession session, ROI roi, double[] featureVector) { 23110 int vectorSize = featureVector.length; 23111 ByteBuffer featureVector_buf = null; 23112 featureVector_buf = ByteBuffer.allocateDirect(featureVector.length*8).order(ByteOrder.nativeOrder()); 23113 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 23114 long jn_rv = _imaqAdvanceClassify(image.getAddress(), session.getAddress(), roi.getAddress(), getByteBufferAddress(featureVector_buf), vectorSize); 23115 23116 return new ClassifierReportAdvanced(jn_rv, true); 23117 } 23118 private static native long _imaqAdvanceClassify(long image, long session, long roi, long featureVector, int vectorSize); 23119 23120 public static ClassifierReport imaqClassify(Image image, ClassifierSession session, ROI roi, double[] featureVector) { 23121 int vectorSize = featureVector.length; 23122 ByteBuffer featureVector_buf = null; 23123 featureVector_buf = ByteBuffer.allocateDirect(featureVector.length*8).order(ByteOrder.nativeOrder()); 23124 featureVector_buf.asDoubleBuffer().put(featureVector).rewind(); 23125 long jn_rv = _imaqClassify(image.getAddress(), session.getAddress(), roi.getAddress(), getByteBufferAddress(featureVector_buf), vectorSize); 23126 23127 return new ClassifierReport(jn_rv, true); 23128 } 23129 private static native long _imaqClassify(long image, long session, long roi, long featureVector, int vectorSize); 23130 23131 public static ClassifierSession imaqCreateClassifier(ClassifierType type) { 23132 23133 long jn_rv = _imaqCreateClassifier(type.getValue()); 23134 23135 return new ClassifierSession(jn_rv, true); 23136 } 23137 private static native long _imaqCreateClassifier(int type); 23138 23139 public static void imaqDeleteClassifierSample(ClassifierSession session, int index) { 23140 23141 _imaqDeleteClassifierSample(session.getAddress(), index); 23142 23143 } 23144 private static native void _imaqDeleteClassifierSample(long session, int index); 23145 23146 public static ClassifierAccuracyReport imaqGetClassifierAccuracy(ClassifierSession session) { 23147 23148 long jn_rv = _imaqGetClassifierAccuracy(session.getAddress()); 23149 23150 return new ClassifierAccuracyReport(jn_rv, true); 23151 } 23152 private static native long _imaqGetClassifierAccuracy(long session); 23153 23154 public static class GetClassifierSampleInfoResult { 23155 public int numSamples; 23156 public ClassifierSampleInfo val; 23157 private GetClassifierSampleInfoResult(ByteBuffer rv_buf) { 23158 numSamples = rv_buf.getInt(0); 23159 } 23160 } 23161 23162 public static GetClassifierSampleInfoResult imaqGetClassifierSampleInfo(ClassifierSession session, int index) { 23163 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23164 long rv_addr = getByteBufferAddress(rv_buf); 23165 long jn_rv = _imaqGetClassifierSampleInfo(session.getAddress(), index, rv_addr+0); 23166 GetClassifierSampleInfoResult rv = new GetClassifierSampleInfoResult(rv_buf); 23167 rv.val = new ClassifierSampleInfo(jn_rv, true); 23168 return rv; 23169 } 23170 private static native long _imaqGetClassifierSampleInfo(long session, int index, long numSamples); 23171 23172 public static ColorOptions imaqGetColorClassifierOptions(ClassifierSession session) { 23173 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23174 long rv_addr = getByteBufferAddress(rv_buf); 23175 _imaqGetColorClassifierOptions(session.getAddress(), rv_addr+0); 23176 ColorOptions options; 23177 options = new ColorOptions(rv_buf, 0); 23178 options.read(); 23179 return options; 23180 } 23181 private static native void _imaqGetColorClassifierOptions(long session, long options); 23182 23183 public static NearestNeighborOptions imaqGetNearestNeighborOptions(ClassifierSession session) { 23184 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23185 long rv_addr = getByteBufferAddress(rv_buf); 23186 _imaqGetNearestNeighborOptions(session.getAddress(), rv_addr+0); 23187 NearestNeighborOptions options; 23188 options = new NearestNeighborOptions(rv_buf, 0); 23189 options.read(); 23190 return options; 23191 } 23192 private static native void _imaqGetNearestNeighborOptions(long session, long options); 23193 23194 public static class GetParticleClassifierOptions2Result { 23195 public ParticleClassifierPreprocessingOptions2 preprocessingOptions; 23196 public ParticleClassifierOptions options; 23197 private GetParticleClassifierOptions2Result(ByteBuffer rv_buf) { 23198 preprocessingOptions = new ParticleClassifierPreprocessingOptions2(rv_buf, 0); 23199 preprocessingOptions.read(); 23200 options = new ParticleClassifierOptions(rv_buf, 8); 23201 options.read(); 23202 } 23203 } 23204 23205 public static GetParticleClassifierOptions2Result imaqGetParticleClassifierOptions2(ClassifierSession session) { 23206 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 23207 long rv_addr = getByteBufferAddress(rv_buf); 23208 _imaqGetParticleClassifierOptions2(session.getAddress(), rv_addr+0, rv_addr+8); 23209 GetParticleClassifierOptions2Result rv = new GetParticleClassifierOptions2Result(rv_buf); 23210 return rv; 23211 } 23212 private static native void _imaqGetParticleClassifierOptions2(long session, long preprocessingOptions, long options); 23213 23214 public static class ReadClassifierFileResult { 23215 public ClassifierType type; 23216 public ClassifierEngineType engine; 23217 public ClassifierSession val; 23218 private ReadClassifierFileResult(ByteBuffer rv_buf) { 23219 type = ClassifierType.fromValue(rv_buf.getInt(0)); 23220 engine = ClassifierEngineType.fromValue(rv_buf.getInt(8)); 23221 } 23222 } 23223 23224 public static ReadClassifierFileResult imaqReadClassifierFile(ClassifierSession session, String fileName, ReadClassifierFileMode mode, String description) { 23225 ByteBuffer fileName_buf = null; 23226 if (fileName != null) { 23227 byte[] fileName_bytes; 23228 try { 23229 fileName_bytes = fileName.getBytes("UTF-8"); 23230 } catch (UnsupportedEncodingException e) { 23231 fileName_bytes = new byte[0]; 23232 } 23233 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 23234 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 23235 } 23236 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 23237 if (description != null) { 23238 byte[] bytes; 23239 try { 23240 bytes = description.getBytes("UTF-8"); 23241 } catch (UnsupportedEncodingException e) { 23242 bytes = new byte[0]; 23243 } 23244 putBytes(description_buf, bytes, 0, bytes.length); 23245 for (int i=bytes.length; i<256; i++) 23246 description_buf.put(i, (byte)0); // fill with zero 23247 } 23248 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 23249 long rv_addr = getByteBufferAddress(rv_buf); 23250 long jn_rv = _imaqReadClassifierFile(session.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), mode.getValue(), rv_addr+0, rv_addr+8, description == null ? 0 : getByteBufferAddress(description_buf)); 23251 ReadClassifierFileResult rv = new ReadClassifierFileResult(rv_buf); 23252 rv.val = new ClassifierSession(jn_rv, true); 23253 return rv; 23254 } 23255 private static native long _imaqReadClassifierFile(long session, long fileName, int mode, long type, long engine, long description); 23256 23257 public static void imaqRelabelClassifierSample(ClassifierSession session, int index, String newClass) { 23258 ByteBuffer newClass_buf = null; 23259 if (newClass != null) { 23260 byte[] newClass_bytes; 23261 try { 23262 newClass_bytes = newClass.getBytes("UTF-8"); 23263 } catch (UnsupportedEncodingException e) { 23264 newClass_bytes = new byte[0]; 23265 } 23266 newClass_buf = ByteBuffer.allocateDirect(newClass_bytes.length+1); 23267 putBytes(newClass_buf, newClass_bytes, 0, newClass_bytes.length).put(newClass_bytes.length, (byte)0); 23268 } 23269 _imaqRelabelClassifierSample(session.getAddress(), index, newClass == null ? 0 : getByteBufferAddress(newClass_buf)); 23270 23271 } 23272 private static native void _imaqRelabelClassifierSample(long session, int index, long newClass); 23273 23274 public static void imaqSetParticleClassifierOptions2(ClassifierSession session, ParticleClassifierPreprocessingOptions2 preprocessingOptions, ParticleClassifierOptions options) { 23275 23276 _imaqSetParticleClassifierOptions2(session.getAddress(), preprocessingOptions.getAddress(), options.getAddress()); 23277 23278 } 23279 private static native void _imaqSetParticleClassifierOptions2(long session, long preprocessingOptions, long options); 23280 23281 public static void imaqSetColorClassifierOptions(ClassifierSession session, ColorOptions options) { 23282 23283 _imaqSetColorClassifierOptions(session.getAddress(), options.getAddress()); 23284 23285 } 23286 private static native void _imaqSetColorClassifierOptions(long session, long options); 23287 23288 public static NearestNeighborTrainingReport imaqTrainNearestNeighborClassifier(ClassifierSession session, NearestNeighborOptions options) { 23289 23290 long jn_rv = _imaqTrainNearestNeighborClassifier(session.getAddress(), options.getAddress()); 23291 23292 return new NearestNeighborTrainingReport(jn_rv, true); 23293 } 23294 private static native long _imaqTrainNearestNeighborClassifier(long session, long options); 23295 23296 public static void imaqWriteClassifierFile(ClassifierSession session, String fileName, WriteClassifierFileMode mode, String description) { 23297 ByteBuffer fileName_buf = null; 23298 if (fileName != null) { 23299 byte[] fileName_bytes; 23300 try { 23301 fileName_bytes = fileName.getBytes("UTF-8"); 23302 } catch (UnsupportedEncodingException e) { 23303 fileName_bytes = new byte[0]; 23304 } 23305 fileName_buf = ByteBuffer.allocateDirect(fileName_bytes.length+1); 23306 putBytes(fileName_buf, fileName_bytes, 0, fileName_bytes.length).put(fileName_bytes.length, (byte)0); 23307 } 23308 ByteBuffer description_buf = ByteBuffer.allocateDirect(256).order(ByteOrder.nativeOrder()); 23309 if (description != null) { 23310 byte[] bytes; 23311 try { 23312 bytes = description.getBytes("UTF-8"); 23313 } catch (UnsupportedEncodingException e) { 23314 bytes = new byte[0]; 23315 } 23316 putBytes(description_buf, bytes, 0, bytes.length); 23317 for (int i=bytes.length; i<256; i++) 23318 description_buf.put(i, (byte)0); // fill with zero 23319 } 23320 _imaqWriteClassifierFile(session.getAddress(), fileName == null ? 0 : getByteBufferAddress(fileName_buf), mode.getValue(), description == null ? 0 : getByteBufferAddress(description_buf)); 23321 23322 } 23323 private static native void _imaqWriteClassifierFile(long session, long fileName, int mode, long description); 23324 23325 /** 23326 * Measure Distances functions 23327 */ 23328 23329 public static ClampMax2Report imaqClampMax2(Image image, ROI roi, CoordinateSystem baseSystem, CoordinateSystem newSystem, CurveOptions curveSettings, ClampSettings clampSettings, ClampOverlaySettings clampOverlaySettings) { 23330 23331 long jn_rv = _imaqClampMax2(image.getAddress(), roi.getAddress(), baseSystem.getAddress(), newSystem.getAddress(), curveSettings.getAddress(), clampSettings.getAddress(), clampOverlaySettings.getAddress()); 23332 23333 return new ClampMax2Report(jn_rv, true); 23334 } 23335 private static native long _imaqClampMax2(long image, long roi, long baseSystem, long newSystem, long curveSettings, long clampSettings, long clampOverlaySettings); 23336 23337 /** 23338 * Inspection functions 23339 */ 23340 23341 public static void imaqCompareGoldenTemplate(Image image, Image goldenTemplate, Image brightDefects, Image darkDefects, InspectionAlignment alignment, InspectionOptions options) { 23342 23343 _imaqCompareGoldenTemplate(image.getAddress(), goldenTemplate.getAddress(), brightDefects.getAddress(), darkDefects.getAddress(), alignment.getAddress(), options.getAddress()); 23344 23345 } 23346 private static native void _imaqCompareGoldenTemplate(long image, long goldenTemplate, long brightDefects, long darkDefects, long alignment, long options); 23347 23348 public static void imaqLearnGoldenTemplate(Image goldenTemplate, PointFloat originOffset, Image mask) { 23349 23350 _imaqLearnGoldenTemplate(goldenTemplate.getAddress(), originOffset.getAddress(), mask.getAddress()); 23351 23352 } 23353 private static native void _imaqLearnGoldenTemplate(long goldenTemplate, long originOffset, long mask); 23354 23355 /** 23356 * Obsolete functions 23357 */ 23358 23359 public static class GetParticleClassifierOptionsResult { 23360 public ParticleClassifierPreprocessingOptions preprocessingOptions; 23361 public ParticleClassifierOptions options; 23362 private GetParticleClassifierOptionsResult(ByteBuffer rv_buf) { 23363 preprocessingOptions = new ParticleClassifierPreprocessingOptions(rv_buf, 0); 23364 preprocessingOptions.read(); 23365 options = new ParticleClassifierOptions(rv_buf, 8); 23366 options.read(); 23367 } 23368 } 23369 23370 public static GetParticleClassifierOptionsResult imaqGetParticleClassifierOptions(ClassifierSession session) { 23371 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 23372 long rv_addr = getByteBufferAddress(rv_buf); 23373 _imaqGetParticleClassifierOptions(session.getAddress(), rv_addr+0, rv_addr+8); 23374 GetParticleClassifierOptionsResult rv = new GetParticleClassifierOptionsResult(rv_buf); 23375 return rv; 23376 } 23377 private static native void _imaqGetParticleClassifierOptions(long session, long preprocessingOptions, long options); 23378 23379 public static int imaqParticleFilter3(Image dest, Image source, ParticleFilterCriteria2 criteria, int criteriaCount, ParticleFilterOptions options, ROI roi) { 23380 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23381 long rv_addr = getByteBufferAddress(rv_buf); 23382 _imaqParticleFilter3(dest.getAddress(), source.getAddress(), criteria.getAddress(), criteriaCount, options.getAddress(), roi.getAddress(), rv_addr+0); 23383 int numParticles; 23384 numParticles = rv_buf.getInt(0); 23385 return numParticles; 23386 } 23387 private static native void _imaqParticleFilter3(long dest, long source, long criteria, int criteriaCount, long options, long roi, long numParticles); 23388 23389 public static LearnPatternAdvancedOptions imaqLearnPattern2(Image image, LearningMode learningMode) { 23390 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23391 long rv_addr = getByteBufferAddress(rv_buf); 23392 _imaqLearnPattern2(image.getAddress(), learningMode.getValue(), rv_addr+0); 23393 LearnPatternAdvancedOptions advancedOptions; 23394 advancedOptions = new LearnPatternAdvancedOptions(rv_buf, 0); 23395 advancedOptions.read(); 23396 return advancedOptions; 23397 } 23398 private static native void _imaqLearnPattern2(long image, int learningMode, long advancedOptions); 23399 23400 public static void imaqDivide(Image dest, Image sourceA, Image sourceB) { 23401 23402 _imaqDivide(dest.getAddress(), sourceA.getAddress(), sourceB.getAddress()); 23403 23404 } 23405 private static native void _imaqDivide(long dest, long sourceA, long sourceB); 23406 23407 public static EdgeReport2 imaqEdgeTool3(Image image, ROI roi, EdgeProcess processType, EdgeOptions2 edgeOptions) { 23408 23409 long jn_rv = _imaqEdgeTool3(image.getAddress(), roi.getAddress(), processType.getValue(), edgeOptions.getAddress()); 23410 23411 return new EdgeReport2(jn_rv, true); 23412 } 23413 private static native long _imaqEdgeTool3(long image, long roi, int processType, long edgeOptions); 23414 23415 public static ConcentricRakeReport imaqConcentricRake(Image image, ROI roi, ConcentricRakeDirection direction, EdgeProcess process, RakeOptions options) { 23416 23417 long jn_rv = _imaqConcentricRake(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), options.getAddress()); 23418 23419 return new ConcentricRakeReport(jn_rv, true); 23420 } 23421 private static native long _imaqConcentricRake(long image, long roi, int direction, int process, long options); 23422 23423 public static SpokeReport imaqSpoke(Image image, ROI roi, SpokeDirection direction, EdgeProcess process, SpokeOptions options) { 23424 23425 long jn_rv = _imaqSpoke(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), options.getAddress()); 23426 23427 return new SpokeReport(jn_rv, true); 23428 } 23429 private static native long _imaqSpoke(long image, long roi, int direction, int process, long options); 23430 23431 public static class MatchPattern2Result { 23432 public PatternMatch[] array; 23433 private long array_addr; 23434 private MatchPattern2Result(ByteBuffer rv_buf, long jn_rv) { 23435 array_addr = jn_rv; 23436 int array_numMatches; 23437 array_numMatches = rv_buf.getInt(0); 23438 array = new PatternMatch[array_numMatches]; 23439 if (array_numMatches > 0 && array_addr != 0) { 23440 ByteBuffer bb = newDirectByteBuffer(array_addr, array_numMatches*52); 23441 for (int i=0, off=0; i<array_numMatches; i++, off += 52) { 23442 array[i] = new PatternMatch(bb, off); 23443 array[i].read(); 23444 } 23445 } 23446 } 23447 23448 @Override 23449 protected void finalize() throws Throwable { 23450 imaqDispose(array_addr); 23451 super.finalize(); 23452 } 23453 } 23454 23455 public static MatchPattern2Result imaqMatchPattern2(Image image, Image pattern, MatchPatternOptions options, MatchPatternAdvancedOptions advancedOptions, Rect searchRect) { 23456 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 23457 long rv_addr = getByteBufferAddress(rv_buf); 23458 long jn_rv = _imaqMatchPattern2(image.getAddress(), pattern.getAddress(), options == null ? 0 : options.getAddress(), advancedOptions.getAddress(), searchRect.getAddress(), rv_addr+0); 23459 MatchPattern2Result rv = new MatchPattern2Result(rv_buf, jn_rv); 23460 return rv; 23461 } 23462 private static native long _imaqMatchPattern2(long image, long pattern, long options, long advancedOptions, long searchRect, long numMatches); 23463 23464 public static void imaqSetParticleClassifierOptions(ClassifierSession session, ParticleClassifierPreprocessingOptions preprocessingOptions, ParticleClassifierOptions options) { 23465 23466 _imaqSetParticleClassifierOptions(session.getAddress(), preprocessingOptions.getAddress(), options.getAddress()); 23467 23468 } 23469 private static native void _imaqSetParticleClassifierOptions(long session, long preprocessingOptions, long options); 23470 23471 public static RakeReport imaqRake(Image image, ROI roi, RakeDirection direction, EdgeProcess process, RakeOptions options) { 23472 23473 long jn_rv = _imaqRake(image.getAddress(), roi.getAddress(), direction.getValue(), process.getValue(), options.getAddress()); 23474 23475 return new RakeReport(jn_rv, true); 23476 } 23477 private static native long _imaqRake(long image, long roi, int direction, int process, long options); 23478 23479 public static void Priv_ReadJPEGString_C(Image image, byte[] string) { 23480 int stringLength = string.length; 23481 ByteBuffer string_buf = null; 23482 string_buf = ByteBuffer.allocateDirect(string.length); 23483 putBytes(string_buf, string, 0, string.length); 23484 _Priv_ReadJPEGString_C(image.getAddress(), getByteBufferAddress(string_buf), stringLength); 23485 23486 } 23487 private static native void _Priv_ReadJPEGString_C(long image, long string, int stringLength); 23488 23489 /** 23490 * Purpose : Include file for NI-IMAQdx library support. 23491 */ 23492 public static final int IMAQDX_MAX_API_STRING_LENGTH = 512; 23493 23494 /** 23495 * Bus Type Enumeration 23496 */ 23497 23498 public static enum IMAQdxBusType { 23499 BusTypeFireWire(0x31333934), 23500 BusTypeEthernet(0x69707634), 23501 BusTypeSimulator(0x2073696D), 23502 BusTypeDirectShow(0x64736877), 23503 BusTypeIP(0x4950636D), 23504 BusTypeSmartCam2(0x53436132), 23505 BusTypeUSB3Vision(0x55534233), 23506 BusTypeUVC(0x55564320), 23507 BusTypeGuard(0xFFFFFFFF), 23508 ; 23509 private final int value; 23510 private IMAQdxBusType(int value) { 23511 this.value = value; 23512 } 23513 public static IMAQdxBusType fromValue(int val) { 23514 for (IMAQdxBusType v : values()) { 23515 if (v.value == val) 23516 return v; 23517 } 23518 return null; 23519 } 23520 public int getValue() { 23521 return value; 23522 } 23523 } 23524 23525 /** 23526 * Camera Control Mode Enumeration 23527 */ 23528 23529 public static enum IMAQdxCameraControlMode { 23530 CameraControlModeController(0), 23531 CameraControlModeListener(1), 23532 CameraControlModeGuard(0xFFFFFFFF), 23533 ; 23534 private final int value; 23535 private IMAQdxCameraControlMode(int value) { 23536 this.value = value; 23537 } 23538 public static IMAQdxCameraControlMode fromValue(int val) { 23539 for (IMAQdxCameraControlMode v : values()) { 23540 if (v.value == val) 23541 return v; 23542 } 23543 return null; 23544 } 23545 public int getValue() { 23546 return value; 23547 } 23548 } 23549 23550 /** 23551 * Buffer Number Mode Enumeration 23552 */ 23553 23554 public static enum IMAQdxBufferNumberMode { 23555 BufferNumberModeNext(0), 23556 BufferNumberModeLast(1), 23557 BufferNumberModeBufferNumber(2), 23558 BufferNumberModeGuard(0xFFFFFFFF), 23559 ; 23560 private final int value; 23561 private IMAQdxBufferNumberMode(int value) { 23562 this.value = value; 23563 } 23564 public static IMAQdxBufferNumberMode fromValue(int val) { 23565 for (IMAQdxBufferNumberMode v : values()) { 23566 if (v.value == val) 23567 return v; 23568 } 23569 return null; 23570 } 23571 public int getValue() { 23572 return value; 23573 } 23574 } 23575 23576 /** 23577 * Plug n Play Event Enumeration 23578 */ 23579 23580 public static enum IMAQdxPnpEvent { 23581 PnpEventCameraAttached(0), 23582 PnpEventCameraDetached(1), 23583 PnpEventBusReset(2), 23584 PnpEventGuard(0xFFFFFFFF), 23585 ; 23586 private final int value; 23587 private IMAQdxPnpEvent(int value) { 23588 this.value = value; 23589 } 23590 public static IMAQdxPnpEvent fromValue(int val) { 23591 for (IMAQdxPnpEvent v : values()) { 23592 if (v.value == val) 23593 return v; 23594 } 23595 return null; 23596 } 23597 public int getValue() { 23598 return value; 23599 } 23600 } 23601 23602 /** 23603 * Bayer Pattern Enumeration 23604 */ 23605 23606 public static enum IMAQdxBayerPattern { 23607 BayerPatternNone(0), 23608 BayerPatternGB(1), 23609 BayerPatternGR(2), 23610 BayerPatternBG(3), 23611 BayerPatternRG(4), 23612 BayerPatternHardware(5), 23613 BayerPatternGuard(0xFFFFFFFF), 23614 ; 23615 private final int value; 23616 private IMAQdxBayerPattern(int value) { 23617 this.value = value; 23618 } 23619 public static IMAQdxBayerPattern fromValue(int val) { 23620 for (IMAQdxBayerPattern v : values()) { 23621 if (v.value == val) 23622 return v; 23623 } 23624 return null; 23625 } 23626 public int getValue() { 23627 return value; 23628 } 23629 } 23630 23631 /** 23632 * Bayer Decode Algorithm Enumeration 23633 */ 23634 23635 public static enum IMAQdxBayerAlgorithm { 23636 BayerAlgorithmBilinear(0), 23637 BayerAlgorithmVNG(1), 23638 BayerAlgorithmGuard(0xFFFFFFFF), 23639 ; 23640 private final int value; 23641 private IMAQdxBayerAlgorithm(int value) { 23642 this.value = value; 23643 } 23644 public static IMAQdxBayerAlgorithm fromValue(int val) { 23645 for (IMAQdxBayerAlgorithm v : values()) { 23646 if (v.value == val) 23647 return v; 23648 } 23649 return null; 23650 } 23651 public int getValue() { 23652 return value; 23653 } 23654 } 23655 23656 /** 23657 * Output Image Types -- Values match Vision Development Module image types 23658 */ 23659 23660 public static enum IMAQdxOutputImageType { 23661 OutputImageTypeU8(0), 23662 OutputImageTypeI16(1), 23663 OutputImageTypeU16(7), 23664 OutputImageTypeRGB32(4), 23665 OutputImageTypeRGB64(6), 23666 OutputImageTypeAuto(0x7FFFFFFF), 23667 OutputImageTypeGuard(0xFFFFFFFF), 23668 ; 23669 private final int value; 23670 private IMAQdxOutputImageType(int value) { 23671 this.value = value; 23672 } 23673 public static IMAQdxOutputImageType fromValue(int val) { 23674 for (IMAQdxOutputImageType v : values()) { 23675 if (v.value == val) 23676 return v; 23677 } 23678 return null; 23679 } 23680 public int getValue() { 23681 return value; 23682 } 23683 } 23684 23685 /** 23686 * Controller Destination Mode Enumeration 23687 */ 23688 23689 public static enum IMAQdxDestinationMode { 23690 DestinationModeUnicast(0), 23691 DestinationModeBroadcast(1), 23692 DestinationModeMulticast(2), 23693 DestinationModeGuard(0xFFFFFFFF), 23694 ; 23695 private final int value; 23696 private IMAQdxDestinationMode(int value) { 23697 this.value = value; 23698 } 23699 public static IMAQdxDestinationMode fromValue(int val) { 23700 for (IMAQdxDestinationMode v : values()) { 23701 if (v.value == val) 23702 return v; 23703 } 23704 return null; 23705 } 23706 public int getValue() { 23707 return value; 23708 } 23709 } 23710 23711 /** 23712 * Attribute Type Enumeration 23713 */ 23714 23715 public static enum IMAQdxAttributeType { 23716 AttributeTypeU32(0), 23717 AttributeTypeI64(1), 23718 AttributeTypeF64(2), 23719 AttributeTypeString(3), 23720 AttributeTypeEnum(4), 23721 AttributeTypeBool(5), 23722 AttributeTypeCommand(6), 23723 AttributeTypeBlob(7), 23724 AttributeTypeGuard(0xFFFFFFFF), 23725 ; 23726 private final int value; 23727 private IMAQdxAttributeType(int value) { 23728 this.value = value; 23729 } 23730 public static IMAQdxAttributeType fromValue(int val) { 23731 for (IMAQdxAttributeType v : values()) { 23732 if (v.value == val) 23733 return v; 23734 } 23735 return null; 23736 } 23737 public int getValue() { 23738 return value; 23739 } 23740 } 23741 23742 /** 23743 * Value Type Enumeration 23744 */ 23745 23746 public static enum IMAQdxValueType { 23747 ValueTypeU32(0), 23748 ValueTypeI64(1), 23749 ValueTypeF64(2), 23750 ValueTypeString(3), 23751 ValueTypeEnumItem(4), 23752 ValueTypeBool(5), 23753 ValueTypeDisposableString(6), 23754 ValueTypeGuard(0xFFFFFFFF), 23755 ; 23756 private final int value; 23757 private IMAQdxValueType(int value) { 23758 this.value = value; 23759 } 23760 public static IMAQdxValueType fromValue(int val) { 23761 for (IMAQdxValueType v : values()) { 23762 if (v.value == val) 23763 return v; 23764 } 23765 return null; 23766 } 23767 public int getValue() { 23768 return value; 23769 } 23770 } 23771 23772 /** 23773 * Interface File Flags Enumeration 23774 */ 23775 23776 public static enum IMAQdxInterfaceFileFlags { 23777 InterfaceFileFlagsConnected(0x1), 23778 InterfaceFileFlagsDirty(0x2), 23779 InterfaceFileFlagsGuard(0xFFFFFFFF), 23780 ; 23781 private final int value; 23782 private IMAQdxInterfaceFileFlags(int value) { 23783 this.value = value; 23784 } 23785 public static IMAQdxInterfaceFileFlags fromValue(int val) { 23786 for (IMAQdxInterfaceFileFlags v : values()) { 23787 if (v.value == val) 23788 return v; 23789 } 23790 return null; 23791 } 23792 public int getValue() { 23793 return value; 23794 } 23795 } 23796 23797 /** 23798 * Overwrite Mode Enumeration 23799 */ 23800 23801 public static enum IMAQdxOverwriteMode { 23802 OverwriteModeGetOldest(0x0), 23803 OverwriteModeFail(0x2), 23804 OverwriteModeGetNewest(0x3), 23805 OverwriteModeGuard(0xFFFFFFFF), 23806 ; 23807 private final int value; 23808 private IMAQdxOverwriteMode(int value) { 23809 this.value = value; 23810 } 23811 public static IMAQdxOverwriteMode fromValue(int val) { 23812 for (IMAQdxOverwriteMode v : values()) { 23813 if (v.value == val) 23814 return v; 23815 } 23816 return null; 23817 } 23818 public int getValue() { 23819 return value; 23820 } 23821 } 23822 23823 /** 23824 * Incomplete Buffer Mode Enumeration 23825 */ 23826 23827 public static enum IMAQdxIncompleteBufferMode { 23828 IncompleteBufferModeIgnore(0), 23829 IncompleteBufferModeFail(1), 23830 IncompleteBufferModeGuard(0xFFFFFFFF), 23831 ; 23832 private final int value; 23833 private IMAQdxIncompleteBufferMode(int value) { 23834 this.value = value; 23835 } 23836 public static IMAQdxIncompleteBufferMode fromValue(int val) { 23837 for (IMAQdxIncompleteBufferMode v : values()) { 23838 if (v.value == val) 23839 return v; 23840 } 23841 return null; 23842 } 23843 public int getValue() { 23844 return value; 23845 } 23846 } 23847 23848 /** 23849 * Lost Packet Mode Enumeration 23850 */ 23851 23852 public static enum IMAQdxLostPacketMode { 23853 LostPacketModeIgnore(0), 23854 LostPacketModeFail(1), 23855 LostPacketModeGuard(0xFFFFFFFF), 23856 ; 23857 private final int value; 23858 private IMAQdxLostPacketMode(int value) { 23859 this.value = value; 23860 } 23861 public static IMAQdxLostPacketMode fromValue(int val) { 23862 for (IMAQdxLostPacketMode v : values()) { 23863 if (v.value == val) 23864 return v; 23865 } 23866 return null; 23867 } 23868 public int getValue() { 23869 return value; 23870 } 23871 } 23872 23873 /** 23874 * Attribute Visibility Enumeration 23875 */ 23876 23877 public static enum IMAQdxAttributeVisibility { 23878 AttributeVisibilitySimple(0x00001000), 23879 AttributeVisibilityIntermediate(0x00002000), 23880 AttributeVisibilityAdvanced(0x00004000), 23881 AttributeVisibilityGuard(0xFFFFFFFF), 23882 ; 23883 private final int value; 23884 private IMAQdxAttributeVisibility(int value) { 23885 this.value = value; 23886 } 23887 public static IMAQdxAttributeVisibility fromValue(int val) { 23888 for (IMAQdxAttributeVisibility v : values()) { 23889 if (v.value == val) 23890 return v; 23891 } 23892 return null; 23893 } 23894 public int getValue() { 23895 return value; 23896 } 23897 } 23898 23899 /** 23900 * Stream Channel Mode Enumeration 23901 */ 23902 23903 public static enum IMAQdxStreamChannelMode { 23904 StreamChannelModeAutomatic(0), 23905 StreamChannelModeManual(1), 23906 StreamChannelModeGuard(0xFFFFFFFF), 23907 ; 23908 private final int value; 23909 private IMAQdxStreamChannelMode(int value) { 23910 this.value = value; 23911 } 23912 public static IMAQdxStreamChannelMode fromValue(int val) { 23913 for (IMAQdxStreamChannelMode v : values()) { 23914 if (v.value == val) 23915 return v; 23916 } 23917 return null; 23918 } 23919 public int getValue() { 23920 return value; 23921 } 23922 } 23923 23924 /** 23925 * Pixel Signedness Enumeration 23926 */ 23927 23928 public static enum IMAQdxPixelSignedness { 23929 PixelSignednessUnsigned(0), 23930 PixelSignednessSigned(1), 23931 PixelSignednessHardware(2), 23932 PixelSignednessGuard(0xFFFFFFFF), 23933 ; 23934 private final int value; 23935 private IMAQdxPixelSignedness(int value) { 23936 this.value = value; 23937 } 23938 public static IMAQdxPixelSignedness fromValue(int val) { 23939 for (IMAQdxPixelSignedness v : values()) { 23940 if (v.value == val) 23941 return v; 23942 } 23943 return null; 23944 } 23945 public int getValue() { 23946 return value; 23947 } 23948 } 23949 23950 /** 23951 * USB Connection Speed Enumeration 23952 */ 23953 23954 public static enum IMAQdxUSBConnectionSpeed { 23955 USBConnectionSpeedLow(1), 23956 USBConnectionSpeedFull(2), 23957 USBConnectionSpeedHigh(4), 23958 USBConnectionSpeedSuper(8), 23959 USBConnectionSpeedGuard(0xFFFFFFFF), 23960 ; 23961 private final int value; 23962 private IMAQdxUSBConnectionSpeed(int value) { 23963 this.value = value; 23964 } 23965 public static IMAQdxUSBConnectionSpeed fromValue(int val) { 23966 for (IMAQdxUSBConnectionSpeed v : values()) { 23967 if (v.value == val) 23968 return v; 23969 } 23970 return null; 23971 } 23972 public int getValue() { 23973 return value; 23974 } 23975 } 23976 23977 /** 23978 * CVI Structures 23979 */ 23980 23981 /** 23982 * Camera Information Structure 23983 */ 23984 23985 public static class IMAQdxCameraInformation extends DisposedStruct { 23986 public int Type; 23987 public int Version; 23988 public int Flags; 23989 public int SerialNumberHi; 23990 public int SerialNumberLo; 23991 public IMAQdxBusType BusType; 23992 public String InterfaceName; 23993 public String VendorName; 23994 public String ModelName; 23995 public String CameraFileName; 23996 public String CameraAttributeURL; 23997 23998 private void init() { 23999 24000 } 24001 public IMAQdxCameraInformation() { 24002 super(2584); 24003 init(); 24004 } 24005 public IMAQdxCameraInformation(int Type, int Version, int Flags, int SerialNumberHi, int SerialNumberLo, IMAQdxBusType BusType, String InterfaceName, String VendorName, String ModelName, String CameraFileName, String CameraAttributeURL) { 24006 super(2584); 24007 this.Type = Type; 24008 this.Version = Version; 24009 this.Flags = Flags; 24010 this.SerialNumberHi = SerialNumberHi; 24011 this.SerialNumberLo = SerialNumberLo; 24012 this.BusType = BusType; 24013 this.InterfaceName = InterfaceName; 24014 this.VendorName = VendorName; 24015 this.ModelName = ModelName; 24016 this.CameraFileName = CameraFileName; 24017 this.CameraAttributeURL = CameraAttributeURL; 24018 } 24019 protected IMAQdxCameraInformation(ByteBuffer backing, int offset) { 24020 super(backing, offset, 2584); 24021 init(); 24022 } 24023 protected IMAQdxCameraInformation(long nativeObj, boolean owned) { 24024 super(nativeObj, owned, 2584); 24025 init(); 24026 } 24027 protected void setBuffer(ByteBuffer backing, int offset) { 24028 super.setBuffer(backing, offset, 2584); 24029 } 24030 public void read() { 24031 Type = backing.getInt(0); 24032 Version = backing.getInt(4); 24033 Flags = backing.getInt(8); 24034 SerialNumberHi = backing.getInt(12); 24035 SerialNumberLo = backing.getInt(16); 24036 BusType = IMAQdxBusType.fromValue(backing.getInt(20)); 24037 { 24038 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24039 getBytes(backing, bytes, 24, IMAQDX_MAX_API_STRING_LENGTH); 24040 int len; 24041 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24042 try { 24043 InterfaceName = new String(bytes, 0, len, "UTF-8"); 24044 } catch (UnsupportedEncodingException e) { 24045 InterfaceName = ""; 24046 } 24047 } 24048 { 24049 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24050 getBytes(backing, bytes, 536, IMAQDX_MAX_API_STRING_LENGTH); 24051 int len; 24052 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24053 try { 24054 VendorName = new String(bytes, 0, len, "UTF-8"); 24055 } catch (UnsupportedEncodingException e) { 24056 VendorName = ""; 24057 } 24058 } 24059 { 24060 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24061 getBytes(backing, bytes, 1048, IMAQDX_MAX_API_STRING_LENGTH); 24062 int len; 24063 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24064 try { 24065 ModelName = new String(bytes, 0, len, "UTF-8"); 24066 } catch (UnsupportedEncodingException e) { 24067 ModelName = ""; 24068 } 24069 } 24070 { 24071 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24072 getBytes(backing, bytes, 1560, IMAQDX_MAX_API_STRING_LENGTH); 24073 int len; 24074 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24075 try { 24076 CameraFileName = new String(bytes, 0, len, "UTF-8"); 24077 } catch (UnsupportedEncodingException e) { 24078 CameraFileName = ""; 24079 } 24080 } 24081 { 24082 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24083 getBytes(backing, bytes, 2072, IMAQDX_MAX_API_STRING_LENGTH); 24084 int len; 24085 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24086 try { 24087 CameraAttributeURL = new String(bytes, 0, len, "UTF-8"); 24088 } catch (UnsupportedEncodingException e) { 24089 CameraAttributeURL = ""; 24090 } 24091 } 24092 } 24093 public void write() { 24094 backing.putInt(0, Type); 24095 backing.putInt(4, Version); 24096 backing.putInt(8, Flags); 24097 backing.putInt(12, SerialNumberHi); 24098 backing.putInt(16, SerialNumberLo); 24099 if (BusType != null) 24100 backing.putInt(20, BusType.getValue()); 24101 if (InterfaceName != null) { 24102 byte[] bytes; 24103 try { 24104 bytes = InterfaceName.getBytes("UTF-8"); 24105 } catch (UnsupportedEncodingException e) { 24106 bytes = new byte[0]; 24107 } 24108 putBytes(backing, bytes, 24, bytes.length); 24109 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24110 backing.put(i, (byte)0); // fill with zero 24111 } 24112 if (VendorName != null) { 24113 byte[] bytes; 24114 try { 24115 bytes = VendorName.getBytes("UTF-8"); 24116 } catch (UnsupportedEncodingException e) { 24117 bytes = new byte[0]; 24118 } 24119 putBytes(backing, bytes, 536, bytes.length); 24120 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24121 backing.put(i, (byte)0); // fill with zero 24122 } 24123 if (ModelName != null) { 24124 byte[] bytes; 24125 try { 24126 bytes = ModelName.getBytes("UTF-8"); 24127 } catch (UnsupportedEncodingException e) { 24128 bytes = new byte[0]; 24129 } 24130 putBytes(backing, bytes, 1048, bytes.length); 24131 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24132 backing.put(i, (byte)0); // fill with zero 24133 } 24134 if (CameraFileName != null) { 24135 byte[] bytes; 24136 try { 24137 bytes = CameraFileName.getBytes("UTF-8"); 24138 } catch (UnsupportedEncodingException e) { 24139 bytes = new byte[0]; 24140 } 24141 putBytes(backing, bytes, 1560, bytes.length); 24142 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24143 backing.put(i, (byte)0); // fill with zero 24144 } 24145 if (CameraAttributeURL != null) { 24146 byte[] bytes; 24147 try { 24148 bytes = CameraAttributeURL.getBytes("UTF-8"); 24149 } catch (UnsupportedEncodingException e) { 24150 bytes = new byte[0]; 24151 } 24152 putBytes(backing, bytes, 2072, bytes.length); 24153 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24154 backing.put(i, (byte)0); // fill with zero 24155 } 24156 } 24157 public int size() { 24158 return 2584; 24159 } 24160 } 24161 24162 /** 24163 * Camera File Structure 24164 */ 24165 24166 public static class IMAQdxCameraFile extends DisposedStruct { 24167 public int Type; 24168 public int Version; 24169 public String FileName; 24170 24171 private void init() { 24172 24173 } 24174 public IMAQdxCameraFile() { 24175 super(520); 24176 init(); 24177 } 24178 public IMAQdxCameraFile(int Type, int Version, String FileName) { 24179 super(520); 24180 this.Type = Type; 24181 this.Version = Version; 24182 this.FileName = FileName; 24183 } 24184 protected IMAQdxCameraFile(ByteBuffer backing, int offset) { 24185 super(backing, offset, 520); 24186 init(); 24187 } 24188 protected IMAQdxCameraFile(long nativeObj, boolean owned) { 24189 super(nativeObj, owned, 520); 24190 init(); 24191 } 24192 protected void setBuffer(ByteBuffer backing, int offset) { 24193 super.setBuffer(backing, offset, 520); 24194 } 24195 public void read() { 24196 Type = backing.getInt(0); 24197 Version = backing.getInt(4); 24198 { 24199 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24200 getBytes(backing, bytes, 8, IMAQDX_MAX_API_STRING_LENGTH); 24201 int len; 24202 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24203 try { 24204 FileName = new String(bytes, 0, len, "UTF-8"); 24205 } catch (UnsupportedEncodingException e) { 24206 FileName = ""; 24207 } 24208 } 24209 } 24210 public void write() { 24211 backing.putInt(0, Type); 24212 backing.putInt(4, Version); 24213 if (FileName != null) { 24214 byte[] bytes; 24215 try { 24216 bytes = FileName.getBytes("UTF-8"); 24217 } catch (UnsupportedEncodingException e) { 24218 bytes = new byte[0]; 24219 } 24220 putBytes(backing, bytes, 8, bytes.length); 24221 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24222 backing.put(i, (byte)0); // fill with zero 24223 } 24224 } 24225 public int size() { 24226 return 520; 24227 } 24228 } 24229 24230 /** 24231 * Attribute Information Structure 24232 */ 24233 24234 public static class IMAQdxAttributeInformation extends DisposedStruct { 24235 public IMAQdxAttributeType Type; 24236 public int Readable; 24237 public int Writable; 24238 public String Name; 24239 24240 private void init() { 24241 24242 } 24243 public IMAQdxAttributeInformation() { 24244 super(524); 24245 init(); 24246 } 24247 public IMAQdxAttributeInformation(IMAQdxAttributeType Type, int Readable, int Writable, String Name) { 24248 super(524); 24249 this.Type = Type; 24250 this.Readable = Readable; 24251 this.Writable = Writable; 24252 this.Name = Name; 24253 } 24254 protected IMAQdxAttributeInformation(ByteBuffer backing, int offset) { 24255 super(backing, offset, 524); 24256 init(); 24257 } 24258 protected IMAQdxAttributeInformation(long nativeObj, boolean owned) { 24259 super(nativeObj, owned, 524); 24260 init(); 24261 } 24262 protected void setBuffer(ByteBuffer backing, int offset) { 24263 super.setBuffer(backing, offset, 524); 24264 } 24265 public void read() { 24266 Type = IMAQdxAttributeType.fromValue(backing.getInt(0)); 24267 Readable = backing.getInt(4); 24268 Writable = backing.getInt(8); 24269 { 24270 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24271 getBytes(backing, bytes, 12, IMAQDX_MAX_API_STRING_LENGTH); 24272 int len; 24273 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24274 try { 24275 Name = new String(bytes, 0, len, "UTF-8"); 24276 } catch (UnsupportedEncodingException e) { 24277 Name = ""; 24278 } 24279 } 24280 } 24281 public void write() { 24282 if (Type != null) 24283 backing.putInt(0, Type.getValue()); 24284 backing.putInt(4, Readable); 24285 backing.putInt(8, Writable); 24286 if (Name != null) { 24287 byte[] bytes; 24288 try { 24289 bytes = Name.getBytes("UTF-8"); 24290 } catch (UnsupportedEncodingException e) { 24291 bytes = new byte[0]; 24292 } 24293 putBytes(backing, bytes, 12, bytes.length); 24294 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24295 backing.put(i, (byte)0); // fill with zero 24296 } 24297 } 24298 public int size() { 24299 return 524; 24300 } 24301 } 24302 24303 /** 24304 * Enumeration Item Structure 24305 */ 24306 24307 public static class IMAQdxEnumItem extends DisposedStruct { 24308 public int Value; 24309 public int Reserved; 24310 public String Name; 24311 24312 private void init() { 24313 24314 } 24315 public IMAQdxEnumItem() { 24316 super(520); 24317 init(); 24318 } 24319 public IMAQdxEnumItem(int Value, int Reserved, String Name) { 24320 super(520); 24321 this.Value = Value; 24322 this.Reserved = Reserved; 24323 this.Name = Name; 24324 } 24325 protected IMAQdxEnumItem(ByteBuffer backing, int offset) { 24326 super(backing, offset, 520); 24327 init(); 24328 } 24329 protected IMAQdxEnumItem(long nativeObj, boolean owned) { 24330 super(nativeObj, owned, 520); 24331 init(); 24332 } 24333 protected void setBuffer(ByteBuffer backing, int offset) { 24334 super.setBuffer(backing, offset, 520); 24335 } 24336 public void read() { 24337 Value = backing.getInt(0); 24338 Reserved = backing.getInt(4); 24339 { 24340 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24341 getBytes(backing, bytes, 8, IMAQDX_MAX_API_STRING_LENGTH); 24342 int len; 24343 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24344 try { 24345 Name = new String(bytes, 0, len, "UTF-8"); 24346 } catch (UnsupportedEncodingException e) { 24347 Name = ""; 24348 } 24349 } 24350 } 24351 public void write() { 24352 backing.putInt(0, Value); 24353 backing.putInt(4, Reserved); 24354 if (Name != null) { 24355 byte[] bytes; 24356 try { 24357 bytes = Name.getBytes("UTF-8"); 24358 } catch (UnsupportedEncodingException e) { 24359 bytes = new byte[0]; 24360 } 24361 putBytes(backing, bytes, 8, bytes.length); 24362 for (int i=bytes.length; i<IMAQDX_MAX_API_STRING_LENGTH; i++) 24363 backing.put(i, (byte)0); // fill with zero 24364 } 24365 } 24366 public int size() { 24367 return 520; 24368 } 24369 } 24370 24371 /** 24372 * Camera Information Structure 24373 */ 24374 24375 /** 24376 * Attributes 24377 */ 24378 24379 /** 24380 * Functions 24381 */ 24382 24383 public static void IMAQdxSnap(int id, Image image) { 24384 24385 _IMAQdxSnap(id, image.getAddress()); 24386 24387 } 24388 private static native void _IMAQdxSnap(int id, long image); 24389 24390 public static void IMAQdxConfigureGrab(int id) { 24391 24392 _IMAQdxConfigureGrab(id); 24393 24394 } 24395 private static native void _IMAQdxConfigureGrab(int id); 24396 24397 public static int IMAQdxGrab(int id, Image image, int waitForNextBuffer) { 24398 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24399 long rv_addr = getByteBufferAddress(rv_buf); 24400 _IMAQdxGrab(id, image.getAddress(), waitForNextBuffer, rv_addr+0); 24401 int actualBufferNumber; 24402 actualBufferNumber = rv_buf.getInt(0); 24403 return actualBufferNumber; 24404 } 24405 private static native void _IMAQdxGrab(int id, long image, int waitForNextBuffer, long actualBufferNumber); 24406 24407 public static void IMAQdxDiscoverEthernetCameras(String address, int timeout) { 24408 ByteBuffer address_buf = null; 24409 if (address != null) { 24410 byte[] address_bytes; 24411 try { 24412 address_bytes = address.getBytes("UTF-8"); 24413 } catch (UnsupportedEncodingException e) { 24414 address_bytes = new byte[0]; 24415 } 24416 address_buf = ByteBuffer.allocateDirect(address_bytes.length+1); 24417 putBytes(address_buf, address_bytes, 0, address_bytes.length).put(address_bytes.length, (byte)0); 24418 } 24419 _IMAQdxDiscoverEthernetCameras(address == null ? 0 : getByteBufferAddress(address_buf), timeout); 24420 24421 } 24422 private static native void _IMAQdxDiscoverEthernetCameras(long address, int timeout); 24423 24424 public static void IMAQdxResetCamera(String name, int resetAll) { 24425 ByteBuffer name_buf = null; 24426 if (name != null) { 24427 byte[] name_bytes; 24428 try { 24429 name_bytes = name.getBytes("UTF-8"); 24430 } catch (UnsupportedEncodingException e) { 24431 name_bytes = new byte[0]; 24432 } 24433 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24434 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24435 } 24436 _IMAQdxResetCamera(name == null ? 0 : getByteBufferAddress(name_buf), resetAll); 24437 24438 } 24439 private static native void _IMAQdxResetCamera(long name, int resetAll); 24440 24441 public static int IMAQdxOpenCamera(String name, IMAQdxCameraControlMode mode) { 24442 ByteBuffer name_buf = null; 24443 if (name != null) { 24444 byte[] name_bytes; 24445 try { 24446 name_bytes = name.getBytes("UTF-8"); 24447 } catch (UnsupportedEncodingException e) { 24448 name_bytes = new byte[0]; 24449 } 24450 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24451 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24452 } 24453 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24454 long rv_addr = getByteBufferAddress(rv_buf); 24455 _IMAQdxOpenCamera(name == null ? 0 : getByteBufferAddress(name_buf), mode.getValue(), rv_addr+0); 24456 int id; 24457 id = rv_buf.getInt(0); 24458 return id; 24459 } 24460 private static native void _IMAQdxOpenCamera(long name, int mode, long id); 24461 24462 public static void IMAQdxCloseCamera(int id) { 24463 24464 _IMAQdxCloseCamera(id); 24465 24466 } 24467 private static native void _IMAQdxCloseCamera(int id); 24468 24469 public static void IMAQdxConfigureAcquisition(int id, int continuous, int bufferCount) { 24470 24471 _IMAQdxConfigureAcquisition(id, continuous, bufferCount); 24472 24473 } 24474 private static native void _IMAQdxConfigureAcquisition(int id, int continuous, int bufferCount); 24475 24476 public static void IMAQdxStartAcquisition(int id) { 24477 24478 _IMAQdxStartAcquisition(id); 24479 24480 } 24481 private static native void _IMAQdxStartAcquisition(int id); 24482 24483 public static int IMAQdxGetImage(int id, Image image, IMAQdxBufferNumberMode mode, int desiredBufferNumber) { 24484 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24485 long rv_addr = getByteBufferAddress(rv_buf); 24486 _IMAQdxGetImage(id, image.getAddress(), mode.getValue(), desiredBufferNumber, rv_addr+0); 24487 int actualBufferNumber; 24488 actualBufferNumber = rv_buf.getInt(0); 24489 return actualBufferNumber; 24490 } 24491 private static native void _IMAQdxGetImage(int id, long image, int mode, int desiredBufferNumber, long actualBufferNumber); 24492 24493 public static int IMAQdxGetImageData(int id, ByteBuffer buffer, IMAQdxBufferNumberMode mode, int desiredBufferNumber) { 24494 long buffer_addr = getByteBufferAddress(buffer); 24495 int buffer_size = buffer.capacity(); 24496 return _IMAQdxGetImageData(id, buffer_addr, buffer_size, mode.getValue(), desiredBufferNumber); 24497 } 24498 private static native int _IMAQdxGetImageData(int id, long buffer, int bufferSize, int mode, int desiredBufferNumber); 24499 24500 public static void IMAQdxStopAcquisition(int id) { 24501 24502 _IMAQdxStopAcquisition(id); 24503 24504 } 24505 private static native void _IMAQdxStopAcquisition(int id); 24506 24507 public static void IMAQdxUnconfigureAcquisition(int id) { 24508 24509 _IMAQdxUnconfigureAcquisition(id); 24510 24511 } 24512 private static native void _IMAQdxUnconfigureAcquisition(int id); 24513 24514 public static class dxEnumerateVideoModesResult { 24515 public IMAQdxEnumItem[] videoModeArray; 24516 public int currentMode; 24517 private ByteBuffer videoModeArray_buf; 24518 private dxEnumerateVideoModesResult(ByteBuffer rv_buf, ByteBuffer videoModeArray_buf) { 24519 this.videoModeArray_buf = videoModeArray_buf; 24520 int count = rv_buf.getInt(0); 24521 videoModeArray = new IMAQdxEnumItem[count]; 24522 for (int i=0, off=0; i<count; i++, off += 520) { 24523 videoModeArray[i] = new IMAQdxEnumItem(videoModeArray_buf, off); 24524 videoModeArray[i].read(); 24525 } 24526 currentMode = rv_buf.getInt(8); 24527 } 24528 } 24529 24530 public static dxEnumerateVideoModesResult IMAQdxEnumerateVideoModes(int id) { 24531 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8+8).order(ByteOrder.nativeOrder()); 24532 long rv_addr = getByteBufferAddress(rv_buf); 24533 _IMAQdxEnumerateVideoModes(id, 0, rv_addr+0, rv_addr+8); 24534 int count = rv_buf.getInt(0); 24535 ByteBuffer videoModeArray_buf = ByteBuffer.allocateDirect(count*520).order(ByteOrder.nativeOrder()); 24536 _IMAQdxEnumerateVideoModes(id, getByteBufferAddress(videoModeArray_buf), rv_addr+0, rv_addr+8); 24537 dxEnumerateVideoModesResult rv = new dxEnumerateVideoModesResult(rv_buf, videoModeArray_buf); 24538 return rv; 24539 } 24540 private static native void _IMAQdxEnumerateVideoModes(int id, long videoModeArray, long count, long currentMode); 24541 24542 public static IMAQdxAttributeType IMAQdxGetAttributeType(int id, String name) { 24543 ByteBuffer name_buf = null; 24544 if (name != null) { 24545 byte[] name_bytes; 24546 try { 24547 name_bytes = name.getBytes("UTF-8"); 24548 } catch (UnsupportedEncodingException e) { 24549 name_bytes = new byte[0]; 24550 } 24551 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24552 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24553 } 24554 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24555 long rv_addr = getByteBufferAddress(rv_buf); 24556 _IMAQdxGetAttributeType(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24557 IMAQdxAttributeType type; 24558 type = IMAQdxAttributeType.fromValue(rv_buf.getInt(0)); 24559 return type; 24560 } 24561 private static native void _IMAQdxGetAttributeType(int id, long name, long type); 24562 24563 public static int IMAQdxIsAttributeReadable(int id, String name) { 24564 ByteBuffer name_buf = null; 24565 if (name != null) { 24566 byte[] name_bytes; 24567 try { 24568 name_bytes = name.getBytes("UTF-8"); 24569 } catch (UnsupportedEncodingException e) { 24570 name_bytes = new byte[0]; 24571 } 24572 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24573 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24574 } 24575 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24576 long rv_addr = getByteBufferAddress(rv_buf); 24577 _IMAQdxIsAttributeReadable(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24578 int readable; 24579 readable = rv_buf.getInt(0); 24580 return readable; 24581 } 24582 private static native void _IMAQdxIsAttributeReadable(int id, long name, long readable); 24583 24584 public static int IMAQdxIsAttributeWritable(int id, String name) { 24585 ByteBuffer name_buf = null; 24586 if (name != null) { 24587 byte[] name_bytes; 24588 try { 24589 name_bytes = name.getBytes("UTF-8"); 24590 } catch (UnsupportedEncodingException e) { 24591 name_bytes = new byte[0]; 24592 } 24593 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24594 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24595 } 24596 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24597 long rv_addr = getByteBufferAddress(rv_buf); 24598 _IMAQdxIsAttributeWritable(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24599 int writable; 24600 writable = rv_buf.getInt(0); 24601 return writable; 24602 } 24603 private static native void _IMAQdxIsAttributeWritable(int id, long name, long writable); 24604 24605 public static void IMAQdxWriteRegister(int id, int offset, int value) { 24606 24607 _IMAQdxWriteRegister(id, offset, value); 24608 24609 } 24610 private static native void _IMAQdxWriteRegister(int id, int offset, int value); 24611 24612 public static int IMAQdxReadRegister(int id, int offset) { 24613 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24614 long rv_addr = getByteBufferAddress(rv_buf); 24615 _IMAQdxReadRegister(id, offset, rv_addr+0); 24616 int value; 24617 value = rv_buf.getInt(0); 24618 return value; 24619 } 24620 private static native void _IMAQdxReadRegister(int id, int offset, long value); 24621 24622 public static void IMAQdxWriteAttributes(int id, String filename) { 24623 ByteBuffer filename_buf = null; 24624 if (filename != null) { 24625 byte[] filename_bytes; 24626 try { 24627 filename_bytes = filename.getBytes("UTF-8"); 24628 } catch (UnsupportedEncodingException e) { 24629 filename_bytes = new byte[0]; 24630 } 24631 filename_buf = ByteBuffer.allocateDirect(filename_bytes.length+1); 24632 putBytes(filename_buf, filename_bytes, 0, filename_bytes.length).put(filename_bytes.length, (byte)0); 24633 } 24634 _IMAQdxWriteAttributes(id, filename == null ? 0 : getByteBufferAddress(filename_buf)); 24635 24636 } 24637 private static native void _IMAQdxWriteAttributes(int id, long filename); 24638 24639 public static void IMAQdxReadAttributes(int id, String filename) { 24640 ByteBuffer filename_buf = null; 24641 if (filename != null) { 24642 byte[] filename_bytes; 24643 try { 24644 filename_bytes = filename.getBytes("UTF-8"); 24645 } catch (UnsupportedEncodingException e) { 24646 filename_bytes = new byte[0]; 24647 } 24648 filename_buf = ByteBuffer.allocateDirect(filename_bytes.length+1); 24649 putBytes(filename_buf, filename_bytes, 0, filename_bytes.length).put(filename_bytes.length, (byte)0); 24650 } 24651 _IMAQdxReadAttributes(id, filename == null ? 0 : getByteBufferAddress(filename_buf)); 24652 24653 } 24654 private static native void _IMAQdxReadAttributes(int id, long filename); 24655 24656 public static void IMAQdxResetEthernetCameraAddress(String name, String address, String subnet, String gateway, int timeout) { 24657 ByteBuffer name_buf = null; 24658 if (name != null) { 24659 byte[] name_bytes; 24660 try { 24661 name_bytes = name.getBytes("UTF-8"); 24662 } catch (UnsupportedEncodingException e) { 24663 name_bytes = new byte[0]; 24664 } 24665 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24666 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24667 } 24668 ByteBuffer address_buf = null; 24669 if (address != null) { 24670 byte[] address_bytes; 24671 try { 24672 address_bytes = address.getBytes("UTF-8"); 24673 } catch (UnsupportedEncodingException e) { 24674 address_bytes = new byte[0]; 24675 } 24676 address_buf = ByteBuffer.allocateDirect(address_bytes.length+1); 24677 putBytes(address_buf, address_bytes, 0, address_bytes.length).put(address_bytes.length, (byte)0); 24678 } 24679 ByteBuffer subnet_buf = null; 24680 if (subnet != null) { 24681 byte[] subnet_bytes; 24682 try { 24683 subnet_bytes = subnet.getBytes("UTF-8"); 24684 } catch (UnsupportedEncodingException e) { 24685 subnet_bytes = new byte[0]; 24686 } 24687 subnet_buf = ByteBuffer.allocateDirect(subnet_bytes.length+1); 24688 putBytes(subnet_buf, subnet_bytes, 0, subnet_bytes.length).put(subnet_bytes.length, (byte)0); 24689 } 24690 ByteBuffer gateway_buf = null; 24691 if (gateway != null) { 24692 byte[] gateway_bytes; 24693 try { 24694 gateway_bytes = gateway.getBytes("UTF-8"); 24695 } catch (UnsupportedEncodingException e) { 24696 gateway_bytes = new byte[0]; 24697 } 24698 gateway_buf = ByteBuffer.allocateDirect(gateway_bytes.length+1); 24699 putBytes(gateway_buf, gateway_bytes, 0, gateway_bytes.length).put(gateway_bytes.length, (byte)0); 24700 } 24701 _IMAQdxResetEthernetCameraAddress(name == null ? 0 : getByteBufferAddress(name_buf), address == null ? 0 : getByteBufferAddress(address_buf), subnet == null ? 0 : getByteBufferAddress(subnet_buf), gateway == null ? 0 : getByteBufferAddress(gateway_buf), timeout); 24702 24703 } 24704 private static native void _IMAQdxResetEthernetCameraAddress(long name, long address, long subnet, long gateway, int timeout); 24705 24706 public static IMAQdxAttributeVisibility IMAQdxGetAttributeVisibility(int id, String name) { 24707 ByteBuffer name_buf = null; 24708 if (name != null) { 24709 byte[] name_bytes; 24710 try { 24711 name_bytes = name.getBytes("UTF-8"); 24712 } catch (UnsupportedEncodingException e) { 24713 name_bytes = new byte[0]; 24714 } 24715 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24716 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24717 } 24718 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24719 long rv_addr = getByteBufferAddress(rv_buf); 24720 _IMAQdxGetAttributeVisibility(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24721 IMAQdxAttributeVisibility visibility; 24722 visibility = IMAQdxAttributeVisibility.fromValue(rv_buf.getInt(0)); 24723 return visibility; 24724 } 24725 private static native void _IMAQdxGetAttributeVisibility(int id, long name, long visibility); 24726 24727 public static int IMAQdxGetAttributeU32(int id, String name) { 24728 ByteBuffer name_buf = null; 24729 if (name != null) { 24730 byte[] name_bytes; 24731 try { 24732 name_bytes = name.getBytes("UTF-8"); 24733 } catch (UnsupportedEncodingException e) { 24734 name_bytes = new byte[0]; 24735 } 24736 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24737 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24738 } 24739 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24740 long rv_addr = getByteBufferAddress(rv_buf); 24741 _IMAQdxGetAttributeU32(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24742 int value; 24743 value = rv_buf.getInt(0); 24744 return value; 24745 } 24746 private static native void _IMAQdxGetAttributeU32(int id, long name, long value); 24747 24748 public static long IMAQdxGetAttributeI64(int id, String name) { 24749 ByteBuffer name_buf = null; 24750 if (name != null) { 24751 byte[] name_bytes; 24752 try { 24753 name_bytes = name.getBytes("UTF-8"); 24754 } catch (UnsupportedEncodingException e) { 24755 name_bytes = new byte[0]; 24756 } 24757 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24758 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24759 } 24760 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24761 long rv_addr = getByteBufferAddress(rv_buf); 24762 _IMAQdxGetAttributeI64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24763 long value; 24764 value = rv_buf.getLong(0); 24765 return value; 24766 } 24767 private static native void _IMAQdxGetAttributeI64(int id, long name, long value); 24768 24769 public static double IMAQdxGetAttributeF64(int id, String name) { 24770 ByteBuffer name_buf = null; 24771 if (name != null) { 24772 byte[] name_bytes; 24773 try { 24774 name_bytes = name.getBytes("UTF-8"); 24775 } catch (UnsupportedEncodingException e) { 24776 name_bytes = new byte[0]; 24777 } 24778 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24779 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24780 } 24781 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24782 long rv_addr = getByteBufferAddress(rv_buf); 24783 _IMAQdxGetAttributeF64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24784 double value; 24785 value = rv_buf.getDouble(0); 24786 return value; 24787 } 24788 private static native void _IMAQdxGetAttributeF64(int id, long name, long value); 24789 24790 public static String IMAQdxGetAttributeString(int id, String name) { 24791 ByteBuffer name_buf = null; 24792 if (name != null) { 24793 byte[] name_bytes; 24794 try { 24795 name_bytes = name.getBytes("UTF-8"); 24796 } catch (UnsupportedEncodingException e) { 24797 name_bytes = new byte[0]; 24798 } 24799 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24800 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24801 } 24802 ByteBuffer rv_buf = ByteBuffer.allocateDirect(IMAQDX_MAX_API_STRING_LENGTH).order(ByteOrder.nativeOrder()); 24803 long rv_addr = getByteBufferAddress(rv_buf); 24804 _IMAQdxGetAttributeString(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24805 String value; 24806 { 24807 byte[] bytes = new byte[IMAQDX_MAX_API_STRING_LENGTH]; 24808 getBytes(rv_buf, bytes, 0, IMAQDX_MAX_API_STRING_LENGTH); 24809 int len; 24810 for (len=0; len<bytes.length && bytes[len] != 0; len++) {} 24811 try { 24812 value = new String(bytes, 0, len, "UTF-8"); 24813 } catch (UnsupportedEncodingException e) { 24814 value = ""; 24815 } 24816 } 24817 return value; 24818 } 24819 private static native void _IMAQdxGetAttributeString(int id, long name, long value); 24820 24821 public static IMAQdxEnumItem IMAQdxGetAttributeEnum(int id, String name) { 24822 ByteBuffer name_buf = null; 24823 if (name != null) { 24824 byte[] name_bytes; 24825 try { 24826 name_bytes = name.getBytes("UTF-8"); 24827 } catch (UnsupportedEncodingException e) { 24828 name_bytes = new byte[0]; 24829 } 24830 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24831 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24832 } 24833 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24834 long rv_addr = getByteBufferAddress(rv_buf); 24835 _IMAQdxGetAttributeEnum(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24836 IMAQdxEnumItem value; 24837 value = new IMAQdxEnumItem(rv_buf, 0); 24838 value.read(); 24839 return value; 24840 } 24841 private static native void _IMAQdxGetAttributeEnum(int id, long name, long value); 24842 24843 public static int IMAQdxGetAttributeBool(int id, String name) { 24844 ByteBuffer name_buf = null; 24845 if (name != null) { 24846 byte[] name_bytes; 24847 try { 24848 name_bytes = name.getBytes("UTF-8"); 24849 } catch (UnsupportedEncodingException e) { 24850 name_bytes = new byte[0]; 24851 } 24852 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24853 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24854 } 24855 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24856 long rv_addr = getByteBufferAddress(rv_buf); 24857 _IMAQdxGetAttributeBool(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24858 int value; 24859 value = rv_buf.getInt(0); 24860 return value; 24861 } 24862 private static native void _IMAQdxGetAttributeBool(int id, long name, long value); 24863 24864 public static int IMAQdxGetAttributeMinimumU32(int id, String name) { 24865 ByteBuffer name_buf = null; 24866 if (name != null) { 24867 byte[] name_bytes; 24868 try { 24869 name_bytes = name.getBytes("UTF-8"); 24870 } catch (UnsupportedEncodingException e) { 24871 name_bytes = new byte[0]; 24872 } 24873 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24874 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24875 } 24876 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24877 long rv_addr = getByteBufferAddress(rv_buf); 24878 _IMAQdxGetAttributeMinimumU32(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24879 int value; 24880 value = rv_buf.getInt(0); 24881 return value; 24882 } 24883 private static native void _IMAQdxGetAttributeMinimumU32(int id, long name, long value); 24884 24885 public static long IMAQdxGetAttributeMinimumI64(int id, String name) { 24886 ByteBuffer name_buf = null; 24887 if (name != null) { 24888 byte[] name_bytes; 24889 try { 24890 name_bytes = name.getBytes("UTF-8"); 24891 } catch (UnsupportedEncodingException e) { 24892 name_bytes = new byte[0]; 24893 } 24894 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24895 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24896 } 24897 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24898 long rv_addr = getByteBufferAddress(rv_buf); 24899 _IMAQdxGetAttributeMinimumI64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24900 long value; 24901 value = rv_buf.getLong(0); 24902 return value; 24903 } 24904 private static native void _IMAQdxGetAttributeMinimumI64(int id, long name, long value); 24905 24906 public static double IMAQdxGetAttributeMinimumF64(int id, String name) { 24907 ByteBuffer name_buf = null; 24908 if (name != null) { 24909 byte[] name_bytes; 24910 try { 24911 name_bytes = name.getBytes("UTF-8"); 24912 } catch (UnsupportedEncodingException e) { 24913 name_bytes = new byte[0]; 24914 } 24915 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24916 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24917 } 24918 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24919 long rv_addr = getByteBufferAddress(rv_buf); 24920 _IMAQdxGetAttributeMinimumF64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24921 double value; 24922 value = rv_buf.getDouble(0); 24923 return value; 24924 } 24925 private static native void _IMAQdxGetAttributeMinimumF64(int id, long name, long value); 24926 24927 public static int IMAQdxGetAttributeMaximumU32(int id, String name) { 24928 ByteBuffer name_buf = null; 24929 if (name != null) { 24930 byte[] name_bytes; 24931 try { 24932 name_bytes = name.getBytes("UTF-8"); 24933 } catch (UnsupportedEncodingException e) { 24934 name_bytes = new byte[0]; 24935 } 24936 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24937 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24938 } 24939 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24940 long rv_addr = getByteBufferAddress(rv_buf); 24941 _IMAQdxGetAttributeMaximumU32(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24942 int value; 24943 value = rv_buf.getInt(0); 24944 return value; 24945 } 24946 private static native void _IMAQdxGetAttributeMaximumU32(int id, long name, long value); 24947 24948 public static long IMAQdxGetAttributeMaximumI64(int id, String name) { 24949 ByteBuffer name_buf = null; 24950 if (name != null) { 24951 byte[] name_bytes; 24952 try { 24953 name_bytes = name.getBytes("UTF-8"); 24954 } catch (UnsupportedEncodingException e) { 24955 name_bytes = new byte[0]; 24956 } 24957 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24958 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24959 } 24960 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24961 long rv_addr = getByteBufferAddress(rv_buf); 24962 _IMAQdxGetAttributeMaximumI64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24963 long value; 24964 value = rv_buf.getLong(0); 24965 return value; 24966 } 24967 private static native void _IMAQdxGetAttributeMaximumI64(int id, long name, long value); 24968 24969 public static double IMAQdxGetAttributeMaximumF64(int id, String name) { 24970 ByteBuffer name_buf = null; 24971 if (name != null) { 24972 byte[] name_bytes; 24973 try { 24974 name_bytes = name.getBytes("UTF-8"); 24975 } catch (UnsupportedEncodingException e) { 24976 name_bytes = new byte[0]; 24977 } 24978 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 24979 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 24980 } 24981 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 24982 long rv_addr = getByteBufferAddress(rv_buf); 24983 _IMAQdxGetAttributeMaximumF64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 24984 double value; 24985 value = rv_buf.getDouble(0); 24986 return value; 24987 } 24988 private static native void _IMAQdxGetAttributeMaximumF64(int id, long name, long value); 24989 24990 public static int IMAQdxGetAttributeIncrementU32(int id, String name) { 24991 ByteBuffer name_buf = null; 24992 if (name != null) { 24993 byte[] name_bytes; 24994 try { 24995 name_bytes = name.getBytes("UTF-8"); 24996 } catch (UnsupportedEncodingException e) { 24997 name_bytes = new byte[0]; 24998 } 24999 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25000 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25001 } 25002 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25003 long rv_addr = getByteBufferAddress(rv_buf); 25004 _IMAQdxGetAttributeIncrementU32(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 25005 int value; 25006 value = rv_buf.getInt(0); 25007 return value; 25008 } 25009 private static native void _IMAQdxGetAttributeIncrementU32(int id, long name, long value); 25010 25011 public static long IMAQdxGetAttributeIncrementI64(int id, String name) { 25012 ByteBuffer name_buf = null; 25013 if (name != null) { 25014 byte[] name_bytes; 25015 try { 25016 name_bytes = name.getBytes("UTF-8"); 25017 } catch (UnsupportedEncodingException e) { 25018 name_bytes = new byte[0]; 25019 } 25020 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25021 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25022 } 25023 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25024 long rv_addr = getByteBufferAddress(rv_buf); 25025 _IMAQdxGetAttributeIncrementI64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 25026 long value; 25027 value = rv_buf.getLong(0); 25028 return value; 25029 } 25030 private static native void _IMAQdxGetAttributeIncrementI64(int id, long name, long value); 25031 25032 public static double IMAQdxGetAttributeIncrementF64(int id, String name) { 25033 ByteBuffer name_buf = null; 25034 if (name != null) { 25035 byte[] name_bytes; 25036 try { 25037 name_bytes = name.getBytes("UTF-8"); 25038 } catch (UnsupportedEncodingException e) { 25039 name_bytes = new byte[0]; 25040 } 25041 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25042 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25043 } 25044 ByteBuffer rv_buf = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()); 25045 long rv_addr = getByteBufferAddress(rv_buf); 25046 _IMAQdxGetAttributeIncrementF64(id, name == null ? 0 : getByteBufferAddress(name_buf), rv_addr+0); 25047 double value; 25048 value = rv_buf.getDouble(0); 25049 return value; 25050 } 25051 private static native void _IMAQdxGetAttributeIncrementF64(int id, long name, long value); 25052 25053 public static void IMAQdxSetAttributeU32(int id, String name, int value) { 25054 ByteBuffer name_buf = null; 25055 if (name != null) { 25056 byte[] name_bytes; 25057 try { 25058 name_bytes = name.getBytes("UTF-8"); 25059 } catch (UnsupportedEncodingException e) { 25060 name_bytes = new byte[0]; 25061 } 25062 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25063 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25064 } 25065 _IMAQdxSetAttributeU32(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 25066 25067 } 25068 private static native void _IMAQdxSetAttributeU32(int id, long name, int value); 25069 25070 public static void IMAQdxSetAttributeI64(int id, String name, long value) { 25071 ByteBuffer name_buf = null; 25072 if (name != null) { 25073 byte[] name_bytes; 25074 try { 25075 name_bytes = name.getBytes("UTF-8"); 25076 } catch (UnsupportedEncodingException e) { 25077 name_bytes = new byte[0]; 25078 } 25079 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25080 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25081 } 25082 _IMAQdxSetAttributeI64(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 25083 25084 } 25085 private static native void _IMAQdxSetAttributeI64(int id, long name, long value); 25086 25087 public static void IMAQdxSetAttributeF64(int id, String name, double value) { 25088 ByteBuffer name_buf = null; 25089 if (name != null) { 25090 byte[] name_bytes; 25091 try { 25092 name_bytes = name.getBytes("UTF-8"); 25093 } catch (UnsupportedEncodingException e) { 25094 name_bytes = new byte[0]; 25095 } 25096 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25097 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25098 } 25099 _IMAQdxSetAttributeF64(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 25100 25101 } 25102 private static native void _IMAQdxSetAttributeF64(int id, long name, double value); 25103 25104 public static void IMAQdxSetAttributeString(int id, String name, String value) { 25105 ByteBuffer name_buf = null; 25106 if (name != null) { 25107 byte[] name_bytes; 25108 try { 25109 name_bytes = name.getBytes("UTF-8"); 25110 } catch (UnsupportedEncodingException e) { 25111 name_bytes = new byte[0]; 25112 } 25113 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25114 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25115 } 25116 ByteBuffer value_buf = null; 25117 if (value != null) { 25118 byte[] value_bytes; 25119 try { 25120 value_bytes = value.getBytes("UTF-8"); 25121 } catch (UnsupportedEncodingException e) { 25122 value_bytes = new byte[0]; 25123 } 25124 value_buf = ByteBuffer.allocateDirect(value_bytes.length+1); 25125 putBytes(value_buf, value_bytes, 0, value_bytes.length).put(value_bytes.length, (byte)0); 25126 } 25127 _IMAQdxSetAttributeString(id, name == null ? 0 : getByteBufferAddress(name_buf), value == null ? 0 : getByteBufferAddress(value_buf)); 25128 25129 } 25130 private static native void _IMAQdxSetAttributeString(int id, long name, long value); 25131 25132 public static void IMAQdxSetAttributeEnum(int id, String name, IMAQdxEnumItem value) { 25133 ByteBuffer name_buf = null; 25134 if (name != null) { 25135 byte[] name_bytes; 25136 try { 25137 name_bytes = name.getBytes("UTF-8"); 25138 } catch (UnsupportedEncodingException e) { 25139 name_bytes = new byte[0]; 25140 } 25141 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25142 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25143 } 25144 _IMAQdxSetAttributeEnum(id, name == null ? 0 : getByteBufferAddress(name_buf), value.getAddress()); 25145 25146 } 25147 private static native void _IMAQdxSetAttributeEnum(int id, long name, long value); 25148 25149 public static void IMAQdxSetAttributeBool(int id, String name, int value) { 25150 ByteBuffer name_buf = null; 25151 if (name != null) { 25152 byte[] name_bytes; 25153 try { 25154 name_bytes = name.getBytes("UTF-8"); 25155 } catch (UnsupportedEncodingException e) { 25156 name_bytes = new byte[0]; 25157 } 25158 name_buf = ByteBuffer.allocateDirect(name_bytes.length+1); 25159 putBytes(name_buf, name_bytes, 0, name_bytes.length).put(name_bytes.length, (byte)0); 25160 } 25161 _IMAQdxSetAttributeBool(id, name == null ? 0 : getByteBufferAddress(name_buf), value); 25162 25163 } 25164 private static native void _IMAQdxSetAttributeBool(int id, long name, int value); 25165}