upon investigation the [0] simply removes this weird thing (object?) which contains the array. (array... [ 255, 255, 255, 255]]], dtype=uint8), False)
the trick was not to use float but ubyte: tex1 = pg.makeRGBA(img_as_ubyte(data[shape[0]/2]))[0] # yz plane tex2 = pg.makeRGBA(img_as_ubyte(data[:,shape[1]/2]))[0] # xz plane tex3 = pg.makeRGBA(img_as_ubyte(data[:,:,shape[2]/2]))[0] # xy plane On Tuesday, 16 August 2016 16:47:07 UTC-7, Georges Hb wrote: > > Hello, so I've been trying to play around the 3D image in GLImageItem.py. > My goal is to plot a 3D array of shape (r, c, t) with images (1002, 1004, > 115) and dtype uint16 > > In an out-of-the-box solution attempt i checked the data variable in the > example shape and type and adjusted to a float 3-dimensional array yet the > output is a white image. > The initial image is not white, to get the middle image in the stack one > could use the following (excerpt of variable tex3): > > >>> data[:,:,shape[2]/2] > array([[10204, 11500, 11012, ..., 10472, 10020, 11232], > [13196, 13024, 13868, ..., 12200, 13252, 12676], > [13184, 11932, 13576, ..., 12668, 12256, 13216], > ..., > [14496, 13908, 13652, ..., 13816, 14204, 13384], > [14472, 14536, 13900, ..., 13960, 15312, 14460], > [15072, 14856, 14984, ..., 15440, 15528, 15888]], dtype=uint16) > > >>> data[:,:,shape[2]/2].shape > (1002, 1004) > > tex3 = pg.makeRGBA(data[:,:,shape[2]/2], levels=levels)[0] # xy plane > tex3 is in that case an array of shape (1004, ) which is not > representative of the xy plane due to [0].. but removing that breaks hell > loose.. > > | shape = self.data.shape > | AttributeError: 'tuple' object has no attribute 'shape' > |==============================<< > Error while drawing item <pyqtgraph.opengl.items.GLImageItem.GLImageItem > object at 0x10e990c30>. > > > changing to float is done using: > from skimage import img_as_float > > > Appreciate any help! > > > > -- 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/04bd27f4-56df-4926-8869-5cb389206457%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
