Commit 645e82ae authored by lafabregue's avatar lafabregue

Add the constraints creation tool in the toolbar

parent 74d5ac3e
...@@ -13,6 +13,9 @@ import jcl.jcld.database.SSHParameters; ...@@ -13,6 +13,9 @@ import jcl.jcld.database.SSHParameters;
import mustic.gui.panels.*; import mustic.gui.panels.*;
import mustic.gui.segmentation.SegmentationPanel; import mustic.gui.segmentation.SegmentationPanel;
import mustic.io.RawImage; import mustic.io.RawImage;
import net.infonode.tabbedpanel.TabFactory;
import net.infonode.tabbedpanel.TabbedPanel;
import net.infonode.tabbedpanel.titledtab.TitledTab;
/** /**
* Classe qui a toutes les donnees concernant l'image ouverte .... - RawImage - ImageData - * Classe qui a toutes les donnees concernant l'image ouverte .... - RawImage - ImageData -
...@@ -51,7 +54,7 @@ public class ImageSession { ...@@ -51,7 +54,7 @@ public class ImageSession {
public String mTitle; public String mTitle;
/** Contains image, classifier, results */ /** Contains image, classifier, results */
protected JPanel mWorskSpace; protected TabbedPanel mWorskSpace;
/** The Data que decrit une imqge */ /** The Data que decrit une imqge */
private RawImage rawImage; private RawImage rawImage;
...@@ -63,7 +66,7 @@ public class ImageSession { ...@@ -63,7 +66,7 @@ public class ImageSession {
public SSHParameters sshparameters = null; public SSHParameters sshparameters = null;
/** enable the image to display the image or not, for a memory usage matter */ /** enable the image to display the image or not, for a memory usage matter */
private boolean displayEnable = false; private boolean displayEnable = true;
/** /**
* @param aImage * @param aImage
...@@ -117,10 +120,16 @@ public class ImageSession { ...@@ -117,10 +120,16 @@ public class ImageSession {
if (MainFrame.DEBUG_MODE) if (MainFrame.DEBUG_MODE)
System.out.println(Messages.getString("ImageSession.6")); //$NON-NLS-1$ System.out.println(Messages.getString("ImageSession.6")); //$NON-NLS-1$
this.mWorskSpace = new JPanel(); this.mWorskSpace = new TabbedPanel();
JScrollPane sp = new JScrollPane(this.mImagePanel); JScrollPane sp = new JScrollPane(this.mImagePanel);
mWorskSpace = new JPanel(new BorderLayout()); final TitledTab tabImage = TabFactory.createTitledTab(
mWorskSpace.add(sp, BorderLayout.CENTER); "Image",
new ImageIcon(getClass().getResource(
"/icons/mimetypes/image-x-generic.png")),
sp);
// mWorskSpace = new JPanel(new BorderLayout());
mWorskSpace.addTab(tabImage);
} }
...@@ -214,7 +223,7 @@ public class ImageSession { ...@@ -214,7 +223,7 @@ public class ImageSession {
return this.segPanels; return this.segPanels;
} }
public JPanel getWorkSpace() { public TabbedPanel getWorkSpace() {
return this.mWorskSpace; return this.mWorskSpace;
} }
......
...@@ -27,6 +27,7 @@ import jcl.learning.methods.monostrategy.SingleClassification; ...@@ -27,6 +27,7 @@ import jcl.learning.methods.monostrategy.SingleClassification;
import jcl.weights.ClassificationWeights; import jcl.weights.ClassificationWeights;
import jsl.Segmentation; import jsl.Segmentation;
import mustic.gui.dialog.*; import mustic.gui.dialog.*;
import mustic.gui.dialog.classifier.ConstraintsSelectionDialog;
import mustic.gui.dialog.consoleHandler.ConsoleFrame; import mustic.gui.dialog.consoleHandler.ConsoleFrame;
import mustic.gui.panels.*; import mustic.gui.panels.*;
import mustic.gui.panels.data.DataConstructFrame; import mustic.gui.panels.data.DataConstructFrame;
...@@ -568,7 +569,17 @@ public class MainFrame extends JFrame { ...@@ -568,7 +569,17 @@ public class MainFrame extends JFrame {
} }
}); });
toolsMenu.add(menuTransformationBmp); toolsMenu.add(menuTransformationBmp);
/** Menu to generate constraints from current image session */
menuConstraints = new JMenuItem(Messages.getString("MainFrame.301"));
menuConstraints.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
createConstraints();
}
});
toolsMenu.add(menuConstraints);
menuBar.add(toolsMenu); menuBar.add(toolsMenu);
ArffMenu = new JMenu(Messages.getString("MainFrame.32")); //$NON-NLS-1$ ArffMenu = new JMenu(Messages.getString("MainFrame.32")); //$NON-NLS-1$
...@@ -963,6 +974,8 @@ public class MainFrame extends JFrame { ...@@ -963,6 +974,8 @@ public class MainFrame extends JFrame {
private Boolean actionCrop; private Boolean actionCrop;
private JMenuItem menuTransformationBmp; private JMenuItem menuTransformationBmp;
private Boolean actionTransformationBmp; private Boolean actionTransformationBmp;
private JMenuItem menuConstraints;
private Boolean actionConstraints;
private JMenuItem menuItemArff; private JMenuItem menuItemArff;
private Boolean actionArff; private Boolean actionArff;
private JMenuItem menuItemRaw; private JMenuItem menuItemRaw;
...@@ -1073,6 +1086,7 @@ public class MainFrame extends JFrame { ...@@ -1073,6 +1086,7 @@ public class MainFrame extends JFrame {
this.actionContrastM = false; this.actionContrastM = false;
this.actionContratsP = false; this.actionContratsP = false;
this.actionCrop = false; this.actionCrop = false;
this.actionConstraints = false;
this.actionFilter = false; this.actionFilter = false;
this.actionMask = false; this.actionMask = false;
this.actionRefresh = false; this.actionRefresh = false;
...@@ -1102,6 +1116,7 @@ public class MainFrame extends JFrame { ...@@ -1102,6 +1116,7 @@ public class MainFrame extends JFrame {
this.actionContrastM = true; this.actionContrastM = true;
this.actionContratsP = true; this.actionContratsP = true;
this.actionCrop = true; this.actionCrop = true;
this.actionConstraints = true;
this.actionFilter = true; this.actionFilter = true;
this.actionMask = true; this.actionMask = true;
this.actionNew = true; this.actionNew = true;
...@@ -1139,6 +1154,7 @@ public class MainFrame extends JFrame { ...@@ -1139,6 +1154,7 @@ public class MainFrame extends JFrame {
menuItemRoiColor.setEnabled(this.actionRoiColor); menuItemRoiColor.setEnabled(this.actionRoiColor);
menuItemMask.setEnabled(this.actionMask); menuItemMask.setEnabled(this.actionMask);
menuCrop.setEnabled(this.actionCrop); menuCrop.setEnabled(this.actionCrop);
menuConstraints.setEnabled(this.actionConstraints);
menuTransformationBmp.setEnabled(this.actionTransformationBmp); menuTransformationBmp.setEnabled(this.actionTransformationBmp);
menuItemArff.setEnabled(this.actionArff); menuItemArff.setEnabled(this.actionArff);
menuItemRaw.setEnabled(this.actionRaw); menuItemRaw.setEnabled(this.actionRaw);
...@@ -1198,6 +1214,7 @@ public class MainFrame extends JFrame { ...@@ -1198,6 +1214,7 @@ public class MainFrame extends JFrame {
menuItemMask.setText(Messages.getString("MainFrame.29")); menuItemMask.setText(Messages.getString("MainFrame.29"));
menuCrop.setText(Messages.getString("MainFrame.0")); menuCrop.setText(Messages.getString("MainFrame.0"));
menuTransformationBmp.setText(Messages.getString("MainFrame.30")); menuTransformationBmp.setText(Messages.getString("MainFrame.30"));
menuConstraints.setText(Messages.getString("MainFrame.301"));
menuItemArff.setText(Messages.getString("MainFrame.33")); menuItemArff.setText(Messages.getString("MainFrame.33"));
menuItemRaw.setText("RawImage to Arff"); menuItemRaw.setText("RawImage to Arff");
menuItemLoadArff.setText(Messages.getString("MainFrame.34")); menuItemLoadArff.setText(Messages.getString("MainFrame.34"));
...@@ -2111,6 +2128,21 @@ public class MainFrame extends JFrame { ...@@ -2111,6 +2128,21 @@ public class MainFrame extends JFrame {
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
} }
} }
/**
* Launch the dialog panel to create constraints
*/
protected void createConstraints() {
try {
ConstraintsSelectionDialog dialog = new ConstraintsSelectionDialog();
dialog.setImage(this.currentImageSession.getRawImage());
MainFrame.getInstance().getDesktop().addFrame(dialog);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, Messages.getString("MainFrame.128"), Messages.getString("MainFrame.129"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.WARNING_MESSAGE);
}
}
public void doAfterSegmentation(Segmentation seg, RawImage img) { public void doAfterSegmentation(Segmentation seg, RawImage img) {
// fenetre et panel du resultat // fenetre et panel du resultat
...@@ -3271,8 +3303,15 @@ public class MainFrame extends JFrame { ...@@ -3271,8 +3303,15 @@ public class MainFrame extends JFrame {
} }
}); });
tab.setHighlightedStateTitleComponent(closeButton); tab.setHighlightedStateTitleComponent(closeButton);
MainFrame.getInstance().getCurrentSession().getWorkSpace().addTab(tab); //MainFrame.getInstance().getCurrentImageSession().getWorkSpace().addTab(tab);
final TitledTab tabSegmentation = TabFactory.createTitledTab(
"Segementation",
new ImageIcon(getClass().getResource(
"/icons/outlines.png")),
sp);
// mWorskSpace = new JPanel(new BorderLayout());
this.currentImageSession.getWorkSpace().addTab(tabSegmentation);
this.currentImageSession.getWorkSpace().setSelectedTab(this.currentImageSession.getWorkSpace() this.currentImageSession.getWorkSpace().setSelectedTab(this.currentImageSession.getWorkSpace()
.getTabAt(this.currentImageSession.getWorkSpace().getTabCount() - 1)); .getTabAt(this.currentImageSession.getWorkSpace().getTabCount() - 1));
} }
......
...@@ -612,7 +612,7 @@ public class PanneauAffichageParam extends JPanel { ...@@ -612,7 +612,7 @@ public class PanneauAffichageParam extends JPanel {
//GridBagLayout layout = new GridBagLayout(); //GridBagLayout layout = new GridBagLayout();
//this.setLayout(layout); //this.setLayout(layout);
for (int index = 0; index < _attributes.getLength(); index++) { // on parcourt la liste des attributs for (int index = 0; index < _attributes.getLength(); index++) { // on parcourt la liste des attributs
String attribut = _attributes.getLocalName(index); String attribut = _attributes.getQName(index);
switch (attribut) switch (attribut)
{ {
case "methode": case "methode":
......
...@@ -26,6 +26,7 @@ import javax.swing.JSpinner; ...@@ -26,6 +26,7 @@ import javax.swing.JSpinner;
import javax.swing.JTextField; import javax.swing.JTextField;
import mustic.gui.DesktopFrame; import mustic.gui.DesktopFrame;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame; import mustic.gui.MainFrame;
import mustic.io.RawImage; import mustic.io.RawImage;
...@@ -55,8 +56,8 @@ public class ImageToArffDialog extends JInternalFrame { ...@@ -55,8 +56,8 @@ public class ImageToArffDialog extends JInternalFrame {
JPanel panelData = new JPanel(new GridLayout(4, 2)); JPanel panelData = new JPanel(new GridLayout(4, 2));
panelData.add(new JLabel(Messages.getString("ImageToArffDialog.0"))); //$NON-NLS-1$ panelData.add(new JLabel(Messages.getString("ImageToArffDialog.0"))); //$NON-NLS-1$
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop() ImageDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames(); .getAllImageDesktopFrames();
int nbSession = desktopFrames.length; int nbSession = desktopFrames.length;
for (int i = 0; i < nbSession; i++) { for (int i = 0; i < nbSession; i++) {
String path = desktopFrames[i].getImageSession().getRawImage() String path = desktopFrames[i].getImageSession().getRawImage()
...@@ -79,12 +80,12 @@ public class ImageToArffDialog extends JInternalFrame { ...@@ -79,12 +80,12 @@ public class ImageToArffDialog extends JInternalFrame {
if (ImageToArffDialog.this.comboImage.getSelectedIndex() == ImageToArffDialog.this.comboImage if (ImageToArffDialog.this.comboImage.getSelectedIndex() == ImageToArffDialog.this.comboImage
.getItemCount() - 1) { .getItemCount() - 1) {
int nbSession = MainFrame.getInstance().getDesktop() int nbSession = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames().length; .getAllImageDesktopFrames().length;
System.out.println(Messages.getString("ImageToArffDialog.6") //$NON-NLS-1$ System.out.println(Messages.getString("ImageToArffDialog.6") //$NON-NLS-1$
+ nbSession); + nbSession);
MainFrame.getInstance().openNewFile(); MainFrame.getInstance().openNewFile();
DesktopFrame[] desktopFrames = MainFrame.getInstance() ImageDesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllDesktopFrames(); .getDesktop().getAllImageDesktopFrames();
System.out.println(Messages.getString("ImageToArffDialog.7") //$NON-NLS-1$ System.out.println(Messages.getString("ImageToArffDialog.7") //$NON-NLS-1$
+ desktopFrames.length); + desktopFrames.length);
if (MainFrame.getInstance().getDesktop() if (MainFrame.getInstance().getDesktop()
...@@ -123,8 +124,8 @@ public class ImageToArffDialog extends JInternalFrame { ...@@ -123,8 +124,8 @@ public class ImageToArffDialog extends JInternalFrame {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
DesktopFrame[] desktopFrames = MainFrame.getInstance() ImageDesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllDesktopFrames(); .getDesktop().getAllImageDesktopFrames();
int nbSessions = desktopFrames.length; int nbSessions = desktopFrames.length;
if (nbSessions > 0) { if (nbSessions > 0) {
String path = desktopFrames[comboImage.getSelectedIndex()] String path = desktopFrames[comboImage.getSelectedIndex()]
...@@ -191,8 +192,8 @@ public class ImageToArffDialog extends JInternalFrame { ...@@ -191,8 +192,8 @@ public class ImageToArffDialog extends JInternalFrame {
* lance la création du fichier arff * lance la création du fichier arff
*/ */
protected void buttonOk_actionPerformed() { protected void buttonOk_actionPerformed() {
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop() ImageDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames(); .getAllImageDesktopFrames();
int nbSessions = desktopFrames.length; int nbSessions = desktopFrames.length;
if (nbSessions == 0) { if (nbSessions == 0) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
......
...@@ -26,7 +26,6 @@ import javax.swing.JScrollPane; ...@@ -26,7 +26,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import mustic.gui.MainFrame;
import mustic.gui.panels.classifier.ClassifierPanel; import mustic.gui.panels.classifier.ClassifierPanel;
import mustic.io.RawImage; import mustic.io.RawImage;
...@@ -194,8 +193,8 @@ public class KMeansSeedSelectionDialog extends JInternalFrame { ...@@ -194,8 +193,8 @@ public class KMeansSeedSelectionDialog extends JInternalFrame {
return this.pixels; return this.pixels;
} }
public void setImage(int selectedIndex) { public void setImage(RawImage img) {
RawImage img = MainFrame.getInstance().getDesktop().getAllImageDesktopFrames()[selectedIndex].getImageSession().getRawImage(); //RawImage img = MainFrame.getInstance().getDesktop().getAllImageDesktopFrames()[selectedIndex].getImageSession().getRawImage();
if (this.image!=null && !this.image.getPath().equals(img.getPath())) if (this.image!=null && !this.image.getPath().equals(img.getPath()))
this.clear(); this.clear();
this.width = img.getWidth(); this.width = img.getWidth();
...@@ -227,19 +226,31 @@ public class KMeansSeedSelectionDialog extends JInternalFrame { ...@@ -227,19 +226,31 @@ public class KMeansSeedSelectionDialog extends JInternalFrame {
* the data values must be between 0 and 255 to be valid, * the data values must be between 0 and 255 to be valid,
* so let's convert them if needed * so let's convert them if needed
*/ */
for (int b = 0; b < img.getNbBands(); b++) {
int[] bands = new int[3];
bands[0] = img.r;
bands[1] = img.g;
bands[2] = img.b;
// we use at most 3 bands
int nbUsedBand = img.getNbBands();
if (nbUsedBand > 3) {
nbUsedBand = 3;
}
for (int b = 0; b < nbUsedBand; b++) {
int i = bands[b];
for (int x = 0; x < data[0].length; x++) { for (int x = 0; x < data[0].length; x++) {
for (int y = 0; y < data[0][0].length; y++) { for (int y = 0; y < data[0][0].length; y++) {
if (data[b][x][y] > 0) { if (data[i][x][y] > 0) {
// convert only if needed to avoid color deformation on 8 bits images // convert only if needed to avoid color deformation on 8 bits images
if (max[b] <= 255 && min[b] >= 0) { if (max[i] <= 255 && min[b] >= 0) {
dataView[b][x][y] = (short) data[b][x][y]; dataView[i][x][y] = (short) data[b][x][y];
} else { } else {
dataView[b][x][y] = (short) (255 dataView[i][x][y] = (short) (255
* (data[b][x][y] - min[b]) / (max[b] - min[b])); * (data[i][x][y] - min[b]) / (max[b] - min[b]));
} }
} else { } else {
dataView[b][x][y] = 0; dataView[i][x][y] = 0;
} }
} }
} }
...@@ -249,8 +260,8 @@ public class KMeansSeedSelectionDialog extends JInternalFrame { ...@@ -249,8 +260,8 @@ public class KMeansSeedSelectionDialog extends JInternalFrame {
for (int y = 0; y < values[0].length; y++) { for (int y = 0; y < values[0].length; y++) {
int pixel = (int) values[x][y] << 24 int pixel = (int) values[x][y] << 24
| dataView[0][x][y] << 16 | dataView[1][x][y] << 8 | dataView[bands[0]][x][y] << 16 | dataView[bands[1]][x][y] << 8
| dataView[2][x][y]; | dataView[bands[2]][x][y];
imageSource.setRGB(x, y, pixel); imageSource.setRGB(x, y, pixel);
imagePoints.setRGB(x, y, pixel); imagePoints.setRGB(x, y, pixel);
......
...@@ -26,3 +26,21 @@ KMeansSeedSelectionDialog.29=Zoom level is at it's minimum... ...@@ -26,3 +26,21 @@ KMeansSeedSelectionDialog.29=Zoom level is at it's minimum...
KMeansSeedSelectionDialog.5=OK KMeansSeedSelectionDialog.5=OK
KMeansSeedSelectionDialog.7=Image KMeansSeedSelectionDialog.7=Image
KMeansSeedSelectionDialog.8=K-means seeds KMeansSeedSelectionDialog.8=K-means seeds
ConstraintsSelectionDialog.0=Information
ConstraintsSelectionDialog.10=Must-Link
ConstraintsSelectionDialog.11=Cannot-Link
ConstraintsSelectionDialog.12=Label
ConstraintsSelectionDialog.13=Add
ConstraintsSelectionDialog.15=pixel
ConstraintsSelectionDialog.21=Apply
ConstraintsSelectionDialog.22=Refresh
ConstraintsSelectionDialog.29=Zoom level at minimum ...
ConstraintsSelectionDialog.30=index(es)
ConstraintsSelectionDialog.31=Remove
ConstraintsSelectionDialog.50=OK
ConstraintsSelectionDialog.51=Import
ConstraintsSelectionDialog.52=Export
ConstraintsSelectionDialog.53=Unknown file format for import
ConstraintsSelectionDialog.54=Error
ConstraintsSelectionDialog.7=Image
ConstraintsSelectionDialog.8=Constraint selection
...@@ -26,3 +26,21 @@ KMeansSeedSelectionDialog.29=Niveau de zoom est ...@@ -26,3 +26,21 @@ KMeansSeedSelectionDialog.29=Niveau de zoom est
KMeansSeedSelectionDialog.5=OK KMeansSeedSelectionDialog.5=OK
KMeansSeedSelectionDialog.7=Image KMeansSeedSelectionDialog.7=Image
KMeansSeedSelectionDialog.8=K-moyens graines KMeansSeedSelectionDialog.8=K-moyens graines
ConstraintsSelectionDialog.0=Information
ConstraintsSelectionDialog.10=Must-Link
ConstraintsSelectionDialog.11=Cannot-Link
ConstraintsSelectionDialog.12=Label
ConstraintsSelectionDialog.13=Ajouter
ConstraintsSelectionDialog.15=pixel
ConstraintsSelectionDialog.21=Appliquer
ConstraintsSelectionDialog.22=Rafraichir
ConstraintsSelectionDialog.29=Niveau de zoom est son minimum....
ConstraintsSelectionDialog.30=index(es)
ConstraintsSelectionDialog.31=Supr.
ConstraintsSelectionDialog.50=OK
ConstraintsSelectionDialog.51=Importer
ConstraintsSelectionDialog.52=Exporter
ConstraintsSelectionDialog.53=Format de fichier inconnu lors de l'import
ConstraintsSelectionDialog.54=Erreur
ConstraintsSelectionDialog.7=Image
ConstraintsSelectionDialog.8=Slection des contraintes
...@@ -158,6 +158,7 @@ MainFrame.28=Warning ...@@ -158,6 +158,7 @@ MainFrame.28=Warning
MainFrame.29=Apply mask... MainFrame.29=Apply mask...
MainFrame.3=nb sessions MainFrame.3=nb sessions
MainFrame.30=Create a sub-image... MainFrame.30=Create a sub-image...
MainFrame.301=Constraints
MainFrame.31=TransformationBmpToRoi... MainFrame.31=TransformationBmpToRoi...
MainFrame.32=Image/ARFF MainFrame.32=Image/ARFF
MainFrame.33=Image to ARFF... MainFrame.33=Image to ARFF...
......
...@@ -158,6 +158,7 @@ MainFrame.28=Avertissement ...@@ -158,6 +158,7 @@ MainFrame.28=Avertissement
MainFrame.29=Appliquer le masque... MainFrame.29=Appliquer le masque...
MainFrame.3=nb sessions MainFrame.3=nb sessions
MainFrame.30=Crer un sous-image... MainFrame.30=Crer un sous-image...
MainFrame.301=Contraintes
MainFrame.31=TransformationBmpEnRoi... MainFrame.31=TransformationBmpEnRoi...
MainFrame.32=Image/ARFF MainFrame.32=Image/ARFF
MainFrame.33=Image en ARFF... MainFrame.33=Image en ARFF...
......
...@@ -53,7 +53,7 @@ public class BirdViewPanel extends JPanel implements MouseListener, ...@@ -53,7 +53,7 @@ public class BirdViewPanel extends JPanel implements MouseListener,
private int action = BirdViewPanel.ACT_NONE; private int action = BirdViewPanel.ACT_NONE;
/** Blue value */ /** Blue value */
int b = 0; int b = 0;
private BufferedImage bImage; private BufferedImage bImage;
......
...@@ -146,14 +146,12 @@ public class ImagePanel extends JPanel { ...@@ -146,14 +146,12 @@ public class ImagePanel extends JPanel {
// this.mBirdPanel = new BirdViewPanel(aImage, this, this.mInfoPanel); // this.mBirdPanel = new BirdViewPanel(aImage, this, this.mInfoPanel);
final JPopupMenu popupMenu = new JPopupMenu(); final JPopupMenu popupMenu = new JPopupMenu();
JMenuItem menuClustering = new JMenuItem("Clustering...");
JMenuItem menuSeg = new JMenuItem("Segmentation..."); JMenuItem menuSeg = new JMenuItem("Segmentation...");
JMenuItem menuROI = new JMenuItem("ROI tools..."); JMenuItem menuROI = new JMenuItem("ROI tools...");
JMenuItem menuResult = new JMenuItem("Open result..."); JMenuItem menuResult = new JMenuItem("Open result...");
JMenuItem menuInfo = new JMenuItem("Image properties..."); JMenuItem menuInfo = new JMenuItem("Image properties...");
JMenuItem menuClose = new JMenuItem("Close"); JMenuItem menuClose = new JMenuItem("Close");
popupMenu.add(menuClustering);
popupMenu.add(menuSeg); popupMenu.add(menuSeg);
popupMenu.add(menuROI); popupMenu.add(menuROI);
popupMenu.add(menuResult); popupMenu.add(menuResult);
...@@ -179,24 +177,6 @@ public class ImagePanel extends JPanel { ...@@ -179,24 +177,6 @@ public class ImagePanel extends JPanel {
} }
}); });
menuClustering.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!ClassificationFrame.isCreated()) {
setCursor(new Cursor(Cursor.WAIT_CURSOR));
ClassificationFrame cf = ClassificationFrame.getInstance();
MainFrame.getInstance().getDesktop().addFrame(cf);
cf.moveToFront();
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
else {
// JOptionPane.showMessageDialog(null,
// "Une fenêtre est déjà ouverte !!!");
ClassificationFrame.getInstance().moveToFront();
}
}
});
menuSeg.addActionListener(new ActionListener() { menuSeg.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
......
...@@ -613,23 +613,23 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen ...@@ -613,23 +613,23 @@ 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();
//TODO remove comments to allow display again //TODO remove comments to allow display again
// this.colored = new BufferedImage(imgData.getResultWidth(), imgData.getResultHeight(), BufferedImage.TYPE_INT_RGB); this.colored = new BufferedImage(imgData.getResultWidth(), imgData.getResultHeight(), BufferedImage.TYPE_INT_RGB);
// if (imgData.getAssociatedImageSessions() != null && imgData.getAssociatedImageSessions().size() > 0) { if (imgData.getAssociatedImageSessions() != null && imgData.getAssociatedImageSessions().size() > 0) {
// this.setData(imgData.getAssociatedImageSessions().get(0).getImagePanel().getImage()); this.setData(imgData.getAssociatedImageSessions().get(0).getImagePanel().getImage());
// } else { } else {
// this.setData(new BufferedImage(imgData.getWidth(), imgData.getHeight(), BufferedImage.TYPE_INT_RGB)); this.setData(new BufferedImage(imgData.getWidth(), imgData.getHeight(), BufferedImage.TYPE_INT_RGB));
// } }
this.classPanel.addTreeSelectionListener(this); this.classPanel.addTreeSelectionListener(this);
setListener(); setListener();
setListenerImage(); setListenerImage();
if (MainFrame.DEBUG_MODE) if (MainFrame.DEBUG_MODE)
System.out.println("updateImageColors from irp"); System.out.println("updateImageColors from irp");
//TODO remove comments to allow display again //TODO remove comments to allow display again
// updateImageColors(); updateImageColors();
//
// if (imgData.getAssociatedImageSessions() != null && imgData.getAssociatedImageSessions().size() > 0) { if (imgData.getAssociatedImageSessions() != null && imgData.getAssociatedImageSessions().size() > 0) {
// imgData.getAssociatedImageSessions().get(0).getBirdViewPanel().syncImage(imgData.getAssociatedImageSessions().get(0)); imgData.getAssociatedImageSessions().get(0).getBirdViewPanel().syncImage(imgData.getAssociatedImageSessions().get(0));
// } }
this.resultTabbedPane.addTab("Image Result", this.panelImage); this.resultTabbedPane.addTab("Image Result", this.panelImage);
this.resultTabbedPane.setSelectedComponent(this.panelImage); this.resultTabbedPane.setSelectedComponent(this.panelImage);
...@@ -769,6 +769,8 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen ...@@ -769,6 +769,8 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));