How to use properly EzVarChannel

17 views
Skip to first unread message

John leger

unread,
May 12, 2015, 11:09:04 AM5/12/15
to icy-so...@googlegroups.com
Hello,

I want to add the option of choosing the channel:

    private EzVarSequence sequenceImg     = new EzVarSequence("Input Image");
   
private EzVarChannel  sequenceImgChan = new EzVarChannel("Image channel", sequenceImg.getVariable(), true);


But once I launch my plugin and then open an image, it's trying to acces the default value -1

java.lang.ArrayIndexOutOfBoundsException: -1
    at java
.util.ArrayList.elementData(ArrayList.java:400)
    at java
.util.ArrayList.get(ArrayList.java:413)
    at ome
.xml.model.Pixels.getChannel(Pixels.java:573)
    at ome
.xml.meta.OMEXMLMetadataImpl.getChannelName(OMEXMLMetadataImpl.java:1053)
    at icy
.sequence.MetaDataUtil.getChannelName(MetaDataUtil.java:555)
    at icy
.sequence.Sequence.getChannelName(Sequence.java:974)
    at plugins
.adufour.vars.gui.swing.ChannelSelector$3$1.valueToString(ChannelSelector.java:93)
    at javax
.swing.JFormattedTextField$AbstractFormatter.install(JFormattedTextField.java:949)
    at javax
.swing.JFormattedTextField.setFormatter(JFormattedTextField.java:465)
    at javax
.swing.JFormattedTextField.setValue(JFormattedTextField.java:789)
    at javax
.swing.JFormattedTextField.setValue(JFormattedTextField.java:502)
    at plugins
.adufour.vars.gui.swing.ChannelSelector.updateInterfaceValue(ChannelSelector.java:126)
    at plugins
.adufour.vars.gui.VarEditor.setEnabled(VarEditor.java:250)
    at plugins
.adufour.ezplug.EzVar.addTo(EzVar.java:190)
    at plugins
.adufour.ezplug.EzComponent$1.run(EzComponent.java:75)
    at icy
.system.thread.ThreadUtil$CaughtRunnable.run(ThreadUtil.java:61)
    at icy
.system.thread.ThreadUtil.invokeLater(ThreadUtil.java:261)
    at icy
.system.thread.ThreadUtil.invokeLater(ThreadUtil.java:244)
    at plugins
.adufour.ezplug.EzComponent.addToContainer(EzComponent.java:70)
    at plugins
.adufour.ezplug.EzDialog.repack(EzDialog.java:289)
    at plugins
.adufour.ezplug.EzDialog$1.run(EzDialog.java:74)
    at java
.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
    at java
.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
    at java
.awt.EventQueue.access$300(EventQueue.java:103)
    at java
.awt.EventQueue$3.run(EventQueue.java:706)
    at java
.awt.EventQueue$3.run(EventQueue.java:704)
    at java
.security.AccessController.doPrivileged(Native Method)
    at java
.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java
.awt.EventQueue.dispatchEvent(EventQueue.java:715)
    at java
.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java
.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java
.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java
.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java
.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java
.awt.EventDispatchThread.run(EventDispatchThread.java:91)

So what I have done wrong ?

Thanks for any answers.

Jerome Mutterer

unread,
May 13, 2015, 10:19:09 AM5/13/15
to icy-so...@googlegroups.com

Hi John,
I can't test this right now, but shouldn't your chose read sequenceImg.getValue() instead of sequenceImg.getVariable()
?
Sincerely,
Jerome.

--
You received this message because you are subscribed to the Google Groups "Icy imaging" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icy-software...@googlegroups.com.
To post to this group, send email to icy-so...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/icy-software/882539b6-a3a4-4f36-b3a1-9830332e5388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jerome Mutterer

unread,
May 13, 2015, 10:20:22 AM5/13/15
to icy-so...@googlegroups.com

Your code, not your 'chose'
Sorry.

Alexandre Dufour

unread,
May 13, 2015, 10:27:42 AM5/13/15
to icy-so...@googlegroups.com
Hi,

Actually getVariable() is correct (the selected variable depends on the other). There is just a silly bug on the “-1” which I will fix ASAP.
In the mean time, you could try using a EzVarDimensionPicker instead (which does pretty much the same thing, but shows the channel index instead of the channel name).

Will let you know when EzVarChannel is fixed…
Thanks for the feedback!

Alexandre

John leger

unread,
May 13, 2015, 11:24:04 AM5/13/15
to icy-so...@googlegroups.com

Thanks for the answers,

For now I will use EzVarDimensionPicker, but I don't understand what how it needs to be created:

public EzVarDimensionPicker(java.lang.String varName,
                            icy.sequence.DimensionId dim,
                            EzVarSequence sequence)

What is the DimensionId ? Why should I need it if I have to give a sequence ?

Alexandre Dufour

unread,
May 13, 2015, 11:33:50 AM5/13/15
to icy-so...@googlegroups.com
the picker works in any dimension (X,Y,Z,C,T), so you have to indicate which dimension to pick. In your case (for channels) you would do:

new EzVarDimensionPicker(“name”, DimensionId.C, ezSeq.getVariable());

Alexandre

Alexandre Dufour

unread,
Jun 16, 2015, 6:22:49 PM6/16/15
to icy-so...@googlegroups.com
Hi,

It took longer than expected (mostly an unusually busy schedule), but this is now fixed. You can now (safely) use EzVarChannel, which has the added value of displaying the channel name in addition to the traditional index.

Have fun
Alexandre

Reply all
Reply to author
Forward
0 new messages