As discussed earlier, the process of QDataStream >> QPainterPath is
quite slow, so this commit makes an improvement on QPainterPath creation
for the case of connect='pairs' by using a naive method of moving the
path and drawing a line on the path. This was the fastest method
identified during testing.
The check for NaN values in arrayToQPath is expensive, this change
attempts to do the check one time, and if no NaN values are present,
an optional flag is passed along telling arrayToQPath that the check
can be skipped
Since QDataStream >> QPainterPath is an expensive operation, we can
construct our QPainterPath from an open polygon instead but only if the
connect='all' mode is present. Future optimizations work can likely
be had with constructing a polygon from each connected segment
* refactor out _ndarray_to_qimage()
* combine levels back with lut
* make use of Grayscale8, RGB888 and Indexed8 QImage formats
Grayscale8 and RGB888 images are those that are ready for display
without further processing.
* add Grayscale16
* apply the efflut early for uint16 mono/rgb, uint8 rgb
* ndarray indexing is faster than np.take
* handle uint16 rgb(a) with no levels same as levels=[0, 65535]
* add support for Format_RGBA64
* fix: support colormaps of shape (h, 1)
* check ImageItem uint8 and uint16 QImage formats
* uint16 mono with rgb lut -> RGBX8888
* got width and height swapped in array dimensions
* set ImageItem as row-major
* no need to form a 1d 32-bit lut for array indexing
you can index (y, x) into a lookup table of shape (nentry, 3) or
(nentry, 4) and get an output of shape (y, x, 3) or (y, x, 4)
* Revert "no need to form a 1d 32-bit lut for array indexing"
This reverts commit 45cf3100de.
* distinguish between levels_lut and colors_lut
this allows uint16 images with user lut to be rendered as
Format_Indexed8
* uint8 (1-chan) images should always combine to efflut
this efflut will then be used for Indexed8 format color table.
previously, we would be taking a performance hit with doing a numpy
lookup with levels_lut.
* adapt benchmarks/makeARGB.py to renderImageItem.py
* restructure uint8 and uint16 codepaths
* normalize 1-chan images to ndim==2 earlier up
* refactor long code into functions
* bug: qimage may not be assigned
* fix: assign to self.qimage only if not None
* for uint16, do rescale rather than do levels_lut lookup
* cases 2,3 are already handled
i.e. no more using lut to do rescale of uint16 image data.
* rescale rgb images by computation, not by memory lookup
* setImage() does not take an output argument
* try to be cupy compatible
use "xp" instead of numpy module
* add numba to benchmarking
* fix: lut_big is dtype uint8 with more than 256 entries
* bug: applying colors_lut needs C-order
* support float with no nans
* fix: variable could be uninitialized
* add float32 format tests
* avoid explicitly forcing to C-contiguous
* cache effective lut only if combination took place
every one of the four branches now does its own return.
this makes it easier to follow.
* fix cupy benchmark : typo in renderQImage
* remove for loop of 1 iteration
* use float32 for floating point benchmark
* superceded by renderImageItem.py
* lint
* benchmark without lut conversion
* put the lut onto the substrate
* fix editor complaints
* handle lack of cupy
* leading underscores imply privacy
Co-authored-by: KIU Shueng Chuan <nixchuan@gmail.com>
this also fixes the assumption that we are on little-endian.
In [18]: qimg = QtGui.QImage(1, 1, QtGui.QImage.Format.Format_RGB32)
In [19]: qimg.fill(QtCore.Qt.GlobalColor.transparent)
In [20]: np.frombuffer(qimg.bits(), dtype=np.uint8)
Out[20]: array([ 0, 0, 0, 255], dtype=uint8)
* added convenience functions to better handle plotting with gradients
* docstring correction, example name correction
* retrying to get documentation format right
* another attempt at cleaning up docs
* Don't hardcode timer type (and docs fixing attempt)
* more docstring re-formatting
* linebreaks in docstrings
* more documentation adjustments
* documentation pass
* some corrections to documentation
* more adjustments to documentation
* again?
* removed some whitespace and redundant blank lines, changed some checks '== None' to 'is None'
* fixed mis-spelling QColor as Qcolor
* Improve HistogramLUTItem docs, a few cosmetic changes
* Initial implementation of horizontally-oriented HistogramLUTItem
- Also adds support in HistogramLUTWidget
- Fixes AxisItem orientation bug for vertical orientation
- Make use of GradientEditorItem orientation (fixes another bug for
vertical orientation)
- Use horizontal orientation in an example for demonstration
* Remove unused HistogramLUTItem option
* A few more minor fixups
* Copy paste bug
* Use f-strings
* Update from review and a couple more minor updates
* Woops
* Add doc for orientation arg
* Add top/bottom orientation to doc. Expand on levelMode doc a bit
* do not cache the cupy so the config option can be set later
* getCupy will always return None if the option is not set
* test of failing behavior
* divorce skip from option; restore option after test