Re: Reversing bits in a byte

2013-03-12 Thread 88888 Dihedral
Oscar Benjamin於 2013年3月12日星期二UTC+8下午11時44分50秒寫道: > On 12 March 2013 14:59, Oscar Benjamin wrote: > > > Numpy and matplotlib will do what you want: > > > > > > import numpy as np > > > import matplotlib.pyplot as plt > > > > > > def bits_to_ndarray(bits, shape): > > > abytes = np.frombuf

Re: Reversing bits in a byte

2013-03-12 Thread Oscar Benjamin
On 12 March 2013 14:59, Oscar Benjamin wrote: > Numpy and matplotlib will do what you want: > > import numpy as np > import matplotlib.pyplot as plt > > def bits_to_ndarray(bits, shape): > abytes = np.frombuffer(bits, dtype=np.uint8) > abits = np.zeros(8 * len(abytes), np.uint8) > for

Re: Reversing bits in a byte

2013-03-12 Thread Oscar Benjamin
On 12 March 2013 13:28, Robert Flintham wrote: > Sorry, the subject line was for a related question that I decided not to ask, > I forgot to change it when I changed my email. I've changed it now! > > I'm using Python 3.3 on Windows with the pydicom module > (http://code.google.com/p/pydicom/).

Re: Reversing bits in a byte

2013-03-12 Thread Tim Chase
On 2013-03-11 15:32, Robert Flintham wrote: > I have a 'bytes' object which contains a simple bitmap image (i.e. > 1 bit per pixel). I can't work out how I would go about displaying > this image. Does anyone have any thoughts? You'd need to detail - how you want to display it (console, GUI, web

RE: Reversing bits in a byte

2013-03-12 Thread Robert Flintham
ical Physics - University Hospitals Birmingham NHS Foundation Trust 63 Melchett Road, Kings Norton, Birmingham, B30 3HP ð Delivering the best in care -Original Message- From: Tim Chase [mailto:python.l...@tim.thechases.com] Sent: 12 March 2013 13:21 To: Robert Flintham Cc: 'python-list@py

RE: Reversing bits in a byte

2013-03-12 Thread Robert Flintham
Behalf Of Dave Angel Sent: 12 March 2013 12:47 To: python-list@python.org Subject: Re: Reversing bits in a byte On 03/11/2013 11:32 AM, Robert Flintham wrote: > Hi, > > I have a 'bytes' object which contains a simple bitmap image (i.e. 1 bit per > pixel). I can't work out

Re: Reversing bits in a byte

2013-03-12 Thread Dave Angel
On 03/11/2013 11:32 AM, Robert Flintham wrote: Hi, I have a 'bytes' object which contains a simple bitmap image (i.e. 1 bit per pixel). I can't work out how I would go about displaying this image. Does anyone have any thoughts? All the best, Rob How does your subject line relate to your