Identifying tags within a region [message #94110] |
Fri, 20 January 2017 07:29  |
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 #94115 is a reply to message #94112] |
Fri, 20 January 2017 08:23   |
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   |
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   |
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  |
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
|
|
|