spectralpython / spectral

Python module for hyperspectral image processing
MIT License
574 stars 139 forks source link

view_cube(): There is no current wx.App object - creating one now #163

Open qm-intel opened 9 months ago

qm-intel commented 9 months ago

@toaarnio @tboggs @donm @lewismc

I am trying to visualize my hypercube data using spectral package and I follow the commands in the main page of spectral by ipython --pylab=wx and then I loaded the data to view::

import spectral
from pylab import *
from spectral import *
spectral.settings.WX_GL_DEPTH_SIZE = 16
hsi_root = "mypath_to_hsi/"
hypercubes = os.listdir(hsi_root)
hsi_list = os.listdir(hsi_root)
idx = 3
filename = "cube_envi32"
data_path = os.path.join(hsi_root, hsi_list[idx], filename)
# Load hypercube data
data = SpyFile.load(envi.open(data_path + '.hdr', data_path + '.dat'))  # (512, 640, 92)

when I am trying to view the cube , I am getting the following message:

view_cube(data,bands=[29, 19, 9])
There is no current wx.App object - creating one now.
  warnings.warn('\nThere is no current wx.App object - creating one now.',
Out[17]: <spectral.graphics.graphics.WindowProxy at 0x7f9dd694ef10>

UPDATED: I added the following codes to initiate wx.APP(). I followed the post here:

https://discuss.wxpython.org/t/instance-of-wx-app/36663/2

app = wx.App()
print(app)
print(wx.GetApp())
print(wx.App.Get())
print(wx.App.GetInstance())
print(wx.AppConsole.GetInstance())

it opens a pycharm window by showing nothing and then it forces to close the window enter image description here

and the output is a blank window. How to solve this?

lewismc commented 9 months ago

Hi @qm-intel are you able to provide a sample of the input data? Thanks