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
4242aa62
Commit
4242aa62
authored
Nov 03, 2017
by
lafabregue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched from Constraints window to ImageAddon
parent
7e1071e6
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
932 additions
and
481 deletions
+932
-481
src/mustic/gui/DataSession.java
src/mustic/gui/DataSession.java
+1
-0
src/mustic/gui/ImageSession.java
src/mustic/gui/ImageSession.java
+2
-1
src/mustic/gui/MainFrame.java
src/mustic/gui/MainFrame.java
+108
-91
src/mustic/gui/dialog/RgbBandChooserInternalFrame.java
src/mustic/gui/dialog/RgbBandChooserInternalFrame.java
+2
-2
src/mustic/gui/dialog/SequenceDialog.java
src/mustic/gui/dialog/SequenceDialog.java
+3
-3
src/mustic/gui/dialog/classifier/ConstraintsColor.java
src/mustic/gui/dialog/classifier/ConstraintsColor.java
+9
-9
src/mustic/gui/dialog/classifier/ConstraintsSelectionFrame.java
...stic/gui/dialog/classifier/ConstraintsSelectionFrame.java
+139
-166
src/mustic/gui/dialog/classifier/ExportConstraintsTask.java
src/mustic/gui/dialog/classifier/ExportConstraintsTask.java
+2
-2
src/mustic/gui/dialog/classifier/ImportConstraintsTask.java
src/mustic/gui/dialog/classifier/ImportConstraintsTask.java
+3
-4
src/mustic/gui/panels/BirdViewPanel.java
src/mustic/gui/panels/BirdViewPanel.java
+63
-46
src/mustic/gui/panels/ImagePanel.java
src/mustic/gui/panels/ImagePanel.java
+127
-80
src/mustic/gui/panels/ImageResultPanel.java
src/mustic/gui/panels/ImageResultPanel.java
+171
-25
src/mustic/gui/panels/data/DataConstructPanel.java
src/mustic/gui/panels/data/DataConstructPanel.java
+4
-3
src/mustic/gui/panels/data/DataPanel.java
src/mustic/gui/panels/data/DataPanel.java
+8
-4
src/mustic/gui/panels/data/components/SourceSelectionPanel.java
...stic/gui/panels/data/components/SourceSelectionPanel.java
+14
-16
src/mustic/io/ImageData.java
src/mustic/io/ImageData.java
+13
-12
src/mustic/io/RawImage.java
src/mustic/io/RawImage.java
+1
-1
src/mustic/utils/image/ImageAddOn.java
src/mustic/utils/image/ImageAddOn.java
+32
-0
src/mustic/utils/image/ImageDisplayer.java
src/mustic/utils/image/ImageDisplayer.java
+102
-0
src/mustic/utils/image/ImageManager.java
src/mustic/utils/image/ImageManager.java
+1
-1
src/mustic/utils/image/Zoomable.java
src/mustic/utils/image/Zoomable.java
+7
-0
src/mustic/utils/image/viewer/BufferedImageViewer.java
src/mustic/utils/image/viewer/BufferedImageViewer.java
+2
-1
src/mustic/utils/image/viewer/ClusteringImageViewer.java
src/mustic/utils/image/viewer/ClusteringImageViewer.java
+75
-1
src/mustic/utils/image/viewer/ImageViewer.java
src/mustic/utils/image/viewer/ImageViewer.java
+26
-1
src/mustic/utils/image/viewer/MultiResolutionClusterMap.java
src/mustic/utils/image/viewer/MultiResolutionClusterMap.java
+1
-1
src/mustic/utils/image/viewer/PyramidImageViewer.java
src/mustic/utils/image/viewer/PyramidImageViewer.java
+16
-11
No files found.
src/mustic/gui/DataSession.java
View file @
4242aa62
...
...
@@ -19,6 +19,7 @@ import mustic.gui.panels.data.DataPanel;
import
mustic.io.ImageData
;
import
mustic.models.gui.ClassificationModel
;
import
mustic.models.gui.panels.ResultPanel
;
import
mustic.utils.image.ImageDisplayer
;
import
net.infonode.tabbedpanel.TabDragEvent
;
import
net.infonode.tabbedpanel.TabEvent
;
import
net.infonode.tabbedpanel.TabListener
;
...
...
src/mustic/gui/ImageSession.java
View file @
4242aa62
...
...
@@ -15,6 +15,7 @@ import mustic.gui.panels.ImageInformationPanel;
import
mustic.gui.panels.ImagePanel
;
import
mustic.gui.segmentation.SegmentationPanel
;
import
mustic.io.RawImage
;
import
mustic.utils.image.ImageManager
;
import
net.infonode.tabbedpanel.TabFactory
;
import
net.infonode.tabbedpanel.TabbedPanel
;
import
net.infonode.tabbedpanel.titledtab.TitledTab
;
...
...
@@ -245,7 +246,7 @@ public class ImageSession extends ImageManager {
if
(
displayEnable
)
{
((
ImagePanel
)
this
.
displayer
).
applyMask
(
this
.
rawImage
.
getMask
());
((
ImagePanel
)
this
.
displayer
).
refresh
();
((
ImagePanel
)
this
.
displayer
).
refresh
(
true
);
}
}
...
...
src/mustic/gui/MainFrame.java
View file @
4242aa62
...
...
@@ -131,7 +131,7 @@ public class MainFrame extends JFrame {
private JPanel infosPanel;
/** boolean pour lier le birdview avec l'image active */
private boolean linkToAllImages =
tru
e;
private boolean linkToAllImages =
fals
e;
/** the project root for datas */
private DefaultMutableTreeNode mDataProjectNode;
...
...
@@ -429,7 +429,8 @@ public class MainFrame extends JFrame {
openZip();
}
});
fileMenu.add(menuItemOpenZip);
//TODO regenerate the result import same as imageResultPanel
//fileMenu.add(menuItemOpenZip);
menuItemSave = new JMenuItem(Messages.getString("MainFrame.10")); //$NON-NLS-1$
menuItemSave.addActionListener(new ActionListener() {
...
...
@@ -493,7 +494,7 @@ public class MainFrame extends JFrame {
}
}
});
toolsMenu.add(menuItemClustering);
//
toolsMenu.add(menuItemClustering);
menuItemSegmentation = new JMenuItem(Messages.getString("MainFrame.17")); //$NON-NLS-1$
menuItemSegmentation.addActionListener(new ActionListener() {
...
...
@@ -625,7 +626,7 @@ public class MainFrame extends JFrame {
createDistanceMatrix();
}
});
toolsMenu.add(menuDistanceMatrix);
//
toolsMenu.add(menuDistanceMatrix);
/** Menu to generate constraints from current image session */
menuConstraints = new JMenuItem(Messages.getString("MainFrame.301"));
...
...
@@ -635,7 +636,7 @@ public class MainFrame extends JFrame {
createConstraints();
}
});
toolsMenu.add(menuConstraints);
//
toolsMenu.add(menuConstraints);
menuBar.add(toolsMenu);
...
...
@@ -914,7 +915,8 @@ public class MainFrame extends JFrame {
}
});
menuResult.add(menuOpenRes);
//TODO regenerate the result import same as imageResultPanel
//menuResult.add(menuOpenRes);
menuResult.add(menuSaveRes);
menuRoiEval = new JMenuItem(Messages.getString("MainFrame.52")); //$NON-NLS-1$
...
...
@@ -1490,7 +1492,7 @@ public class MainFrame extends JFrame {
// =============== Creation of the Desktop ================
JPanel panel_desktop = new JPanel(new BorderLayout());
panel_desktop.setOpaque(false);
panel_desktop.setBorder(Borders.DIALOG
_BORDER
);
panel_desktop.setBorder(Borders.DIALOG);
panel_desktop.add(this.desktop);
sif_desktop = new SimpleInternalFrame(Messages.getString("MainFrame.72")); //$NON-NLS-1$
...
...
@@ -1504,7 +1506,7 @@ public class MainFrame extends JFrame {
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
panel.setBorder(Borders.DIALOG
_BORDER
);
panel.setBorder(Borders.DIALOG);
panel.add(pane);
// =============== Creation of the Progress Panel => South
...
...
@@ -1625,7 +1627,7 @@ public class MainFrame extends JFrame {
// =============== Creation of the Desktop ================
JPanel panel_desktop = new JPanel(new BorderLayout());
panel_desktop.setOpaque(false);
panel_desktop.setBorder(Borders.DIALOG
_BORDER
);
panel_desktop.setBorder(Borders.DIALOG);
panel_desktop.add(this.desktop);
sif_desktop = new SimpleInternalFrame(Messages.getString("MainFrame.72")); //$NON-NLS-1$
...
...
@@ -1639,7 +1641,7 @@ public class MainFrame extends JFrame {
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
panel.setBorder(Borders.DIALOG
_BORDER
);
panel.setBorder(Borders.DIALOG);
panel.add(pane);
// =============== Creation of the Progress Panel => South
...
...
@@ -2167,7 +2169,8 @@ public class MainFrame extends JFrame {
}
});
toolBar.add(jbOpen);
//TODO regenerate the result import same as imageResultPanel
//toolBar.add(jbOpen);
toolBar.add(jbSave);
JButton jbRoiEval = new JButton(new ImageIcon(getClass().getResource("/icons/icon_roi_eval.png"))); //$NON-NLS-1$
...
...
@@ -3007,44 +3010,44 @@ public class MainFrame extends JFrame {
// seg = segThread.getS();
// setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
Data data = MainFrame.this.currentImageSession.getImageData();
MainFrame.this.currentImageSession.setData(data);
ClassificationImage ci = new ClassificationImage(data, Messages.getString("MainFrame.190") //$NON-NLS-1$
+ Image
Session.nbClustering, true);
SegmentationResultPanel srp = new SegmentationResultPanel(classif, ci, MainFrame.this.currentImageSession.getRawImage(),
seg, imageLabelisee, -1); // ImageSession.getSession(0).getImage(),ImageSession.getSession(0),
// scene);
Tab tabResult = ClassificationModel.createTab(Messages.getString("MainFrame.191") + ResultPanel.nbResult, //$NON-NLS-1$
new ImageIcon(getClass()
.getResource("/icons/actions/document-open-result.png")), //$NON-NLS-1$
srp, true);
ci.tabbedPane.addTab(tabResult);
tabResult.setSelected(true);
SegmentationResultPanel irp = (SegmentationResultPanel) ci.tabbedPane.getTabAt(ci.tabbedPane.getTabCount() - 1)
.getContentComponent();
irp.historique.addInfosln("******** Classification apres segmentation *********"); //$NON-NLS-1$
irp.historique.addInfosln(Messages.getString("MainFrame.0") //$NON-NLS-1$
+ classif.getData().getDataName() + "\n"); //$NON-NLS-1$
// irp.historique.addInfosln(ci.().getParameters().toString());
final TitledTab tab = new TitledTab(Messages.getString("MainFrame.196") //$NON-NLS-1$
+ ImageSession.nbClustering++, null, ci.tabbedPane, new JPanel());
tab.setFocusableComponent(null);
MainFrame.this.currentImageSession.getWorkSpace().addTab(tab);
MainFrame.this.currentImageSession.getWorkSpace().setSelectedTab(tab);
try {
MainFrame.this.currentImageSession.associatedFrame.setMaximum(true);
} catch (PropertyVetoException e1) {}
irp.updateImageColors();
//
Data data = MainFrame.this.currentImageSession.getImageData();
//
//
MainFrame.this.currentImageSession.setData(data);
//
ClassificationImage ci = new ClassificationImage(data, Messages.getString("MainFrame.190") //$NON-NLS-1$
// + Data
Session.nbClustering, true);
//
//
SegmentationResultPanel srp = new SegmentationResultPanel(classif, ci, MainFrame.this.currentImageSession.getRawImage(),
//
seg, imageLabelisee, -1); // ImageSession.getSession(0).getImage(),ImageSession.getSession(0),
//
// scene);
//
//
Tab tabResult = ClassificationModel.createTab(Messages.getString("MainFrame.191") + ResultPanel.nbResult, //$NON-NLS-1$
//
new ImageIcon(getClass()
//
.getResource("/icons/actions/document-open-result.png")), //$NON-NLS-1$
//
srp, true);
//
ci.tabbedPane.addTab(tabResult);
//
tabResult.setSelected(true);
//
//
SegmentationResultPanel irp = (SegmentationResultPanel) ci.tabbedPane.getTabAt(ci.tabbedPane.getTabCount() - 1)
//
.getContentComponent();
//
irp.historique.addInfosln("******** Classification apres segmentation *********"); //$NON-NLS-1$
//
//
irp.historique.addInfosln(Messages.getString("MainFrame.0") //$NON-NLS-1$
//
+ classif.getData().getDataName() + "\n"); //$NON-NLS-1$
//
//
// irp.historique.addInfosln(ci.().getParameters().toString());
//
//
final TitledTab tab = new TitledTab(Messages.getString("MainFrame.196") //$NON-NLS-1$
//
+ ImageSession.nbClustering++, null, ci.tabbedPane, new JPanel());
//
tab.setFocusableComponent(null);
//
//
MainFrame.this.currentImageSession.getWorkSpace().addTab(tab);
//
MainFrame.this.currentImageSession.getWorkSpace().setSelectedTab(tab);
//
//
try {
//
MainFrame.this.currentImageSession.associatedFrame.setMaximum(true);
//
} catch (PropertyVetoException e1) {}
//
//
irp.updateImageColors();
}
else {
...
...
@@ -3736,8 +3739,8 @@ public class MainFrame extends JFrame {
String resultPath = "/home/baptiste/A2CNES/results/";
String testResultPath = "/home/baptiste/A2CNES/Train_results/";
Data dataTrain = getDataFromFile(dataPath+datasetPath+"/train/"+datasetName+".data", '\t', "train");
Data dataTest = getDataFromFile(dataPath+datasetPath+"/test/"+datasetName+".data", '\t', "test");
Data dataTrain = getDataFromFile(dataPath+datasetPath+"/train/"+datasetName+".data", '\t', "train"
, null
);
Data dataTest = getDataFromFile(dataPath+datasetPath+"/test/"+datasetName+".data", '\t', "test"
, null
);
// AttributeMultiDimSequence.setMode(AttributeMultiDimSequence.EUCLIDIEN);
...
...
@@ -3781,38 +3784,39 @@ public class MainFrame extends JFrame {
// we search for all constraints files
// <<<< START FOR PARAM config
for (int i = 0 ; i < 10 ; i++) {
HybridClassification classif = (HybridClassification) classification.clone();
if (i % 2 == 1 ) {
classification.setParameters(nInf, nSup, minC, 0.4, 0.6, pcr);
}
if (i <= 5)
classif.addAgent(new ParametersKmeans(8, 10, weights), dataTrain);
if (i <= 7)
classif.addAgent(new ParametersKmeans(10, 10, weights), dataTrain);
classif.addAgent(new ParametersKmeans(13, 10, weights), dataTrain);
classif.addAgent(new ParametersKmeans(16, 10, weights), dataTrain);
if (i >= 2)
classif.addAgent(new ParametersKmeans(19, 10, weights), dataTrain);
if (i >= 4)
classif.addAgent(new ParametersKmeans(22, 10, weights), dataTrain);
// classif.addAgent(new ParametersKmeans(3, 10, weights), dataTest);
// classif.addAgent(new ParametersKmeans(4, 10, weights), dataTest);
// classif.addAgent(new ParametersKmeans(6, 10, weights), dataTest);
classif.setName(testResultPath+datasetName+"/clusteing"+i);
classif.setData(dataTrain);
//// >>>> END FOR PARAM config1
// for (int i = 0 ; i < 10 ; i++) {
// HybridClassification classif = (HybridClassification) classification.clone();
//// classif.addAgent(new ParametersKmeans(10, 15, weights), dataTest);
// classif.addAgent(new ParametersKmeans(13, 10, weights), dataTest);
// classif.addAgent(new ParametersKmeans(16, 10, weights), dataTest);
// classif.addAgent(new ParametersKmeans(19, 10, weights), dataTest);
//
// classif.setName(resultPath+datasetPath+"/clustering"+i);
// classif.setData(dataTest);
//// >>>> REPLACE PARAM
// if (i % 2 == 1 ) {
// classification.setParameters(nInf, nSup, minC, 0.4, 0.6, pcr);
// }
// if (i <= 5)
// classif.addAgent(new ParametersKmeans(8, 25, weights), dataTrain);
// if (i <= 7)
// classif.addAgent(new ParametersKmeans(10, 25, weights), dataTrain);
// classif.addAgent(new ParametersKmeans(13, 25, weights), dataTrain);
// classif.addAgent(new ParametersKmeans(16, 25, weights), dataTrain);
// if (i >= 2)
// classif.addAgent(new ParametersKmeans(19, 25, weights), dataTrain);
// if (i >= 4)
// classif.addAgent(new ParametersKmeans(22, 25, weights), dataTrain);
//// classif.addAgent(new ParametersKmeans(3, 10, weights), dataTest);
//// classif.addAgent(new ParametersKmeans(4, 10, weights), dataTest);
//// classif.addAgent(new ParametersKmeans(6, 10, weights), dataTest);
//
// classif.setName(testResultPath+datasetName+"/clusteing"+i);
// classif.setData(dataTrain);
// >>>> END FOR PARAM config1
for (int i = 0 ; i < 10 ; i++) {
HybridClassification classif = (HybridClassification) classification.clone();
// classif.addAgent(new ParametersKmeans(10, 25, weights), dataTest);
classif.addAgent(new ParametersKmeans(13, 25, weights), dataTest);
classif.addAgent(new ParametersKmeans(16, 25, weights), dataTest);
classif.addAgent(new ParametersKmeans(19, 25, weights), dataTest);
// classif.addAgent(new ParametersKmeans(22, 25, weights), dataTest);
classif.setName(resultPath+datasetPath+"/clustering"+i);
classif.setData(dataTest);
// >>>> REPLACE PARAM
Thread t = null;
ClassificationImage classificationImage = new ClassificationImage(testSession,
...
...
@@ -3879,9 +3883,11 @@ public class MainFrame extends JFrame {
// Data currentData = (Data) dataTest.clone();
// currentData.updateAndSetConstraintsToSample(constraints);
//
// classif.addAgent(new ParametersKmeans(4, 15, weights), currentData);
// classif.addAgent(new ParametersKmeans(6, 15, weights), currentData);
// classif.addAgent(new ParametersKmeans(8, 15, weights), currentData);
// classif.addAgent(new ParametersKmeans(10, 25, weights), currentData);
// classif.addAgent(new ParametersKmeans(13, 25, weights), currentData);
// classif.addAgent(new ParametersKmeans(16, 25, weights), currentData);
// classif.addAgent(new ParametersKmeans(19, 25, weights), currentData);
// classif.addAgent(new ParametersKmeans(22, 25, weights), currentData);
//
// classif.setName(resultPath+datasetName+"/"+
// ImageHelper.stripExtension(filename)+
...
...
@@ -3890,9 +3896,9 @@ public class MainFrame extends JFrame {
//
// Thread t = null;
//
// ClassificationImage classificationImage = new ClassificationImage(
currentData
,
//
Messages.getString("ClassifierPanel.73") + DataSession.nbClustering, //$NON-NLS-1$
//
true);
// ClassificationImage classificationImage = new ClassificationImage(
testSession
,
// Messages.getString("ClassifierPanel.73") + DataSession.nbClustering, //$NON-NLS-1$
// true);
//
//
// t = new ClassificationThread(classif, classificationImage.getProgressBar(),
...
...
@@ -3908,7 +3914,6 @@ public class MainFrame extends JFrame {
// } catch (PropertyVetoException e) {
// e.printStackTrace();
// }
// classificationImage.toFront();
// classificationImage.setVisible(true);
//
// threadList.add(t);
...
...
@@ -3946,7 +3951,7 @@ public class MainFrame extends JFrame {
ClassificationFrame.getInstance().dispose();
}
private Data getDataFromFile(String path, char separator, String name) {
private Data getDataFromFile(String path, char separator, String name
, String mask
) {
Data data = null;
// we create the two data session
...
...
@@ -3955,12 +3960,20 @@ public class MainFrame extends JFrame {
List<DataObject> result = new ArrayList<DataObject>();
CSVUtils reader = null;
CSVUtils maskReader = null;
try {
File file = new File(path);
reader = new CSVUtils(file, separator);
List<String> line;
if (mask != null) {
maskReader = new CSVUtils(new File(mask), separator);
}
List<String> maskLine = null;
while((line = reader.readNext()) != null) {
extractObjectFromLine(result, line, 1);
if (mask != null) {
maskLine = maskReader.readNext();
}
extractObjectFromLine(result, line, 3, maskLine);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
...
...
@@ -3985,10 +3998,14 @@ public class MainFrame extends JFrame {
* @param line
* the line to interpret
*/
private void extractObjectFromLine(List<DataObject> list, List<String> line, int featureNb) {
private void extractObjectFromLine(List<DataObject> list, List<String> line, int featureNb
, List<String> maskLine
) {
DataObject obj = new DataObject(1);
double[][] seq = new double[line.size()/featureNb][];
for (int i = 0 ; i < line.size()/featureNb ; i++) {
if (maskLine != null) {
if(Integer.parseInt(maskLine.get(i)) == 0)
continue;
}
seq[i] = new double[featureNb];
for (int j = 0 ; j < featureNb ; j++) {
seq[i][j] = Double.parseDouble(line.get(i*featureNb + j));
...
...
src/mustic/gui/dialog/RgbBandChooserInternalFrame.java
View file @
4242aa62
...
...
@@ -50,8 +50,8 @@ public class RgbBandChooserInternalFrame extends JInternalFrame {
public
RgbBandChooserInternalFrame
(
final
RawImage
rawImage
)
{
super
();
this
.
scaledMax
=
rawImage
.
getScaledMaxValues
();
this
.
scaledMin
=
rawImage
.
getScaledMinValues
();
this
.
scaledMax
=
rawImage
.
getScaledMaxValues
()
.
clone
()
;
this
.
scaledMin
=
rawImage
.
getScaledMinValues
()
.
clone
()
;
this
.
redComboBox
=
new
JComboBox
<
String
>();
this
.
redMin
=
new
JTextArea
();
this
.
redMax
=
new
JTextArea
();
...
...
src/mustic/gui/dialog/SequenceDialog.java
View file @
4242aa62
...
...
@@ -301,10 +301,10 @@ public class SequenceDialog extends JDialog {
* @throws FormatException
* if the images don't have the same dimensions
*/
public
Vector
<
String
>
getSequenceData
()
throws
FormatException
{
public
Vector
<
RawImage
>
getSequenceData
()
throws
FormatException
{
int
nb
=
this
.
dlmSeq
.
getSize
();
Donnee
donnee
;
Vector
<
String
>
paths
=
new
Vector
<
String
>();
Vector
<
RawImage
>
paths
=
new
Vector
<
RawImage
>();
if
(
nb
>
0
)
{
ImageDesktopFrame
[]
desktopFrames
=
MainFrame
.
getInstance
().
getDesktop
()
...
...
@@ -314,7 +314,7 @@ public class SequenceDialog extends JDialog {
for
(
int
i
=
0
;
i
<
nb
;
i
++)
{
donnee
=
(
Donnee
)
this
.
dlmSeq
.
getElementAt
(
i
);
paths
.
add
(
desktopFrames
[
donnee
.
index
].
getImageSession
()
.
getRawImage
()
.
getPath
()
);
.
getRawImage
());
}
}
...
...
src/mustic/gui/dialog/classifier/ConstraintsColor.java
View file @
4242aa62
...
...
@@ -26,19 +26,19 @@ public class ConstraintsColor extends JDialog {
private
static
final
long
serialVersionUID
=
1L
;
/** constraints colors */
private
Color
mustLinkColor
=
new
Color
(
124
,
252
,
0
);
private
Color
cannotLinkColor
=
new
Color
(
255
,
0
,
255
);
private
Vector
<
Color
>
labelConstraintColor
=
new
Vector
<
Color
>();
private
Color
mustLinkColor
=
new
Color
(
124
,
252
,
0
);
private
Color
cannotLinkColor
=
new
Color
(
255
,
0
,
255
);
private
Vector
<
Color
>
labelConstraintColor
=
new
Vector
<
Color
>();
/** constraints buttons */
private
JButton
jb_mustLinkChooseColor
=
new
JButton
();
private
JButton
jb_cannotLinkChooseColor
=
new
JButton
();
private
Vector
<
JButton
>
jb_labelConstraintClassChooseColor
=
new
Vector
<
JButton
>();
private
JButton
jb_mustLinkChooseColor
=
new
JButton
();
private
JButton
jb_cannotLinkChooseColor
=
new
JButton
();
private
Vector
<
JButton
>
jb_labelConstraintClassChooseColor
=
new
Vector
<
JButton
>();
/** dynamic JPanel Colors of Label Constraints Classes*/
JPanel
labelColorConstraintPanel
=
new
JPanel
(
new
GridLayout
(
0
,
1
));
private
JPanel
labelColorConstraintPanel
=
new
JPanel
(
new
GridLayout
(
0
,
1
));
private
ConstraintsSelection
Dialog
dialog
=
null
;
private
ConstraintsSelection
Frame
dialog
=
null
;
/**
* @brief Constructor dialog window that allows the user to change the color of the constraints
...
...
@@ -47,7 +47,7 @@ public class ConstraintsColor extends JDialog {
* @param colorCL
* @param colorVectorLabel
*/
public
ConstraintsColor
(
ConstraintsSelection
Dialog
d
,
Color
colorML
,
Color
colorCL
,
Vector
<
Color
>
colorVectorLabel
)
{
public
ConstraintsColor
(
ConstraintsSelection
Frame
d
,
Color
colorML
,
Color
colorCL
,
Vector
<
Color
>
colorVectorLabel
)
{
this
.
dialog
=
d
;
this
.
mustLinkColor
=
colorML
;
this
.
cannotLinkColor
=
colorCL
;
...
...
src/mustic/gui/dialog/classifier/ConstraintsSelection
Internal
Frame.java
→
src/mustic/gui/dialog/classifier/ConstraintsSelectionFrame.java
View file @
4242aa62
This diff is collapsed.
Click to expand it.
src/mustic/gui/dialog/classifier/ExportConstraintsTask.java
View file @
4242aa62
...
...
@@ -24,12 +24,12 @@ import mustic.utils.filters.CSVFileFilter;
*/
public
class
ExportConstraintsTask
extends
SwingWorker
<
Void
,
Void
>
{
ConstraintsSelection
Dialog
dialog
=
null
;
ConstraintsSelection
Frame
dialog
=
null
;
static
final
private
int
incrementation
=
10
;
static
int
progress
=
0
;
static
int
jalon
=
incrementation
;
// avoid too many progress update
public
ExportConstraintsTask
(
ConstraintsSelection
Dialog
dialog
)
public
ExportConstraintsTask
(
ConstraintsSelection
Frame
dialog
)
{
this
.
dialog
=
dialog
;
}
...
...
src/mustic/gui/dialog/classifier/ImportConstraintsTask.java
View file @
4242aa62
...
...
@@ -21,12 +21,12 @@ import mustic.utils.io.CSVUtils;
*/
public
class
ImportConstraintsTask
extends
SwingWorker
<
Void
,
Void
>
{
ConstraintsSelection
Dialog
dialog
=
null
;
ConstraintsSelection
Frame
dialog
=
null
;
static
final
private
int
incrementation
=
10
;
static
int
progress
=
0
;
static
int
jalon
=
incrementation
;
// avoid too many progress update
public
ImportConstraintsTask
(
ConstraintsSelection
Dialog
dialog
)
public
ImportConstraintsTask
(
ConstraintsSelection
Frame
dialog
)
{
this
.
dialog
=
dialog
;
}
...
...
@@ -108,8 +108,7 @@ public class ImportConstraintsTask extends SwingWorker<Void, Void>
}
dialog
.
enableAllComponents
();
dialog
.
displayPixels
();
dialog
.
updateUI
();
dialog
.
refresh
();
imageOuvre
=
true
;
}
...
...
src/mustic/gui/panels/BirdViewPanel.java
View file @
4242aa62
...
...
@@ -17,10 +17,10 @@ import java.util.Vector;
import
javax.swing.JPanel
;
import
mustic.gui.ImageDesktopFrame
;
import
mustic.gui.ImageManager
;
import
mustic.gui.ImageSession
;
import
mustic.gui.MainFrame
;
import
mustic.io.PiLLiTools
;
import
mustic.utils.image.ImageManager
;
public
class
BirdViewPanel
extends
JPanel
implements
MouseListener
,
MouseMotionListener
,
Observer
{
...
...
@@ -593,6 +593,16 @@ public class BirdViewPanel extends JPanel implements MouseListener,
if
(!
session
.
isDisplayEnable
())
return
;
this
.
setCursor
(
Cursor
.
getDefaultCursor
());
if
(
this
.
selArea
.
x
<
0
)
{
selArea
.
width
=
selArea
.
width
+
selArea
.
x
;
selArea
.
x
=
0
;
}
if
(
this
.
selArea
.
y
<
0
)
{
selArea
.
height
=
selArea
.
height
+
selArea
.
y
;
selArea
.
y
=
0
;
}
this
.
repaint
();
this
.
action
=
BirdViewPanel
.
ACT_NONE
;
...
...
@@ -687,7 +697,7 @@ public class BirdViewPanel extends JPanel implements MouseListener,
* @param height
* height in the original image
*/
public
void
updateSelectedArea
(
int
x
,
int
y
,
int
width
,
int
height
)
{
public
void
updateSelectedArea
(
int
x
,
int
y
,
double
width
,
double
height
)
{
double
xfact
=
(
double
)
this
.
session
.
getRawImage
().
getWidth
()
/
(
double
)
mBirdImage
.
getWidth
();
double
yfact
=
(
double
)
this
.
session
.
getRawImage
().
getHeight
()
...
...
@@ -741,8 +751,8 @@ public class BirdViewPanel extends JPanel implements MouseListener,
int
rx
=
(
int
)
(
this
.
selArea
.
x
*
xfact
);
int
ry
=
(
int
)
(
this
.
selArea
.
y
*
yfact
);
int
width
=
(
int
)
Math
.
ceil
(
this
.
selArea
.
width
*
xfact
)
;
int
height
=
(
int
)
Math
.
ceil
(
this
.
selArea
.
height
*
yfact
)
;
double
width
=
this
.
selArea
.
width
*
xfact
;
double
height
=
this
.
selArea
.
height
*
yfact
;
this
.
session
.
getImageDisplayer
().
updateImageViewTo
(
rx
,
ry
,
width
,
height
);
...
...
@@ -770,46 +780,53 @@ public class BirdViewPanel extends JPanel implements MouseListener,
double
xgeo
;
double
ygeo
;
if
(
this
.
session
.
getRawImage
().
getInitPosGeo
()
!=
null
)
{
int
rx
;
int
ry
;
double
width
;
double
height
;
if
(
this
.
session
.
getRawImage
().
getInitPosGeo
()
!=
null
&&
session
.
getRawImage
().
getInitPosGeo
()
!=
null
)
{
xgeo
=
this
.
session
.
getRawImage
().
getInitPosGeoX
()
+
this
.
selArea
.
x
*
xfact
*
this
.
session
.
getRawImage
().
getResolution
()[
0
];
ygeo
=
this
.
session
.
getRawImage
().
getInitPosGeoY
()
-
this
.
selArea
.
y
*
yfact
*
this
.
session
.
getRawImage
().
getResolution
()[
1
];
}
else
{
xgeo
=
this
.
selArea
.
x
*
xfact
;
ygeo
=
this
.
selArea
.
y
*
yfact
;
}
int
rx
;
int
ry
;
if
(
session
.
getRawImage
().
getInitPosGeo
()
!=
null
)
{
rx
=
(
int
)
((
xgeo
-
session
.
getRawImage
().
getInitPosGeoX
())
/
session
.
getRawImage
().
getResolution
()[
0
]);
ry
=
(
int
)
((
session
.
getRawImage
().
getInitPosGeoY
()
-
ygeo
)
/
session
.
getRawImage
().
getResolution
()[
1
]);
}
else
{
width
=
this
.
selArea
.
width
*
xfact
*
this
.
session
.
getRawImage
().
getResolution
()[
0
]
/
session
.
getRawImage
().
getResolution
()[
0
];
height
=
this
.
selArea
.
height
*
yfact
*
this
.
session
.
getRawImage
().
getResolution
()[
1
]
/
session
.
getRawImage
().
getResolution
()[
1
];
}
else
{
rx
=
(
int
)
(
this
.
selArea
.
x
*
xfact
);
ry
=
(
int
)
(
this
.
selArea
.
y
*
yfact
);
width
=
this
.
selArea
.
width
*
xfact
;
height
=
this
.
selArea
.
height
*
yfact
;
}
xfact
=
(
double
)
session
.
getRawImage
().
getWidth
()
/
(
double
)
session
.
getBirdViewPanel
().
getImage
().
getWidth
();
yfact
=
(
double
)
session
.
getRawImage
().
getHeight
()
/
(
double
)
session
.
getBirdViewPanel
().
getImage
().
getHeight
();
int
width
=
(
int
)
Math
.
ceil
(
this
.
selArea
.
width
*
xfact
);
int
height
=
(
int
)
Math
.
ceil
(
this
.
selArea
.
height
*
yfact
);
if
(
width
>
session
.
getRawImage
().
getWidth
())
width
=
session
.
getRawImage
().
getWidth
();
if
(
height
>
session
.
getRawImage
().
getHeight
())
height
=
session
.
getRawImage
().
getHeight
();
if
(
rx
+
width
>=
session
.
getRawImage
().
getWidth
())
rx
=
session
.
getRawImage
().
getWidth
()
-
width
-
1
;
rx
=
session
.
getRawImage
().
getWidth
()
-
(
int
)
Math
.
ceil
(
width
)
-
1
;
if
(
rx
<
0
)
rx
=
0
;
if
(
ry
+
height
>=
session
.
getRawImage
().
getHeight
())
ry
=
session
.
getRawImage
().
getHeight
()
-
height
-
1
;
ry
=
session
.
getRawImage
().
getHeight
()
-
(
int
)
Math
.
ceil
(
height
)
-
1
;
if
(
ry
<
0
)
ry
=
0
;
...
...
@@ -818,36 +835,36 @@ public class BirdViewPanel extends JPanel implements MouseListener,
}
public
void
update
()
{
double
x_zoomFactor
=
1
;
double
y_zoomFactor
=
1
;
double
dest_w
=
180
;
double
dest_h
=
200
;
// we considerate only the smallest zoom factor
if
(
this
.
session
.
getRawImage
().
getWidth
()
>
0
)
x_zoomFactor
=
(
double
)
dest_w
/
(
double
)
this
.
session
.
getRawImage
().
getWidth
();
if
(
this
.
session
.
getRawImage
().
getHeight
()
>
0
)
y_zoomFactor
=
(
double
)
dest_h
/
(
double
)
this
.
session
.
getRawImage
().
getHeight
();
if
(
MainFrame
.
DEBUG_MODE
)
System
.
out
.
println
(
"public void createBirdview(int dest_w, int dest_h)"
+
dest_w
+
" "
+
dest_h
+
" "