Commit 7233b0d7 authored by lafabregue's avatar lafabregue

minor changes

parent 76bfd602
......@@ -17,3 +17,4 @@ local.properties
.settings/
.loadpath
*.hprof
*.log
......@@ -744,7 +744,7 @@ public class MainFrame extends JFrame {
customClassify();
}
});
// CSVMenu.add(customToDelete);
CSVMenu.add(customToDelete);
// menuItemResultToCSV = new JMenuItem(Messages.getString("MainFrame.305")); //$NON-NLS-1$
// menuItemResultToCSV.addActionListener(new ActionListener() {
......
......@@ -265,7 +265,7 @@ public class ImagePanel extends JPanel implements Zoomable, Observer, ImageDispl
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
// zoom in zoom box
if((e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK) {
if (e.getUnitsToScroll() > 0) {
if (e.getUnitsToScroll() < 0) {
displayPanel.zoomInBox();
} else {
displayPanel.zoomOutBox();
......@@ -502,6 +502,7 @@ public class ImagePanel extends JPanel implements Zoomable, Observer, ImageDispl
});
this.displayPanel.setFocusable(true);
this.requestFocusInWindow();
}
/**
......
......@@ -96,7 +96,7 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
private ImageData imgData;
protected JInternalFrame jif_saveResult = new JInternalFrame();
protected JLayeredPane lpane = new JLayeredPane();
/** width of the screen image */
......@@ -129,8 +129,6 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
private float opacityCluster = 1;
/** */
protected JPanel panelImage = new JPanel(new BorderLayout());
protected JPanel panelResSave = new JPanel();
/** offset between the panel and the actual displayed image */
......@@ -227,8 +225,8 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
setListenerImage();
if (MainFrame.DEBUG_MODE)
System.out.println("updateImageColors from irp");
this.panelImage.add(displayPanel, BorderLayout.CENTER);
this.panelImage.setBackground(Color.CYAN);
// this.panelImage.add(displayPanel, BorderLayout.CENTER);
// this.panelImage.setBackground(Color.CYAN);
this.resultTabbedPane.addTab("Image Result", this.displayPanel);
this.resultTabbedPane.addTab("Historique", this.historique);
......@@ -349,6 +347,11 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
// }
}
@Override
public void mouseEntered(MouseEvent e) {
displayPanel.requestFocusInWindow();
}
@Override
public void mousePressed(MouseEvent e) {
evaluatePopup(e);
......@@ -358,29 +361,31 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
@Override
public void mouseReleased(MouseEvent e) {
evaluatePopup(e);
int translateX = (int) ((mousePressedCoordinates.x - e.getX())/mZoomRate);
int translateY = (int) ((mousePressedCoordinates.y - e.getY())/mZoomRate);
currentTopLeft.x += translateX;
currentTopLeft.y += translateY;
if (currentTopLeft.x + (int) (displayPanel.getWidth()/mZoomRate) > viewer.getRealImageWidth()) {
currentTopLeft.x = viewer.getRealImageWidth() - (int) (displayPanel.getWidth()/mZoomRate);
}
if (currentTopLeft.y + (int) (displayPanel.getHeight()/mZoomRate) > viewer.getRealImageHeight()) {
currentTopLeft.y = viewer.getRealImageHeight() - (int) (displayPanel.getHeight()/mZoomRate);
if (mousePressedCoordinates != null) {
int translateX = (int) ((mousePressedCoordinates.x - e.getX())/mZoomRate);
int translateY = (int) ((mousePressedCoordinates.y - e.getY())/mZoomRate);
currentTopLeft.x += translateX;
currentTopLeft.y += translateY;
if (currentTopLeft.x + (int) (displayPanel.getWidth()/mZoomRate) > viewer.getRealImageWidth()) {
currentTopLeft.x = viewer.getRealImageWidth() - (int) (displayPanel.getWidth()/mZoomRate);
}
if (currentTopLeft.y + (int) (displayPanel.getHeight()/mZoomRate) > viewer.getRealImageHeight()) {
currentTopLeft.y = viewer.getRealImageHeight() - (int) (displayPanel.getHeight()/mZoomRate);
}
if (currentTopLeft.x < 0)
currentTopLeft.x = 0;
if (currentTopLeft.y < 0)
currentTopLeft.y = 0;
viewer.getScreenImage(currentTopLeft.x, currentTopLeft.y, displayPanel.getWidth(),
displayPanel.getHeight(), mZoomRate, true);
updateImageView();
mousePressedCoordinates = null;
displayPanel.setAddedOffset(null);
}
if (currentTopLeft.x < 0)
currentTopLeft.x = 0;
if (currentTopLeft.y < 0)
currentTopLeft.y = 0;
viewer.getScreenImage(currentTopLeft.x, currentTopLeft.y, displayPanel.getWidth(),
displayPanel.getHeight(), mZoomRate, true);
updateImageView();
mousePressedCoordinates = null;
displayPanel.setAddedOffset(null);
}
});
......@@ -530,14 +535,54 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
this.displayPanel.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getUnitsToScroll() > 0) {
zoomOut();
// zoom in zoom box
if((e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK) {
if (e.getUnitsToScroll() <= 0) {
displayPanel.zoomInBox();
} else {
displayPanel.zoomOutBox();
}
}
else {
zoomIn();
// resize zoom box area
else if((e.getModifiers() & InputEvent.ALT_MASK) == InputEvent.ALT_MASK) {
if (e.getUnitsToScroll() > 0) {
displayPanel.increaseZoomBoxArea();
} else {
displayPanel.decreaseZoomBoxArea();
}
}
// zoom in the image
else {
if (e.getUnitsToScroll() > 0) {
zoomOut();
} else {
zoomIn();
}
}
}
});
// key listener for the ZoomBox
displayPanel.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
// enable zoom box
if(e.getKeyCode() == KeyEvent.VK_Z) {
displayPanel.setZoomBoxEnabled(!displayPanel.isZoomBoxEnabled());
}
}
@Override
public void keyReleased(KeyEvent e) {
}
});
this.displayPanel.setFocusable(true);
}
@Override
......@@ -1617,7 +1662,7 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
double zoomOrigin = zoom*mZoomRate ;
BufferedImage subImage = viewer.getScreenImage(xo, yo, width, height, zoomOrigin, false);
return subImage;
return drawAllElements(subImage);
}
......
......@@ -309,7 +309,7 @@ public class SourceSelectionPanel extends JPanel {
for(int i = 0 ; i < rawImages.length ; i++) {
filesPaths.add(sequenceData.get(i).getFilename());
rawImages[i] = sequenceData.get(i);
if (rawImages[i].getInfoImage().isGeoReferenced()) {
if (allGeoReferenced && rawImages[i].getInfoImage().isGeoReferenced()) {
double[] imageVector = new double[4];
imageVector[0] = rawImages[i].getInitPosGeoX();
imageVector[1] = rawImages[i].getInitPosGeoY();
......@@ -318,7 +318,6 @@ public class SourceSelectionPanel extends JPanel {
geoTranslateVectors.add(imageVector);
} else {
allGeoReferenced = false;
break;
}
}
if (allGeoReferenced) {
......
......@@ -15,11 +15,13 @@ import jcl.clustering.Cluster;
import jcl.clustering.ClusteringResult;
import jcl.learning.IterativeClassification;
import jcl.learning.methods.ClassifierUtils;
import jcl.learning.methods.multistrategy.samarah.HybridClassification;
import jcl.utils.Matrix;
import jcl.utils.exceptions.MethodNotImplementedException;
import mustic.gui.ClassificationImage;
import mustic.gui.DataDesktopFrame;
import mustic.gui.MainFrame;
import mustic.gui.panels.classifier.components.HybridClassificationSubParametersPanel;
import mustic.models.gui.charts.MultiresolutionChart;
import mustic.models.gui.dialogs.MergeDialog;
import mustic.models.gui.dialogs.SplitDialog;
......@@ -259,11 +261,11 @@ public class ClassConfigPanel extends JPanel implements TreeSelectionListener, A
rp.historique.addInfosln("**** Operation " + rp.nbOperations + " ****");
rp.historique.addInfosln("Suppression du cluster " + (i + 1));
} catch (MethodNotImplementedException e) {
JOptionPane.showMessageDialog(this.resultPanel_, "This classification method does not implement this operator", "Error",
JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this.resultPanel_, "This classification method does not implement this operator",
"Error", JOptionPane.ERROR_MESSAGE);
} catch (NullPointerException e) {
JOptionPane.showMessageDialog(this.resultPanel_, "This classification method does not implement this operator", "Error",
JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this.resultPanel_, "This classification method does not implement this operator",
"Error", JOptionPane.ERROR_MESSAGE);
}
}
......@@ -276,23 +278,61 @@ public class ClassConfigPanel extends JPanel implements TreeSelectionListener, A
* Method that launch a new iteration if from the current classification
*/
protected void actionPerformed_newIteration() {
Classification classif = (Classification) this.classification_.clone();
final Classification classif = (Classification) this.classification_.clone();
classif.setName(this.classification_.getName());
Thread t = null;
ClassificationImage classificationImage = new ClassificationImage(resultPanel_.getSession(),
classif.getName(), //$NON-NLS-1$
true);
t = new ClassificationThread(classif, classificationImage.getProgressBar(),
classificationImage, null, true, this.resultPanel_.getConstraintsToUse());
t.start();
if (classif instanceof HybridClassification) {
final JDialog dialog = new JDialog();
JPanel container = new JPanel();
container.setLayout(new BorderLayout());
final HybridClassificationSubParametersPanel parameters = new HybridClassificationSubParametersPanel(
(HybridClassification) classif);
container.add(parameters, BorderLayout.CENTER);
JButton launch = new JButton("Launch");
launch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
parameters.setParameters((HybridClassification) classif);
dialog.setVisible(false);
dialog.dispose();
Thread t = null;
ClassificationImage classificationImage = new ClassificationImage(
resultPanel_.getSession(), classif.getName(),
true);
t = new ClassificationThread(classif, classificationImage.getProgressBar(),
classificationImage, null, true, resultPanel_.getConstraintsToUse());
t.start();
resultPanel_.getSession().addClassifier(classificationImage);
classificationImage.setVisible(true);
}
});
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
dialog.dispose();
}
});
JPanel bottomPanel = new JPanel(new FlowLayout());
bottomPanel.add(launch);
bottomPanel.add(cancel);
container.add(bottomPanel, BorderLayout.SOUTH);
dialog.setContentPane(container);
dialog.setSize(new Dimension(450, 450));
dialog.setLocationRelativeTo(this);
dialog.setModal(true);
dialog.setVisible(true);
}
resultPanel_.getSession().addClassifier(classificationImage);
classificationImage.setVisible(true);
}
......
......@@ -60,7 +60,7 @@ public class ResultPanel extends JPanel {
protected Vector<Constraint> constraintsUsed = null;
/** Set of constraints that should be used for a next iteration (only for IterativeClassification) */
protected Vector<Constraint> constraintsToUse = null;
protected Vector<Constraint> constraintsToUse = new Vector<Constraint>();
public HistoriquePanel historique = new HistoriquePanel();
......
......@@ -38,14 +38,18 @@ public class GDALPyramidImageViewer extends PyramidImageViewer {
if (zoomRate > zoomRateY)
zoomRate = zoomRateY;
int[] overviewArray = new int[(int) Math.floor(Math.log(zoomRate) / Math.log(2))];
for (int i = 0 ; i < overviewArray.length ; i++) {
overviewArray[i] = (int) Math.pow(2, i+1);
}
GDALImageReaderWrapper.generateOverviews(rawImage.getFilename(), overviewArray);
int overviewLength = (int) Math.floor(Math.log(zoomRate) / Math.log(2));
for (int i = 0 ; i < overviewArray.length ; i++) {
pyramidReaders.add(new GDALImageReaderWrapper(rawImage.getFilename(), i));
if (overviewLength > 0) {
int[] overviewArray = new int[overviewLength];
for (int i = 0 ; i < overviewArray.length ; i++) {
overviewArray[i] = (int) Math.pow(2, i+1);
}
GDALImageReaderWrapper.generateOverviews(rawImage.getFilename(), overviewArray);
for (int i = 0 ; i < overviewArray.length ; i++) {
pyramidReaders.add(new GDALImageReaderWrapper(rawImage.getFilename(), i));
}
}
long allocatedMemory = (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory());
......
This diff is collapsed.
This diff is collapsed.
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