[ImageJ-devel] Parameter decorator and supported classes

Curtis Rueden ctrueden at wisc.edu
Fri Nov 21 14:12:43 CST 2014


Hi Felix,

> java.lang.NullPointerException
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:532)

FWIW, I made a couple of fixes to avoid this problem:
*
https://github.com/scijava/scijava-common/commit/bce7b69391791f39b5019dca14bf110816c97265
*
https://github.com/scijava/scijava-common/commit/93c340f472401567dee50f2edbb70abbff261749

These fixes made it into the scijava-common-2.35.1 release [1]. Give it a
try if you have a chance.

However, the fact that there were nulls involved there at all suggests
another possible bug lurking elsewhere. I have not yet had time to
investigate further, unfortunately.

Regards,
Curtis

On Fri, Oct 31, 2014 at 6:17 AM, MEYENHOFER Felix <felix.meyenhofer at unifr.ch
> wrote:

>  Hi Curtis
>
>  thanks for getting back to me. From a short look at the recent mails, it
> looks like you guys went through a considerable pile of work so you I am
> fully understanding this delay.
>
>  The option “Use SCIFIO when opening files” was checked in my case…
> However I went ahead and tried to use a ImagePlus as input parameter. But
> the message dialog "An ImgPlus is required, but none exists” persists.
> Now when I open some image first, I get the following warning.
> [WARNING] No widget found for input: imp
>
>  I should probably mention that when launching ImageJ (2.47) with the
> following lines:
> final ImageJ ij = net.imagej.Main.launch(args);
> ij.command().run(Sanbox.class, true);
>
>  I get the error below:
>
> [ERROR] Exception during event handling:
> [Event] org.scijava.module.event.ModulesUpdatedEvent
> context = org.scijava.Context at 71d382ab
> consumed = false
> items[0] = label='About ImageJ...',
> iconPath='/icons/commands/information.png', priority=0.0, enabled=true,
> pluginType=Command
> items[1] = label='Preferences', priority=0.0, enabled=true,
> pluginType=Command
> items[2] = label='Quit', iconPath='/icons/commands/door_in.png',
> priority=0.0, enabled=true, pluginType=Command
> [Subscriber] org.scijava.menu.DefaultMenuService [priority = 0.0]
> [Method] protected void
> org.scijava.menu.DefaultMenuService.onEvent(org.scijava.module.event.ModulesUpdatedEvent)
> java.lang.NullPointerException
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:532)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addChild(ShadowMenu.java:529)
> at org.scijava.menu.ShadowMenu.addInternal(ShadowMenu.java:478)
> at org.scijava.menu.ShadowMenu.addAll(ShadowMenu.java:351)
> at org.scijava.menu.ShadowMenu.<init>(ShadowMenu.java:117)
> at
> org.scijava.menu.DefaultMenuService.addModules(DefaultMenuService.java:154)
> at
> org.scijava.menu.DefaultMenuService.rootMenus(DefaultMenuService.java:179)
> at org.scijava.menu.DefaultMenuService.onEvent(DefaultMenuService.java:118)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:278)
> at
> org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:252)
> at
> org.bushe.swing.event.ThreadSafeEventService.publish(ThreadSafeEventService.java:971)
> at org.scijava.event.DefaultEventBus.access$101(DefaultEventBus.java:56)
> at org.scijava.event.DefaultEventBus$1.run(DefaultEventBus.java:197)
> at
> org.scijava.thread.DefaultThreadService$1.run(DefaultThreadService.java:147)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
> at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
> at java.awt.EventQueue.access$400(EventQueue.java:82)
> at java.awt.EventQueue$2.run(EventQueue.java:676)
> at java.awt.EventQueue$2.run(EventQueue.java:674)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
> at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
> at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
> at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>
>  Sorry for throwing this stack-trace half investigated at you, but being
> a newbie in these matters, my hope i that you might tell me that I
> overlooked something obvious, before I go off looking at the wrong place to
> resolve the issue at hand.
>
>
>  Best, regards,
>
>  Felix
>
>  On 30 Oct 2014, at 18:51 , Curtis Rueden <ctrueden at WISC.EDU> wrote:
>
>  Hi Felix,
>
>  Apologies for the delay in reply. Due to work surrounding the ImgLib2
> release, this is an exceptionally busy time.
>
>  > An ImgPlus is required, but none exists
>
>  The issue is that ImageJ2 uses the ImgPlus and Dataset classes for
> images, but ImageJ1 uses ij.ImagePlus. And the automatic conversion between
> these types is currently incomplete. The "Enable ImageJ2 data structures"
> option of Edit > Options > ImageJ2 is intended to toggle this
> auto-conversion, but it currently has performance problems, so is off by
> default.
>
>  We have a plan to address these issues, but it will be some time before
> the work can be completed.
>
>  Some related issues in the issue tracker:
> * https://github.com/imagej/imagej-legacy/issues/95
>  * https://github.com/imagej/imagej-legacy/issues/86
>  * https://github.com/imagej/imagej-legacy/issues/31
>  * https://github.com/imagej/imagej-legacy/issues/22
>
>  In the meantime, it may be easier to use ImageJ 1.x's image data
> structure:
>
>     @Parameter
>    ImagePlus imp;
>
>  Instead of the IJ2/ImgLib2 ones.
>
>  Regards,
> Curtis
>
> On Wed, Oct 15, 2014 at 8:52 AM, MEYENHOFER Felix <
> felix.meyenhofer at unifr.ch> wrote:
>
>> Hi
>>
>> during my first attempts of implementing a ij2 plugin I realised that the
>> following point is not clear to me:
>> thanks to the widget demo of the imagej-tutorials I managed to define my
>> UI in the ij2-way. Now during my further research to find a way to easily
>> define an image input and getting the dialog with the Parameter decorator I
>> found examples like
>>
>>         @Parameter(type = ItemIO.INPUT)
>>         private ImgPlus<FloatType> img;
>> or
>>         @Parameter(type = ItemIO.INPUT)
>>         private Dataset ds;
>>
>> but when running such code I get a warning-dialog saying; “An ImgPlus is
>> required, but none exists”
>> So I open an image and run  the plugin again. The same dialog appears
>> again.
>> All the other types work well (String, File, etc.). Is this a bug or am I
>> missing something.
>>
>> Best regards,
>>
>> Felix
>> _______________________________________________
>> ImageJ-devel mailing list
>> ImageJ-devel at imagej.net
>> http://imagej.net/mailman/listinfo/imagej-devel
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20141121/4c87bb7f/attachment-0001.html>


More information about the ImageJ-devel mailing list