Accessing Image/Overlay data in FSLeyes from a plugin script
See original GitHub issueI 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:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.