Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!p25g2000hsf.googlegroups.com!not-for-mail
From: "Chris P." <chris.peressotti@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Any way to speed up drawing of tiny patch object?
Date: Thu, 12 Jun 2008 14:27:18 -0700 (PDT)
Organization: http://groups.google.com
Lines: 39
Message-ID: <c99b0c35-4eca-4087-981d-ac5489bd7849@p25g2000hsf.googlegroups.com>
NNTP-Posting-Host: 142.76.1.62
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1213306038 19341 127.0.0.1 (12 Jun 2008 21:27:18 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 12 Jun 2008 21:27:18 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p25g2000hsf.googlegroups.com; posting-host=142.76.1.62; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.14) 
Xref: news.mathworks.com comp.soft-sys.matlab:473563



Hey.

I'm creating a program in MATLAB where a grid is drawn on a
histological image and a pathologist will click within certain grid
cells based on the features appearing within the cell.

I have the entire thing finished but am looking for an optimization.
I decided to draw a translucent patch object (in this case, a square)
on top of any cell which is clicked.  The time taken to draw square
between "clicking on a cell" and "being ready to click on another
cell" is more than one second -- and I'd like it to be faster (i.e.
appearing to be "instantaneous") since a pathologist's time is
precious, as it is (note that our dataset includes hundreds of images
which will be split into 48 cells, each).  Here's the snippet of the
code used to generate the patch:

% Earlier in the program...
p_facecolour = [0 1 0]; p_facealpha = 0.2;

% p_x1, p_y1, p_x2, p_y2 are calculated based on [x,y] returned from
ginput(1).
x = [p_x1 p_x1 p_x2 p_x2];
y = [p_y1 p_y2 p_y2 p_y1];
h_patch_array(row_select, col_select) = ...
   patch(x, y, p_facecolour, ...
   'FaceAlpha', p_facealpha);

(NB: I save the handle into an array so that I can turn the
Visiblility of the square on and off, if required.)
Is it just the case that it takes > 1 second to draw a patch,
regardless of size?  I tried some of the tips at http://preview.tinyurl.com/43pj3u
but they didn't seem to make a difference.  I don't know if this
request seems ridiculous, but I wanted to be sure that I'm not missing
anything obvious.

Thanks for any help you can give, either to speed this up or with a
suggestion about another way to go about this.

- Chris