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

Home » Public Forums » archive » IDL ROI Objects
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: IDL ROI Objects [message #90110 is a reply to message #90107] Wed, 28 January 2015 06:12 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David B writes:

> Thanks for taking a look anyhow! I seem to have a talent for breaking IDL functions lately.

A useful talent. :-)

Here is a piece of code that I think dramatically shows the problem:

;*********************************************************** *******
PRO ROI_BUG
poly = [[5, 10, 10, 5, 5], [5, 5, 10, 10, 5]]
cgDisplay, 600, 600, WID=0, Title = 'Polygon Fill'
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0, $
YTickLen=1.0, XTickLen=1.0
cgPolygon, poly[*,0], poly[*,1], COLOR='dodger blue', /Fill

cgDisplay, 600, 600, WID=1, Title='Polygon Pixel Fill - PolyFillV'
testImage = BytArr(20,20)+1B
pixels = PolyfillV(poly[*,0], poly[*,1], 20, 20)
testImage[pixels]=255
TVLCT, cgColor('red6', /Triple), 255
TVLCT, cgColor('white', /Triple), 1
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0
cgImage, testImage, XRange=[0,20], YRange=[0,20], /Overplot
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0, $
YTickLen=1.0, XTickLen=1.0, /NoErase

cgDisplay, 600, 600, WID=2, Title='Polygon Interior Pixel Fill -
IDLanROI'
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p -> ComputeMask(DIMENSIONS=[20,20], MASK_RULE=1)
pixels = Where(mask EQ 255)
anImage = BytArr(20,20)+1B
anImage[pixels] = 255
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0
cgImage, anImage, XRange=[0,20], YRange=[0,20], /Overplot
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0, $
YTickLen=1.0, XTickLen=1.0, /NoErase

cgDisplay, 600, 600, WID=3, Title='Polygon All Pixel Fill - IDLanROI'
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p -> ComputeMask(DIMENSIONS=[20,20], MASK_RULE=2)
pixels = Where(mask EQ 255)
anImage = BytArr(20,20)+1B
anImage[pixels] = 255
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0
cgImage, anImage, XRange=[0,20], YRange=[0,20], /Overplot
cgPlot, [1], XRange=[0,20], YRange=[0,20], /NoData, ASPECT=1.0, $
YTickLen=1.0, XTickLen=1.0, /NoErase
END
;*********************************************************** *******

With IDLanROI, if you try to take interior pixels, the box is one pixel
too short. If you try to take *all* the pixels, the box is one pixel too
long. It seems impossible to get the box "just right", given a
particular polygon description.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Krig2d from point to image
Next Topic: Re: Why did IDL just start crashing

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

Current Time: Fri Oct 10 06:41:18 PDT 2025

Total time taken to generate the page: 0.95590 seconds