Hi everyone-

I hope someone can help me here.

I am displaying 2D numpy arrays in an ImageView widget and am trying to 
*antialias* the image - my users tend to zoom in and see the ugly pixels.
[image: low-res-noAA.png]
While I have seen people use this:

    pg.setConfigOptions(antialias=True)
 in conjunction with ImageItem within a GraphicsView, I owuld like to use 
the volume view (with slider) that you get with the ImageView but you don't 
get with ImageItem.


I haven't found a way to antialias *image within an ImageView.*

Perhaps there is something Qt/PySide or a more raw OpenGL option I can use 
to do this?  Unfortunately I do not have a deep enough grasp on this to go 
any further...

Or perhaps I just don't know how to get the slider in the ImageItem to view 
slices of a 3D dataset (a stack of 2d images in this case).

Any help would be much appreciated.

Cheers-
 Oli

here's my minimal code:

import sys
from PySide2.QtWidgets import (
    QApplication,
    QHBoxLayout,
    QMainWindow,
    QWidget,
)
import pyqtgraph as pg
import numpy as np

pg.setConfigOptions(antialias=True)


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.cw = QWidget(self)
        self.cw.setAutoFillBackground(True)
        self.setCentralWidget(self.cw)

        self.layout = QHBoxLayout()
        self.cw.setLayout(self.layout)

        self.DcmImgWidget = MyImageWidget(parent=self)
        self.layout.addWidget(self.DcmImgWidget)

        self.show()


class MyImageWidget(pg.ImageView):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui.histogram.hide()
        self.ui.roiBtn.hide()
        self.ui.menuBtn.hide()

        # 5 frames of 50x50 random noise ranging from -500 to 500
        img = (1000 * np.random.normal(size=(5, 50, 50))) - 500
        self.setImage(img)


def main():
    app = QApplication()
    main = MainWindow()
    main.show()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()

 

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/5c2ec5f5-4a1b-4198-be7a-2f9984d13788n%40googlegroups.com.

Reply via email to