Exemplo n.º 1
0
        public bool CreateRaster(string outFileName, int bandCount, enumDataType datatype, IRasterDataProvider referProvider)
        {
            CoordEnvelope env    = referProvider.CoordEnvelope;
            float         resX   = referProvider.ResolutionX;
            float         resY   = referProvider.ResolutionY;
            int           width  = referProvider.Width;
            int           height = referProvider.Height;

            Project.ISpatialReference spatialRef = referProvider.SpatialRef;
            List <string>             options    = new List <string>();

            options.Add("INTERLEAVE=BSQ");
            options.Add("VERSION=LDF");
            options.Add("WITHHDR=TRUE");
            options.Add("SPATIALREF=" + spatialRef.ToProj4String());
            options.Add("MAPINFO={" + 1 + "," + 1 + "}:{" + env.MinX + "," + env.MaxY + "}:{" + resX + "," + resY + "}"); //=env.ToMapInfoString(new Size(width, height));
            options.Add("BANDNAMES= " + "red,nir,fir");
            if (!Directory.Exists(Path.GetDirectoryName(outFileName)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outFileName));
            }
            using (IRasterDataDriver raster = RasterDataDriver.GetDriverByName("LDF") as IRasterDataDriver)
            {
                using (RasterDataProvider outRaster = raster.Create(outFileName, width, height, bandCount, datatype, options.ToArray()) as RasterDataProvider)
                {
                    unsafe
                    {
                        fixed(UInt16 *ptr = output[0])
                        {
                            IntPtr buffer = new IntPtr(ptr);

                            outRaster.GetRasterBand(1).Write(0, 0, width, height, buffer, enumDataType.UInt16, width, height);
                        }

                        fixed(UInt16 *ptr = output[1])
                        {
                            IntPtr buffer = new IntPtr(ptr);

                            outRaster.GetRasterBand(2).Write(0, 0, width, height, buffer, enumDataType.UInt16, width, height);
                        }

                        fixed(UInt16 *ptr = output[2])
                        {
                            IntPtr buffer = new IntPtr(ptr);

                            outRaster.GetRasterBand(3).Write(0, 0, width, height, buffer, enumDataType.UInt16, width, height);
                        }
                    }
                    return(true);
                }
            }
        }
