Re: creating elliptically shaped images [message #37182 is a reply to message #37099] |
Wed, 03 December 2003 09:24  |
condor
Messages: 35 Registered: January 2002
|
Member |
|
|
mruschin@hotmail.com (mark) wrote in message news:<a9116224.0311240712.618f4088@posting.google.com>...
> I'd like to form an image which has an elliptical shape and where all
> the pixels within this ellipse have values corresponding to any given
> function that I would specify, the simplest example being a uniform
> image (i.e. a value of 1 for all the pixels in the ellipse). Is there
> any nice way to do this in IDL or MATLAB other than looping through
> all the pixels and determining whether any given one lies within the
> ellipse?
In IDL at least, you can send raw strings to your output device.
Depending on the device, you could use that to send clipping
instructions.
If you were plotting into a PostScript file for example, this might
look vaguely like this:
;; Some random dots to plot:
x=randomu(seed,5000)
y=randomu(seed,5000)
set_plot,'PS'
device,/landscape
;; plot without clipping to show where the dots are:
plot,x,y,psym=3
;; PS clipping path -- here vaguely elliptical, but could be anything:
clipstring='currentpoint 37 rotate 1 .5 scale '+$
'newpath 15000 5000 5000 0 360 arc clip '+$
'1 2 scale -37 rotate newpath moveto'
device,output=clipstring
;; plot again with different psym to illustrate clipping:
oplot,x,y,psym=4
device,/close
set_plot,'X'
|
|
|