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 #90131 is a reply to message #90130] Thu, 29 January 2015 02:50 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 29.01.2015 11:05, David B wrote:
> IDl>Are you looking at the floor or the sky?

For the record, a better "tutorial" here:

PRO ROIPolygonAlternativeView

poly = [[0.8, 1.7, 2.7, 2.7, 0.8], [0.2, 2.2, 2.2, 0.2, 0.2]]

nn = 4
centersX = transpose(fltarr(nn)+1) ## (INDGEN(nn)+ 0.5)
centersY = transpose(INDGEN(nn)+ 0.5) ## (fltarr(nn)+1)

TVLCT, cgColor('red6', /Triple), 255
TVLCT, cgColor('white', /Triple), 1

cgDisplay, 700, 800
pos = cgLayout([2,2], OXMARGIN=[2, 2], OYMARGIN=[3, 4], XGAP=2, YGAP=6)


; Rule 0
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p->ComputeMask(DIMENSIONS=[nn, nn], MASK_RULE=0)
anImage = BytArr(nn,nn)+1B
anImage[Where(mask EQ 255)] = 255
po = pos[*,0]
cgImage, anImage, /AXES, /SAVE, POS=po, TITLE='RULE 0', /NOERASE
cgPlotS, centersX, centersY, PSYM=16, /DATA
cgPlotS, poly[*, 0]+ 0.5, poly[*, 1]+ 0.5, COLOR='green', /DATA, THICK=3
cgPlot, [1], XRange=[0,4], YRange=[0,4], /NoData, $
YTickLen=1.0, XTickLen=1.0, POS=po, /NOERASE

; Rule 1
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p->ComputeMask(DIMENSIONS=[nn, nn], MASK_RULE=1)
anImage = BytArr(nn,nn)+1B
anImage[Where(mask EQ 255)] = 255
po = pos[*,1]
cgImage, anImage, /AXES, /SAVE, POS=po, TITLE='RULE 1', /NOERASE
cgPlotS, centersX, centersY, PSYM=16, /DATA
cgPlotS, poly[*, 0]+ 0.5, poly[*, 1]+ 0.5, COLOR='green', /DATA, THICK=3
cgPlot, [1], XRange=[0,4], YRange=[0,4], /NoData, $
YTickLen=1.0, XTickLen=1.0, POS=po, /NOERASE

; Rule 2
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p->ComputeMask(DIMENSIONS=[nn, nn], MASK_RULE=2)
anImage = BytArr(nn,nn)+1B
anImage[Where(mask EQ 255)] = 255
po = pos[*,2]
cgImage, anImage, /AXES, /SAVE, POS=po, TITLE='RULE 2', /NOERASE
cgPlotS, centersX, centersY, PSYM=16, /DATA
cgPlotS, poly[*, 0]+ 0.5, poly[*, 1]+ 0.5, COLOR='green', /DATA, THICK=3
cgPlot, [1], XRange=[0,4], YRange=[0,4], /NoData, $
YTickLen=1.0, XTickLen=1.0, POS=po, /NOERASE

; Contains points
p = OBJ_NEW('IDLanROI', poly[*,0], poly[*,1])
mask = p->ContainsPoints(centersX[*]-0.5, centersY[*]-0.5)
anImage = BytArr(nn,nn)+1B
p = where(mask eq 1)
po = pos[*,3]
cgImage, anImage, /AXES, /SAVE, POS=po, TITLE='CONTAINS POINTS', /NOERASE
cgPlotS, centersX, centersY, PSYM=16, /DATA
cgPlotS, centersX[p], centersY[p], PSYM=16, /DATA, COLOR='red'
cgPlotS, poly[*, 0]+ 0.5, poly[*, 1]+ 0.5, COLOR='green', /DATA, THICK=3

end
[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 17:30:06 PDT 2025

Total time taken to generate the page: 1.60012 seconds