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))); }
public GeoImageLoader(GeoImageData gImgData, params int[] includedBands) { _gImgData = gImgData; _includedBands = includedBands; PointCount = _gImgData.Ncols * _gImgData.Nrows; BandCount = _includedBands.Length; }
public ImageDisplay(byte[] byIn, GeoImageData gd) { gimDa = gd; InitializeComponent(); curBand = byIn; screenHeight = Screen.PrimaryScreen.WorkingArea.Height; screenWidth = Screen.PrimaryScreen.WorkingArea.Width; initImage(); }
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."); } }
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); }
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); }
public ClusteringForm(GeoImageData gImgData, byte[] currentBand = null) { InitializeComponent(); DialogResult = DialogResult.None; _gImgData = gImgData; _currentBand = currentBand; InitControls(); IsClusteringInProgress = false; }
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)); }
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, ""); }
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); } } }
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)); }
public LaplaceFilter(GeoImageData image, int band, List <string> par) : base(image, band, par) { }
public Thresholding(byte[] inputBand, GeoImageData image, List <string> par) : base(inputBand, image, par) { }
public GeoImageDataPointLoader(GeoImageData gImgData, int[] includedBands) { _gImgData = gImgData; _includedBands = includedBands; }
public LowPassFilter(GeoImageData image, int band, List <string> pars) : base(image, band, pars) { KernelLength = int.Parse(pars[0]); }
public Thresholding(GeoImageData image, int band, List <string> par) : base(image, band, par) { }
public HighPassFilter(byte[] inputBand, GeoImageData image, List <string> par) : base(inputBand, image, par) { }
public LowPassFilter(byte[] inputBand, GeoImageData image, List <string> pars) : base(inputBand, image, pars) { KernelLength = int.Parse(pars[0]); }
public LaplaceFilter(byte[] inputBand, GeoImageData image, List <string> par) : base(inputBand, image, par) { }
public HighPassFilter(GeoImageData image, int band, List <string> par) : base(image, band, par) { }
public SobelFilter(GeoImageData image, int band, List <string> par) : base(image, band, par) { }
public NDVI(GeoImageData image, int[] bands) : base(image, bands) { }
public MedianFilter(byte[] inputBand, GeoImageData image, List <string> par) : base(inputBand, image, par) { KernelLength = int.Parse(par[0]); }
public NDVI(GeoImageData image, int nirBand, int redBand) : base(image, new int[] { nirBand, redBand }) { }
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); }
public SingleBandOperation(GeoImageData imgData, int band, List <string> par) { this.imageData = imgData; this.imageTools = new GeoImageTools(imgData); this.inputBand = imageTools.getOneBandBytes(band); }
public GaussFilter(GeoImageData image, int band) : base(image, band) { }
public SaveResult(GeoImageData image, int band, List <string> par) : base(image, band, par) { byteIn = inputBand; }
public SingleBandOperation(byte[] byIn, GeoImageData gimda, List <string> par) { imageData = gimda; inputBand = byIn; }