-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AreaDetector_Display not showing image (16bit data) #14
Comments
@zunbeltz Hmm, I'm not completely sure. It turns out that I've been playing with the AreaDetector image display code, and trying to update it. So, I'll try to look into this over the next couple days... # default mode and size
im_mode = 'L'
im_size = (arrsize[0], arrsize[1])
dsize = arrsize[0]*arrsize[1]
if colormode == 2: # color image
im_mode = 'RGB'
im_size = (arrsize[1], arrsize[2])
dsize *= arrsize[2]
rawdata = ad_img.PV('ArrayData').get(count=dsize)
if (colormode == 0 and isinstance(rawdata, np.ndarray) and
rawdata.dtype != np.uint8):
im_mode = 'I'
rawdata = rawdata.astype(np.uint32)
if im_mode in ('L', 'I'):
wximage = wx.EmptyImage(width, height)
imbuff = Image.frombuffer(im_mode, im_size, rawdata,
'raw', im_mode, 0, 1)
wximage.SetData(imbuff.convert('RGB').tostring())
elif im_mode == 'RGB':
rawdata = rawdata.astype(np.uint32)
rawdata.shape = (3, width, height)
wximage = wx.ImageFromData(width, height, rawdata)
wximage = wximage.Scale(int(scale*width), int(scale*height)) but that is not actually tested. Again, I'll try this out over the next couple days.... |
@newville Just updating to the last commits has solved the problem here. |
@zunbeltz -- Glad it works! Can you clarify whether you mean the most recent version of the code works, or was the code snippet I posted needed? |
I made a new clone of the project which includes commits from yesterday. I
|
Dear Matt,
I would like to customise the AreaDetector application to do some image processing "on the fly."
At the moment the application connects to the camera and the "acquisition start/stop" works properly.
Unfortunately the image is not show in the frame (just black).
I looked to the code and I think that this is due to the fact that my raw data is of type uint16 and mono.
In this case
ad_display.py
lines 866--876, setsim_mode
to'I'
and convert to uint32.But in the
DataToImage
method I couldn't find the code lines that convert the data to an image.As far as I understand from the documentation neither the python Image library 'image.frombuffer
nor 'wx.ImageFromData
support this kind of data. Am I correct?Does this mean that the only way to go is to scale down the rawdata to uint8? or is there other ways to plot the uint16 data?
Thanks
ps. I used some
print
statement, so the line numbers above may be a bit shifted.The text was updated successfully, but these errors were encountered: