public void ReadTooManyPixels() { ErdasImageFile image = null; try { image = new ErdasImageFile(inputLanImagePath, RWFlag.Read); FredLanPixel pixel = new FredLanPixel(); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.ReadPixel(pixel); } // one too many image.ReadPixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }
public void ReadFromWritable1() { ErdasImageFile image = null; try { image = new ErdasImageFile(Data.MakeOutputPath("junk.gis"), new Dimensions(10, 10), 1, System.TypeCode.Byte, null); Erdas74Pixel8 pixel = new Erdas74Pixel8(); // read after opening for Write image.ReadPixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }
public void WritePixels() { Erdas74Pixel8 pixel = new Erdas74Pixel8(); ErdasImageFile image = new ErdasImageFile(outputGisImagePath, new Dimensions(10, 10), 1, System.TypeCode.Byte, null); byte[] bytes = new byte[1]; bytes[0] = 1; pixel[0].SetBytes(bytes, 0); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.WritePixel(pixel); } image.Close(); }
public void OpenExistingWritable() { ErdasImageFile image = new ErdasImageFile(outputGisImagePath, RWFlag.Write); image.Close(); }
public void OpenExistingReadOnly() { ErdasImageFile image = new ErdasImageFile(inputGisImagePath, RWFlag.Read); image.Close(); }
public void ReadPixels() { ErdasImageFile image = new ErdasImageFile(inputLanImagePath, RWFlag.Read); FredLanPixel pixel = new FredLanPixel(); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.ReadPixel(pixel); } image.Close(); }
public void ConstructNewGis() { ErdasImageFile image = new ErdasImageFile(outputGisImagePath, new Dimensions(60, 40), 1, System.TypeCode.Byte, null); Assert.AreEqual(60, image.Dimensions.Rows); Assert.AreEqual(40, image.Dimensions.Columns); Assert.AreEqual(1, image.BandCount); Assert.AreEqual(System.TypeCode.Byte, image.BandType); Assert.AreEqual(null, image.Metadata); image.Close(); // needed or file stays locked after run of tests. why? }
public void ConstructNewLan() { ErdasImageFile image = new ErdasImageFile(outputLanImagePath, new Dimensions(100, 50), 2, System.TypeCode.UInt16, null); Assert.AreEqual(100, image.Dimensions.Rows); Assert.AreEqual(50, image.Dimensions.Columns); Assert.AreEqual(2, image.BandCount); Assert.AreEqual(System.TypeCode.UInt16, image.BandType); Assert.AreEqual(null, image.Metadata); image.Close(); // needed or file stays locked after run of tests. why? }
public void Init() { gisImagePath = Data.MakeOutputPath("OutputRasterTests.gis"); ErdasImageFile image; image = new ErdasImageFile(gisImagePath, new Dimensions(60, 40), 1, System.TypeCode.Byte, null); image.Close(); lanImagePath = Data.MakeOutputPath("OutputRasterTests.lan"); image = new ErdasImageFile(lanImagePath, new Dimensions(100, 50), 2, System.TypeCode.UInt16, null); image.Close(); }
private void TryCtor <T>(string imagePath, RWFlag rwFlag) where T : IPixel, new() { ErdasImageFile image = null; try { image = new ErdasImageFile(imagePath, rwFlag); OutputRaster <T> raster = new OutputRaster <T>(image); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }
public void WriteTooManyPixels() { ErdasImageFile image = null; try { Erdas74Pixel8 pixel = new Erdas74Pixel8(); image = new ErdasImageFile(outputGisImagePath, new Dimensions(10, 10), 1, System.TypeCode.Byte, null); byte[] bytes = new byte[1]; bytes[0] = 1; pixel[0].SetBytes(bytes, 0); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.WritePixel(pixel); } // one too many image.WritePixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }
public void WriteToReadable() { ErdasImageFile image = null; try { image = new ErdasImageFile(Data.MakeOutputPath("junk.gis"), RWFlag.Read); Erdas74Pixel8 pixel = new Erdas74Pixel8(); // write after opening for Read image.WritePixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }