Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 80bc5e7d authored by hvernier's avatar hvernier
Browse files

Maj Projection Panel

Affichage des centroide plusieur attribue simultané
Coube centroide  envelope avec export des valeur en csv et carac des cluster en csv.
Todo: mise à niveau des fonction pour tous les cas possible a faire ( au niveau des export)
parent 5386ad76
File added
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Mustic</groupId>
<artifactId>Mustic</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
</project>
\ No newline at end of file
......@@ -74,7 +74,6 @@ public class ClassificationResultFrame extends JFrame{
_tabbed = tabbed;
((ResultPanel)jComponent).isInFrame = true;
setVisible(true);
//addInternalFrameListener(this);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
......@@ -161,18 +160,9 @@ public class ClassificationResultFrame extends JFrame{
returnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//TabbedPanel tmp = new TabbedPanel();
//new Tab().add(_jComponent);
//tmp.setName(mTitle);
//tmp.add(_jComponent);
//Tab tmp = new Tab();
/*tmp.add("Tab 2", null, _jComponent,
"Does twice as much nothing");*/
System.out.println(_pere.getTabCount());
_pere.addTab((Tab) _jComponent);
//addTab("Tab 2", null, _jComponent,
// "Does twice as much nothing");
jFrame.dispose();
}
......@@ -190,7 +180,6 @@ public class ClassificationResultFrame extends JFrame{
_pere = pere;
tmpmp = index;
setVisible(true);
//addInternalFrameListener(this);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
......@@ -200,19 +189,8 @@ public class ClassificationResultFrame extends JFrame{
returnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//TabbedPanel tmp = new TabbedPanel();
//new Tab().add(_jComponent);
//tmp.setName(mTitle);
//tmp.add(_jComponent);
//Tab tmp = new Tab();
/*tmp.add("Tab 2", null, _jComponent,
"Does twice as much nothing");*/
System.out.println(_pere.getTabCount());
//_pere.addTab((Tab) _jComponent);
//((TabbedPanel)_pere.getTabAt(index).getContentComponent()).getTabAt(0).add(_jComponent);
_pere.getTabAt(index).setVisible(true);
//addTab("Tab 2", null, _jComponent,
// "Does twice as much nothing");
jFrame.dispose();
}
......
......@@ -3,6 +3,7 @@ package mustic.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import java.util.List;
import java.util.Vector;
import javax.swing.Icon;
......@@ -14,12 +15,14 @@ import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import jcl.data.Data;
import jcl.data.DataObject;
import mustic.gui.panels.BirdViewPanel;
import mustic.gui.panels.ImageResultPanel;
import mustic.gui.panels.classifier.ClassifierPanel;
import mustic.gui.panels.data.DataPanel;
import mustic.io.ImageData;
import mustic.models.gui.ClassificationModel;
import mustic.models.gui.charts.MethodeResult;
import mustic.models.gui.panels.ResultPanel;
import mustic.utils.image.ImageDisplayer;
import net.infonode.tabbedpanel.Tab;
......@@ -72,7 +75,29 @@ public class DataSession {
/** save the number of clustering already done a the overall sessions */
public static int nbClustering = 1;
/******************************************************************/
double[][] SimilarityDistanceMatrix ;
private MethodeResult[] CoordinatesTab2D = new MethodeResult[3];
private MethodeResult[] CoordinatesTab3D = new MethodeResult[3];
/******************************************************************/
/******************************************************************/
public double[][] getSimilarityDistanceMatrix() {
return SimilarityDistanceMatrix;
}
public double[][] getNormalizedSimilarityDistanceMatrix() {
return Normaliser(SimilarityDistanceMatrix);
}
public void setSimilarityDistanceMatrix(double[][] similarityDistanceMatrix) {
SimilarityDistanceMatrix = similarityDistanceMatrix;
}
/******************************************************************/
/**
* Constructor
......@@ -84,7 +109,12 @@ public class DataSession {
this.data.setIdObjectIfNeed();
this.mTitle = "Data - "+data.getDataName();
/********************************************************/
// MatrixDist(this.data);
/*********************************************************/
this.dataPanel = new DataPanel(data,this);
this.mWorskSpace.addTab(dataPanel.getDataTabPanel());
this.mWorskSpace.addTabListener(new TabListener() {
......@@ -371,4 +401,69 @@ public class DataSession {
}
}
/**************************************************************************************/
public void MatrixDist(Data data) {
List <DataObject> obj = data.getViewDataObjects();
System.out.println("Total memory (bytes): " +
Runtime.getRuntime().totalMemory()+" "+obj.size()+"\n");
SimilarityDistanceMatrix= new double [obj.size()][obj.size()];
for(int i =0 ; i<obj.size() ; i++){
for(int j =0 ; j< obj.size() ; j++){
SimilarityDistanceMatrix[i][j] = obj.get(i).distance(obj.get(j), data.getDistanceModel(),
data.getDistanceParameters()[0]);
if (SimilarityDistanceMatrix[i][j] <0) {
throw new IllegalArgumentException("The disimilarity matrix is not positif.");
}
if(i==j && SimilarityDistanceMatrix[i][j] != 0 ) {
throw new IllegalArgumentException("The matrix diagonal values are not zeros.");
}
}
}
for(int i =0 ; i<obj.size() ; i++){
for(int j =0 ; j< obj.size() ; j++){
if (i!=j && SimilarityDistanceMatrix[i][j] != SimilarityDistanceMatrix[j][i]) {
throw new IllegalArgumentException("The disimilarity matrix is not symetric.");
}
}
}
}
public double[][] Normaliser(double[][] matrice){
double[][] z = new double[matrice.length][matrice.length];
//recherche du min et du max
double max=matrice[0][0];
double min = max;
for(int i=0;i<matrice.length;i++) {
for(int j=0;j<matrice.length;j++) {
if(matrice[i][j]>max) max=matrice[i][j];
if(matrice[i][j]<min) min=matrice[i][j];
}
}
//normalisation des valeurs
double k=max-min;
for(int i=0;i<matrice.length;i++) {
for(int j=0;j<matrice.length;j++) {
z[i][j]= (matrice[i][j] - min)/k;
}
}
return z;
}
}
\ No newline at end of file
......@@ -60,6 +60,8 @@ import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import org.rosuda.JRI.Rengine;
import jcl.Classification;
import jcl.clustering.Cluster;
import jcl.clustering.ClusteringResult;
......@@ -123,6 +125,11 @@ public class MainFrame extends JFrame {
/*
* temporary files directory Always check the directory existence or create it
*/
/****************************************************/
public static Rengine engine ;
/*******************************************************/
private static final String TMP_DIR_PATH = "temporary";
public static final File TMP_DIR_FILE = new File(TMP_DIR_PATH);
/** l'instance unique de ce singleton */
......@@ -239,7 +246,15 @@ public class MainFrame extends JFrame {
*/
public MainFrame() {
super();
TMP_DIR_FILE.mkdir();
/*String[] paths = System.getProperty("java.library.path").split(";");
for (String path : paths) {
File file = new File(path + "/jri.dll");
}
System.loadLibrary("jri");*/
/***************************************************************/
//engine = new Rengine(new String[]{"--no-save"},false,null);
/*******************************************************/
//TMP_DIR_FILE.mkdir();
this.setTitle("MultiCube 0.9"); //$NON-NLS-1$
this.setIconImage(new ImageIcon(this.getClass().getResource("/icons/musticFond.png")).getImage());
this.setSize(1040, 768);
......@@ -2172,18 +2187,15 @@ public class MainFrame extends JFrame {
DataSession session = new DataSession(data);
listDataSession.add(session);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(session);
this.mDataTreeModel.insertNodeInto(newNode, this.mDataProjectNode, this.mDataProjectNode.getChildCount());
final TreePath pates = new TreePath(newNode.getPath());
this.mDataProjectTree.setSelectionPath(pates);
// this.currentDataSession = session;
//this.mDataProjectTree.setSelectionPath(pates);
this.currentDataSession = session;
long endTime = System.currentTimeMillis();
actionArffData = true;
actionOGRData = true;
setEnabledMenu();
if (MainFrame.DEBUG_MODE)
System.out.println(Messages.getString("MainFrame.74") //$NON-NLS-1$
+ ((endTime - startTime)));
......
......@@ -22,6 +22,7 @@ import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import jcl.data.Data;
......@@ -57,7 +58,11 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
private File[] filesArray = null;
private JCheckBox seqMode = new JCheckBox("SeqMode");
private JCheckBox seqMode1 = new JCheckBox("SeqMode");
private JRadioButton seqMode = new JRadioButton("MonoSeq");
private JRadioButton multiSeq = new JRadioButton("MultiSeq");
public CSVToDataDialog() {
super();
......@@ -80,9 +85,9 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
});
ButtonGroup bg = new ButtonGroup();
JCheckBox multiMode = new JCheckBox("MultiMode");
//bg.add(multiMode);
//bg.add(seqMode);
multiSeq.setSelected(true);
bg.add(multiSeq);
bg.add(seqMode);
JButton buttonBrowse = new JButton("..."); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
......@@ -129,8 +134,8 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
});
pInpout.add(buttonBrowse, BorderLayout.EAST);
JPanel p = new JPanel();
p.add(multiSeq);
p.add(seqMode);
p.add(multiMode);
pInpout.add(p, BorderLayout.SOUTH);
panel.add(pInpout);
......@@ -154,7 +159,6 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
@Override
public void actionPerformed(ActionEvent e) {
if(multiMode.isSelected()) {
System.out.println(filesArray.length);
buttonOk_actionPerformed(filesArray);
}else {
buttonOk_actionPerformed();
......@@ -266,7 +270,9 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
countElem++;
}
}
object.setAttribute(numAttr,new AttributeSequence(tmpAttr));
AttributeSequence attrSeq = new AttributeSequence(tmpAttr);
attrSeq.nbValManquante = countNull;
object.setAttribute(numAttr,attrSeq);
}
......@@ -300,7 +306,6 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
else {
String tmpS = rowScanner.next();
if(tmpS.length()!=0) {
System.out.println(tmpS);
tabValue[conteur-2] = Double.parseDouble(tmpS);
}else {
double test = Double.NaN;
......@@ -328,7 +333,6 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
String[] attrNames = new String[attributeNames.size()-2];
for(int i=2 ; i<attributeNames.size();i++) {
attrNames[i-2] = attributeNames.get(i);
System.out.println(attrNames[i-2]);
}
if(seqMode.isSelected()) {
data.setAttributesNames(attrNames);
......@@ -394,7 +398,6 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
double[][] seq = new double[line.size()][];
for (int i = 0 ; i < line.size() ; i++) {
seq[i] = new double[1];
System.out.println(line.get(i));
seq[i][0] = Double.parseDouble(line.get(i));
}
......@@ -536,10 +539,8 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
for(int i=0 ; i<files.length ; i++) {
if(haveDate[i]) {
String[] attrNames = new String[allName[i].size()-2];
System.out.println(allName[i].size());
for(int j=2 ; j<allName[i].size();j++) {
attrNames[j-2] = allName[i].get(j);
System.out.println(attrNames[j-2]);
}
data.setAttributesNames(attrNames);
data.setSubAttributesNames(attrNames);
......
......@@ -911,7 +911,6 @@ public class ClassifierPanel extends JPanel {
}
}
System.out.println(classification);
return classification;
}
......@@ -939,7 +938,6 @@ public class ClassifierPanel extends JPanel {
}
}
System.out.println("yolo");
return nameData;
}
......
......@@ -158,8 +158,8 @@ public class DataConstructPanel extends JPanel implements ToUpdateObject {
.generateDefaultDistanceParameters(1, distModel, data);
data.setDistanceModel(distModel, distParameters);
MainFrame.getInstance().createDataSession(data);
DataConstructFrame.getInstance().updateDataConstructPanel();
DataConstructFrame.getInstance().dispose();
//DataConstructFrame.getInstance().updateDataConstructPanel();
//DataConstructFrame.getInstance().dispose();
}
}.start();
}
......
......@@ -150,7 +150,7 @@ public class DataPanel extends JPanel implements ChangeListener {
/* On garde une trace des donnees */
this.data = _data;
this.classifyButton.setFont(classifyButton.getFont().deriveFont(Font.BOLD));
JPanel container = buildBody();
// JScrollPane sp = new JScrollPane(container);
JPanel sp = container;//no scroll bars for better visibility
......@@ -166,7 +166,7 @@ public class DataPanel extends JPanel implements ChangeListener {
dataPane);
tabPanel.setFocusableComponent(null);
/* Selectionne par defaut le premier attribut */
this.attrTable.getSelectionModel().setLeadSelectionIndex(0);
......@@ -408,7 +408,7 @@ public class DataPanel extends JPanel implements ChangeListener {
this.viewDataButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPanel test = new JPanel();
/*JPanel test = new JPanel();
pythonProcessing.initOngletVisualisation(test, dataPanel);
ClarffxDialog viewDataDialog = new ClarffxDialog(test
,
......@@ -418,8 +418,8 @@ public class DataPanel extends JPanel implements ChangeListener {
RefineryUtilities.centerFrameOnScreen(viewDataDialog);
// @todo
viewDataDialog.setTitle("Data View");
viewDataDialog.setVisible(true);
/*ClarffxDialog viewDataDialog = new ClarffxDialog(
viewDataDialog.setVisible(true);*/
ClarffxDialog viewDataDialog = new ClarffxDialog(
new DataViewPanel(DataPanel.this.data,
DataPanel.this.nbobjLabel),
ClarffxDialog.CLOSE_BUTTONS);
......@@ -428,7 +428,7 @@ public class DataPanel extends JPanel implements ChangeListener {
RefineryUtilities.centerFrameOnScreen(viewDataDialog);
// @todo
viewDataDialog.setTitle("Data View");
viewDataDialog.setVisible(true);*/
viewDataDialog.setVisible(true);
}
});
......
......@@ -157,10 +157,12 @@ public abstract class ClassificationModel extends JPanel {
@Override
public void tabDropped(TabDragEvent arg0) {
}
@Override
public void tabDragged(TabDragEvent arg0) {
}
@Override
......@@ -497,10 +499,17 @@ public abstract class ClassificationModel extends JPanel {
for(int i=0 ; i<resultPanels.size();i++) {
if(result == resultPanels.get(i)){
if(tabbedPane.getTabAt(0).getContentComponent() instanceof HybridClassificationMonitor) {
if(resultPanels.size()<2) {
tabbedPane.insertTab(new Tab(), 0);
}
((HybridClassificationMonitor)tabbedPane.getTabAt(0).getContentComponent()).tabbedPane.removeTab(
((HybridClassificationMonitor)tabbedPane.getTabAt(0).getContentComponent()).tabbedPane.getTabAt(i+2-countResultToFrame));
}else {
tabbedPane.removeTab(tabbedPane.getTabAt(i-countResultToFrame));
if(resultPanels.size()<2) {
tabbedPane.addTab (new TitledTab("tab pour pas fermé l onglet", null, null, new JPanel()));
}
tabbedPane.removeTab(tabbedPane.getTabAt(i-countResultToFrame));
}
}
}
......
package mustic.models.gui.charts;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.util.List;
import javax.swing.JPanel;
import jcl.Classification;
import jcl.clustering.ClusteringResult;
import jcl.data.Data;
import jcl.data.DataObject;
public class AxisHeatmap extends JPanel{
ClusteringResult result;
int axis ;
int size;
int [] ids;
int[] clusterMapEchantillon = null;
int[] pos = null;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int largeur = (int)(((this.getWidth()-(size-1))/size));
int hauteur = (int)(((this.getHeight()-(size-1))/size));
int clusterMap[] = this.result.getClusterMap();
int milieu = (int)(largeur/2) + 5;
int milieu2 = (int)(hauteur/2) + 5;
// System.out.println(hauteur);
Font font;
if(axis==0) {
if(largeur>=13) {
milieu = (int)(largeur/2) + 8;
// milieu = (int)(largeur/2) + 6;
font = new Font("default",Font.PLAIN,15);
}
else if(largeur>=12) {
milieu = (int)(largeur/2) + 8;
// milieu = (int)(largeur/2) + 5;
font = new Font("default",Font.PLAIN,14);
}
else if(largeur>=11){
milieu = (int)(largeur/2) + 7;
// milieu = (int)(largeur/2) + 5;
font = new Font("default",Font.PLAIN,13);
}else if(largeur>=10){
milieu = (int)(largeur/2) + 7;
// milieu = (int)(largeur/2) + 4;
font = new Font("default",Font.PLAIN,12);
}
else if(largeur>=8) {
milieu = (int)(largeur/2) + 6;
// milieu = (int)(largeur/2) + 4;
font = new Font("default",Font.PLAIN,11);
}
else {
milieu = (int)(largeur/2) + 5;
//milieu = (int)(largeur/2) + 4;
font = new Font("default",Font.PLAIN,10);
}
AffineTransform affineTransform = new AffineTransform();
affineTransform.rotate(Math.toRadians(-90), 0, 0);
Font rotatedFont = font.deriveFont(affineTransform);
g.setFont(rotatedFont);
List<DataObject> data = result.getData().getViewDataObjects();
if(ids==null) {
for (int i = 0; i < size; i++) {
if(pos == null) {
g.setColor(result.getCluster(clusterMap[i]).getColor());
g.drawString(Integer.toString((i+1)), i*largeur+i+milieu,25);
}else {
g.setColor(result.getCluster(clusterMapEchantillon[i]).getColor());
g.drawString(Integer.toString((data.get(pos[i]).getId())), i*largeur+i+milieu,30);
}
}
}
else {
for (int i = 0; i < size; i++) {
int id = ids[i];
if(pos == null) {
g.setColor(result.getCluster(clusterMap[id]).getColor());
g.drawString(Integer.toString((id+1)), i*largeur+i+milieu,25);
}else {
g.setColor(result.getCluster(clusterMapEchantillon[i]).getColor());
g.drawString(Integer.toString((data.get(pos[i]).getId())), i*largeur+i+milieu,30);
}
}
}
}
else {
if(hauteur>=13) {
milieu = (int)(hauteur/2) + 6;
font = new Font("default",Font.PLAIN,15);
}
else if(hauteur>=12) {
milieu = (int)(hauteur/2) + 5;
font = new Font("default",Font.PLAIN,14);
}
else if(hauteur>=11){
milieu = (int)(hauteur/2) + 5;