octave-maintainers
[Top][All Lists]
Advanced

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

Re: tmp gets full when plotting many images


From: Daniel J Sebald
Subject: Re: tmp gets full when plotting many images
Date: Mon, 26 Mar 2007 16:22:05 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

John W. Eaton wrote:
On 26-Mar-2007, Daniel J Sebald wrote:

| John W. Eaton wrote:
| > On 26-Mar-2007, Daniel J Sebald wrote:
| > | > | This could be improved perhaps by utilizing the fact that data through the pipe | > | can now also be binary. (I doubt there are any pipes out there that restrict | > | data to 7 bits, ASCII, rather than 8 bits.) Let me know if you want to try this | > | approach. | > | > I think it would be best if we can avoid the temporary files for image
| > data.  Can we do the same for the palette data?
| | Sure, if I remember correctly, there is a conditional test in the current Octave | __go_draw_now__ code that checks the length of the palette. If it gets very | long, then it too uses a datafile. So, simply modify that condition test to | remove the path using data files.

I started doing that, but then I realized that I don't understand why
the first case has 4 columns and the second only three.

4 is better than 3!...  I don't know, got me:

Subtopic of set palette: file
 `set palette file` is basically a `set palette defined (<gradient>)` where
 <gradient> is read from a datafile.  Either 4 columns (gray,R,G,B) or
 just three columns (R,G,B) have to be selected via the `using` data file
 modifier.  In the three column case, the line number will be used as gray.
 The gray range is automatically rescaled to [0,1].  The file is read as a
 normal data file, so all datafile modifiers can be used.
 Please note, that `R` might actually be e.g. `H` if HSV color space is
 selected.

It seems to me that the use of the 4 columns is ultimately the same once gnuplot takes 1,2,3,4,5,... and maps it to [0,1].

Anyway, here's a patch to illustrate using binary data. Give it a try and see if you like it. (If you want to stay ASCII, remove the "binary" portion of the option and use fprintf instead.) It shouldn't be too difficult to make the changes for sending the line/surface/image data as binary as well.

Dan
--- /usr/local/src/octave-cvs/octave/scripts/plot/__go_draw_axes__.m    
2007-03-26 12:32:09.000000000 -0500
+++ ./__go_draw_axes__.m        2007-03-26 16:15:55.888293020 -0500
@@ -311,24 +311,8 @@
                fprintf (plot_stream,
                         "set palette positive color model RGB maxcolors %i;\n",
                         palette_size);
-               if (palette_size <= 128)
-                 ## Break up command to avoid buffer overflow.
-                 fprintf (plot_stream, "set palette file \"-\" using 
1:2:3:4;\n");
-                 for i = 1:palette_size
-                   fprintf (plot_stream, "%g %g %g %g;\n",
-                            1e-3*round (1e3*[(i-1)/(palette_size-1), 
img_colormap(i,:)]));
-                 endfor
-                 fprintf (plot_stream, "e;\n");
-               else
-                 ## Let the file be deleted when Octave exits or
-                 ## `purge_tmp_files' is called.
-                 [cmap_fid, cmap_fname, msg] = mkstemp (fullfile (P_tmpdir, 
"gpimageXXXXXX"), 1);
-                 fwrite (cmap_fid, img_colormap', "float32", 0, "ieee-le");
-                 fclose (cmap_fid);
-                 fprintf (plot_stream,
-                          "set palette file \"%s\" binary record=%d using 
1:2:3;\n",
-                          cmap_fname, palette_size);
-               endif
+               fprintf (plot_stream, "set palette file \"-\" binary record=%d 
using 1:2:3:4;\n", palette_size);
+               fwrite (plot_stream, [[1:palette_size]' img_colormap]', 
"float32", 0, "ieee-le");
              endif
            endif
            fclose (img_fid);

reply via email to

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