Commit 41cccadf authored by balanche's avatar balanche

Correction d'un bug sur la progress bar Sampling et d'un autre bug sur la progress bar Displaying

parent 1ebd5b90
package mustic.gui; package mustic.gui;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
...@@ -57,19 +60,17 @@ public class ClassificationImage extends ClassificationModel { ...@@ -57,19 +60,17 @@ public class ClassificationImage extends ClassificationModel {
} }
rpanel.setName(title); rpanel.setName(title);
resultPanels.add(rpanel); resultPanels.add(rpanel);
Tab t1 = ClassificationModel.createTab(title, new ImageIcon(getClass() Tab t1 = ClassificationModel.createTab(title, new ImageIcon(getClass()
.getResource("/icons/actions/document-open-result.png")), //$NON-NLS-1$ .getResource("/icons/actions/document-open-result.png")), //$NON-NLS-1$
rpanel, true); rpanel, true);
pane.addTab(t1); pane.addTab(t1);
t1.setSelected(true); t1.setSelected(true);
} }
@Override @Override
public void doOperationAfterClassification(Classification result) { public void doOperationAfterClassification(Classification result) {
/* Monitoring the operation */ // Monitoring the operation status
result.setStatus("Step "+ (result.getProgressableList().size()+1) + "/" + (result.getProgressableList().size()+1) + " : Displaying result"); result.setStatus("Step "+ (result.getProgressableList().size()+1) + "/" + (result.getProgressableList().size()+1) + " : Displaying");
if (!result.isHybrid() && !(result instanceof ClassificationSAM4)) { if (!result.isHybrid() && !(result instanceof ClassificationSAM4)) {
if (result.getTimeExec() != 0) if (result.getTimeExec() != 0)
result.setTimeExec(ManagementFactory.getThreadMXBean() result.setTimeExec(ManagementFactory.getThreadMXBean()
...@@ -97,6 +98,7 @@ public class ClassificationImage extends ClassificationModel { ...@@ -97,6 +98,7 @@ public class ClassificationImage extends ClassificationModel {
irp.historique.addInfosln(Messages.getString("ClassificationImage.6") //$NON-NLS-1$ irp.historique.addInfosln(Messages.getString("ClassificationImage.6") //$NON-NLS-1$
+ (exec / 1.0E9) + "s"); //$NON-NLS-1$ + (exec / 1.0E9) + "s"); //$NON-NLS-1$
} }
} }
} }
......
...@@ -4,6 +4,8 @@ import java.awt.*; ...@@ -4,6 +4,8 @@ import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.*; import java.awt.image.*;
import java.io.*; import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import java.util.Vector; import java.util.Vector;
...@@ -200,10 +202,9 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen ...@@ -200,10 +202,9 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
MainFrame.getInstance().getCurrentDataSession().addResultPanel(this); MainFrame.getInstance().getCurrentDataSession().addResultPanel(this);
this.result = classification.getClusteringResult(); this.result = classification.getClusteringResult();
this.clusterMap = new MultiResolutionClusterMap(this, imgData.getWidth(), this.clusterMap = new MultiResolutionClusterMap(this, imgData.getWidth(),
imgData.getHeight(), result.getClusterMap(false), this.result.getClusters());//!! imgData.getHeight(), result.getClusterMap(false), this.result.getClusters());
this.classPanel.addTreeSelectionListener(this); this.classPanel.addTreeSelectionListener(this);
if (imgData.getRawImages() != null && imgData.getRawImages().size() > 0) { if (imgData.getRawImages() != null && imgData.getRawImages().size() > 0) {
this.viewer = new ClusteringImageViewer(new GDALPyramidImageViewer( this.viewer = new ClusteringImageViewer(new GDALPyramidImageViewer(
imgData.getRawImages().get(0), true), this.clusterMap); imgData.getRawImages().get(0), true), this.clusterMap);
......
...@@ -238,13 +238,10 @@ public class ImageData extends SimpleData implements Serializable { ...@@ -238,13 +238,10 @@ public class ImageData extends SimpleData implements Serializable {
* a mask to apply to the sampler * a mask to apply to the sampler
*/ */
public ImageData(Sampler sampler, RawImage path, Mask mask) { public ImageData(Sampler sampler, RawImage path, Mask mask) {
System.out.println("ImageData(Sampler sampler, RawImage path, Mask mask)");
if (MainFrame.DEBUG_MODE) { if (MainFrame.DEBUG_MODE) {
System.out.println(">> ImageData(Sampler,String) <<"); System.out.println(">> ImageData(Sampler,String) <<");
} }
MainFrame.getProgressStatus().setMessage("loading sampler...");
this.rawImages.add(path); this.rawImages.add(path);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
......
...@@ -132,7 +132,7 @@ public class ClassificationThread extends Thread { ...@@ -132,7 +132,7 @@ public class ClassificationThread extends Thread {
/* Si on a un container on affiche le resultat */ /* Si on a un container on affiche le resultat */
if (this.container_ != null) { if (this.container_ != null) {
this.container_ this.container_
.doOperationAfterClassification(this.classification_);//prends aussi du temps ?!!! .doOperationAfterClassification(this.classification_);
} }
} }
......
...@@ -41,13 +41,13 @@ public class MultiResolutionClusterMap { ...@@ -41,13 +41,13 @@ public class MultiResolutionClusterMap {
private void generateMaps(int[] map) { private void generateMaps(int[] map) {
int[][] newMap = new int[width][height]; int[][] newMap = new int[width][height];
double pas = 100./(height*width); // double step = 100./(height*width);
double progress = imageResultPanel.getClassification().getProgress()+pas; // double progress = imageResultPanel.getClassification().getProgress()+step;
for(int j = 0 ; j < height ; j++) { for(int j = 0 ; j < height ; j++) {
for(int i = 0 ; i < width ; i++) { for(int i = 0 ; i < width ; i++) {
newMap[i][j] = map[i + j*width]; newMap[i][j] = map[i + j*width];
progress+=pas; // progress+=step;
imageResultPanel.getClassification().setProgress((int)progress); // imageResultPanel.getClassification().setProgress((int)progress);
} }
} }
this.maps.add(newMap); this.maps.add(newMap);
......
...@@ -64,7 +64,7 @@ public class ImageSampler extends Sampler { ...@@ -64,7 +64,7 @@ public class ImageSampler extends Sampler {
private double progressM = 100; private double progressM = 100;
private String status = null; private String status = "Sampling";
/** /**
* Constructor from a sequence of images * Constructor from a sequence of images
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment