From: levellee ? on
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!
From: ImageAnalyst on
Why don't you post a few of them?
I'd probably get the data into an image and then sum it horizontally
and vertically to find where the actual image is and where the gray
surrounding background is. Then use those rows and columns to do your
cropping. Again, posting example images (fig files) would help.
-ImageAnalyst
From: us on
"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
From: levellee lee on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <106b0124-3fff-497b-94cf-b771f3beb601(a)m4g2000vbl.googlegroups.com>...
> Why don't you post a few of them?
> I'd probably get the data into an image and then sum it horizontally
> and vertically to find where the actual image is and where the gray
> surrounding background is. Then use those rows and columns to do your
> cropping. Again, posting example images (fig files) would help.
> -ImageAnalyst


Yes I just send a fig pic to your email , thank you for helping me to have a look at it
From: levellee lee on
"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!