<p>I am masking an image based on 50 some vector shapefiles using the following code:</p>
<p>pro CIR_vector<br />
<br />
e=ENVI()<br />
cd, current = first_dir<br />
<br />
;location where NAIP image is located<br />
cd, 'F:\Sheyenne\NDVI_comparison\mosaic'<br />
files = FILE_SEARCH('*.dat', count=count)<br />
cd, first_dir<br />
<br />
;output location to save roi subsets to<br />
thisdir = 'F:\Sheyenne\NDVI_comparison\Subset'<br />
<br />
;initiate loop on VI files<br />
foreach file, files do begin<br />
<br />
;input raster<br />
infile = file<br />
infile_path = FILEPATH(infile,ROOT_DIR='F:\Sheyenne\NDVI_comparison\mosaic')<br />
<br />
;save the date located within filename for later use<br />
date = strmid(infile_path,15,7, /REVERSE_OFFSET)</p>
<p >
; Load the input raster<br />
input_raster = e.OpenRaster(infile_path)</p>
<p >
;set new pathway where roi files are located<br />
cd, 'F:\Sheyenne\NDVI_comparison\polygons'<br />
files2 = FILE_SEARCH('*.shp', count=count)</p>
<p >
foreach file, files2 do begin<br />
<br />
;input roi<br />
infile2=file<br />
infile_path2=FILEPATH(infile2, ROOT_DIR='F:\Sheyenne\NDVI_comparison\polygons')</p>
<p >
;set name and location for output file which is the subseted data<br />
;get the name of the roi without extension for later use<br />
allotment=strmid(infile2, 0, strpos(infile2,'.'))</p>
<p> outfile = 'NDVI_CIR_' + allotment + '.dat'</p>
<p>
outfile_path = thisdir + path_sep() + outfile<br />
;load input roi<br />
rois=e.OpenVector(infile_path2)<br />
rasterWithMask=ENVIVectorMaskRaster(input_raster,rois)<br />
<br />
; ;save the file<br />
rasterWithMask.Export,outfile_path, 'ENVI'<br />
endforeach<br />
endforeach<br />
print, "Done"<br />
end</p>
<p><br />
</p>
<p>the code executes but the output is not actually masked. Each output is just an identical copy of the input_raster. The input raster is a 2009 CIR NAIP 1 meter resolution image. I have used the same code on Landsat images and they are masked just fine, so I am not sure why the NAIP image is acting any differently. </p>
<p><br />
</p>
|