question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing Image/Overlay data in FSLeyes from a plugin script

See original GitHub issue

I am trying to figure out how to access the data from an image loaded in FSLeyes.

I tried to look at how it is done in the spinalcordtoolbox plugin This script used commands such as: selected_overlay = displayCtx.getSelectedOverlay() and overlayList.append(image)

How is it possible to access the objects displayCtx and overlayList?

When I try to use them in my plugin script, I get an error saying that they are not defined.

Here’s my code for the plugin script:

import_ wx import fsleyes.controls.controlpanel as ctrlpanel import fsleyes

class Ads_control_v1(ctrlpanel.ControlPanel):

def __init__(self, *args, **kwargs):
    ctrlpanel.ControlPanel.__init__(self, *args, **kwargs)
    sizer = wx.BoxSizer(wx.VERTICAL)
    self.SetSizer(sizer)
    sizer.Add(wx.StaticText(self, label='Ads_plugin_v1_controls'),
              flag=wx.EXPAND, proportion=1)

    adsButton = wx.Button(self, label = "Ads_pushbutton")
    adsButton.Bind(wx.EVT_BUTTON, self.onAdsButton)
    sizer.Add(adsButton, flag=wx.SHAPED, proportion=1)


def onAdsButton(self, event):
    print(overlayList) # NameError: name 'overlayList' is not defined
    print(fsleyes.overlay.OverlayList.overlays) # This is not working



@staticmethod
def supportedViews():
    from fsleyes.views.orthopanel import OrthoPanel
    return [OrthoPanel]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Stoyan-I-Acommented, Feb 21, 2019

I contacted the FSL developers via their mailing list about this issue. Here’s the link to their response : https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1902&L=FSL&F=&S=&X=9164C4158CCC55B25D&Y=stoyan.asenov.400%40gmail.com&P=216512

1reaction
peronecommented, Feb 18, 2019

They changed this API so I’m not sure about it, have you tried to look if the displayCtx isn’t being passed as the parameter on the *args or **kwargs of your constructors ? That would be a reasonable way to pass these parameters so I guess they might use that. You can also ask that in their mailing list or repository because they probably now that and will be able to answer immediately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessing Image/Overlay data in FSLeyes from a plugin script
I am trying to figure out how to access the data from an image loaded in FSLeyes. I tried to look at how...
Read more >
Command line interface — FSLeyes 1.5.0 documentation
The --runscript option allows you to execute a Python script when FSLeyes starts, which can load overlays and configure their display properties, and...
Read more >
fsleyes release history — FSLeyes 1.5.0 documentation
Images with a complex data type are no longer split into separate real and imaginary volume overlays - they are loaded as a...
Read more >
Overlays — FSLeyes 1.5.0 documentation - University of Oxford
FSLeyes refers to the files that you load as overlays. FSLeyes 1.5.0 is capable of loading the following types of data: NIFTI image...
Read more >
Troubleshooting — FSLeyes 1.5.0 documentation
This page describes some problems which you may encounter when using FSLeyes. If you are having a problem which is not listed here,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found