Path: news.mathworks.com!not-for-mail
From: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Any way to speed up drawing of tiny patch object?
Date: Thu, 12 Jun 2008 21:55:03 +0000 (UTC)
Organization: Cincinnati Children's Hospital Research Center
Lines: 68
Message-ID: <g2s5vn$5l3$1@fred.mathworks.com>
References: <c99b0c35-4eca-4087-981d-ac5489bd7849@p25g2000hsf.googlegroups.com>
Reply-To: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1213307703 5795 172.30.248.38 (12 Jun 2008 21:55:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Jun 2008 21:55:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1165924
Xref: news.mathworks.com comp.soft-sys.matlab:473565



"Chris P." <chris.peressotti@gmail.com> wrote in message 
<c99b0c35-4eca-4087-981d-
ac5489bd7849@p25g2000hsf.googlegroups.com>...
> 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

The transparency may be what is taking so much 
computational effort. Try with solid-colored patches... you 
will probably see a significant speed-up. The transparent 
patches may look nicer, but I've noticed that adding 
transparent objects or modifiying the transparency of an 
object can sometimes be slow.

Ken