Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MultiCube
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lafabregue
MultiCube
Commits
f7d1e6a3
Commit
f7d1e6a3
authored
Apr 20, 2017
by
lafabregue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Import of clustering from KMeans
parent
dd622006
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
414 additions
and
125 deletions
+414
-125
src/mustic/gui/ImageSession.java
src/mustic/gui/ImageSession.java
+1
-1
src/mustic/gui/panels/classifier/ClassifierPanel.java
src/mustic/gui/panels/classifier/ClassifierPanel.java
+151
-69
src/mustic/gui/panels/classifier/components/ApproachSelectionPanel.java
.../panels/classifier/components/ApproachSelectionPanel.java
+149
-32
src/mustic/gui/panels/classifier/messages_en.properties
src/mustic/gui/panels/classifier/messages_en.properties
+4
-0
src/mustic/gui/panels/classifier/messages_fr.properties
src/mustic/gui/panels/classifier/messages_fr.properties
+22
-18
src/mustic/utils/io/WriteDistancesPath.java
src/mustic/utils/io/WriteDistancesPath.java
+5
-5
src/mustic/utils/io/dataExchange/DataArffExchange.java
src/mustic/utils/io/dataExchange/DataArffExchange.java
+82
-0
No files found.
src/mustic/gui/ImageSession.java
View file @
f7d1e6a3
...
...
@@ -66,7 +66,7 @@ public class ImageSession {
public
SSHParameters
sshparameters
=
null
;
/** enable the image to display the image or not, for a memory usage matter */
private
boolean
displayEnable
=
fals
e
;
private
boolean
displayEnable
=
tru
e
;
/**
* @param aImage
...
...
src/mustic/gui/panels/classifier/ClassifierPanel.java
View file @
f7d1e6a3
...
...
@@ -15,8 +15,8 @@ import javax.xml.parsers.SAXParser;
import
javax.xml.parsers.SAXParserFactory
;
import
jcl.Classification
;
import
jcl.clustering.constraints.Constraint
;
import
jcl.data.Data
;
import
jcl.data.DataObject
;
import
jcl.data.attribute.AttributeMultiDimSequence
;
import
jcl.io.arff.ClassificationParametersIO
;
import
jcl.jcld.RmiServer
;
...
...
@@ -28,6 +28,7 @@ import jcl.learning.methods.monostrategy.cobweb.ParametersCobweb;
import
jcl.learning.methods.monostrategy.em.ParametersEM
;
import
jcl.learning.methods.monostrategy.evidence.ParametersEvidence
;
import
jcl.learning.methods.monostrategy.gng.ParametersGNG
;
import
jcl.learning.methods.monostrategy.kmeans.ClassifierKmeans
;
import
jcl.learning.methods.monostrategy.kmeans.ParametersKmeans
;
import
jcl.learning.methods.monostrategy.kmeans.otb.ParametersOTBKmeans
;
import
jcl.learning.methods.monostrategy.perceptron.ParametersPerceptron
;
...
...
@@ -35,11 +36,8 @@ import jcl.learning.methods.monostrategy.random.ParametersRandom;
import
jcl.learning.methods.monostrategy.som.ParametersSOM
;
import
jcl.weights.ClassificationWeights
;
import
jcl.weights.GlobalWeights
;
import
loci.formats.FormatException
;
import
mustic.gui.*
;
import
mustic.gui.dialog.SequenceDialog
;
import
mustic.gui.dialog.classifier.AttributeSelectionDialog
;
import
mustic.gui.dialog.classifier.ConstraintsSelectionDialog
;
import
mustic.gui.dialog.classifier.KMeansSeedSelectionDialog
;
import
mustic.gui.panels.classifier.components.*
;
import
mustic.io.ImageData
;
...
...
@@ -48,6 +46,7 @@ import mustic.models.gui.dialogs.ServerParametersDialog;
import
mustic.models.gui.panels.AttributeSelectionPanel
;
import
mustic.models.gui.panels.HybridClassificationAdvancedParametersPanel
;
import
mustic.models.thread.ClassificationThread
;
import
mustic.utils.io.dataExchange.DataArffExchange
;
import
com.l2fprod.common.swing.JTaskPane
;
import
com.l2fprod.common.swing.JTaskPaneGroup
;
...
...
@@ -270,13 +269,11 @@ public class ClassifierPanel extends JPanel {
buttonSeed
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
/**
* Gestion du fait que la fonction sequence est dans la liste
*/
// Gestion du fait que la fonction sequence est dans la liste
Data
dataSelected
=
getSessionsIndexes
()[
approachPanel
.
getDataComboBox
()
.
getSelectedIndex
()].
getDataSession
().
getData
();
if
(!(
dataSelected
instanceof
ImageData
))
{
System
.
err
.
println
(
"This action is only supported on image represnetation data !"
);
System
.
err
.
println
(
"This action is only supported on image represnetation data !"
);
//$NON-NLS-1$
return
;
}
...
...
@@ -534,34 +531,11 @@ public class ClassifierPanel extends JPanel {
switch
(
choice
)
{
// TODO multidata a faire
case
SelectionModel
.
MONO_STRATEGY_APPROACH
:
{
// if (data == null) {
// JOptionPane.showMessageDialog(this, Messages.getString("ClassifierPanel.47"), Messages.getString("ClassifierPanel.48"), //$NON-NLS-1$
// JOptionPane.ERROR_MESSAGE);
// }
// else {
// int index = approachPanel.getSingleDataComboBox().getSelectedIndex();
// if (index < nbSessions && approachPanel.getMonodataRadioButton().isSelected()) {
// imgSession = desktopFrames[approachPanel.getSingleDataComboBox().getSelectedIndex()].getImageSession();
// if (data == null)
// data = imgSession.getImageData();
// }
// else if (approachPanel.getMultidateRadioButton().isSelected()) {
// int firstIndex = this.sequenceDialog.getFirstIndex();
// if (firstIndex >= 0) {
// imgSession = desktopFrames[firstIndex].getImageSession();
// data = imgSession.getImageData();
// try {
// data.setSequence(this.sequenceDialog.getSequenceData());
// } catch (FormatException e) {
// e.printStackTrace();
// }
// }
// }
if
(
dataSession
.
getData
()
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.49"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.50"
),
JOptionPane
.
ERROR_MESSAGE
);
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.50"
),
//$NON-NLS-1$
JOptionPane
.
ERROR_MESSAGE
);
//$NON-NLS-1$
}
else
{
LearningParameters
lp
=
getParameters
(
dataSession
.
getData
());
...
...
@@ -570,18 +544,21 @@ public class ClassifierPanel extends JPanel {
&&
matchingStr
.
equalsIgnoreCase
(
lp
.
getLearningMethodName
()))
{
System
.
out
.
println
(
Messages
.
getString
(
"ClassifierPanel.52"
));
//$NON-NLS-1$
if
(
checkboxSeeds
.
isSelected
())
{
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
().
getSequence
(),
seedPanel
.
getSeeds
());
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
().
getSequence
(),
seedPanel
.
getSeeds
());
}
else
{
classification
=
new
SingleClassification
(
dataSession
.
getData
().
getSequence
(),
lp
);
}
}
else
if
(
matchingStr
.
equalsIgnoreCase
(
lp
.
getLearningMethodName
())
&&
this
.
checkboxSeeds
.
isSelected
())
{
else
if
(
matchingStr
.
equalsIgnoreCase
(
lp
.
getLearningMethodName
())
&&
this
.
checkboxSeeds
.
isSelected
())
{
// if (this.isTabbed){
// data = MainFrame.getInstance().getCurrentSession()
// .getData();}
lp
=
getParameters
(
dataSession
.
getData
());
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
(),
this
.
seedPanel
.
getSeeds
());
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
(),
this
.
seedPanel
.
getSeeds
());
}
else
{
// if (this.isTabbed)
...
...
@@ -697,6 +674,25 @@ public class ClassifierPanel extends JPanel {
break
;
}
case
SelectionModel
.
IMPORT_APPROACH
:
{
if
(
nbSessions
==
0
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.61"
),
Messages
.
getString
(
"ClassifierPanel.62"
),
//$NON-NLS-1$ //$NON-NLS-2$
JOptionPane
.
ERROR_MESSAGE
);
}
else
{
if
(
dataSession
.
getData
()
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.63"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.64"
),
JOptionPane
.
ERROR_MESSAGE
);
//$NON-NLS-1$
}
else
{
LearningParameters
lp
=
getParameters
(
dataSession
.
getData
());
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
(),
lp
.
getSamples
());
}
}
break
;
}
default
:
System
.
out
.
println
(
Messages
.
getString
(
"ClassifierPanel.71"
));
//$NON-NLS-1$
}
...
...
@@ -826,10 +822,6 @@ public class ClassifierPanel extends JPanel {
*/
public
Classification
getClassification
()
{
Classification
classification
=
null
;
ImageSession
imgSession
=
null
;
DesktopFrame
[]
desktopFrames
=
MainFrame
.
getInstance
().
getDesktop
().
getAllDesktopFrames
();
int
nbSessions
=
desktopFrames
.
length
;
int
choice
=
this
.
modele
.
getSelectedApproach
();
...
...
@@ -838,9 +830,9 @@ public class ClassifierPanel extends JPanel {
if
(
dataSession
.
getData
()
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.79"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.80"
),
JOptionPane
.
ERROR_MESSAGE
);
//$NON-NLS-1$
}
else
{
Messages
.
getString
(
"ClassifierPanel.80"
),
//$NON-NLS-1$
JOptionPane
.
ERROR_MESSAGE
);
}
else
{
LearningParameters
lp
=
getParameters
(
dataSession
.
getData
());
String
matchingStr
=
Messages
.
getString
(
"ClassifierPanel.81"
);
//$NON-NLS-1$
if
(
this
.
mdateClustering
&&
dataSession
.
getData
().
getSequence
()
!=
null
&&
...
...
@@ -888,7 +880,8 @@ public class ClassifierPanel extends JPanel {
case
SelectionModel
.
VOTING_APPROACH
:
{
if
(
dataSession
.
getData
()
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.93"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.94"
),
JOptionPane
.
ERROR_MESSAGE
);
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.94"
),
//$NON-NLS-1$
JOptionPane
.
ERROR_MESSAGE
);
}
else
{
classification
=
new
SingleClassification
(
dataSession
.
getData
(),
...
...
@@ -896,16 +889,25 @@ public class ClassifierPanel extends JPanel {
}
break
;
}
case
SelectionModel
.
IMPORT_APPROACH
:
{
if
(
dataSession
.
getData
()
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.79"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.80"
),
//$NON-NLS-1$
JOptionPane
.
ERROR_MESSAGE
);
}
else
{
LearningParameters
lp
=
getParameters
(
dataSession
.
getData
());
classification
=
new
SingleClassification
(
lp
,
dataSession
.
getData
(),
lp
.
getSamples
());
}
break
;
}
}
System
.
out
.
println
(
classification
);
return
classification
;
}
public
JInternalFrame
getContainer
()
{
return
this
.
container_
;
}
public
boolean
getIsSimpleAgent
()
{
return
this
.
isSimpleAgent
;
}
...
...
@@ -975,14 +977,55 @@ public class ClassifierPanel extends JPanel {
params
=
new
ParametersEvidence
(
nbClassifications
,
nbClustersMax
,
nbClustersMin
,
pourcentage
,
weights
);
return
params
;
}
if
(
choice
!=
SelectionModel
.
MONO_STRATEGY_APPROACH
)
{
if
(
choice
!=
SelectionModel
.
MONO_STRATEGY_APPROACH
&&
choice
!=
SelectionModel
.
IMPORT_APPROACH
)
{
System
.
out
.
println
(
Messages
.
getString
(
"ClassifierPanel.105"
));
//$NON-NLS-1$
return
null
;
}
int
selectedMethod
=
this
.
modele
.
getSelectedMethod
();
// import approaches
if
(
choice
==
SelectionModel
.
IMPORT_APPROACH
)
{
switch
(
selectedMethod
)
{
case
ClassifierUtils
.
IMPORT_KMEANS
:
{
String
filePath
=
((
JTextField
)
((
JPanel
)
comp
[
1
]).
getComponent
(
0
)).
getText
();
if
(
filePath
.
endsWith
(
".arff"
))
{
//$NON-NLS-1$
List
<
DataObject
>
result
=
DataArffExchange
.
arffToDataObjects
(
filePath
);
params
=
new
ParametersKmeans
(
result
.
size
(),
0
,
weights
);
params
.
setSamples
(
new
Vector
<
DataObject
>(
result
));
}
else
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.1041"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.1042"
),
//$NON-NLS-1$
JOptionPane
.
WARNING_MESSAGE
);
}
break
;
}
case
ClassifierUtils
.
IMPORT_CLUSTERING_TO_KMEANS
:
{
String
filePath
=
((
JTextField
)
((
JPanel
)
comp
[
1
]).
getComponent
(
0
)).
getText
();
if
(
filePath
.
endsWith
(
".arff"
))
{
//$NON-NLS-1$
int
[][]
clustering
=
DataArffExchange
.
arffToClusteredIndexes
(
filePath
);
List
<
DataObject
>
result
=
ClassifierKmeans
.
getCentroidsFromClustering
(
data
,
clustering
);
params
=
new
ParametersKmeans
(
result
.
size
(),
0
,
weights
);
params
.
setSamples
(
new
Vector
<
DataObject
>(
result
));
}
else
{
JOptionPane
.
showMessageDialog
(
this
,
Messages
.
getString
(
"ClassifierPanel.1041"
),
//$NON-NLS-1$
Messages
.
getString
(
"ClassifierPanel.1042"
),
//$NON-NLS-1$
JOptionPane
.
WARNING_MESSAGE
);
}
break
;
}
}
return
params
;
}
// monostrategic approaches
switch
(
selectedMethod
)
{
case
ClassifierUtils
.
KMEANS
:
{
...
...
@@ -1657,10 +1700,12 @@ public class ClassifierPanel extends JPanel {
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
false
);
this
.
votingDataComboBox
.
setEnabled
(
false
);
this
.
infosLabel
.
setText
(
"<html>"
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
SAMARAH
)
+
"</html>"
);
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
SAMARAH
,
false
)
+
"</html>"
);
//$NON-NLS-1$
updateUI
();
}
...
...
@@ -1674,10 +1719,12 @@ public class ClassifierPanel extends JPanel {
updateParams
(
this
.
maclawParametersPanel
,
null
);
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
false
);
this
.
votingDataComboBox
.
setEnabled
(
false
);
this
.
infosLabel
.
setText
(
"<html>"
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
MACLAW
)
+
"</html>"
);
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
MACLAW
,
false
)
+
"</html>"
);
//$NON-NLS-1$
updateUI
();
}
...
...
@@ -1688,10 +1735,12 @@ public class ClassifierPanel extends JPanel {
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
false
);
this
.
votingDataComboBox
.
setEnabled
(
false
);
this
.
infosLabel
.
setText
(
"<html>"
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
SAMARAHV4
)
+
"</html>"
);
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
SAMARAHV4
,
false
)
+
"</html>"
);
//$NON-NLS-1$
updateUI
();
}
...
...
@@ -1741,7 +1790,8 @@ public class ClassifierPanel extends JPanel {
public
void
setSingleClassificationPanel
()
{
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
true
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
false
);
this
.
votingDataComboBox
.
setEnabled
(
false
);
if
(!
this
.
isTabbed
)
{
...
...
@@ -1756,7 +1806,7 @@ public class ClassifierPanel extends JPanel {
this
.
approachPanel
.
getDataComboBox
().
updateUI
();
}
}
updateParams
(
this
.
approachPanel
.
getMethodComboBox
().
getSelectedIndex
());
updateParams
(
this
.
approachPanel
.
getMethodComboBox
().
getSelectedIndex
()
,
false
);
}
/**
...
...
@@ -1849,18 +1899,21 @@ public class ClassifierPanel extends JPanel {
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
false
);
this
.
votingDataComboBox
.
setEnabled
(
true
);
updateParamsVoting
();
}
public
void
setImportClassificationPanel
()
{
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
true
);
this
.
approachPanel
.
getMethodComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
false
);
this
.
approachPanel
.
getImportMethodComboBox
().
setEnabled
(
true
);
this
.
approachPanel
.
getImportDataComboBox
().
setEnabled
(
true
);
this
.
votingDataComboBox
.
setEnabled
(
false
);
if
(!
this
.
isTabbed
)
{
this
.
approachPanel
.
getDataComboBox
().
setEnabled
(
true
);
int
nbSessions
=
MainFrame
.
getInstance
().
getDesktop
().
getAllDesktopFrames
().
length
;
if
(
nbSessions
==
1
||
nbSessions
!=
this
.
approachPanel
.
getDataComboBox
().
getItemCount
()
-
2
)
{
String
[]
items
=
getNameData
();
...
...
@@ -1871,7 +1924,7 @@ public class ClassifierPanel extends JPanel {
this
.
approachPanel
.
getDataComboBox
().
updateUI
();
}
}
updateParams
(
this
.
approachPanel
.
getMethodComboBox
().
getSelectedIndex
());
updateParams
(
this
.
approachPanel
.
getMethodComboBox
().
getSelectedIndex
()
,
true
);
}
/**
...
...
@@ -1896,18 +1949,41 @@ public class ClassifierPanel extends JPanel {
* </p>
* @param m indice de la methode a afficher
*/
public
void
updateParams
(
int
m
)
{
String
[]
method
=
this
.
approachPanel
.
getMethodNames
()[
m
];
public
void
updateParams
(
int
m
,
boolean
isImport
)
{
String
[]
method
=
this
.
approachPanel
.
getMethodNames
(
isImport
)[
m
];
this
.
paramsPanel
.
removeAll
();
this
.
paramsPanel
.
setLayout
(
this
.
paramsGridLayout
);
this
.
paramsGridLayout
.
setRows
(
method
.
length
/
2
);
this
.
paramsGridLayout
.
setVgap
(
5
);
for
(
int
i
=
1
;
i
<
method
.
length
;
i
+=
2
)
{
this
.
paramsPanel
.
add
(
new
JLabel
(
" ... "
+
method
[
i
]));
//$NON-NLS-1$
this
.
paramsPanel
.
add
(
new
JTextField
(
method
[
i
+
1
]));
if
(
method
[
i
]
==
ClassifierUtils
.
FILE_PARAMETER
)
{
JTextField
txtField
=
new
JTextField
(
method
[
i
+
1
]);
JButton
browseButton
=
new
JButton
(
Messages
.
getString
(
"ClassifierPanel.113"
));
//$NON-NLS-1$
browseButton
.
addActionListener
(
new
BrowseButtonActionListener
(
txtField
)
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
JFileChooser
fileChooser
=
new
JFileChooser
();
fileChooser
.
setDialogTitle
(
Messages
.
getString
(
"ClassifierPanel.112"
));
//$NON-NLS-1$
fileChooser
.
setMultiSelectionEnabled
(
true
);
int
returnVal
=
fileChooser
.
showOpenDialog
(
ClassifierPanel
.
this
);
if
(
returnVal
==
JFileChooser
.
APPROVE_OPTION
)
{
this
.
textField
.
setText
(
fileChooser
.
getSelectedFile
().
getPath
());
}
}
});
JPanel
innerPane
=
new
JPanel
();
innerPane
.
setLayout
(
new
BorderLayout
());
innerPane
.
add
(
txtField
,
BorderLayout
.
CENTER
);
innerPane
.
add
(
browseButton
,
BorderLayout
.
EAST
);
this
.
paramsPanel
.
add
(
innerPane
);
}
else
{
this
.
paramsPanel
.
add
(
new
JTextField
(
method
[
i
+
1
]));
}
}
int
nbSessions
=
MainFrame
.
getInstance
().
getDesktop
().
getAllDesktopFrames
().
length
;
if
(
m
==
0
&&
nbSessions
>
0
)
{
if
(
!
isImport
&&
m
==
ClassifierUtils
.
KMEANS
&&
nbSessions
>
0
)
{
this
.
paramsGridLayout
.
setRows
(
method
.
length
/
2
+
1
);
JPanel
panelSeed
=
new
JPanel
(
new
BorderLayout
());
panelSeed
.
add
(
this
.
checkboxSeeds
,
BorderLayout
.
WEST
);
...
...
@@ -1946,7 +2022,7 @@ public class ClassifierPanel extends JPanel {
// Data dataSelected = getSessionsIndexes()[approachPanel.getDataComboBox()
// .getSelectedIndex()].getDataSession().getData();
// if (!(dataSelected instanceof ImageData)) {
// System.err.println("This action is only supported on image repres
ne
tation data !");
// System.err.println("This action is only supported on image repres
en
tation data !");
// return;
// }
// ConstraintsSelectionDialog dialog = new ConstraintsSelectionDialog();
...
...
@@ -1970,7 +2046,7 @@ public class ClassifierPanel extends JPanel {
}
this
.
paramsPanel
.
updateUI
();
this
.
infosLabel
.
setText
(
"<html>"
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
m
)
+
"</html>"
);
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
m
,
isImport
)
+
"</html>"
);
//$NON-NLS-1$
this
.
advParamsPanel
.
removeAll
();
this
.
advParamsPanel
.
add
(
this
.
noAdvParamsLabel
);
...
...
@@ -2037,17 +2113,23 @@ public class ClassifierPanel extends JPanel {
JPanel
line5
=
new
JPanel
(
new
GridLayout
(
1
,
1
));
String
[]
methode
=
new
String
[
1
];
methode
[
0
]
=
Messages
.
getString
(
"ClassifierPanel.248"
);
//$NON-NLS-1$
this
.
multiClassifComboBox
=
new
JComboBox
(
methode
);
this
.
multiClassifComboBox
=
new
JComboBox
<
String
>
(
methode
);
line5
.
add
(
this
.
multiClassifComboBox
);
this
.
paramsPanel
.
add
(
line5
);
// this.infosLabel.setText("Voting infos");
this
.
infosLabel
.
setText
(
"<html>"
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
VOTING
)
+
"</html>"
);
//$NON-NLS-1$
+
ClassifierUtils
.
getMethodDescription
(
ClassifierUtils
.
VOTING
,
false
)
+
"</html>"
);
//$NON-NLS-1$
this
.
advParamsPanel
.
removeAll
();
this
.
advParamsPanel
.
add
(
this
.
noAdvParamsLabel
);
this
.
advParamsPanel
.
updateUI
();
}
private
abstract
class
BrowseButtonActionListener
implements
ActionListener
{
protected
JTextField
textField
;
public
BrowseButtonActionListener
(
JTextField
textField
){
this
.
textField
=
textField
;
}
}
}
\ No newline at end of file
src/mustic/gui/panels/classifier/components/ApproachSelectionPanel.java
View file @
f7d1e6a3
...
...
@@ -55,29 +55,25 @@ public class ApproachSelectionPanel extends JPanel {
private
static
final
String
VOTING_ALABEL
=
" Voting approach "
;
public
static
final
int
IMPORT_STRATEGY
=
5
;
private
static
final
String
IMPORT_STRATEGY_ALABEL
=
"
Voting approach
"
;
private
static
final
String
IMPORT_STRATEGY_ALABEL
=
"
Import from file
"
;
/*
* groupe de boutons type radiobox pour sélectionner le mode de
* classification
*/
private
ButtonGroup
clusteringModeSelector
=
new
ButtonGroup
();
private
ButtonGroup
clusteringModeSelector
=
new
ButtonGroup
();
private
ClassifierPanel
fatherContenair
;
private
JRadioButton
maclawMethodButton
=
new
JRadioButton
(
MACLAW_ALABEL
,
false
);
private
JComboBox
<
String
>
methodComboBox
=
null
;
// on récupère les noms des méthodes
public
String
[][]
methodNames
=
ClassifierUtils
.
methods
;
private
JComboBox
<
String
>
methodComboBox
=
null
;
private
SelectionModel
modele
;
private
JComboBox
<
String
>
dataComboBox
=
null
;
private
JComboBox
<
String
>
dataComboBox
=
null
;
private
JComboBox
<
String
>
importDataComboBox
=
null
;
private
JComboBox
<
String
>
import
Data
ComboBox
=
null
;
private
JComboBox
<
String
>
import
Method
ComboBox
=
null
;
/*
* boutons offrant les différents choix, le premier étant préselectionné
...
...
@@ -86,9 +82,12 @@ public class ApproachSelectionPanel extends JPanel {
private
JRadioButton
singleStrategyButton
=
new
JRadioButton
(
MONO_STRATEGY_ALABEL
,
true
);
private
JRadioButton
voting
MethodButton
=
new
JRadioButton
(
private
JRadioButton
voting
StrategyButton
=
new
JRadioButton
(
VOTING_ALABEL
,
false
);
private
JRadioButton
maclawStrategyButton
=
new
JRadioButton
(
MACLAW_ALABEL
,
false
);
private
JRadioButton
multiStrategyButton
=
new
JRadioButton
(
MULTI_STRATEGY_ALABEL
,
false
);
...
...
@@ -214,6 +213,15 @@ public class ApproachSelectionPanel extends JPanel {
// break;
//
// }
case
6
:
{
currentPanel
.
add
(
button
);
currentPanel
.
add
(
new
JLabel
(
METHOD_LABEL
));
currentPanel
.
add
(
importMethodComboBox
);
currentPanel
.
add
(
new
JLabel
(
" - "
));
currentPanel
.
add
(
importDataComboBox
);
break
;
}
default
:
currentPanel
.
add
(
button
);
}
...
...
@@ -271,8 +279,7 @@ public class ApproachSelectionPanel extends JPanel {
fatherContenair
.
attributeSelectionPanel
=
new
AttributeSelectionPanel
(
data
);
JTaskPaneGroup
attributsGroup
=
new
JTaskPaneGroup
();
attributsGroup
.
setTitle
(
"Attributes selection and weigths configuration"
);
attributsGroup
.
setTitle
(
"Attributes selection and weigths configuration"
);
JPanel
panelAttributs
=
new
JPanel
(
new
FlowLayout
());
JPanel
panelVisu
=
new
JPanel
(
new
FlowLayout
());
panelVisu
.
add
(
fatherContenair
.
getButtonVisu
());
...
...
@@ -290,7 +297,7 @@ public class ApproachSelectionPanel extends JPanel {
fatherContenair
,
data
,
dataComboBox
.
getSelectedIndex
()));
fatherContenair
.
updateParams
(
methodComboBox
.
getSelectedIndex
());
.
getSelectedIndex
()
,
false
);
updateAdvOptionPanel
(
data
.
isSequence
());
}
...
...
@@ -300,6 +307,73 @@ public class ApproachSelectionPanel extends JPanel {
}
});
this
.
importDataComboBox
=
new
JComboBox
<
String
>(
this
.
fatherContenair
.
getNameData
());
if
(
MainFrame
.
getInstance
().
getCurrentDataSession
()
!=
null
)
{
for
(
int
i
=
0
;
i
<
nbSessions
;
i
++)
{
if
(
MainFrame
.
getInstance
().
getCurrentDataSession
()
.
equals
(
desktopFrames
[
i
].
getDataSession
()))
this
.
importDataComboBox
.
setSelectedIndex
(
i
);
}
}
this
.
importDataComboBox
.
setEnabled
(
false
);
this
.
importDataComboBox
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
// System.out.println(e.getID());
if
(!
fatherContenair
.
isTabbed
)
{
if
(
fatherContenair
.
attributeSelectionPanel
!=
null
&&
fatherContenair
.
mdateClustering
)
{
fatherContenair
.
taskPane
.
remove
(
3
);
}
else
if
(
fatherContenair
.
mdateClustering
)
fatherContenair
.
taskPane
.
remove
(
2
);
fatherContenair
.
mdateClustering
=
false
;
int
nbSession
=
fatherContenair
.
getSessionsIndexes
().
length
;
if
(
importDataComboBox
.
getSelectedIndex
()
<
nbSession
&&
importDataComboBox
.
getSelectedIndex
()
>=
0
)
{
Data
data
=
fatherContenair
.
getSessionsIndexes
()[
importDataComboBox
.
getSelectedIndex
()].
getDataSession
().
getData
();
fatherContenair
.
setDataSession
(
fatherContenair
.
getSessionsIndexes
()
[
importDataComboBox
.
getSelectedIndex
()].
getDataSession
());
if
(
fatherContenair
.
attributeSelectionPanel
!=
null
)
fatherContenair
.
taskPane
.
remove
(
2
);
fatherContenair
.
attributeSelectionPanel
=
new
AttributeSelectionPanel
(
data
);
JTaskPaneGroup
attributsGroup
=
new
JTaskPaneGroup
();
attributsGroup
.
setTitle
(
"Attributes selection and weigths configuration"
);
JPanel
panelAttributs
=
new
JPanel
(
new
FlowLayout
());
JPanel
panelVisu
=
new
JPanel
(
new
FlowLayout
());
panelVisu
.
add
(
fatherContenair
.
getButtonVisu
());
panelVisu
.
add
(
fatherContenair
.
getLabelAide
());
attributsGroup
.
add
(
panelVisu
);
panelAttributs
.
add
(
fatherContenair
.
attributeSelectionPanel
);
attributsGroup
.
add
(
panelAttributs
);
fatherContenair
.
taskPane
.
add
(
attributsGroup
,
2
);
// fatherContenair.taskPane.add(attributsGroup);