Giter Club home page Giter Club logo

Comments (3)

jlegrand62 avatar jlegrand62 commented on June 23, 2024

Using ipython --gui=qt I get this message:

from openalea.image.gui.point_selection import point_selection
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-d4b6dd0d5243> in <module>()
----> 1 from openalea.image.gui.point_selection import point_selection

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.py in <module>()
     29         globals()[m] = mod.__getattribute__(m)
     30 
---> 31 from openalea.vpltk.qt import QtGui, QtCore
     32 load_local(QtCore,'Qt,QObject,SIGNAL,QRectF,QPointF, QPoint')
     33 load_local(QtGui,"""QApplication,QMainWindow,QGraphicsScene,QGraphicsPixmapItem,

/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/__init__.py in <module>()
    166     autodetect()
    167 
--> 168 import openalea.vpltk.qt.designer

/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/designer.py in <module>()
     92 
     93 
---> 94 from openalea.vpltk.qt.uic import compileUi, compile_args
     95 
     96 

/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/uic.py in <module>()
      9 
     10 try:
---> 11     if os.environ[QT_API] in PYQT5_API:
     12         from PyQt5.QtNetwork import *
     13     elif os.environ[QT_API] in PYQT4_API:

/usr/lib/python2.7/UserDict.pyc in __getitem__(self, key)
     38         if hasattr(self.__class__, "__missing__"):
     39             return self.__class__.__missing__(self, key)
---> 40         raise KeyError(key)
     41     def __setitem__(self, key, item): self.data[key] = item
     42     def __delitem__(self, key): del self.data[key]

KeyError: 'QT_API'

from openalea-components.

pradal avatar pradal commented on June 23, 2024

It seems that you need to set the environment variable QT_API to pyqt or pyqt5 depending on what you have installed on your computer.

Something like:
export QT_API=pyqt

from openalea-components.

jlegrand62 avatar jlegrand62 commented on June 23, 2024

It does work with ipython --gui=qt if you correct this error upon calling point_selection (replace has it says):

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-1-82e79edf55ce> in <module>()
     21     surf2reg, alti2reg = im2surface(imread(im2reg))
     22     while not done:
---> 23         ps_ref = point_selection(surf_ref)
     24         ps2reg = point_selection(surf2reg)
     25         try:

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.pyc in point_selection(image, palette_name, color_index_max)
    474         cmax = color_index_max
    475     palette = palette_factory(palette_name,cmax)
--> 476     w.set_palette(palette)
    477     w.show()
    478     return w

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.pyc in set_palette(self, palette, palette_name)
    268             ind = self._palette_select.findText(palette_name)
    269             self._palette_select.setCurrentIndex(ind)
--> 270         self._view.set_palette(palette)
    271         self.update_pix()
    272 

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap_view.pyc in set_palette(self, palette, axis)
    309 
    310         if self.image() is not None :
--> 311             self._reconstruct_pixmaps(axis)
    312 
    313     def set_image (self, img) :

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap_view.pyc in _reconstruct_pixmaps(self, axis)
    213             #             data.shape[1],
    214             #             QImage.Format_ARGB32)
--> 215             dat = to_pix (dat)
    216             pix.append(dat.transformed(tr) )
    217 

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap.pyc in to_pix(img, scalar_type, lut, forceNativeLut)
    178     :Returns Type: QPixmap
    179     """
--> 180     return QPixmap.fromImage(to_img(img, scalar_type, lut, forceNativeLut) )
    181 
    182 def to_tex (img) :

/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap.pyc in to_img(img, scalar_type, lut, forceNativeLut)
     58             raise Exception("Unknown image shape, cannot deduce pixel format")
     59     _img = Image.fromarray(img)
---> 60     pseudo_QImage = ImageQt(_img)
     61     return pseudo_QImage
     62 

/home/jonathan/Softwares/vp/openalea-components/image/src/image/pil/ImageQt.pyc in __init__(self, im)
     67         elif im.mode == "RGBA":
     68             try:
---> 69                 data = im.tostring("raw", "BGRA")
     70             except SystemError:
     71                 # workaround for earlier versions

/usr/lib/python2.7/dist-packages/PIL/Image.pyc in tostring(self, *args, **kw)
    693     def tostring(self, *args, **kw):
    694         raise Exception("tostring() has been removed. " +
--> 695                         "Please call tobytes() instead.")
    696 
    697     def tobitmap(self, name="image"):

Exception: tostring() has been removed. Please call tobytes() instead.

from openalea-components.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.