Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8081642

MouseWheelListener Crash via Netbeans and ImageJ

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_8

      Description

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      FULL OS VERSION :
      Windows 8.1 64bit
      ver 6.3.9600

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      i5 4200U
      AMD HD 8530M 2GB


      A DESCRIPTION OF THE PROBLEM :
      MouseWheelListener crash while running ImageJ plugin code within Netbeans 8.0.2.
      MouseWheelListener works on the assigned canvas. Crash occurs on either trying mousewheel on different canvas before the assigned canvas, or on returning to the canvas after using the listener on the correct canvas and then selecting and mousewheeling on a different canvas.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      as described above

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      mousewheel works fine if assigned canvas is used first, returning to canvas or mouse wheel events on different canvases cause the crash
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000001da1aba, pid=6732, tid=1144
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # j java.awt.Window.getMostRecentFocusOwner()Ljava/awt/Component;+1
      #
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #

      --------------- T H R E A D ---------------

      Current thread (0x00000000189f7800): JavaThread "Run$_AWT-EventQueue-0" [_thread_in_Java, id=1144, stack(0x000000001a490000,0x000000001a590000)]

      siginfo: ExceptionCode=0xc0000005, reading address 0x0000000c000000c9

      Registers:
      RAX=0x00000001000c9e48, RBX=0x0000000c00000079, RCX=0x00000000d9f25960, RDX=0x000000001cfac758
      RSP=0x000000001a58b3d0, RBP=0x000000001a58b420, RSI=0x00000000d9f18178, RDI=0x000000001cfa5380
      R8 =0x00000000d9f247c0, R9 =0x0000000000000001, R10=0x00000000696862c0, R11=0x0000000081c02718
      R12=0x0000000000000000, R13=0x000000001a58b3d8, R14=0x000000001cfac758, R15=0x00000000189f7800
      RIP=0x0000000001da1aba, EFLAGS=0x0000000000010297

      Top of Stack: (sp=0x000000001a58b3d0)
      0x000000001a58b3d0: 0000000001d87200 00000000d9f25960
      0x000000001a58b3e0: 000000001a58b3e0 00000000161c66a9
      0x000000001a58b3f0: 000000001a58b438 00000000161fae98
      0x000000001a58b400: 000000001cfac758 00000000161c66e0
      0x000000001a58b410: 000000001a58b3d8 000000001a58b440
      0x000000001a58b420: 000000001a58bba0 00000000022faac4
      0x000000001a58b430: 0000000000000000 00000000d9f25960
      0x000000001a58b440: 0000000001c2da90 0000000001cc6c70
      0x000000001a58b450: 0000000081c02718 00000000690e4000
      0x000000001a58b460: 0000000000000000 0000000000000000
      0x000000001a58b470: 000000001a58bba0 00000000023716dc
      0x000000001a58b480: 000000001a58bac0 000000001a58b4f0
      0x000000001a58b490: 0000000000000000 000000006902c2d3
      0x000000001a58b4a0: 000000001a58b530 0000000016906220
      0x000000001a58b4b0: 00000000189f7800 0000000068f2f5c0
      0x000000001a58b4c0: 0000000000017b70 0000000001edddb1

      Instructions: (pc=0x0000000001da1aba)
      0x0000000001da1a9a: 48 83 c2 10 4c 8b 6a d8 41 83 ed 04 41 c1 e5 03
      0x0000000001da1aaa: 49 03 d5 48 89 55 e0 4c 8d 6c 24 08 4c 89 6d f0
      0x0000000001da1aba: ff 63 50 66 66 90 c0 02 00 00 00 00 00 00 40 b3
      0x0000000001da1aca: 48 69 00 00 00 00 b7 00 00 00 00 00 00 00 00 00


      Register to memory mapping:

      RAX=0x00000001000c9e48 is pointing into metadata
      RBX=0x0000000c00000079 is an unknown value
      RCX=0x00000000d9f25960 is an oop
      ij.gui.ImageCanvas
       - klass: 'ij/gui/ImageCanvas'
      RDX=0x000000001cfac758 is pointing into metadata
      RSP=0x000000001a58b3d0 is pointing into the stack for thread: 0x00000000189f7800
      RBP=0x000000001a58b420 is pointing into the stack for thread: 0x00000000189f7800
      RSI=0x00000000d9f18178 is an oop
      ij.gui.StackWindow
       - klass: 'ij/gui/StackWindow'
      RDI=0x000000001cfa5380 is pointing into metadata
      R8 =0x00000000d9f247c0 is an oop
      java.util.HashMap
       - klass: 'java/util/HashMap'
      R9 =0x0000000000000001 is an unknown value
      R10=0x00000000696862c0 is an unknown value
      R11=0x0000000081c02718 is an oop
      java.lang.Class
       - klass: 'java/lang/Class'
      R12=0x0000000000000000 is an unknown value
      R13=0x000000001a58b3d8 is pointing into the stack for thread: 0x00000000189f7800
      R14=0x000000001cfac758 is pointing into metadata
      R15=0x00000000189f7800 is a thread


      Stack: [0x000000001a490000,0x000000001a590000], sp=0x000000001a58b3d0, free space=1004k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C 0x0000000001da1aba


      --------------- P R O C E S S ---------------

      Java Threads: ( => current thread )
        0x0000000018b9e000 JavaThread "TimerQueue" daemon [_thread_blocked, id=6356, stack(0x000000001cd80000,0x000000001ce80000)]
        0x000000001bb2a800 JavaThread "zSelector" [_thread_blocked, id=6168, stack(0x000000001c880000,0x000000001c980000)]
        0x0000000018cb3800 JavaThread "zSelector" [_thread_blocked, id=5660, stack(0x000000001ab10000,0x000000001ac10000)]
        0x0000000001c82800 JavaThread "DestroyJavaVM" [_thread_blocked, id=1240, stack(0x0000000001b10000,0x0000000001c10000)]
      =>0x00000000189f7800 JavaThread "Run$_AWT-EventQueue-0" [_thread_in_Java, id=1144, stack(0x000000001a490000,0x000000001a590000)]
        0x00000000189d9000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=6972, stack(0x00000000193c0000,0x00000000194c0000)]
        0x00000000189d8800 JavaThread "AWT-Shutdown" [_thread_blocked, id=3696, stack(0x00000000192c0000,0x00000000193c0000)]
        0x00000000189d7800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1368, stack(0x00000000191c0000,0x00000000192c0000)]
        0x000000001693d800 JavaThread "Service Thread" daemon [_thread_blocked, id=5652, stack(0x0000000018530000,0x0000000018630000)]
        0x00000000168ea800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=4352, stack(0x0000000018030000,0x0000000018130000)]
        0x00000000168e7800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=6192, stack(0x0000000017f30000,0x0000000018030000)]
        0x00000000168df000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=6108, stack(0x0000000017e30000,0x0000000017f30000)]
        0x00000000168dd000 JavaThread "Attach Listener" daemon [_thread_blocked, id=5888, stack(0x0000000017d30000,0x0000000017e30000)]
        0x00000000168dc000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=816, stack(0x0000000017c30000,0x0000000017d30000)]
        0x0000000001d76800 JavaThread "Finalizer" daemon [_thread_blocked, id=4388, stack(0x0000000017b30000,0x0000000017c30000)]
        0x0000000001d6e000 JavaThread "Reference Handler" daemon [_thread_blocked, id=2624, stack(0x0000000017a30000,0x0000000017b30000)]

      Other Threads:
        0x00000000168a5000 VMThread [stack: 0x0000000017930000,0x0000000017a30000] [id=2508]
        0x0000000018155000 WatcherThread [stack: 0x0000000018630000,0x0000000018730000] [id=4676]

      VM state:not at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: None

      Heap:
       PSYoungGen total 76288K, used 27658K [0x00000000d5f00000, 0x00000000db400000, 0x0000000100000000)
        eden space 65536K, 25% used [0x00000000d5f00000,0x00000000d6f84968,0x00000000d9f00000)
        from space 10752K, 99% used [0x00000000d9f00000,0x00000000da97e1b8,0x00000000da980000)
        to space 10752K, 0% used [0x00000000da980000,0x00000000da980000,0x00000000db400000)
       ParOldGen total 175104K, used 5226K [0x0000000081c00000, 0x000000008c700000, 0x00000000d5f00000)
        object space 175104K, 2% used [0x0000000081c00000,0x000000008211aa20,0x000000008c700000)
       Metaspace used 18214K, capacity 18410K, committed 18688K, reserved 1064960K
        class space used 2158K, capacity 2217K, committed 2304K, reserved 1048576K

      Card table byte_map: [0x0000000011140000,0x0000000011540000] byte_map_base: 0x0000000010d32000

      Marking Bits: (ParMarkBitMap*) 0x000000006969d4f0
       Begin Bits: [0x0000000011bf0000, 0x0000000013b80000)
       End Bits: [0x0000000013b80000, 0x0000000015b10000)

      Polling page: 0x0000000001c10000

      CodeCache: size=245760Kb used=7631Kb max_used=7631Kb free=238128Kb
       bounds [0x0000000001d80000, 0x0000000002500000, 0x0000000010d80000]
       total_blobs=2761 nmethods=2201 adapters=472
       compilation: enabled

      Compilation events (10 events):
      Event: 50.652 Thread 0x00000000168ea800 2362 3 ij.ImagePlus::setupProcessor (117 bytes)
      Event: 50.653 Thread 0x00000000168ea800 nmethod 2362 0x00000000024ee750 code [0x00000000024ee960, 0x00000000024ef738]
      Event: 50.697 Thread 0x00000000168ea800 2363 3 sun.java2d.SunGraphics2D::setPaint (158 bytes)
      Event: 50.698 Thread 0x00000000168ea800 nmethod 2363 0x00000000024f1fd0 code [0x00000000024f21a0, 0x00000000024f2c88]
      Event: 51.543 Thread 0x00000000168ea800 2364 3 sun.misc.FDBigInteger::valueOfPow2 (27 bytes)
      Event: 51.544 Thread 0x00000000168ea800 nmethod 2364 0x00000000024f1990 code [0x00000000024f1b00, 0x00000000024f1e48]
      Event: 51.864 Thread 0x00000000168ea800 2365 3 ij.gui.ImageWindow::mouseMoved (10 bytes)
      Event: 51.864 Thread 0x00000000168ea800 nmethod 2365 0x00000000024f1550 code [0x00000000024f16c0, 0x00000000024f18c8]
      Event: 51.864 Thread 0x00000000168ea800 2366 3 ij.ImagePlus::mouseMoved (53 bytes)
      Event: 51.865 Thread 0x00000000168ea800 nmethod 2366 0x00000000024f0550 code [0x00000000024f0740, 0x00000000024f10f8]

      GC Heap History (2 events):
      Event: 19.375 GC heap before
      {Heap before GC invocations=1 (full 0):
       PSYoungGen total 76288K, used 65536K [0x00000000d5f00000, 0x00000000db400000, 0x0000000100000000)
        eden space 65536K, 100% used [0x00000000d5f00000,0x00000000d9f00000,0x00000000d9f00000)
        from space 10752K, 0% used [0x00000000da980000,0x00000000da980000,0x00000000db400000)
        to space 10752K, 0% used [0x00000000d9f00000,0x00000000d9f00000,0x00000000da980000)
       ParOldGen total 175104K, used 0K [0x0000000081c00000, 0x000000008c700000, 0x00000000d5f00000)
        object space 175104K, 0% used [0x0000000081c00000,0x0000000081c00000,0x000000008c700000)
       Metaspace used 17336K, capacity 17510K, committed 17792K, reserved 1064960K
        class space used 2116K, capacity 2151K, committed 2176K, reserved 1048576K
      Event: 19.405 GC heap after
      Heap after GC invocations=1 (full 0):
       PSYoungGen total 76288K, used 10744K [0x00000000d5f00000, 0x00000000db400000, 0x0000000100000000)
        eden space 65536K, 0% used [0x00000000d5f00000,0x00000000d5f00000,0x00000000d9f00000)
        from space 10752K, 99% used [0x00000000d9f00000,0x00000000da97e1b8,0x00000000da980000)
        to space 10752K, 0% used [0x00000000da980000,0x00000000da980000,0x00000000db400000)
       ParOldGen total 175104K, used 5226K [0x0000000081c00000, 0x000000008c700000, 0x00000000d5f00000)
        object space 175104K, 2% used [0x0000000081c00000,0x000000008211aa20,0x000000008c700000)
       Metaspace used 17336K, capacity 17510K, committed 17792K, reserved 1064960K
        class space used 2116K, capacity 2151K, committed 2176K, reserved 1048576K
      }

      Deoptimization events (10 events):
      Event: 39.561 Thread 0x00000000189f7800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000244b528 method=sun.java2d.SurfaceData.getSourceSurfaceData(Ljava/awt/Image;ILsun/java2d/loops/CompositeType;Ljava/awt/Color;)Lsun/java2d/SurfaceData; @ 8
      Event: 39.574 Thread 0x00000000189f7800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000024597d8 method=sun.java2d.SunGraphics2D.copyImage(Ljava/awt/Image;IIIIIILjava/awt/Color;Ljava/awt/image/ImageObserver;)Z @ 20
      Event: 39.574 Thread 0x00000000189f7800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000244b528 method=sun.java2d.SurfaceData.getSourceSurfaceData(Ljava/awt/Image;ILsun/java2d/loops/CompositeType;Ljava/awt/Color;)Lsun/java2d/SurfaceData; @ 8
      Event: 39.574 Thread 0x00000000189f7800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002445de0 method=sun.java2d.SurfaceData.getSourceSurfaceData(Ljava/awt/Image;ILsun/java2d/loops/CompositeType;Ljava/awt/Color;)Lsun/java2d/SurfaceData; @ 8
      Event: 42.639 Thread 0x00000000189f7800 Uncommon trap: reason=predicate action=maybe_recompile pc=0x00000000023e2700 method=java.util.Vector.indexOf(Ljava/lang/Object;I)I @ 44
      Event: 44.153 Thread 0x00000000189f7800 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002400b50 method=ij.gui.ImageCanvas.getSliceNumber(Ljava/lang/String;)I @ 1
      Event: 44.153 Thread 0x00000000189f7800 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000247bc0c method=ij.gui.ImageCanvas.drawRoi(Ljava/awt/Graphics;Lij/gui/Roi;I)V @ 28
      Event: 44.154 Thread 0x00000000189f7800 Uncommon trap: reason=unreached action=reinterpret pc=0x00000000023ffc74 method=sun.java2d.SunGraphics2D.setComposite(Ljava/awt/Composite;)V @ 77
      Event: 44.259 Thread 0x00000000189f7800 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002490054 method=sun.awt.image.SurfaceManager.getManager(Ljava/awt/Image;)Lsun/awt/image/SurfaceManager; @ 9
      Event: 45.509 Thread 0x00000000189f7800 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000243ad90 method=sun.awt.image.SurfaceManager.getManager(Ljava/awt/Image;)Lsun/awt/image/SurfaceManager; @ 9

      Internal exceptions (10 events):
      Event: 18.248 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d93c9e78) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 18.429 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d946cb60) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 18.619 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d948f680) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 21.093 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d5fd4000) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 22.652 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d65519c8) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 22.760 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d6569b48) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 35.419 Thread 0x00000000189f7800 Implicit null exception at 0x00000000023e1cc8 to 0x00000000023e1daa
      Event: 44.150 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d6aefea8) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 44.150 Thread 0x00000000189f7800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d6b04b30) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm.cpp, line 1312]
      Event: 44.259 Thread 0x00000000189f7800 Implicit null exception at 0x000000000248ea7c to 0x000000000248fff9

      Events (10 events):
      Event: 44.183 Thread 0x00000000168ea800 flushing nmethod 0x000000000221ac50
      Event: 44.183 Thread 0x00000000168ea800 flushing nmethod 0x000000000221ea10
      Event: 44.185 Thread 0x00000000189f7800 DEOPT PACKING pc=0x00000000023c4bfa sp=0x000000001a58cca0
      Event: 44.185 Thread 0x00000000189f7800 DEOPT UNPACKING pc=0x0000000001dc75bf sp=0x000000001a58c9e0 mode 0
      Event: 44.259 Thread 0x00000000189f7800 Uncommon trap: trap_request=0xffffffad fr.pc=0x0000000002490054
      Event: 44.259 Thread 0x00000000189f7800 DEOPT PACKING pc=0x0000000002490054 sp=0x000000001a58cc20
      Event: 44.259 Thread 0x00000000189f7800 DEOPT UNPACKING pc=0x0000000001dc556a sp=0x000000001a58c958 mode 2
      Event: 45.509 Thread 0x00000000189f7800 Uncommon trap: trap_request=0xffffffad fr.pc=0x000000000243ad90
      Event: 45.509 Thread 0x00000000189f7800 DEOPT PACKING pc=0x000000000243ad90 sp=0x000000001a58ca20
      Event: 45.509 Thread 0x00000000189f7800 DEOPT UNPACKING pc=0x0000000001dc556a sp=0x000000001a58c9b8 mode 2


      Dynamic libraries:
      0x00007ff7e7480000 - 0x00007ff7e74b4000 C:\Program Files\Java\jdk1.8.0_31\bin\java.exe
      0x00007ffba7610000 - 0x00007ffba77bc000 C:\Windows\SYSTEM32\ntdll.dll
      0x00007ffba6820000 - 0x00007ffba695e000 C:\Windows\system32\KERNEL32.DLL
      0x00007ffba4830000 - 0x00007ffba4945000 C:\Windows\system32\KERNELBASE.dll
      0x00007ffba3310000 - 0x00007ffba339e000 C:\Windows\system32\apphelp.dll
      0x00007ffb95860000 - 0x00007ffb958b3000 C:\Windows\AppPatch\AppPatch64\AcGenral.DLL
      0x00007ffba6270000 - 0x00007ffba631a000 C:\Windows\system32\msvcrt.dll
      0x00007ffba4580000 - 0x00007ffba45ae000 C:\Windows\SYSTEM32\SspiCli.dll
      0x00007ffba61b0000 - 0x00007ffba6204000 C:\Windows\system32\SHLWAPI.dll
      0x00007ffba7020000 - 0x00007ffba7197000 C:\Windows\system32\USER32.dll
      0x00007ffba6320000 - 0x00007ffba64b4000 C:\Windows\system32\ole32.dll
      0x00007ffba4c90000 - 0x00007ffba61a8000 C:\Windows\system32\SHELL32.dll
      0x00007ffba3d00000 - 0x00007ffba3d21000 C:\Windows\SYSTEM32\USERENV.dll
      0x00007ffba6760000 - 0x00007ffba680a000 C:\Windows\system32\ADVAPI32.dll
      0x00007ffb98410000 - 0x00007ffb9842e000 C:\Windows\SYSTEM32\MPR.dll
      0x00007ffba6e10000 - 0x00007ffba6f51000 C:\Windows\system32\RPCRT4.dll
      0x00007ffba6210000 - 0x00007ffba6269000 C:\Windows\SYSTEM32\sechost.dll
      0x00007ffba6960000 - 0x00007ffba6b71000 C:\Windows\SYSTEM32\combase.dll
      0x00007ffba71a0000 - 0x00007ffba72f1000 C:\Windows\system32\GDI32.dll
      0x00007ffba4760000 - 0x00007ffba4775000 C:\Windows\SYSTEM32\profapi.dll
      0x00007ffba2cb0000 - 0x00007ffba2d62000 C:\Windows\SYSTEM32\SHCORE.dll
      0x00007ffba6700000 - 0x00007ffba6736000 C:\Windows\system32\IMM32.DLL
      0x00007ffba65a0000 - 0x00007ffba66f2000 C:\Windows\system32\MSCTF.dll
      0x00007ffba0650000 - 0x00007ffba08cb000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17784_none_624760d1ecb7236e\COMCTL32.dll
      0x0000000068de0000 - 0x0000000068eb2000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\msvcr100.dll
      0x0000000068ec0000 - 0x000000006971a000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\server\jvm.dll
      0x00007ffb996c0000 - 0x00007ffb996c9000 C:\Windows\SYSTEM32\WSOCK32.dll
      0x00007ffb9ccf0000 - 0x00007ffb9cd12000 C:\Windows\SYSTEM32\WINMM.dll
      0x00007ffba7600000 - 0x00007ffba7607000 C:\Windows\system32\PSAPI.DLL
      0x00007ffba7300000 - 0x00007ffba735a000 C:\Windows\system32\WS2_32.dll
      0x00007ffb9c340000 - 0x00007ffb9c36a000 C:\Windows\SYSTEM32\WINMMBASE.dll
      0x00007ffba6590000 - 0x00007ffba6599000 C:\Windows\system32\NSI.dll
      0x00007ffba49b0000 - 0x00007ffba49ff000 C:\Windows\SYSTEM32\cfgmgr32.dll
      0x00007ffba3560000 - 0x00007ffba3588000 C:\Windows\SYSTEM32\DEVOBJ.dll
      0x0000000069c90000 - 0x0000000069c9f000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\verify.dll
      0x0000000068db0000 - 0x0000000068dd8000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\java.dll
      0x0000000069c70000 - 0x0000000069c86000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\zip.dll
      0x0000000068bd0000 - 0x0000000068d68000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\awt.dll
      0x00007ffba6b90000 - 0x00007ffba6c51000 C:\Windows\system32\OLEAUT32.dll
      0x00007ffba2ab0000 - 0x00007ffba2ad1000 C:\Windows\system32\DWMAPI.DLL
      0x00007ffba33e0000 - 0x00007ffba3509000 C:\Windows\system32\uxtheme.dll
      0x00007ffb9a940000 - 0x00007ffb9a9eb000 C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll
      0x00007ffba3300000 - 0x00007ffba330b000 C:\Windows\SYSTEM32\kernel.appcore.dll
      0x00007ffba4730000 - 0x00007ffba473b000 C:\Windows\SYSTEM32\CRYPTBASE.dll
      0x00007ffba45b0000 - 0x00007ffba4613000 C:\Windows\SYSTEM32\bcryptPrimitives.dll
      0x0000000068b80000 - 0x0000000068bc7000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\fontmanager.dll
      0x0000000068d90000 - 0x0000000068daa000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\net.dll
      0x00007ffba3f70000 - 0x00007ffba3fc9000 C:\Windows\system32\mswsock.dll
      0x0000000068d70000 - 0x0000000068d81000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\nio.dll
      0x0000000068b30000 - 0x0000000068b71000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\t2k.dll
      0x00007ffb9edf0000 - 0x00007ffb9ee5a000 C:\Windows\SYSTEM32\oleacc.dll
      0x00007ffba7540000 - 0x00007ffba75f6000 C:\Windows\SYSTEM32\clbcatq.dll
      0x00007ffba2900000 - 0x00007ffba2aae000 C:\Windows\SYSTEM32\WindowsCodecs.dll
      0x00007ffba3fd0000 - 0x00007ffba3ff0000 C:\Windows\SYSTEM32\CRYPTSP.dll
      0x00007ffba3bf0000 - 0x00007ffba3c26000 C:\Windows\system32\rsaenh.dll
      0x00007ffba4220000 - 0x00007ffba4246000 C:\Windows\SYSTEM32\bcrypt.dll
      0x0000000068af0000 - 0x0000000068b1a000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\dcpr.dll
      0x00007ffb9e740000 - 0x00007ffb9e76a000 C:\Windows\SYSTEM32\IPHLPAPI.DLL
      0x00007ffb9e710000 - 0x00007ffb9e71a000 C:\Windows\SYSTEM32\WINNSI.DLL
      0x00007ffb9dab0000 - 0x00007ffb9dac6000 C:\Windows\SYSTEM32\dhcpcsvc6.DLL
      0x00007ffb9dcc0000 - 0x00007ffb9dcda000 C:\Windows\SYSTEM32\dhcpcsvc.DLL
      0x0000000068980000 - 0x0000000068a22000 C:\Program Files\Java\jdk1.8.0_31\jre\bin\mlib_image.dll
      0x00007ffb96dc0000 - 0x00007ffb96f4a000 C:\Windows\SYSTEM32\dbghelp.dll

      VM Arguments:
      jvm_args: -Dfile.encoding=UTF-8 -Xms256m
      java_command: ij.ImageJ
      java_class_path (initial): C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-anim.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-awt-util.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-bridge.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-codec.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-css.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-dom.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-ext.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-extension.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-gui-util.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-gvt.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-parser.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-script.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-svg-dom.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-svggen.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\Waterloo_git\Sources\Java\kcl-waterloo-base\dist\lib\batik-swing.jar;C:\Users\nellypledge\Google Drive\Data Analysis\Code\Java\W
      Launcher Type: SUN_STANDARD

      Environment Variables:
      PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MATLAB\R2014b\runtime\win64;C:\Program Files\MATLAB\R2014b\bin;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\
      USERNAME=nellypledge
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel



      --------------- S Y S T E M ---------------

      OS: Windows 8.1 , 64 bit Build 9600

      CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2

      Memory: 4k page, physical 8268996k(4897380k free), swap 16657604k(12861048k free)

      vm_info: Java HotSpot(TM) 64-Bit Server VM (25.31-b07) for windows-amd64 JRE (1.8.0_31-b13), built on Dec 17 2014 21:00:28 by "java_re" with MS VC++ 10.0 (VS2010)

      time: Sat May 16 08:14:27 2015
      elapsed time: 52 seconds (0d 0h 0m 52s)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import ij.CompositeImage;
      import ij.IJ;
      import ij.ImagePlus;
      import ij.Menus;
      import ij.WindowManager;
      import ij.gui.ImageRoi;
      import ij.gui.Overlay;
      import ij.gui.Roi;
      import ij.measure.ResultsTable;
      import ij.plugin.Duplicator;
      import ij.plugin.ImageCalculator;
      import ij.plugin.frame.RoiManager;
      import ij.process.*;
      import java.awt.Canvas;
      import java.awt.Color;
      import java.awt.MenuItem;
      import java.awt.Point;
      import java.awt.PopupMenu;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.MouseEvent;
      import java.awt.event.MouseListener;
      import java.awt.event.MouseWheelEvent;
      import java.awt.event.MouseWheelListener;
      import java.awt.geom.AffineTransform;
      import java.awt.image.AffineTransformOp;
      import java.awt.image.BufferedImage;
      import java.io.IOException;
      import java.net.URL;
      import java.util.ArrayList;
      import javax.imageio.ImageIO;
      import kcl.waterloo.graphics.GJGraph;
      import kcl.waterloo.graphics.GJGraphContainer;
      import kcl.waterloo.graphics.plots2D.GJPlotInterface;
      import kcl.waterloo.graphics.plots2D.GJPolarBar;
      import kcl.waterloo.swing.GCFrame;


      /**
       *
       * @author nellypledge
       */
      public class RadialArrowList implements MouseListener, MouseWheelListener {
          
          static int count = 0;
          int id;
          Canvas imgCanvas = new Canvas();
          Canvas compCanvas = new Canvas();
              
          public ArrayList<RadialArrow> arrows; // list of Radial Arrows - one for each analyzed nuclei in the list
          Roi[] ROIs; // array of ROIs for reference - ROIs define the detected edges of the nuclei
          RoiManager rm; // ROI manager for this radial arrow list - here assumed one arror list per image analyzed
          ImagePlus origImp; // ImagePlus of the data to be analyzed
          CompositeImage comp_img; // Composite image for display
          PopupMenu comp_img_popup; // Popup menu for composite image
          Overlay arwOvrly; // Overlay to add all arrows
          float px_um; // pixels per micrometer
          float um_px; // micrometers per pixel
          r_clickLstnr r_clickMenu; // action listener for the right click menus on the composite image
          Point r_clickXY;
          int distChanThreshold; // threshold of distribution channel - analyze data above this value
          
          public RadialArrowList(ImagePlus anlayzeImp, float cali){
              
              // TODO - think about id's in terms of removing RadialArrowLists
              count = count + 1; // increase static count to keep track of total number of RadilArrowLists
              id = count; // assign count to id number
              
              this.origImp = anlayzeImp; // input image to analyze
              //this.imgCanvas = anlayzeImp.getCanvas();
              // create list with zero elements
              this.arrows = new ArrayList<RadialArrow>();
              arwOvrly = new Overlay(); // each image has an overlay of arrows etc.
              um_px = cali; // here cali is um per pixel
              px_um = 1 / cali; // convert to pixels per um
              r_clickMenu = new r_clickLstnr(); // listener for right-click to add show dist - TODO: update from dist to other options
          }

          public void addArrow(float x, float y, float rad_um){
              
              RadialArrow newArrow = new RadialArrow(x, y, rad_um); // create blank arrow
              arrows.add(newArrow); // add to arrows list
              createAngularDist(newArrow); // create dist around nucleus
              newArrow.setInitAngles(); // set the initial arrow direction
              int bin_factor = Angular_Distribution_.angDistForm.getBinValue();
              int binTrue = newArrow.bin_dist(bin_factor);
          }
          
          // TODO - figure out 0, 90, 180, 360 increased values
          // - use red channel made of noise
          // - thresholding and/or smoothing to remove signal from backgroud
          // - plot colors
          // - increase plot bin size
          
          public void createAngularDist(RadialArrow radAr){
              // listIndx indicates which arrow in the list
              // binWid for distribution histogram width
              // - allow only 1, 2, 3, 6, 10, 12, 15, 30, 45, 90 - TODO: write snap to function
              
              radAr.ang_dist = new int[360]; // angular distribution of intensities
              radAr.ang_idx = new int[360]; // indicies/abscissa for plot
              radAr.rad_ang_dist = new int[360]; // angular distribution of radii - i.e. distance away from nuc for each angle

              int nuc_px_dia = Math.round(2 * radAr.nuc_rad_um * px_um);
              int nuc_px_rad = nuc_px_dia >> 1; // shift right 1 - equivalant to div 2
              Point nuc_px_cen = new Point(Math.round(radAr.x_um*px_um), Math.round(radAr.y_um*px_um));
              radAr.rad_dist = new int[nuc_px_dia+1]; // limit to circle enclosed by the 2wid sqaure around nuc_px_cen
              
              // TODO - use channel selections from GUI here
              origImp.setSlice(0); // golgi channel
              ImageProcessor ip = origImp.getChannelProcessor();
              
              int i, j;
              int pix_int;
              int hyp_sqrd;
              double hyp;
              String ang_rad_imp_str;
              String ang_deg_imp_str;
              int ang_wid = 2*nuc_px_dia+1;
              radAr.ang_rad = new double[ang_wid][ang_wid];
              radAr.ang_deg = new double[ang_wid][ang_wid];
              int angle;
              int img_wid = ip.getWidth();
              int img_hgt = ip.getHeight();
              int sign = 0;
              int idx;
              int jdx;
              String testStr;
              
              // scan pixels 1 diameter before and after the center of the nucleus
              // TODO - include fall off weighting parameter here
              // from -dia to +dia+1 -> +1 allows for the additional central zero pixel
              for ( i = nuc_px_cen.x-nuc_px_dia; i < nuc_px_cen.x+nuc_px_dia+1; i++ ) {
                  
                  //testStr = "";
                  
                  for ( j = nuc_px_cen.y-nuc_px_dia; j < nuc_px_cen.y+nuc_px_dia+1; j++ ) {
                      
                      // if NOT outside of the full image
                      if ( !( (i<0 || i>(img_wid-1)) || (j<0 || j>(img_hgt-1)) ) ) {
                          
                          hyp_sqrd = (i-nuc_px_cen.x)*(i-nuc_px_cen.x) + (j-nuc_px_cen.y)*(j-nuc_px_cen.y); // calc hyp squareed
                          if ( hyp_sqrd>(nuc_px_dia*nuc_px_dia) ) {
                              continue; // exits the loop in the corners - only the circle around nuc_px_cen is used
                          }
                          idx = i - (nuc_px_cen.x-nuc_px_dia);
                          jdx = j - (nuc_px_cen.y-nuc_px_dia);
                          //System.out.println(String.valueOf(i)+","+String.valueOf(j));
                          pix_int = ip.get(i, j); // get pixel intensity; get is fast version of getPixel without bounds checking - bounds should be checked in above if statement
                          
                          // only include pixels above the autotheshold previously set
                          if (pix_int>distChanThreshold){
                              
                              hyp = Math.sqrt( hyp_sqrd );
                              // TODO - multiply by sign of (j-nuc_px_cen.y) delta value
                              if ( hyp == 0 ){
                                  angle = 0;
                              } else {
                                  //testStr += "("+Integer.toString(idx)+","+Integer.toString(jdx)+") ";
                                  // convention for polar plots is zero at east with anticlockwise roation
                                  if ((j-nuc_px_cen.y)<0){ // angle between 0 and 180 - above center line
                                      radAr.ang_rad[idx][jdx] = Math.acos( (i-nuc_px_cen.x)/hyp );
                                      radAr.ang_deg[idx][jdx] = Math.toDegrees( radAr.ang_rad[idx][jdx] );
                                      angle = (int) Math.round( radAr.ang_deg[idx][jdx] );
                                  } else{ // angle between 180 and 360 - below center line
                                      radAr.ang_rad[idx][jdx] = Math.acos( -1 * (i-nuc_px_cen.x)/hyp );
                                      radAr.ang_deg[idx][jdx] = Math.toDegrees( radAr.ang_rad[idx][jdx] );
                                      angle = 180 + (int) Math.round( radAr.ang_deg[idx][jdx] );
                                  }
                                  angle = (angle==360) ? 0 : angle;
                              }

                              radAr.ang_dist[angle] += pix_int; // add the current intensity value to the bin for this current angle
                              radAr.rad_dist[(int)Math.round(hyp)] += pix_int; // add the int to the bin for current hyp value
                              radAr.rad_ang_dist[angle] += Math.round(hyp); // add the radius to the bin for current angle
                          }
                      } // end if statement
                      
                  }
                  
                  //System.out.println(testStr);
              } // end for loops
              
      // ang_deg_imp_str = "Degrees Nuc " + Integer.toString(radAr.id);
      // ang_rad_imp_str = "Radians Nuc " + Integer.toString(radAr.id);
      // radAr.ang_deg_imp = NewImage.createFloatImage(ang_deg_imp_str, ang_wid, ang_wid, 1, NewImage.FILL_BLACK );
      // ImageProcessor ang_deg_ip = radAr.ang_deg_imp.getProcessor();
      // radAr.ang_rad_imp = NewImage.createFloatImage(ang_rad_imp_str, ang_wid, ang_wid, 1, NewImage.FILL_BLACK );
      // ImageProcessor ang_rad_ip = radAr.ang_rad_imp.getProcessor();
      //
      // for ( int m=0; m<(ang_wid); m++ ){
      // for ( int n=0; n<(ang_wid); n++ ){
      // ang_deg_ip.putPixelValue(m, n, radAr.ang_deg[m][n]);
      // ang_rad_ip.putPixelValue(m, n, radAr.ang_rad[m][n]);
      // }
      // }
      // radAr.ang_deg_imp.show();
      // radAr.ang_rad_imp.show();
                  
          }
          
          public void analyzeNuclei(ImagePlus imp){
              
              ImagePlus imp_bkgd, // large kernal Gaussian blur to remove any field distortions
                          imp_med, // median filtered nuclei image
                          imp_nuc, // median minus background for thresholding and analyzing
                          imp_disp, // duplicate of two channels for display
                          imp_tmp_dist; // temp dist channel for finding threshold value
              ImageProcessor ip_tmp_dist; // image processor for above
              ResultsTable rt;

              
              
              if (WindowManager.getFrame("ROI Manager")!=null) {
                  IJ.selectWindow("ROI Manager");
                  IJ.run("Close");
                  }
              
              rm = new RoiManager();
              
              imp_bkgd = new Duplicator().run(imp, 2, 2, 1, 1, 1, 1);
              imp_med = new Duplicator().run(imp, 2, 2, 1, 1, 1, 1);
              IJ.run(imp_bkgd, "Gaussian Blur...", "sigma=40"); // for background removal
              IJ.run(imp_med, "Median...", "radius=2"); // pre threshold
              ImageCalculator ic = new ImageCalculator();
              imp_nuc = ic.run("Subtract create", imp_med, imp_bkgd);
              IJ.setAutoThreshold(imp_nuc, "Huang dark");
              IJ.run(imp_nuc, "Convert to Mask", "");
              IJ.run(imp_nuc, "Fill Holes", "");
              IJ.run(imp_nuc, "Watershed", "");
              IJ.run("Set Measurements...", "area centroid redirect=None decimal=2");
              // TODO - add size option to panel; maybe, auto size find?
              IJ.run(imp_nuc, "Analyze Particles...", "size=150-Infinity circularity=0.2-1.00 show=[Overlay Masks] clear add");
              rm.runCommand("Show All with labels");
              rm.runCommand("Show All");
              ROIs = rm.getRoisAsArray();
                      
              // get Threshold for distribution channel
              imp_tmp_dist = new Duplicator().run(imp, 1, 1, 1, 1, 1, 1);
              ip_tmp_dist = imp_tmp_dist.getProcessor();
              ip_tmp_dist.setAutoThreshold(AutoThresholder.Method.IsoData, false);
              distChanThreshold = ip_tmp_dist.getAutoThreshold();
              
              // duplicate for display
              imp_disp = new Duplicator().run(imp, 1, 2, 1, 1, 1, 1);
              comp_img = new CompositeImage(imp_disp);
              imgCanvas = comp_img.getCanvas();
              comp_img.setMode(CompositeImage.COMPOSITE);
              comp_img.show();
              
              comp_img_popup = Menus.getPopupMenu();
              if (!menuContains(comp_img_popup, "Plot Angular Dist.")){
                  MenuItem mi = new MenuItem("Plot Angular Dist.");
                  comp_img_popup.insert(mi, 0);
                  comp_img_popup.insertSeparator(1);
                  comp_img_popup.addActionListener(r_clickMenu);
              }
                     
              rm.runCommand("Show All with labels");

              /*ParticleAnalyzer analyser;
              analyser = new ParticleAnalyzer(
                      ParticleAnalyzer.ADD_TO_MANAGER,
                      Measurements.AREA + Measurements.CENTROID,
                      rt, 200.0, Double.MAX_VALUE, 0.25, 1);
              analyser.analyze(imp_analyze);*/
              
              rt = ResultsTable.getResultsTable();
              //rt.show("Analyze Results");
              //String colStrs = rt.getColumnHeadings();
              //IJ.log(colStrs);
              
              //int type = imp_analyze.getType();
              
              int col_len;
              col_len = rt.getCounter();
              float[] area = new float[col_len];
              float[] x_col = new float[col_len];
              float[] y_col = new float[col_len];
              area = rt.getColumn(0);
              x_col = rt.getColumn(6);
              y_col = rt.getColumn(7);
              
              int i;
              
              for (i = 0 ; i < col_len ; ++i) {
                  this.addArrow(x_col[i], y_col[i], (float)(Math.sqrt((float)(area[i]*0.318))));
                  }

              //imgCanvas.addMouseListener(this);
              //imgCanvas.addMouseWheelListener(this);
              compCanvas = comp_img.getCanvas();
              compCanvas.addMouseListener(this);
              compCanvas.addMouseWheelListener(this);
      // comp_img.getCanvas().addMouseListener(this);
      // comp_img.getCanvas().addMouseWheelListener(this);
          }
          
          public boolean menuContains(PopupMenu popMen, String chkStr){
              
              int pop_count = popMen.getItemCount();
              MenuItem mi;
              String labStr;
              for (int pi = 0; pi < pop_count; pi++) {
                  mi = comp_img_popup.getItem(pi);
                  labStr = mi.getLabel();
                  if (labStr.equals(chkStr)){
                      return true;
                  }
              }
              return false;
          }
          
          public void createOvrly(){
              
              // clear img overlay
              // for each arrow in list add roi to overlay
              // set image overlay
              
              arwOvrly.clear();
              for (int ii=0; ii<arrows.size(); ii++){
                  arwOvrly.add(arrows.get(ii).arwRoi);
              }
              //origImp.setOverlay(arwOvrly);
              
              comp_img.setOverlay(arwOvrly);
              
          }

          // classs and functions for each arrow
          public class RadialArrow {
              public int id; // ID fof this arrow
              public float x_um; // x position in physical units (pu)
              public float y_um; // y position in pu
              public int x_px; // x position in pixels
              public int y_px; // y position in pixels
              public float nuc_rad_um; // radius of nucleus in pu
              public int angle; // angle in degrees -- TODO: check starting point and +/- values
              public Boolean visible;
              
              public int[] ang_dist; // intensity at each angle - 360
              public int[] ang_dist_bin; // binned version of the above
              public int[] ang_idx; // abscissa for angles - 360
              public int[] ang_idx_bin; // corresponding binned version
              public Boolean binned; // indicates that binned distribution should be used
              public int[] rad_dist; // intensity at each radii - 0 to 2 x nuc radius
              public int[] rad_ang_dist; // radii at each angle - 360

              public int[] rad_idx; // abscissa for radii - 0 to 2 x nuc radius
              public double[][] ang_rad; // angle radian around nuc center
              public double[][] ang_deg; // angle degree around nuc center
              public ImagePlus ang_deg_imp; // image plus to display the test angles
              public ImagePlus ang_rad_imp; // image plus to display the test angles
              public int max_ang; // stores the angle with max intensity on first analysis
              public int max_ang_cnt; // max intensity of angular dist -- for color scaling and disp.
              public int max_rad; // stores the radius with max intensity on first analysis
              public URL arwUrl; // link to pngArrow resource
              public float arwOpacity; // 0.0 - 1.0 overlay opacity value
              public BufferedImage png_bi = null; // buffered image for rotated arrow
              private BufferedImage png_bi_orig = null; // original buffered image
              public int bi_half_wid; // half width and height of buffered image
              public int bi_half_hght;
              public ImageRoi arwRoi; // ROI for placing buffered image ROI
              private AffineTransform aff_trans;
              private AffineTransformOp aff_trans_op; // transformation and operation for rotation of buffered image
              
              // On create - for all arrows
              {
                  angle = 0;
                  visible = false;
                  
                  binned = false;
                  arwUrl = getClass().getResource("/Res/pngArrow.png");
                  try {
                      png_bi = ImageIO.read(arwUrl);
                      png_bi_orig = ImageIO.read(arwUrl);
                      } catch (IOException e) {
                      }
                  bi_half_wid = png_bi.getWidth() / 2;
                  bi_half_hght = png_bi.getHeight() / 2;
                  arwOpacity = (float) 0.4;
                  aff_trans = new AffineTransform();
              }
              
              // Constructor
              public RadialArrow(float a_um, float b_um, float rad_um){
                  x_um = a_um;
                  y_um = b_um;
                  x_px = Math.round( x_um / um_px );
                  y_px = Math.round( y_um / um_px );
                  nuc_rad_um = rad_um;
                  id = arrows.size();
                  
              }
              
              // setup the initial angle and overlay image
              public void setInitAngles(){
                  // set the angle to match the max histogram entry - find the most probably angle
                  int max_idx = 0; int max = 0;
                  for (int i = 0; i < ang_dist.length; i++) {
                      if (ang_dist[i] > max) {
                          max = ang_dist[i];
                          max_idx = i;
                          }
                      }
                  angle = max_idx; // may change based on user control -- reported end result
                  max_ang = max_idx; // for resetting without re-calc
                  max_ang_cnt = max; // maximum histogram count
                  
                  // set AffineTransformation and Operation filter to buffered image png
                  int adj_angle = 360 - angle + 90;
                  aff_trans.rotate(Math.toRadians(adj_angle), bi_half_wid, bi_half_hght);
                  aff_trans_op = new AffineTransformOp(aff_trans, AffineTransformOp.TYPE_BILINEAR);
                  png_bi = aff_trans_op.filter(png_bi_orig, null);
                      
                  // create arrow ROI
                  arwRoi = new ImageRoi(x_px-bi_half_wid, y_px-bi_half_hght, png_bi);
                  arwRoi.setOpacity(arwOpacity);
              }
              
              public int bin_dist(int bf){
                  // bin distribution by a facter 'bf'
                              
                  // use 3, 5, 9, 15 to keep bin central
                  // initializes the binned dist array
                  // sum bins into new array
                  // create new abscissa array - calc. midpoint; round up on even bin sizes
                  
                  // quotient a / b; remainder a % b;
                  int i = 1; float remain; int lc = 0;
                  do{
                      lc = lc + 1;
                      remain = 360 % bf; // remainder after integer division
                      if (remain > 0) bf += 1; // only move on once bin factor is correct fit
                      else i = 0;
                      if (lc>50) return -1; // returns -1 if loop runs too many times
                  }while(i == 1);
                  
                  int newN = 360 / bf;
                  
                  ang_dist_bin = new int[newN];
                  ang_idx_bin = new int[newN];
                  // TODO think about periodic boundaries... idx's 359 + 0 + 1 to keep central point on 0
                  // for each binned dist index add bf indicies from dist
                  // create binned idx
                  // e.g. bf=3
                  // 0,1,2 -> 1 -- sum[idx_offset to (idx_offset + bf - 1)] -- first idx is bf / 2
                  // 3,4,5 -> 4 -- idx_offset += bf -- idx += bf
                  // 6,7,8 -> 7
                  int idxo = 0;
                  int ii;
                  int tmp;
                  int idx = bf / 2;
                  for ( i=0; i<newN; i=i+1){
                      tmp = 0;
                      for ( ii=idxo; ii<(idxo+bf); ii=ii+1 ){
                          tmp = tmp + ang_dist[ii];
                      }
                      ang_dist_bin[i] = tmp;
                      ang_idx_bin[i] = idx;
                      idxo = idxo + bf;
                      idx = idx + bf;
                  }
                  binned = true;
                  return 1;
              }
              
              // TODO - keep track of all open frames to replot binned distribution
              public void disp_radPlot(){
                  // TODO - add array list of frames to keep track for later
                  String frmNameStr;
                  // name of window to match arrow x,y, or ROI name
                  frmNameStr = "Nucleus (" + String.valueOf(x_px) + "," + String.valueOf(y_px) + ")";
                  GCFrame f = new GCFrame(frmNameStr);
                  GJGraphContainer gc = GJGraphContainer.createInstance(GJGraph.createInstance());
                  f.add(gc);
                  GJPlotInterface plot = GJPolarBar.createInstance();
                  
                  int clr_idx;
                  double stp = max_ang_cnt / 17; // create a step variable for descretizing data to color scale
                  Color[] colors = new Color[ang_dist.length];
                  for (int i = 0; i < ang_dist.length; i++) {
                      if ( i%2==0 ){ clr_idx = 5; } else{ clr_idx = 6; }
                      colors[i] = kcl.waterloo.defaults.Colors.getColor(clr_idx);
                  }
                  plot.setFill(colors);
                  //plot.setEdgeColor(colors);
                  //plot.setFill(Color.WHITE);
                  plot.setEdgeColor(Color.BLACK);
                  if (binned){
                      plot.setXData(ang_idx_bin);
                      plot.setYData(ang_dist_bin);
                  } else {
                      plot.setXData(ang_idx);
                      plot.setYData(ang_dist);
                  }
                  
                  gc.getView().add(plot);
                  gc.getView().autoScale();
              }
          }

          
          public class r_clickLstnr implements ActionListener {

              @Override
              public void actionPerformed(ActionEvent e) {
                  if ("Plot Angular Dist.".equals(e.getActionCommand())) {
                      for (int i = 0 ; i < ROIs.length ; ++i) {
                          if (ROIs[i].contains(r_clickXY.x, r_clickXY.y)) {
                              arrows.get(i).disp_radPlot();
                          }
                      }
                  }
              }
          }
          
          @Override
          public void mouseClicked(MouseEvent me) {
          }

          @Override
          public void mousePressed(MouseEvent me) {
              r_clickXY = me.getPoint();
              //IJ.log("mousePressed event: (" + Integer.toString(r_clickXY.x) + "," + Integer.toString(r_clickXY.y) + ")");
          }

          @Override
          public void mouseReleased(MouseEvent me) {
          }

          @Override
          public void mouseEntered(MouseEvent me) {
          }

          @Override
          public void mouseExited(MouseEvent me) {
          }

          @Override
          public void mouseWheelMoved(MouseWheelEvent mwe) {
              int x = mwe.getX();
              int y = mwe.getY();
              
              for (int i = 0 ; i < ROIs.length ; ++i) {
                  if (ROIs[i].contains(x, y)) {
                      rm.select(i);
                      mwe.consume();
                  }
              }
              IJ.log("mouseWheelMoved event: (" + Integer.toString(x) + "," + Integer.toString(y) + ")");
          }
              
          // Additional faster functions to speed things up
          
          public static double fexp(double val) {
              final long tmp = (long) (1512775 * val + 1072632447);
              return Double.longBitsToDouble(tmp << 32);
          }
          
          public static double sqrt(final double a) {
              final long x = Double.doubleToLongBits(a) >> 32;
              double y = Double.longBitsToDouble((x + 1072632448) << 31);
              // repeat the following line for more precision
              //y = (y + a / y) * 0.5;
              return y;
          }
          
          public static boolean almostEqual(float a, float b, float eps){
              return (float)Math.abs(a-b)<eps;
          }
          
      }
















      // Old saved clipets


      // int clr_idx;
      // float alpha = 1.0f;
      //
      // float[] hsb = new float[3];
      // hsb[1] = 1.0f; hsb[2] = 0.5f;
      // for (int i = 0; i < ang_dist.length; i++) {
      // //clr_idx = (int) ( ang_dist[i] / stp );
      // //colors[i] = kcl.waterloo.defaults.Colors.getColor(clr_idx);
      // hsb[0] = (float) ang_dist[i] / max_ang_cnt;
      // //colors[i] = new Color(TYPE_HSV, hsb, alpha);
      // colors[i] = Color.getHSBColor(hsb[0],hsb[1],hsb[2]);
      // //colors[i] = new Color(TYPE_HSV, hsb, 1f);
      // }
      // plot.setFill(colors);
      // plot.setEdgeColor(colors);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none yet

        Attachments

          Activity

            People

            Assignee:
            ssadetsky Semyon Sadetsky (Inactive)
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: