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

Home » Public Forums » archive » Identifying tags within a region
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Identifying tags within a region [message #94110] Fri, 20 January 2017 07:29 Go to next message
ann[1] is currently offline  ann[1]
Messages: 9
Registered: December 2012
Junior Member
Hi all,

Does anyone know how to retrieve the tags in a chosen region?
Using where condition I chose pixels (ref_ppix) that satisfy a certain condition.
This region have multiple number tags starting from 1.
The command I used is:
loc_p = where(id_chk[ref_ppix] gt 0)

Here, ref_ppix comes from one image and I collect loc_p in a different image id_chk, which returns locations that have tag > 0.

I want to know how many tags are there and the method to get those tags.

Any help would be appreciated.

Thanks,
Alice
Re: Identifying tags within a region [message #94112 is a reply to message #94110] Fri, 20 January 2017 08:11 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 01/20/2017 04:29 PM, Alice wrote:
> Does anyone know how to retrieve the tags in a chosen region?
> Using where condition I chose pixels (ref_ppix) that satisfy a certain condition.
> This region have multiple number tags starting from 1.
> The command I used is:
> loc_p = where(id_chk[ref_ppix] gt 0)
>
> Here, ref_ppix comes from one image and I collect loc_p in a different image id_chk, which returns locations that have tag > 0.
>
> I want to know how many tags are there and the method to get those tags.
>
> Any help would be appreciated.

I'm not sure I understand what you want to do, but if I do, LABEL_REGION
might be what you are looking for.

http://www.harrisgeospatial.com/docs/LABEL_REGION.html
Re: Identifying tags within a region [message #94115 is a reply to message #94112] Fri, 20 January 2017 08:23 Go to previous messageGo to next message
ann[1] is currently offline  ann[1]
Messages: 9
Registered: December 2012
Junior Member
On Friday, 20 January 2017 17:11:34 UTC+1, Markus Schmassmann wrote:
> On 01/20/2017 04:29 PM, Alice wrote:
>> Does anyone know how to retrieve the tags in a chosen region?
>> Using where condition I chose pixels (ref_ppix) that satisfy a certain condition.
>> This region have multiple number tags starting from 1.
>> The command I used is:
>> loc_p = where(id_chk[ref_ppix] gt 0)
>>
>> Here, ref_ppix comes from one image and I collect loc_p in a different image id_chk, which returns locations that have tag > 0.
>>
>> I want to know how many tags are there and the method to get those tags.
>>
>> Any help would be appreciated.
>
> I'm not sure I understand what you want to do, but if I do, LABEL_REGION
> might be what you are looking for.
>
> http://www.harrisgeospatial.com/docs/LABEL_REGION.html

Hi Markus,

I have two images that I already labelled with numbers.
Now, I chose a small region from image1 and want to get the tags in image2 that share the same spatial locations.

Alice
Re: Identifying tags within a region [message #94118 is a reply to message #94115] Fri, 20 January 2017 10:36 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
It is not clear to me what you are trying to do. Is this anything like what you need?

;Create two arrays of the same size but different values
img1 = bindgen(5,5)
img2 = bindgen(5,5)+10B

;Select a subset of points
ipos = where(img1 gt 6 and img1 lt 18, count)

;Show the pixels in img1 that I selected:
print, img1
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
print, img1[ipos]
7 8 9 10 11 12 13 14 15 16 17

;Now, to extract the same points in img2, just use the same indices
print, img2
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
print, img2[ipos]
17 18 19 20 21 22 23 24 25 26 27
Re: Identifying tags within a region [message #94130 is a reply to message #94115] Mon, 23 January 2017 02:29 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On Friday, 20.01.2017 17:23 Alice wrote:
> On Friday, 20 January 2017 17:11:34 UTC+1, Markus Schmassmann wrote:
>> On 01/20/2017 04:29 PM, Alice wrote:
>>> Does anyone know how to retrieve the tags in a chosen region?
>>> Using where condition I chose pixels (ref_ppix) that satisfy a certain condition.
>>> This region have multiple number tags starting from 1.
>>> The command I used is:
>>> loc_p = where(id_chk[ref_ppix] gt 0)
>>>
>>> Here, ref_ppix comes from one image and I collect loc_p in a different image id_chk, which returns locations that have tag > 0.
>>>
>>> I want to know how many tags are there and the method to get those tags.
>>>
>>> Any help would be appreciated.
>> I'm not sure I understand what you want to do, but if I do, LABEL_REGION
>> might be what you are looking for.
>>
>> http://www.harrisgeospatial.com/docs/LABEL_REGION.html
> I have two images that I already labelled with numbers.
> Now, I chose a small region from image1 and want to get the tags in image2 that share the same spatial locations.
assuming labels1 & labels2 are arrays with unsigned integers
containing the labels for image1 & image2 respectively,
furthermore assuming these images have the same dimensions, I would try
something like this:

h1=histogram(labels1,min=0,reverse_indices=ri1)
max1=max(labels1)
nlabels=ulong(max1)
p1=ptrarr(max1,/allocate_heap)
for i=0,max1 do begin
thisLabels=labels2[r1[r1[i]:r[i+1]-1]]
u=uniq(thisLabels,sort(thisLabels))
nlabels[i]=n_elements(u)-(u[0] eq 0)
*p1[i]=u[(u[0] eq 0):-1]
endfor

This code is untested, if it does not work and you don't find the bug
yourself, pleas send me some sample data, then I can do some debugging.

Good Luck, Markus
Re: Identifying tags within a region [message #94131 is a reply to message #94115] Mon, 23 January 2017 02:29 Go to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On Friday, 20.01.2017 17:23 Alice wrote:
> On Friday, 20 January 2017 17:11:34 UTC+1, Markus Schmassmann wrote:
>> On 01/20/2017 04:29 PM, Alice wrote:
>>> Does anyone know how to retrieve the tags in a chosen region?
>>> Using where condition I chose pixels (ref_ppix) that satisfy a certain condition.
>>> This region have multiple number tags starting from 1.
>>> The command I used is:
>>> loc_p = where(id_chk[ref_ppix] gt 0)
>>>
>>> Here, ref_ppix comes from one image and I collect loc_p in a different image id_chk, which returns locations that have tag > 0.
>>>
>>> I want to know how many tags are there and the method to get those tags.
>>>
>>> Any help would be appreciated.
>> I'm not sure I understand what you want to do, but if I do, LABEL_REGION
>> might be what you are looking for.
>>
>> http://www.harrisgeospatial.com/docs/LABEL_REGION.html
> I have two images that I already labelled with numbers.
> Now, I chose a small region from image1 and want to get the tags in image2 that share the same spatial locations.
assuming labels1 & labels2 are arrays with unsigned integers
containing the labels for image1 & image2 respectively,
furthermore assuming these images have the same dimensions, I would try
something like this:

h1=histogram(labels1,min=0,reverse_indices=ri1)
max1=max(labels1)
nlabels=ulong(max1)
p1=ptrarr(max1,/allocate_heap)
for i=0,max1 do begin
thisLabels=labels2[r1[r1[i]:r[i+1]-1]]
u=uniq(thisLabels,sort(thisLabels))
nlabels[i]=n_elements(u)-(u[0] eq 0)
*p1[i]=u[(u[0] eq 0):-1]
endfor

This code is untested, if it does not work and you don't find the bug
yourself, pleas send me some sample data, then I can do some debugging.

Good Luck, Markus
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: VELOVECT Procedure
Next Topic: GDL 0.9.7 delivered

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

Current Time: Wed Oct 08 09:13:11 PDT 2025

Total time taken to generate the page: 0.00487 seconds