Path: news.mathworks.com!not-for-mail
From: "barba pere" <barbapere@net.hr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Images in GUI
Date: Thu, 10 Jul 2008 10:20:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 56
Message-ID: <g54non$aqg$1@fred.mathworks.com>
References: <fmhg3f$e5q$1@fred.mathworks.com> <fmi9bh$s3j$1@fred.mathworks.com> <fmieie$fbq$1@fred.mathworks.com> <fmim81$d4r$1@fred.mathworks.com> <fmip05$hfh$1@fred.mathworks.com>
Reply-To: "barba pere" <barbapere@net.hr>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1215685207 11088 172.30.248.37 (10 Jul 2008 10:20:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 10 Jul 2008 10:20:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1437629
Xref: news.mathworks.com comp.soft-sys.matlab:478566


Ok, I'm new one here. Hello everyone

So, I have much similar problem as you do

I am using GUI from matlab 2008a. In my program I have much
axes, and a specific one. On that specific axes I need to
draw a horizontal line on the place where user clicks (I'm
using imshow function). The size of the image that I need to
draw is modified so that it can fit in the axes perfectly
(axes and image are the same size).

Besides that (besides drawing a horizontal line on the place
where user clicks), I need to update handles structure with
info about mouse pozition. So I figured the best way to do
this is if I use ButtonDownFcn from the axes.


I already turned image's HitTest to off. and that works.

Then I heard that axes replaces all properties when you draw
new image. So I set NextPlot to add.

And ButtonDownFcn worked. Now when I click on the picture,
axesTrenutniFrame_ButtonDownFcn is called. But one new
problem occured.

Now, Image that I'm drawing won't fit to the axes perfectly.
My axes is (15x800), and the imagethat I need to draw is
(15x800x3), but now image is rescaled. 

Here is part of my code. It is from GUI opening function. It
is a picture with 9 horizontal lines and one red line at
101.-103. pixel 


slika = ones (15, 800, 3) * 255;
a = floor(linspace(1, 800, 9));

slika (:, a, :) = 0;
slika (:, 101:103, 2:3) = 0;

slika = uint8(slika);

axes(handles.axesTrenutniFrame);
g = imshow(slika);
set(g,'HitTest','off');

I also tried to set NextPlot to other values. Everithing but
'Replace' rescales my image. Can you help me so that  I can
get image that perfectly fits to the axes, and that I get
axesTrenutniFrame_ButtonDownFcn called when I click on the image

Thanx.