示例#1
0
 public async Task <ISupervisedModel> TrainAsync(GeoImageData image, int[] includedBands, GeoImageData clustering, int clusteringBand,
                                                 IProgress <ClusteringProgress> progress, CancellationToken cancellationToken)
 {
     _progress          = progress;
     _cancellationToken = cancellationToken;
     return(await Task.Run(() => Train(image, includedBands, clustering, clusteringBand)));
 }
示例#2
0
        public GeoImageLoader(GeoImageData gImgData, params int[] includedBands)
        {
            _gImgData      = gImgData;
            _includedBands = includedBands;

            PointCount = _gImgData.Ncols * _gImgData.Nrows;
            BandCount  = _includedBands.Length;
        }
示例#3
0
 public ImageDisplay(byte[] byIn, GeoImageData gd)
 {
     gimDa = gd;
     InitializeComponent();
     curBand      = byIn;
     screenHeight = Screen.PrimaryScreen.WorkingArea.Height;
     screenWidth  = Screen.PrimaryScreen.WorkingArea.Width;
     initImage();
 }
示例#4
0
        private void ValidateInputImages(GeoImageData image, GeoImageData clustering)
        {
            int imagePixelCount      = image.Ncols * image.Nrows;
            int clusteringPixelCount = clustering.Ncols * clustering.Nrows;

            if (imagePixelCount != clusteringPixelCount)
            {
                throw new ArgumentException("The pixel counts of the input image and the clustering do not match.");
            }
        }
示例#5
0
        protected CentroidBasedClustering(GeoImageData gImgData, int[] includedBands, uint maxIter, uint maxClusterNum)
            : this(maxIter, maxClusterNum)
        {
            if (includedBands.Length == 0 || includedBands.Length > gImgData.Nbands)
            {
                throw new ArgumentOutOfRangeException(nameof(includedBands), "Array length out of range predefined by the GeoImageData.");
            }

            _pointLoader = new GeoImageDataPointLoader(gImgData, includedBands);
        }
示例#6
0
 public KmeansClustering(GeoImageData gImgData, int[] bandsToUse,
                         uint maxIter,
                         float changeThreshold,
                         uint minClusterNum,
                         uint maxClusterNum,
                         float changeElbow)
     : base(gImgData, bandsToUse, maxIter, maxClusterNum)
 {
     InitParameters(changeThreshold, minClusterNum, maxClusterNum, changeElbow);
 }
示例#7
0
        public ClusteringForm(GeoImageData gImgData, byte[] currentBand = null)
        {
            InitializeComponent();
            DialogResult = DialogResult.None;

            _gImgData    = gImgData;
            _currentBand = currentBand;

            InitControls();
            IsClusteringInProgress = false;
        }
示例#8
0
        public MultiBandOperation(GeoImageData imageData, int[] bands)
        {
            this.imageData  = imageData;
            this.imageTools = new GeoImageTools(imageData);
            this.inputBands = new List <byte[]>();

            foreach (int band in bands)
            {
                this.inputBands.Add(imageTools.getOneBandBytes(band));
            }
        }
        public async Task <byte[]> ExecuteAsync(GeoImageData geoImageData, int[] includedBands,
                                                IProgress <ClusteringProgress> progress, CancellationToken cancellationToken)
        {
            if (includedBands.Length == 0 || includedBands.Length > geoImageData.Nbands)
            {
                throw new ArgumentOutOfRangeException(nameof(includedBands), "Array length out of range predefined by the GeoImageData.");
            }

            var imageLoader = new GeoImageLoader(geoImageData, includedBands);

            return(await ExecuteAsync(imageLoader, progress, cancellationToken));
        }
示例#10
0
        void SaveResult(GeoImageData gimda, byte[] byout, int iband)
        {
            GeoImageTools gt        = new GeoImageTools(gimda);
            string        dirname   = Path.GetDirectoryName(gimda.FileName);
            string        fname     = Path.GetFileNameWithoutExtension(gimda.FileName);
            string        extension = Path.GetExtension(gimda.FileName);
            string        fileName  = dirname + "\\" + fname + tbResultAppendix.Text + extension;

            if (iband == 0)
            {
                gt.saveHeader2Giwer(fileName);
            }
            gt.saveGivenBand2GiwerFormat(dirname + "\\" + fname + tbResultAppendix.Text, byout, iband, "");
            //gt.saveOneBandResultAsGiwerFormat(fileName, byout, "");
        }
示例#11
0
        private void btnSelectClustering_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog fileDialog = new OpenFileDialog())
            {
                fileDialog.Filter = "Giwer header file|*.gwh";

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    _clusteringImage = new GeoImageData {
                        FileName = fileDialog.FileName
                    };
                    ClusteringImageSelected(fileDialog.SafeFileName);
                }
            }
        }
示例#12
0
        private RandomForestModel Train(GeoImageData image, int[] includedBands, GeoImageData clustering, int clusteringBand)
        {
            ValidateInputImages(image, clustering);
            HandleBandCountPerSplitValue(includedBands.Length);

            _progress.Report(ClusteringProgress.Initializing(TreeCount));

            var imageLoader = new GeoImageLoader(image, includedBands);

            byte[][] points = imageLoader.LoadJaggedBands();

            var targetLoader = new GeoImageLoader(clustering, clusteringBand);

            byte[] targets = targetLoader.LoadPoints(); //RandomForestUtilities.LoadPoints(clustering, clusteringBand);

            return(TrainForestModel(points, targets, includedBands.Length));
        }
