Re: inverting a binary image(array)? [message #78279] |
Mon, 07 November 2011 11:58 |
desertdryad
Messages: 39 Registered: August 2011
|
Member |
|
|
David - 'invert' as in, 0's become 1's, and vice-versa.
On Nov 7, 1:00 am, "M. Katz" <MKatz...@yahoo.com> wrote:
> In my quick tests,
> a = ~temporary(a)
Say, thanks! I tried this, and it works right quick.
|
|
|
|
Re: inverting a binary image(array)? [message #78285 is a reply to message #78284] |
Sun, 06 November 2011 07:24  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Nov 4, 3:54 pm, desertdryad <dry...@gmail.com> wrote:
> What's the most streamlined way to do this?
In the ENVI environment, you might consider writing a simple band math
user function.
Look for the "Band and Spectral" math section of the ENVI Programmer's
Guide in the online help.
You'll then have a function you can reuse in other contexts within
ENVI.
ENVI will tile the data as necessary so if the image is very large you
won't exhaust memory.
For extra points, use the TEMPORARY function and use the same data
type as the input band to prevent upcasting and unnecessary data
copying, (e.g., for byte data: RETURN, 1B - TEMPORARY(b1), for
unsigned short data: RETURN, 1US - TEMPORARY(b1)).
Social media alert: I work for Exelis VIS, but any implied or
expressed opinions are my own.
|
|
|
Re: inverting a binary image(array)? [message #78286 is a reply to message #78285] |
Sat, 05 November 2011 21:29  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On 11/4/11 6:54 PM, desertdryad wrote:
> Hi folks -
>
> I have the need, in an IDL 7.0 / ENVI 4.5 script, to take a rather
> large raster (Landsat tile sized) of 1's and 0's, and invert it, in
> preferably an efficient manner. What's the most streamlined way to do
> this?
>
> thanks,
> Cyndy
>
If by "invert" you mean turn the 1s to 0s and the 0s to 1s, I would
hazard a guess that you're not going to get much more efficient than
data = 1 - data
-Jeremy.
|
|
|
Re: inverting a binary image(array)? [message #78290 is a reply to message #78286] |
Fri, 04 November 2011 16:09  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
desertdryad writes:
> I have the need, in an IDL 7.0 / ENVI 4.5 script, to take a rather
> large raster (Landsat tile sized) of 1's and 0's, and invert it, in
> preferably an efficient manner. What's the most streamlined way to do
> this?
What does "invert" mean in this context?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|