ENVI data and R
My machine currently has 4 GB on it, but a lot of that's getting eaten by video memory and the other programs I have in memory. Also, some of my image cubes are 12 GB in size, so I'd need to find a workaround anyways. However, since what my colleagues and I are interested in are pixel-by-pixel spectral analyses, I assume the best approach would be to pass the spectra either from ENVI/IDL (for which there is no frontend, but I have logged a request with ITT Visual Solutions to develop one) or conversely from ArcGIS (which can read ENVI data with the ENVI Reader) into R for analysis. Are you aware of ways to send arrays back and forth between R and ArcGIS? Guy
On Tue, Jul 29, 2008 at 4:24 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
On Tue, 29 Jul 2008, Guy Serbin wrote:
Thank you all for the help- I successfully read an image into R using these methods. I did, however, encounter some problems when loading a hyperspectral image cube into R as it was unable to allocate the 2.9 GB of volatile memory that it needed.
Buy more memory, 64-bit Linux works fine. Seriously, R is for statistics, so its memory management is designed for samples, even though very large samples can be handled when used appropriately. If your data are in a GeoTiff, you can read them by band using functions in the rgdal package, or equally well many bands in a window or tile of a larger scene. Note that ArcGIS uses GDAL too for handling some raster formats. Using R does mean thinking through your work flow. Roger
Is there a way to improve memory management by R, so that it only reads in the data when actually needed for processing, e.g., only read in the bands I need, or conversely read in spectra on a per-pixel basis? Guy On Tue, Jul 29, 2008 at 4:05 PM, PUJAN RAJ REGMI <regmi_pujan at hotmail.com> wrote:
This might help to mange the orientation of image:
# To read ENVI format
cir.image<-("YOUR_ENVI_FILE")
CIR.envi<-read.ENVI(cir.image,headerfile=paste(cir.image,".hdr",sep=""))
# To Show image
CIR.envi.band1<-CIR.envi[,,1]
CIR.envi.band1.s<-CIR.envi.band1[order(nrow(CIR.envi.band1):1),]
CIR.envi.band1.t<-t(CIR.envi.band1.s)
image(CIR.envi.band1.t,main="")
mtext("Raw Matrix ENVI Image for Band1", side=3,line=2, font=3,cex=1.25)
Pujan
________________________________
From: andrew.niccolai at yale.edu
To: guy.serbin at gmail.com; R-sig-Geo at stat.math.ethz.ch
Date: Tue, 29 Jul 2008 14:24:04 -0400
Subject: Re: [R-sig-Geo] ENVI data and R
This code might help:
############################################################################
####
############################################################################
####
## Read in envi file
cir.image <- "C:/YOUR_ENVI_FILE"
CIR.envi = read.ENVI(cir.image, headerfile=paste(cir.image,".hdr",
sep=""))
############################################################################
####
############################################################################
####
## Show image
CIR.envi.band1 <- CIR.envi[,,1]
image(CIR.envi.band1, main="")
mtext("Raw Matrix ENVI Image for Band 1", side=3,line = 2, font=3,
cex=1.25)
############################################################################
####
############################################################################
####
Andrew Niccolai
Doctoral Candidate
Yale School of Forestry
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Guy Serbin
Sent: Tuesday, July 29, 2008 12:55 PM
To: R-sig-Geo at stat.math.ethz.ch
Subject: [R-sig-Geo] ENVI data and R
Hi,
I was wondering if anyone knows how to either call up R functions from
within IDL, or conversely read ENVI image data into R. If you have
any advice I'd greatly appreciate it.
Thanks,
Guy Serbin
--
Guy Serbin, Ph.D.
Research Soil Scientist
Hydrology and Remote Sensing Lab
Bldg 007 Rm 104 BARC-West
10300 Baltimore Blvd
Beltsville, MD 20705-2350 USA
+1(301)504-5250 guy.serbin at gmail.com
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
________________________________
Stay in touch when you're away with Windows Live Messenger. IM anytime
you're online.
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
Guy Serbin, Ph.D. Research Soil Scientist Hydrology and Remote Sensing Lab Bldg 007 Rm 104 BARC-West 10300 Baltimore Blvd Beltsville, MD 20705-2350 USA +1(301)504-5250 guy.serbin at gmail.com