octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: images


From: Daniel J Sebald
Subject: Re: images
Date: Thu, 15 Feb 2007 04:16:19 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

John W. Eaton wrote:
On  9-Feb-2007, Daniel J Sebald wrote:

| The attached patch should be a step in the right direction.  The
| file diffs were created separately rather than recursively.

OK, I applied the patch with some changes (see below).

| If I missed a file, let me know.

What about imagesc.m?  Can parts of that be replaced by a call to __img__?

Knew I forgot one.



| --- image/colormap.m  2007-02-08 11:50:52.000000000 -0600
| +++ /home/sebald/octave/colormap.m    2007-02-09 04:25:16.561543488 -0600
| @@ -61,12 +61,12 @@
|          error ("colormap: map must have values in [0,1]");
|        endif
|        ## Set the new color map
| -      set (gcf (), "colormap", map);
| +      set (gca (), "colormap", map);
|      endif
| | endif | | ## Return current color map.
| -  cmap = get (gcf (), "colormap");
| +  cmap = get (gca (), "colormap");
| --- plot/__uiobject_axes_ctor__.m     2007-02-08 11:50:56.000000000 -0600
| +++ /home/sebald/octave/__uiobject_axes_ctor__.m      2007-02-09 
02:30:20.000000000 -0600
| @@ -32,6 +32,7 @@
|      s.parent = p;
|      s.children = [];
|      s.position = [];
| +    s.colormap = __default_colormap__ ();
| | h = __uiobject_make_handle__ (s); |
Matlab stores the colormap in the figure object, not the axes object,
so I did not apply these changes, and I made a small change in
__uiobject_draw_axes__ to get the colormap from the figure object that
is the parent of the current axes.

Really, as part of the figure, not the axes?  Hmm, that leaves out the 
possibility of having two plots on the figure with different colormaps.  That's 
too bad.


| +       fwrite (fid, [img_data(:,:,1)(:) img_data(:,:,2)(:) img_data(:,:,3)(:)]'(:), 
"float");

I think the reordering of img_data can be expressed as

  permute (img_data, [3, 1, 2])(:)

so I used this expression instead.

Looks much nicer.

There is some more that can be done with __uiobject_draw_axes__, but probably 
better to not do too much at once (hence giving you a chance to tidy the code).

For example, images can be treated similar to the other cases.  There can be multiple, and the 
command can be put in "using_string" "with_string" fashion.  That will make the 
bottom loop look a bit more compact and generic, and plot things in order they were issued.  Not 
sure I can get to it this week.

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]