Images and Image Data
PEChumbley at aol.com
PEChumbley at aol.com
Thu Jul 4 23:41:00 EDT 2002
Would this run faster?
on mouseUp
put fld "data" into tOrigData
set the itemdelimiter to TAB
create image
put it into tID
set the width of tID to tWidth
set the height of tID to tHeight
put empty into iData
repeat for each line l in tOrigData
repeat for each item i in l
if i > 0 then put binaryEncode("CCCC",0,0,255,0) after iData ---make
green
else put binaryEncode("CCCC",0,0,0,255) after iData --- make blue
end repeat
end repeat
set the imageData of tID to iData
end mouseUp
Philip Chumbley
> Hello,
>
>
> I have modified my script to produce the appropriate image and it works
> perfectly apart from one thing...
>
>
> The script looks like this. Basically it loops across some tab delimited
> data (which is elevation data, that is a height measurement). If that point
> is above 0, ie above sealevel it makes it green (ie solid land). If it is 0
> or below zero it makes it blue (ie under water)
>
> on mouseUp
> ## get the data
> put fld "data" into tOrigData
> set the itemdelimiter to TAB
>
> put 571 into twidth -- data is 571 across
> put 429 into tHeight -- data is 429 lines in height
>
> ## create the image
> create image
> put it into tID
>
> set the width of tID to tWidth
> set the height of tID to tHeight
>
> put empty into iData
> repeat with j = 1 to tHeight
> repeat with i = 1 to tWidth
> put item i of line j of tOrigData into tDataValue
> if tDataValue > 0 then -- above sea level
> put binaryEncode("CCCC",0,0,255,0) after iData ---make green
> else -- point is below sea level
> put binaryEncode("CCCC",0,0,0,255) after iData --- make blue
> end if
> end repeat
> end repeat
> set the imageData of tID to iData
> end mouseUp
>
>
> The only problem is the speed of execution. It is painfully slow. A bit of
> checking reveals that it is the line:
>
> put item i of line j of tOrigData into tDataValue
>
>
> that is causing the bottleneck. There must be a better way to do this? In
> the past I have never really bothered optimising these sort of repeat loops
> as it has always been fast enough for me. With 571 x 429 data points though
> it is just too slow. Does any one have any suggestions?
>
>
> Thanks
>
>
> Michael Crawford
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.runrev.com/pipermail/metacard/attachments/20020704/e4388619/attachment.htm
More information about the metacard
mailing list