From: Nicholas Y. <N.P...@wa...> - 2005-06-01 12:15:25
|
On Wed, 2005-06-01 at 12:39 +0100, Nicholas Young wrote: > On Tue, 2005-05-31 at 10:28 -0500, John Hunter wrote: > > >>>>> "Nicholas" == Nicholas Young <su...@su...> writes: > > I have mixed feelings about making this a separate class / separate > > function. The current axes imshow / image.AxesImage is already > > overloaded (handling MxN, MxNx3, MxNx3, _image.Image and PIL images. > > What is the logic of making a special functions/classes case for MxNx4 > > with directshow. On the one hand, I appreciate the desire to simplify > > the code by pulling it into separate classes and functions. On the > > other hand, I wonder if it will confuse users to have one separate > > function for UInt8 images and another for everything else. Another > > worry I have about the separate DirectImage class is that it copies > > much of the image resize functionality from AxesImage, including the > > broken handling of aspect='preserve'. This too argues for keeping as > > much functionality in AxesImage as possible, testing for A.typecode() > > where appropriate. What do you think? > > I'm happy for it be be called from imshow but I can't think of a syntax > to do so which isn't going to be confusing. The existing variations to > imshow are all based upon the type of the input image and this won't > work here - the case of someone who wants to plot a MxNx4 UInt8 array > and have the values it contains normalised being the problem. Another > keyword parameter could be added which only takes effect in this case; I > thought this likely to confuse but if you prefer it I'm happy. Sorry to reply to my own message but I realised just after sending it that it didn't make any sense (as MxNx4 images aren't normalised anyway). I now realise that it makes sense to assume that an MxNx4 UInt8 image will contain pixel data as John suggested and I'll rewrite my code to implement this. It also occurred to me that it would make sense to change the PIL code to avoid the UInt8 -> Float -> UInt transition. I'll try implementing this after making the alterations John suggested. Nick |