Q: How to dereference a subset 'quickly'. [message #9605] |
Thu, 24 July 1997 00:00 |
Wendy Gale
Messages: 3 Registered: June 1997
|
Junior Member |
|
|
I'm trying to cut down on processing time so I'd like to avoid using a
FOR loop. I have a set of pixels I grab by DEFROI representing cells
from a tiff image. Either I save each cell's pixels in a separate
pointer of a PTRARR or as a pair of subscripts from one long vector of
pixel subscripts. At a given frame of my movie, I would like to display
any subset of these cells in a different color.
I'm posting two examples that don't use FOR loops that fail.
Could anyone think of a way I might do this efficiently.
Thanks,
Wendy
___________________________________________________________
IDL> set=[12,23,34,45,56,67,78,89,90,110,120]
IDL> start_points=[0,2,6]
IDL> end_points=[1,5,10]
IDL> subsets=[0,1]
IDL> result=set(start_points(subsets):end_points(subsets))
% Expression must be a scalar in this context: <INT Array[2]>.
% Execution halted at: $MAIN$
____________________________________________________________ _____
IDL> m=intarr(6,2)
IDL> m(*,0)=[1,0,1,0,1,0]
IDL> m(*,1)=[1,2,1,2,1,2]
IDL> Subset_1=where(m(*,0) EQ 1)
IDL> Subset_2=where(m(*,1) EQ 2)
IDL> print, Subset_1
0 2 4
IDL> print, Subset_2
1 3 5
IDL> c=ptrarr(6)
IDL> c(0)=ptr_new([12])
IDL> c(1)=ptr_new([23,34])
IDL> c(2)=ptr_new([45,56,67])
IDL> c(3)=ptr_new([78])
IDL> c(4)=ptr_new([89,90])
IDL> c(5)=ptr_new([100,110,120])
IDL> print, *c(2)
45 56 67
IDL> print, *c(Subset_2)
% Expression must be a scalar in this context: <POINTER Array[3]>.
% Execution halted at: $MAIN$
|
|
|