comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Shape to raster
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Shape to raster [message #78175 is a reply to message #78139] Mon, 31 October 2011 09:07 Go to previous messageGo to previous message
Fabzou is currently offline  Fabzou
Messages: 76
Registered: November 2010
Member
Ok, it seems that [0,0] is the center point of the pixel (quite in
contradiction with polyfill, actually).

The following tests help to understand its behavior:

IDL> xs = [-0.05,-0.05,0.05,0.05,-0.05]
IDL> ys = [-0.05,0.05,0.05,-0.05,-0.05]
IDL> roi = OBJ_NEW('IDLanROI', xs, ys)
IDL> mask = roi->ComputeMask(DIMENSIONS=[3,3])
IDL> print, mask
255 0 0
0 0 0
0 0 0
IDL> OBJ_DESTROY, roi
IDL> xs = [-0.05,-0.05,0.05,0.05,-0.05]
IDL> ys = [-0.05,0.05,0.05,-0.05,-0.05]
IDL> roi = OBJ_NEW('IDLanROI', xs, ys)
IDL> mask = roi->ComputeMask(DIMENSIONS=[3,3], MASK_RULE=1)
IDL> print, mask
0 0 0
0 0 0
0 0 0
IDL> OBJ_DESTROY, roi
IDL> xs = [0.45,0.45,1.55,1.55,0.45]
IDL> ys = [0.45,1.55,1.55,0.45,0.45]
IDL> roi = OBJ_NEW('IDLanROI', xs, ys)
IDL> mask = roi->ComputeMask(DIMENSIONS=[3,3], MASK_RULE=1)
IDL> print, mask
0 0 0
0 255 0
0 0 0
IDL> OBJ_DESTROY, roi
IDL> xs = [0.45,0.45,1.55,1.55,0.45]
IDL> ys = [0.45,1.55,1.55,0.45,0.45]
IDL> roi = OBJ_NEW('IDLanROI', xs, ys)
IDL> mask = roi->ComputeMask(DIMENSIONS=[3,3])
IDL> print, mask
255 255 255
255 255 255
255 255 255
IDL> OBJ_DESTROY, roi

There is no possibility to generate a mask based on how many percent of
the pixel surface is covered by the polygon, but some trick can allow
this (generate a mask on an image 10 times larger and aggregate it
afterwards, for example)


Fab



On 10/31/2011 03:54 PM, David Fanning wrote:
> Fabzou writes:
>
>> I have an other question though. How will the IDLanROI object
>> "understand" the XY coordinates [0.5,0.5]? In my conception, these
>> coordinates correspond to the center of the first down left pixel, but
>> my first tests tend to show that this may not be the case...
>
> Oh, my gosh! I just spent a week worrying about this
> in conjunction with an update of my Active Contouring
> software! I don't use an IDLanROI object there, because
> I want to do this myself and completely understand what
> I am doing. In *my* ROI, the [0.5,0.5] location would
> indeed be the center of the first pixel. I don't know
> off-hand what the IDLanROI object will do. And I have
> no compelling interest in looking into it this morning,
> either. It makes my head hurt. :-)
>
> Cheers,
>
> David
>
> P.S. If you are going to test this, however, I would
> test with the values 0.45 and 0.55, not the value 0.5.
> At some point, you are going to have to do some rounding
> if you want image or device coordinates. The question
> you want to answer is how the rounding is done.
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: unable to set time attribute for netCDF in IDL
Next Topic: Re: wind fields on map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:44:41 PDT 2025

Total time taken to generate the page: 0.31877 seconds