示例#13
0
 public LaplaceFilter(GeoImageData image, int band, List <string> par)
     : base(image, band, par)
 {
 }
示例#14
0
 public Thresholding(byte[] inputBand, GeoImageData image, List <string> par)
     : base(inputBand, image, par)
 {
 }
 public GeoImageDataPointLoader(GeoImageData gImgData, int[] includedBands)
 {
     _gImgData      = gImgData;
     _includedBands = includedBands;
 }
示例#16
0
 public LowPassFilter(GeoImageData image, int band, List <string> pars)
     : base(image, band, pars)
 {
     KernelLength = int.Parse(pars[0]);
 }
示例#17
0
 public Thresholding(GeoImageData image, int band, List <string> par)
     : base(image, band, par)
 {
 }
示例#18
0
 public HighPassFilter(byte[] inputBand, GeoImageData image, List <string> par)
     : base(inputBand, image, par)
 {
 }
示例#19
0
 public LowPassFilter(byte[] inputBand, GeoImageData image, List <string> pars)
     : base(inputBand, image, pars)
 {
     KernelLength = int.Parse(pars[0]);
 }
示例#20
0
 public LaplaceFilter(byte[] inputBand, GeoImageData image, List <string> par)
     : base(inputBand, image, par)
 {
 }
示例#21
0
 public HighPassFilter(GeoImageData image, int band, List <string> par)
     : base(image, band, par)
 {
 }
示例#22
0
 public SobelFilter(GeoImageData image, int band, List <string> par)
     : base(image, band, par)
 {
 }
示例#23
0
文件: NDVI.cs 项目: istvan-elek/Giwer
 public NDVI(GeoImageData image, int[] bands)
     : base(image, bands)
 {
 }
示例#24
0
 public MedianFilter(byte[] inputBand, GeoImageData image, List <string> par)
     : base(inputBand, image, par)
 {
     KernelLength = int.Parse(par[0]);
 }
示例#25
0
文件: NDVI.cs 项目: istvan-elek/Giwer
 public NDVI(GeoImageData image, int nirBand, int redBand)
     : base(image, new int[] { nirBand, redBand })
 {
 }
示例#26
0
        void RunWorkflow(Project proj)
        {
            //Assembly assem = typeof(WorkflowBuilder).Assembly;
            //Type tt = assem.GetType("Giwer.workflowBuilder.Operations.HighPassFilter");

            //MethodInfo method = tt.GetMethod("Execute", BindingFlags.Public | BindingFlags.Instance);
            //method.Invoke(tt, null);

            //GeoImageData imgData=new GeoImageData();
            //int band = 0;
            //SingleBandOperation op = (SingleBandOperation)Activator.CreateInstance(tt, new object[] { imgData, band });
            //// propertyket beállítani
            //op.Execute();

            if (!checkParameters())
            {
                return;
            }
            if (MessageBox.Show("The process can take a long time (even hours)", "Long last process notice", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            progressWorkflow.Maximum = proj.FileNames.Count;
            progressWorkflow.Value   = 0;
            progressWorkflow.Visible = true;

            foreach (string fileItem in proj.FileNames)
            {
                progressWorkflow.PerformStep();
                GeoImageData imgData = new GeoImageData();
                imgData.FileName = fileItem;
                byte[] byin  = new byte[imgData.Nrows * imgData.Ncols];
                byte[] byout = new byte[imgData.Nrows * imgData.Ncols];

                for (int band = 0; band < imgData.Nbands; band++)
                {
                    int k = 0;
                    for (int i = 0; i < currentWorkflow.Methods.Count; i++)
                    {
                        Assembly assem = typeof(WorkflowBuilder).Assembly;
                        Type     opt   = assem.GetType("Giwer.workflowBuilder.Operations." + currentWorkflow.Methods[i].Split(' ')[0]);
                        if (opt.BaseType.Name == "SingleBandOperation")
                        {
                            if (k == 0)
                            {
                                GeoImageTools gt = new GeoImageTools(imgData);
                                byin = gt.getOneBandBytes(band);
                                SingleBandOperation op = (SingleBandOperation)Activator.CreateInstance(opt, new object[] { imgData, band, currentWorkflow.Pars[i] });
                                op.Execute();
                                byin  = op.Output;
                                byout = op.Output;
                                k     = 1;
                            }
                            else
                            {
                                SingleBandOperation op = (SingleBandOperation)Activator.CreateInstance(opt, new object[] { byin, imgData, currentWorkflow.Pars[i] });
                                op.Execute();
                                byin  = op.Output;
                                byout = op.Output;
                            }
                        }
                        if (opt.BaseType.Name == "MultiBandOperation")
                        {
                        }
                    }
                    if (chkSave.Checked)
                    {
                        SaveResult(imgData, byout, band);
                    }
                }
            }
            this.Cursor = Cursors.Default;
            progressWorkflow.Visible = false;
            MessageBox.Show("Save process has completed", "Save completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#27
0
 public SingleBandOperation(GeoImageData imgData, int band, List <string> par)
 {
     this.imageData  = imgData;
     this.imageTools = new GeoImageTools(imgData);
     this.inputBand  = imageTools.getOneBandBytes(band);
 }
示例#28
0
 public GaussFilter(GeoImageData image, int band)
     : base(image, band)
 {
 }
示例#29
0
 public SaveResult(GeoImageData image, int band, List <string> par) : base(image, band, par)
 {
     byteIn = inputBand;
 }
示例#30
0
 public SingleBandOperation(byte[] byIn, GeoImageData gimda, List <string> par)
 {
     imageData = gimda;
     inputBand = byIn;
 }