From: ImageAnalyst on
On May 15, 6:14 pm, "levellee lee" <level...(a)gmail.com> wrote:
> Yes I just send a fig pic to your email , thank you for helping me to have a look at it
------------------------------------------------------------------------------
That email doesn't take attachments or permit replies - it's a spam
thing. So like I said, why don't you post a few of them? ("Few" means
more than one, by the way, because I'm assuming that they won't all be
cropped at the same locations otherwise it would be exceedingly
trivial) For example, you can post to http://drop.io (no account
creation necessary), or some other site that you may have an account
with already.

From: levellee lee on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <61838d35-ac49-4cdd-bfe7-76114d217d5f(a)m4g2000vbl.googlegroups.com>...
> On May 15, 6:14 pm, "levellee lee" <level...(a)gmail.com> wrote:
> > Yes I just send a fig pic to your email , thank you for helping me to have a look at it
> ------------------------------------------------------------------------------
> That email doesn't take attachments or permit replies - it's a spam
> thing. So like I said, why don't you post a few of them? ("Few" means
> more than one, by the way, because I'm assuming that they won't all be
> cropped at the same locations otherwise it would be exceedingly
> trivial) For example, you can post to http://drop.io (no account
> creation necessary), or some other site that you may have an account
> with already.


yes sir, thank you, I drop several files in it (http://drop.io/nkcrxtk), and I just want crop them all at the [46 46 10 10] location of 100 pixels for caculation (sum up) thank you very much!
From: us on
"levellee lee" <levellee(a)gmail.com> wrote in message <hsn7a1$605$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <hsn5u8$qk3$1(a)fred.mathworks.com>...
> > "levellee ?" <levellee(a)gmail.com> wrote in message <hsn4ql$3fk$1(a)fred.mathworks.com>...
> > > get some pics as .fig files
> > >
> > > I want to use imcrop do such thing like
> > >
> > > c2 = imcrop(filename.fig,[46 46 10 10]);
> > >
> > >
> > >
> > > but the file is the .fig file
> > >
> > > I mean how could I just get the matrix infomation automatically from the .fig files in the ROI(like the center 100 pixels)
> > >
> > > because the only file I have is the filename.fig file.
> > >
> > > I dont konw the code to realize it effectively.
> > >
> > >
> > > I konw if the other fomart such as tif or png, I can use imread and creat a matrix then use imcrop to get the submatrix of ROI use the code above.
> > >
> > > how about fig, how to treat it because there are so many .fig files, now I cant just open it and use
> > >
> > > c1 = imcrop
> > >
> > > then use mouse crop the ROI and then do the caculate work...
> > >
> > >
> > > thank you for help me!
> >
> > one of the solutions
> > - you have to re-create the fig, then extract the data part you need, eg,
> >
> > fnam='foo.fig';
> > fh=figure;
> > imagesc(magic(16));
> > saveas(fh,fnam);
> > delete(fh);
> > fh=open(fnam);
> > fc=findall(fh,'type','image'); % <- depends on what data you're looking for...
> > d=get(fc,'cdata'); % <- ...
> > delete(fh);
> > % check
> > isequalwithequalnans(d,magic(16))
> > % ans = 1
> >
> > us
>
>
> dear us
>
> I sent an email, and could you treat it as an example, thank you very much!

sorry but NO... i simply don't have the time...
have you ever bothered to look at the solution above(?)...

us
From: ImageAnalyst on
I did. It seems to work although the image extracted from the figure
is black and white (grayscale actually) and the colormap seems to be
null unlike what you see when you open the fig file (which shows a
pseudocolored image). But it does retrieve the image values
correctly. Maybe I'm just not used to working with colormaps - I
rarely apply them, and never save and retrieve them from a file.

fullFileName = 'C:\Documents and Settings\user\My Documents\Temporary
stuff\m11.fig';

inputFigHandle = open(fullFileName);

childImages = findall(inputFigHandle, 'type', 'image'); % <-
depends on what data you're looking for...

storedColormap = findall(inputFigHandle, 'type', 'Colormap'); % <-
depends on what data you're looking for...

imageOnly = get(childImages, 'cdata');
%imshow(imageOnly, 'Colormap', storedColormap); % fail
imshow(imageOnly, []);

set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
title('Image Extracted from the Figure', 'FontSize', 30);
From: us on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <be7634ac-6051-4b4f-b865-4cab3badab9f(a)i31g2000vbt.googlegroups.com>...
> I did. It seems to work although the image extracted from the figure
> is black and white (grayscale actually) and the colormap seems to be
> null unlike what you see when you open the fig file (which shows a
> pseudocolored image). But it does retrieve the image values
> correctly. Maybe I'm just not used to working with colormaps - I
> rarely apply them, and never save and retrieve them from a file.
>
> fullFileName = 'C:\Documents and Settings\user\My Documents\Temporary
> stuff\m11.fig';
>
> inputFigHandle = open(fullFileName);
>
> childImages = findall(inputFigHandle, 'type', 'image'); % <-
> depends on what data you're looking for...
>
> storedColormap = findall(inputFigHandle, 'type', 'Colormap'); % <-
> depends on what data you're looking for...
>
> imageOnly = get(childImages, 'cdata');
> %imshow(imageOnly, 'Colormap', storedColormap); % fail
> imshow(imageOnly, []);
>
> set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
> title('Image Extracted from the Figure', 'FontSize', 30);

ia
i'd do it this way after downloading the FIG-file...

fnam='m11.fig';
fh=open(fnam);
fc=findall(fh,'type','image');
fd=get(fc,'cdata');
ft=get(fc,'cdatamapping')
% ft = scaled % <- hence, depending on your color map...
% therefore...
fm=load(fnam,'-mat');
fm=fm.hgS_070000; % <- standard
cm=fm.properties.Colormap;
imagesc(fd);
colormap(cm);
axis image;
colorbar;

best
urs