Exemplo n.º 2
0
        public static bool CreateRaster(string outFileName, int bandCount, enumDataType datatype, IRasterDataProvider referProvider)
        {
            CoordEnvelope env    = referProvider.CoordEnvelope;
            float         resX   = referProvider.ResolutionX;
            float         resY   = referProvider.ResolutionY;
            int           width  = referProvider.Width;
            int           height = referProvider.Height;

            Project.ISpatialReference spatialRef = referProvider.SpatialRef;
            List <string>             options    = new List <string>();

            options.Add("INTERLEAVE=BSQ");
            options.Add("VERSION=LDF");
            options.Add("WITHHDR=TRUE");
            options.Add("SPATIALREF=" + spatialRef.ToProj4String());
            options.Add("MAPINFO={" + 1 + "," + 1 + "}:{" + env.MinX + "," + env.MaxY + "}:{" + resX + "," + resY + "}"); //=env.ToMapInfoString(new Size(width, height));
            options.Add("BANDNAMES= " + "LAI");
            //string hdrfile = HdrFile.GetHdrFileName(referProvider.fileName);
            //if (!string.IsNullOrWhiteSpace(hdrfile) && File.Exists(hdrfile))
            //{
            //    HdrFile hdr = HdrFile.LoadFrom(hdrfile);
            //    if (hdr != null && hdr.BandNames != null)
            //        options.Add("BANDNAMES=" + string.Join(",", hdr.BandNames));
            //}
            //CheckAndCreateDir();
            if (!Directory.Exists(Path.GetDirectoryName(outFileName)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outFileName));
            }
            using (IRasterDataDriver raster = RasterDataDriver.GetDriverByName("LDF") as IRasterDataDriver)
            {
                using (RasterDataProvider outRaster = raster.Create(outFileName, width, height, bandCount, datatype, options.ToArray()) as RasterDataProvider)
                {
                    unsafe
                    {
                        fixed(UInt16 *ptr = output[0])
                        {
                            IntPtr buffer = new IntPtr(ptr);

                            outRaster.GetRasterBand(1).Write(0, 0, width, height, buffer, enumDataType.UInt16, width, height);
                        }
                    }
                    return(true);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 单文件计算其NDVI
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="bandNos"></param>
        /// <param name="zoom"></param>
        /// <param name="aoiTemplate"></param>
        /// <param name="progressTracker"></param>
        /// <returns></returns>
        private IExtractResult CalcNDVI(string inputFile, int[] bandNos, float zoom, double[] CloudyZoom, float[] cloudyArgs, Int16 defCloudy, bool isFitterCloud, bool isAppCloud, string aoiTemplate, Action <int, string> progressTracker)
        {
            //查找输入文件对应的云判识结果文件
            RasterProcessModel <ushort, short> rfr = null;
            List <RasterMaper> fileIns             = new List <RasterMaper>();

            RasterMaper[]       fileOuts = null;
            IRasterDataProvider clmPrd   = null;

            try
            {
                //输入数据(LDF)
                IRasterDataProvider inRaster = RasterDataDriver.Open(inputFile) as IRasterDataProvider;
                if (inRaster == null)
                {
                    PrintInfo("读取栅格文件失败:" + inRaster);
                    return(null);
                }
                //输出数据(NDVI)
                string            outFileName = GetFileName(new string[] { inRaster.fileName }, _subProductDef.ProductDef.Identify, _identify, ".dat", null);
                IRasterDataDriver dd          = RasterDataDriver.GetDriverByName("MEM") as IRasterDataDriver;
                string            mapInfo     = inRaster.CoordEnvelope.ToMapInfoString(new Size(inRaster.Width, inRaster.Height));
                string[]          opts        = new string[] {
                    "INTERLEAVE=BSQ",
                    "VERSION=MEM",
                    "WITHHDR=TRUE",
                    "SPATIALREF=" + inRaster.SpatialRef.ToProj4String(),
                    mapInfo
                };

                RasterDataProvider outRaster = dd.Create(outFileName, inRaster.Width, inRaster.Height, 1, enumDataType.Int16, opts) as RasterDataProvider;
                outRaster.GetRasterBand(1).Fill(Int16.MinValue);
                string clmFile = GetClmFile(inputFile);
                int    cloudCH = GetCloudCHNO();
                //栅格数据映射
                fileIns.Add(new RasterMaper(inRaster, bandNos));
                if (isAppCloud)
                {
                    if (!string.IsNullOrEmpty(clmFile) && File.Exists(clmFile))
                    {
                        clmPrd = GeoDataDriver.Open(clmFile) as IRasterDataProvider;
                        if (clmPrd.BandCount < cloudCH)
                        {
                            PrintInfo("请选择正确的云数据通道进行计算.");
                            isAppCloud = false;
                        }
                        else
                        {
                            fileIns.Add(new RasterMaper(clmPrd, new int[] { cloudCH }));
                        }
                    }
                    else
                    {
                        isAppCloud = false;
                    }
                }
                RasterMaper fileOut = new RasterMaper(outRaster, new int[] { 1 });
                //创建处理模型
                fileOuts = new RasterMaper[] { fileOut };
                rfr      = new RasterProcessModel <ushort, short>(progressTracker);
                rfr.SetRaster(fileIns.ToArray(), fileOuts);
                rfr.SetTemplateAOI(aoiTemplate);
                rfr.RegisterCalcModel(new RasterCalcHandler <ushort, short>((rvInVistor, rvOutVistor, aoi) =>
                {
                    if (rvInVistor[0].RasterBandsData != null)
                    {
                        if (rvInVistor == null)
                        {
                            return;
                        }
                        ushort[] inBand0  = rvInVistor[0].RasterBandsData[0];                     //第1个输入文件的第1个波段的各像素值
                        ushort[] inBand1  = rvInVistor[0].RasterBandsData[1];                     //第1个输入文件的第2个波段的各像素值
                        ushort[] inBand2  = rvInVistor[0].RasterBandsData[2];                     //第1个输入文件的第3个波段的各像素值
                        ushort[] inBand3  = rvInVistor[0].RasterBandsData[3];                     //第1个输入文件的第4个波段的各像素值
                        ushort[] inBand12 = isAppCloud ? rvInVistor[1].RasterBandsData[0] : null; //第2个输入文件的第1个波段的各像素值
                        short[] ndvi      = new short[inBand0.Length];
                        if (aoi == null || aoi.Length == 0)
                        {
                            for (int index = 0; index < inBand0.Length; index++)
                            {
                                if ((inBand12 != null && inBand12[index] != 0) || (isFitterCloud && inBand1[index] / CloudyZoom[0] > cloudyArgs[0] && inBand3[index] / CloudyZoom[2] < cloudyArgs[1] && Math.Abs(inBand2[index] / CloudyZoom[1] - inBand3[index] / CloudyZoom[2]) > cloudyArgs[2]))
                                {
                                    rvOutVistor[0].RasterBandsData[0][index] = defCloudy;
                                    continue;
                                }
                                //第1个输出文件的第1个波段存储NDVI值
                                rvOutVistor[0].RasterBandsData[0][index] = (short)((inBand1[index] - inBand0[index]) * zoom / (inBand1[index] + inBand0[index]));
                            }
                        }
                        else if (aoi != null && aoi.Length != 0)
                        {
                            int index;
                            for (int i = 0; i < aoi.Length; i++)
                            {
                                index = aoi[i];
                                if ((inBand12 != null && inBand12[index] != 0) || (isFitterCloud && inBand1[index] / CloudyZoom[0] > cloudyArgs[0] && inBand3[index] / CloudyZoom[2] < cloudyArgs[1] && Math.Abs(inBand2[index] / CloudyZoom[1] - inBand3[index] / CloudyZoom[2]) > cloudyArgs[2]))
                                {
                                    rvOutVistor[0].RasterBandsData[0][index] = defCloudy;
                                    continue;
                                }
                                //第1个输出文件的第1个波段存储NDVI值
                                rvOutVistor[0].RasterBandsData[0][index] = (short)((inBand1[index] - inBand0[index]) * zoom / (inBand1[index] + inBand0[index]));
                            }
                        }
                    }
                }));
                //执行
                rfr.Excute();
                FileExtractResult res = new FileExtractResult(_subProductDef.Identify, outFileName, true);
                res.SetDispaly(false);
                return(res);
            }
            finally
            {
                if (fileIns != null)
                {
                    for (int i = 0; i < fileIns.Count; i++)
                    {
                        fileIns[i].Raster.Dispose();
                    }
                }
                if (fileOuts != null)
                {
                    for (int i = 0; i < fileOuts.Length; i++)
                    {
                        fileOuts[i].Raster.Dispose();
                    }
                }
                if (clmPrd != null)
                {
                    clmPrd.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        private IExtractResult BaseOrbitAlgorithm(Action <int, string> progressTracker)
        {
            int    CSRVisibleCH      = (int)_argumentProvider.GetArg("VisibleCH");
            int    maxNDVICH         = (int)_argumentProvider.GetArg("NDVICH");
            double VisibleZoom       = (double)_argumentProvider.GetArg("Visible_Zoom");
            double ShortInfraredZoom = (double)_argumentProvider.GetArg("ShortInfrared_Zoom");
            double VisibleCHZoom     = (double)_argumentProvider.GetArg("VisibleCH_Zoom");
            double NDVICHZoom        = (double)_argumentProvider.GetArg("NDVICH_Zoom");
            double ndviZoom          = (float)_argumentProvider.GetArg("NDVIZoom");

            if (_argumentProvider.GetArg("HistroySRCFile") == null || _argumentProvider.GetArg("CurrentRasterFile") == null)
            {
                return(null);
            }
            Dictionary <string, string> csrStr = GetFilemap("HistroyCSRFile");
            string CurrentRasterFile           = _argumentProvider.GetArg("CurrentRasterFile").ToString();
            int    visibleCH     = (int)_argumentProvider.GetArg("Visible");
            int    shortInfrared = (int)_argumentProvider.GetArg("ShortInfrared");

            if (CSRVisibleCH == -1 || maxNDVICH == -1 || csrStr == null || csrStr.Count < 2 || !File.Exists(CurrentRasterFile))
            {
                PrintInfo("晴空反射率生产所用文件或通道未设置完全,请检查!");
                return(null);
            }

            if (visibleCH == -1 || shortInfrared == -1)
            {
                using (IRasterDataProvider rasterProvider = RasterDataDriver.Open(CurrentRasterFile) as IRasterDataProvider)
                {
                    if (rasterProvider != null)
                    {
                        IBandNameRaster bandNameRaster = rasterProvider as IBandNameRaster;
                        visibleCH     = TryGetBandNo(bandNameRaster, "Visible");
                        shortInfrared = TryGetBandNo(bandNameRaster, "ShortInfrared");
                    }
                }
                if (visibleCH == -1 || shortInfrared == -1)
                {
                    PrintInfo("晴空反射率生产所用文件或通道未设置完全,请检查!");
                    return(null);
                }
            }

            //是否为自动生成时生成该产品,若是,需要查找"0CSR"与"MAXN"文件
            if (!ResetCsrString(csrStr))
            {
                PrintInfo("晴空反射率生产所用文件不齐备,请检查!");
                return(null);
            }

            //查找输入文件对应的云判识结果文件
            RasterProcessModel <short, UInt16> rfr = null;
            List <RasterMaper> fileIns             = new List <RasterMaper>();

            RasterMaper[]       fileOuts   = null;
            IRasterDataProvider skyPrd     = null;
            IRasterDataProvider maxNdviPrd = null;

            try
            {
                //输入数据(LDF)
                IRasterDataProvider inRaster = _argumentProvider.DataProvider;
                //输出数据(0CSR)
                string            outFileName = GetFileName(new string[] { inRaster.fileName }, _subProductDef.ProductDef.Identify, _identify, ".dat", null);
                IRasterDataDriver dd          = RasterDataDriver.GetDriverByName("MEM") as IRasterDataDriver;
                string            mapInfo     = inRaster.CoordEnvelope.ToMapInfoString(new Size(inRaster.Width, inRaster.Height));
                string[]          opts        = new string[] {
                    "INTERLEAVE=BSQ",
                    "VERSION=MEM",
                    "WITHHDR=TRUE",
                    "SPATIALREF=" + inRaster.SpatialRef.ToProj4String(),
                    mapInfo
                };
                RasterDataProvider outRaster = dd.Create(outFileName, inRaster.Width, inRaster.Height, 1, enumDataType.UInt16, opts) as RasterDataProvider;
                outRaster.GetRasterBand(1).Fill(Int16.MinValue);
                //栅格数据映射
                fileIns.Add(new RasterMaper(inRaster, new int[] { visibleCH, shortInfrared }));
                skyPrd = GeoDataDriver.Open(csrStr["0CSR"]) as IRasterDataProvider;
                if (skyPrd.BandCount < CSRVisibleCH)
                {
                    PrintInfo("请选择正确的云数据通道进行计算.");
                    return(null);
                }
                fileIns.Add(new RasterMaper(skyPrd, new int[] { CSRVisibleCH }));
                maxNdviPrd = GeoDataDriver.Open(csrStr["MAXN"]) as IRasterDataProvider;
                if (maxNdviPrd.BandCount < maxNDVICH)
                {
                    PrintInfo("请选择正确的云数据通道进行计算.");
                    return(null);
                }
                fileIns.Add(new RasterMaper(maxNdviPrd, new int[] { maxNDVICH }));

                RasterMaper fileOut = new RasterMaper(outRaster, new int[] { 1 });
                //创建处理模型
                fileOuts = new RasterMaper[] { fileOut };
                rfr      = new RasterProcessModel <short, UInt16>(progressTracker);
                rfr.SetRaster(fileIns.ToArray(), fileOuts);
                float curNDVI = 0f;
                rfr.RegisterCalcModel(new RasterCalcHandler <short, UInt16>((rvInVistor, rvOutVistor, aoi) =>
                {
                    if (rvInVistor[0].RasterBandsData != null)
                    {
                        if (rvInVistor == null)
                        {
                            return;
                        }
                        short[] inBand0  = rvInVistor[0].RasterBandsData[0]; //第1个输入文件的第1个波段的各像素值
                        short[] inBand1  = rvInVistor[0].RasterBandsData[1]; //第1个输入文件的第2个波段的各像素值
                        short[] inBand21 = rvInVistor[1].RasterBandsData[0]; //第2个输入文件的第1个波段的各像素值
                        short[] inBand31 = rvInVistor[2].RasterBandsData[0]; //第3个输入文件的第1个波段的各像素值
                        for (int index = 0; index < inBand0.Length; index++)
                        {
                            curNDVI = GetNDVI(inBand0[index], inBand1[index]);
                            if (curNDVI * NDVICHZoom > inBand31[index])
                            {
                                rvOutVistor[0].RasterBandsData[0][index] = (UInt16)inBand1[index];
                            }
                            else
                            {
                                rvOutVistor[0].RasterBandsData[0][index] = (UInt16)inBand21[index];
                            }
                        }
                    }
                }));
                //执行
                rfr.Excute();
                FileExtractResult res = new FileExtractResult(_subProductDef.Identify, outFileName, true);
                res.SetDispaly(false);
                return(res);
            }
            finally
            {
                if (fileOuts != null)
                {
                    for (int i = 0; i < fileOuts.Length; i++)
                    {
                        fileOuts[i].Raster.Dispose();
                    }
                }
                if (skyPrd != null)
                {
                    skyPrd.Dispose();
                }
                if (maxNdviPrd != null)
                {
                    maxNdviPrd.Dispose();
                }
            }
            //

            //Dictionary<string, FilePrdMap> filePrdMap = new Dictionary<string, FilePrdMap>();
            //filePrdMap.Add("CurrentRasterFile", new FilePrdMap(CurrentRasterFile, VisibleZoom, new VaildPra(UInt16.MinValue, UInt16.MaxValue), new int[] { visibleCH, shortInfrared }));
            //filePrdMap.Add("csrFile", new FilePrdMap(csrStr["0CSR"], VisibleCHZoom, new VaildPra(UInt16.MinValue, UInt16.MaxValue), new int[] { CSRVisibleCH }));
            //filePrdMap.Add("maxNDVIFile", new FilePrdMap(csrStr["MAXN"], NDVICHZoom, new VaildPra(Int16.MinValue, Int16.MaxValue), new int[] { maxNDVICH }));
            //ITryCreateVirtualPrd tryVPrd = new TryCreateVirtualPrdByMultiFile();
            //IVirtualRasterDataProvider vrd = tryVPrd.CreateVirtualRasterPRD(ref filePrdMap);
            //if (vrd == null)
            //{
            //    PrintInfo("当前数据与历史晴空数据不在同一区域内,请重新设置!");
            //    foreach (FilePrdMap value in filePrdMap.Values)
            //    {
            //        if (value.Prd != null)
            //            value.Prd.Dispose();
            //    }
            //    return null;
            //}
            //try
            //{
            //    float curNDVI = 0f;
            //    ArgumentProvider ap = new ArgumentProvider(vrd, null);
            //    RasterPixelsVisitor<float> rpVisitor = new RasterPixelsVisitor<float>(ap);
            //    IPixelFeatureMapper<UInt16> _curCSR = new MemPixelFeatureMapper<UInt16>("0CSR", 1000, new Size(vrd.Width, vrd.Height), vrd.CoordEnvelope, vrd.SpatialRef);
            //    IPixelFeatureMapper<Int16> _maxNDVI = new MemPixelFeatureMapper<Int16>("MAXN", 1000, new Size(vrd.Width, vrd.Height), vrd.CoordEnvelope, vrd.SpatialRef);
            //    rpVisitor.VisitPixel(new int[] { filePrdMap["CurrentRasterFile"].StartBand,
            //                                     filePrdMap["CurrentRasterFile"].StartBand+1,
            //                                     filePrdMap["csrFile"].StartBand,
            //                                     filePrdMap["maxNDVIFile"].StartBand},
            //        (index, values) =>
            //        {
            //            curNDVI = GetNDVI(values, 1, 0);
            //            if (curNDVI > values[3])
            //            {
            //                _curCSR.Put(index, (UInt16)(values[0] * VisibleZoom));
            //                _maxNDVI.Put(index, (Int16)(curNDVI * ndviZoom));
            //            }
            //            else
            //            {
            //                _curCSR.Put(index, (UInt16)(values[2] * VisibleZoom));
            //                _maxNDVI.Put(index, (Int16)(values[3] * ndviZoom));
            //            }
            //        });
            //    IExtractResultArray extractArray = new ExtractResultArray("0CRS");
            //    extractArray.Add(_curCSR);
            //    extractArray.Add(_maxNDVI);
            //    return extractArray;
            //}
            //finally
            //{
            //    vrd.Dispose();
            //    if (filePrdMap != null && filePrdMap.Count() > 0)
            //    {
            //        foreach (FilePrdMap value in filePrdMap.Values)
            //        {
            //            if (value.Prd != null)
            //                value.Prd.Dispose();
            //        }
            //    }
            //}
        }
Exemplo n.º 5
0
        public void Calc()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Action <int, string> progres = new Action <int, string>(
                (progress, text) =>
            {
                //this.progressBar1.Value = progress;
                //this.Text = text;
                //Application.DoEvents();
                Console.WriteLine(progress);
            }
                );
            //举例计算NDVI
            RasterProcessModel <ushort, short> rfr = null;

            RasterMaper[] fileIns  = null;
            RasterMaper[] fileOuts = null;
            try
            {
                string fin = @"E:\Smart\MAS\ldf\FY3A_MERSI_GBAL_L1_20120517_0235_0250M_MS_GLL_DXX.ldf";
                //fin = @"E:\Smart\ldf\FY3A_MERSI_海南省_GLL_L1_20120911_D_0250M_MS.ldf";
                fin = @"E:\Smart\MAS\ldf\FY3B_MERSI_20120510_0640.LDF";
                RasterDataProvider or = RasterDataDriver.Open(fin) as RasterDataProvider;
                //初始化输出数据,这里输出为dat,可根据实际需求,自行决定输出文件格式
                IRasterDataDriver dd      = RasterDataDriver.GetDriverByName("MEM") as IRasterDataDriver;
                string            mapInfo = or.CoordEnvelope.ToMapInfoString(new Size(or.Width * 2, or.Height * 2));
                //"MAPINFO={X,Y}:{Col,Row}:{ResolutionX,ResolutionY}";
                //mapInfo = "MAPINFO={1,1}:{108.0904,20.1572}:{0.0025,0.0025}";
                //输出数据和输入数据的范围可以不一致
                RasterDataProvider tr = dd.Create(@"E:\Smart\ldf\FY3A_MERSI_海南省_GLL_L1_20120911_D_0250M_MS_NDVI.dat", or.Width, or.Height, 1, enumDataType.Int16, mapInfo) as RasterDataProvider;
                tr.GetRasterBand(1).Fill(-999);

                RasterMaper fileIn  = new RasterMaper(or, new int[] { 3, 4 });
                RasterMaper fileOut = new RasterMaper(tr, new int[] { 1 });
                fileIns  = new RasterMaper[] { fileIn };
                fileOuts = new RasterMaper[] { fileOut };
                //创建处理器
                rfr = new RasterProcessModel <ushort, short>(progres);
                rfr.SetRaster(fileIns, fileOuts);
                rfr.SetTemplateAOI("vector:海陆模版");
                rfr.RegisterCalcModel(new RasterCalcHandler <ushort, short>((rvInVistor, rvOutVistor, aoiIndex) =>
                {
                    if (rvInVistor[0].RasterBandsData != null)
                    {
                        if (rvInVistor == null)
                        {
                            return;
                        }
                        ushort[] inBand0 = rvInVistor[0].RasterBandsData[0]; //第1个输入文件的第1个波段的各像素值
                        ushort[] inBand1 = rvInVistor[0].RasterBandsData[1]; //第1个输入文件的第2个波段的各像素值
                        short[] ndvi     = new short[inBand0.Length];
                        if (aoiIndex != null)
                        {
                            int index;
                            for (int i = 0; i < aoiIndex.Length; i++)
                            {
                                index = aoiIndex[i];
                                rvOutVistor[0].RasterBandsData[0][index] = (short)((inBand1[index] - inBand0[index]) * 1000f / (inBand1[index] + inBand0[index]));
                            }
                        }
                        //else
                        //{
                        //    for (int i = 0; i < inBand0.Length; i++)
                        //    {
                        //        //第1个输出文件的第1个波段存储NDVI值
                        //        rvOutVistor[0].RasterBandsData[0][i] = (short)((inBand1[i] - inBand0[i]) * 1000f / (inBand1[i] + inBand0[i]));
                        //        //通道1和通道2的差值
                        //        //fileOutVistor[0].RasterBandsData[1][p] = (short)(inBand0[p] - inBand1[p]);
                        //    }
                        //}
                    }
                }));
                rfr.Excute();
            }
            finally
            {
                if (fileIns != null)
                {
                    for (int i = 0; i < fileIns.Length; i++)
                    {
                        fileIns[i].Raster.Dispose();
                    }
                }
                if (fileOuts != null)
                {
                    for (int i = 0; i < fileOuts.Length; i++)
                    {
                        fileOuts[i].Raster.Dispose();
                    }
                }
            }
            sw.Stop();
            Console.WriteLine((sw.ElapsedMilliseconds / 1000f).ToString() + "秒");
        }