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
b59a342a
Commit
b59a342a
authored
Jul 13, 2017
by
kirandjiska
Browse files
Options
Browse Files
Download
Plain Diff
Fixed merging conlicts
parents
f1057248
4588e9b0
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2174 additions
and
55 deletions
+2174
-55
cursor_icon.png
cursor_icon.png
+0
-0
src/mustic/gui/MainFrame.java
src/mustic/gui/MainFrame.java
+43
-7
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
...tic/gui/dialog/classifier/ConstraintsSelectionDialog.java
+118
-48
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java.orig
...ui/dialog/classifier/ConstraintsSelectionDialog.java.orig
+1727
-0
src/mustic/gui/tools/ZoomBoxPanel.java
src/mustic/gui/tools/ZoomBoxPanel.java
+247
-0
src/mustic/gui/tools/Zoomable.java
src/mustic/gui/tools/Zoomable.java
+39
-0
No files found.
cursor_icon.png
0 → 100644
View file @
b59a342a
16.7 KB
src/mustic/gui/MainFrame.java
View file @
b59a342a
...
...
@@ -5,10 +5,12 @@ import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.beans.PropertyVetoException;
import java.io.*;
import java.net.URI;
import java.util.List;
import java.util.Vector;
import java.util.zip.ZipEntry;
...
...
@@ -598,7 +600,9 @@ public class MainFrame extends JFrame {
menuConstraints.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// createPanelFromOther(currentImageSession);
createConstraints();
}
});
toolsMenu.add(menuConstraints);
...
...
@@ -1340,7 +1344,7 @@ public class MainFrame extends JFrame {
JPanel westPanel = new JPanel(new BorderLayout());
/** Panel West : default */
// C
e
reation of the Project Tree Interface for datas
// Creation of the Project Tree Interface for datas
JPanel treeDataPanel = new JPanel(new BorderLayout());
JScrollPane treeDataScrollPane = new JScrollPane(this.mDataProjectTree);
treeDataScrollPane.setPreferredSize(new Dimension(180, 100));
...
...
@@ -1350,7 +1354,7 @@ public class MainFrame extends JFrame {
sif_treeDataPanel.setPreferredSize(new Dimension(160, 50));
sif_treeDataPanel.add(treeDataPanel);
// C
e
reation of the Project Tree Interface for images
// Creation of the Project Tree Interface for images
JPanel treeImagePanel = new JPanel(new BorderLayout());
JScrollPane treeImageScrollPane = new JScrollPane(this.mImageProjectTree);
treeImageScrollPane.setPreferredSize(new Dimension(180, 100));
...
...
@@ -1367,7 +1371,7 @@ public class MainFrame extends JFrame {
sif_infosPanel.setPreferredSize(new Dimension(160, 180));
sif_infosPanel.add(this.infosPanel);
// Creation of the Bi
t
d View Interface
// Creation of the Bi
r
d View Interface
this.birdPanel = new JPanel(new BorderLayout());
this.birdPanel.setPreferredSize(new Dimension(160, 100));
...
...
@@ -1446,6 +1450,37 @@ public class MainFrame extends JFrame {
// Selection par defaut
this.birdPanel.requestFocus();
}
// method for resizing an image while keeping aspect ratio
private static BufferedImage resizeImage(BufferedImage originalImage, int type, int frameWidth, int frameHeight) {
double height = originalImage.getHeight();
double width = originalImage.getWidth();
int newWidth, newHeight;
// if image size smaller than window size, do not resize
if (height < frameHeight && width < frameWidth) {
newWidth = (int) width;
newHeight = (int) height;
}
// else resize
else {
double scaleX = (frameWidth / width);
double scaleY = (frameHeight / height);
double scale = Math.min(scaleX, scaleY);
newWidth = (int) (width * scale);
newHeight = (int) (height * scale);
}
BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, type);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g.dispose();
return resizedImage;
}
// 20120309_MBH-Test-Fin
/**
...
...
@@ -1465,7 +1500,7 @@ public class MainFrame extends JFrame {
JPanel westPanel = new JPanel(new BorderLayout());
/** Panel West : default */
// C
e
reation of the Project Tree Interface for datas
// Creation of the Project Tree Interface for datas
JPanel treeDataPanel = new JPanel(new BorderLayout());
JScrollPane treeDataScrollPane = new JScrollPane(this.mDataProjectTree);
treeDataScrollPane.setPreferredSize(new Dimension(180, 100));
...
...
@@ -1475,7 +1510,7 @@ public class MainFrame extends JFrame {
sif_treeDataPanel.setPreferredSize(new Dimension(160, 50));
sif_treeDataPanel.add(treeDataPanel);
// C
e
reation of the Project Tree Interface for images
// Creation of the Project Tree Interface for images
JPanel treeImagePanel = new JPanel(new BorderLayout());
JScrollPane treeImageScrollPane = new JScrollPane(this.mImageProjectTree);
treeImageScrollPane.setPreferredSize(new Dimension(180, 100));
...
...
@@ -1484,6 +1519,7 @@ public class MainFrame extends JFrame {
sif_treeImagePanel = new SimpleInternalFrame(Messages.getString("MainFrame.691")); //$NON-NLS-1$
sif_treeImagePanel.setPreferredSize(new Dimension(160, 50));
sif_treeImagePanel.add(treeImagePanel);
// Creation of the Informations Panel Interface
this.infosPanel = new JPanel(new BorderLayout());
...
...
@@ -1492,7 +1528,7 @@ public class MainFrame extends JFrame {
sif_infosPanel.setPreferredSize(new Dimension(160, 180));
sif_infosPanel.add(this.infosPanel);
// Creation of the Bi
t
d View Interface
// Creation of the Bi
r
d View Interface
this.birdPanel = new JPanel(new BorderLayout());
this.birdPanel.setPreferredSize(new Dimension(160, 100));
...
...
@@ -1512,7 +1548,7 @@ public class MainFrame extends JFrame {
JSplitPane pane4 = Factory.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT,
pane3, sif_birdPanel, 1f);
pane3.setOpaque(false);
westPanel.add(pane4, BorderLayout.CENTER);
/** End of operation => Panel West : default */
...
...
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
View file @
b59a342a
...
...
@@ -11,10 +11,13 @@ import java.awt.Frame;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.GridLayout
;
import
java.awt.Image
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.FocusEvent
;
import
java.awt.event.FocusListener
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.ItemListener
;
import
java.awt.event.KeyEvent
;
import
java.awt.event.KeyListener
;
import
java.awt.event.MouseAdapter
;
...
...
@@ -69,6 +72,8 @@ import jcl.clustering.constraints.MustLinkConstraint;
import
jcl.clustering.constraints.NbClusterConstraint
;
import
jcl.data.Data
;
import
jcl.utils.Images.StreamedImageReaderWrapper
;
import
mustic.gui.tools.ZoomBoxPanel
;
import
mustic.gui.tools.Zoomable
;
import
mustic.io.RawImage
;
import
mustic.utils.filters.CSVFileFilter
;
import
mustic.utils.io.CSVUtils
;
...
...
@@ -79,7 +84,7 @@ import mustic.utils.io.CSVUtils;
* @author Baptiste LAFABREGUE
*
*/
public
class
ConstraintsSelectionDialog
extends
JInternalFrame
{
public
class
ConstraintsSelectionDialog
extends
JInternalFrame
implements
Zoomable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -99,7 +104,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
/** Image displayed */
private
BufferedImage
mNew
=
null
;
private
JLabel
labelImage
;
/** Panl that containsthe displayed image */
private
JPanel
displayPanel
=
null
;
public
JPanel
mainPanel
;
...
...
@@ -185,8 +191,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
private
BufferedImage
imagePixelCLTemp
;
private
int
classID
;
private
int
classIndex
;
JPanel
container
;
private
JPanel
container
;
/**
* Constructor to a dialog window to visualize and build a set of
...
...
@@ -200,7 +205,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
public
ConstraintsSelectionDialog
(
RawImage
img
,
Data
data
)
{
super
();
mainPanel
=
new
JPanel
(
new
BorderLayout
());
if
(
data
!=
null
)
{
// case of Data provided
...
...
@@ -215,12 +219,10 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
}
// display the image
this
.
labelImage
=
new
JLabel
();
this
.
labelImage
.
setHorizontalAlignment
(
SwingConstants
.
CENTER
);
panelImage
.
add
(
this
.
labelImage
,
BorderLayout
.
CENTER
);
this
.
displayPanel
=
(
JPanel
)
new
ZoomBoxPanel
(
this
);
// key listener for the key "h" which hides/displays the current constraints on the image
labelImage
.
addKeyListener
(
new
KeyListener
()
{
this
.
displayPanel
.
addKeyListener
(
new
KeyListener
()
{
@Override
public
void
keyTyped
(
KeyEvent
e
)
{
...
...
@@ -241,8 +243,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
}
});
labelImage
.
setFocusable
(
true
);
this
.
labelImage
.
addMouseWheelListener
(
new
MouseWheelListener
()
{
this
.
displayPanel
.
setFocusable
(
true
);
this
.
displayPanel
.
addMouseWheelListener
(
new
MouseWheelListener
()
{
@Override
public
void
mouseWheelMoved
(
MouseWheelEvent
e
)
{
if
(
e
.
getUnitsToScroll
()
>
0
)
{
...
...
@@ -253,19 +255,20 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
}
});
this
.
labelImage
.
addMouseListener
(
new
MouseAdapter
()
{
this
.
displayPanel
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
// mouse focus on the window
labelImage
.
requestFocusInWindow
();
int
x
=
(
int
)
((
e
.
getX
()
-
(
int
)
((
labelImage
.
getWidth
()
-
(
labelImage
.
getIcon
().
getIconWidth
()))
/
2.0
))
/
mZoomRate
);
int
y
=
(
int
)
((
e
.
getY
()
-
(
int
)
((
labelImage
.
getHeight
()
-
(
labelImage
.
getIcon
().
getIconHeight
()))
/
2.0
))
/
mZoomRate
);
displayPanel
.
requestFocusInWindow
();
if
(
x
>=
0
&&
y
>=
0
&&
x
<
imageSource
.
getWidth
()
/** mZoomRate*/
&&
y
<
imageSource
.
getHeight
()
/** mZoomRate*/
)
{
// point coordinates relative to img
int
x
=
(
int
)
((
e
.
getX
()
-
(
int
)
((
displayPanel
.
getWidth
()
-
(
mNew
.
getWidth
()))
/
2.0
))
/
mZoomRate
);
int
y
=
(
int
)
((
e
.
getY
()
-
(
int
)
((
displayPanel
.
getHeight
()
-
(
mNew
.
getHeight
()))
/
2.0
))
/
mZoomRate
);
if
(
x
>=
0
&&
y
>=
0
&&
x
<
imageSource
.
getWidth
()
*
mZoomRate
&&
y
<
imageSource
.
getHeight
()
/* mZoomRate*/
)
{
switch
(
currentStep
)
{
case
MustLink_step1:
case
CannotLink_step1:
...
...
@@ -283,10 +286,18 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
displayPixels
();
}
}
@Override
public
void
mouseEntered
(
MouseEvent
e
)
{
displayPanel
.
requestFocusInWindow
();
}
});
setImage
(
img
);
panelImage
.
add
(
this
.
displayPanel
,
BorderLayout
.
CENTER
);
setImage
(
img
);
JPanel
panelButton
=
new
JPanel
();
JButton
buttonOk
=
new
JButton
(
Messages
.
getString
(
"ConstraintsSelectionDialog.50"
));
//$NON-NLS-1$
buttonOk
.
addActionListener
(
new
ActionListener
()
{
...
...
@@ -330,7 +341,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
});
panelButton
.
add
(
exportButton
);
otherComponentList
.
add
(
exportButton
);
JButton
constraintsColorChooser
=
new
JButton
(
Messages
.
getString
(
"ConstraintsSelectionDialog.56"
));
//$NON-NLS-1$
constraintsColorChooser
.
addActionListener
(
new
ActionListener
()
{
...
...
@@ -358,9 +369,28 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
}
});
panelButton
.
add
(
check
);
initializeConstraintsColors
();
otherComponentList
.
add
(
constraintsColorChooser
);
JCheckBox
zoomBoxChkBox
=
new
JCheckBox
(
"Zoom Box"
);
zoomBoxChkBox
.
setMnemonic
(
KeyEvent
.
VK_Z
);
// zoomBoxChkBox.setSelected(zoomBoxActivated);
zoomBoxChkBox
.
addItemListener
(
new
ItemListener
()
{
@Override
public
void
itemStateChanged
(
ItemEvent
e
)
{
if
(
e
.
getStateChange
()
==
ItemEvent
.
SELECTED
)
{
((
ZoomBoxPanel
)
displayPanel
).
setZoomBoxEnabled
(
true
);
}
else
{
((
ZoomBoxPanel
)
displayPanel
).
setZoomBoxEnabled
(
false
);
}
}
});
panelButton
.
add
(
zoomBoxChkBox
);
otherComponentList
.
add
(
zoomBoxChkBox
);
JScrollPane
jpane
=
new
JScrollPane
(
panelImage
);
jpane
.
setBorder
(
BorderFactory
.
createTitledBorder
(
Messages
.
getString
(
"ConstraintsSelectionDialog.7"
)));
//$NON-NLS-1$
...
...
@@ -375,6 +405,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
setConstraints
(
data
.
getConstraints
(),
false
);
}
doZoomedOp
();
this
.
setContentPane
(
mainPanel
);
this
.
setTitle
(
Messages
.
getString
(
"ConstraintsSelectionDialog.8"
));
//$NON-NLS-1$
this
.
setVisible
(
true
);
...
...
@@ -437,10 +469,22 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
jb_labelConstraintClassChooseColor
.
get
(
0
).
putClientProperty
(
"index"
,
0
);
jb_labelConstraintClassChooseColor
.
get
(
0
).
setBackground
(
labelConstraintColor
.
get
(
0
));
createLabelColorConstraintsPanel
();
createLabelColorConstraintsPanel
();
}
protected
float
getmZoomRate
()
{
return
mZoomRate
;
}
protected
JPanel
getImgPanel
()
{
return
panelImage
;
}
@Override
public
BufferedImage
getDisplayedImage
()
{
return
mNew
;
}
protected
void
exportConstraints
()
{
boolean
isImageRelated
=
true
;
...
...
@@ -488,9 +532,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
e
.
printStackTrace
();
}
}
}
protected
void
importConstraints
()
{
try
{
...
...
@@ -540,6 +583,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
classNameButtonPanel
.
add
(
new
JLabel
(
"Class "
+
labelClassesCount
+
":"
));
jb_labelConstraintClassChooseColor
.
get
(
labelClassesCount
-
1
).
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
event
)
{
JButton
lblClassColorButtonClicked
=
(
JButton
)
event
.
getSource
();
int
buttonIndex
=
(
int
)
lblClassColorButtonClicked
.
getClientProperty
(
"index"
);
chooseLabelClassColor
(
buttonIndex
);
...
...
@@ -582,11 +626,13 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
clConstraintsPanel
.
add
(
jb_cannotLinkChooseColor
,
BorderLayout
.
CENTER
);
mlclConstraintsPanel
.
add
(
clConstraintsPanel
);
// button panel
JPanel
buttonPanel
=
new
JPanel
();
JButton
ok
=
new
JButton
(
"OK"
);
// update color changes on ok, update only fields that have changed
ok
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
event
)
{
if
(
mustLinkColorTemp
!=
null
&&
mustLinkColorTemp
!=
mustLinkColor
){
mustLinkColor
=
mustLinkColorTemp
;
changeColorPixel
(
imagePixelMLTemp
,
mustLinkColor
);
...
...
@@ -603,6 +649,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
for
(
int
i
=
0
;
i
<
labelClassesCount
;
i
++){
if
(
labelConstraintColorTemp
.
get
(
i
)
!=
null
&&
labelConstraintColorTemp
.
get
(
i
)
!=
labelConstraintColor
.
get
(
i
)){
labelConstraintColor
.
set
(
i
,
labelConstraintColorTemp
.
get
(
i
));
changeColorPixelLabel
(
imageLabelPixelTemp
.
get
(
i
),
i
,
labelConstraintColorTemp
);
imageLabelPixel
.
set
(
i
,
imageLabelPixelTemp
.
get
(
i
));
...
...
@@ -640,7 +687,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
jb_mustLinkChooseColor
.
setBackground
(
mustLinkColor
);
jb_cannotLinkChooseColor
.
setBackground
(
cannotLinkColor
);
buttonPanel
.
add
(
ok
);
buttonPanel
.
add
(
cancel
);
...
...
@@ -786,8 +833,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
e
.
printStackTrace
();
}
break
;
}
}
...
...
@@ -1076,10 +1121,13 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
imagePoints
.
setRGB
(
x
,
y
,
pixel
);
}
}
this
.
labelImage
.
setIcon
(
new
ImageIcon
(
this
.
imagePoints
));
this
.
image
=
img
;
doZoomedOp
();
// TODO : Solve conflict
// <<
displayPixels
();
// doZoomedOp();
//>>
}
protected
void
addSecondPixel
(
int
x
,
int
y
)
{
...
...
@@ -1094,7 +1142,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
default
:
return
;
}
currentStep
=
-
1
;
previousIndex
=
-
1
;
((
JTextField
)
constraintsPanels
.
get
(
constraintsPanels
.
size
()
-
1
)
...
...
@@ -1125,15 +1172,16 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
Messages
.
getString
(
"ConstraintsSelectionDialog.34"
),
JOptionPane
.
PLAIN_MESSAGE
,
null
,
possibilities
,
"1"
);
// If a string was returned, say so.
if
((
s
!=
null
)
&&
(
s
.
length
()
>
0
))
{
classIndex
=
0
;
int
classIndex
=
0
;
BufferedImage
copy
;
if
(
s
.
equals
(
Messages
.
getString
(
"ConstraintsSelectionDialog.35"
)))
{
labelClassesCount
++;
classIndex
=
labelClassesCount
;
// generate a random color for label constraints of the same
// class
Random
rand
=
new
Random
(
new
Date
().
getTime
());
...
...
@@ -1142,13 +1190,14 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
float
b
=
rand
.
nextFloat
();
labelConstraintColor
.
add
(
new
Color
(
r
,
g
,
b
));
labelConstraintColorTemp
.
add
(
new
Color
(
r
,
g
,
b
));
// initialize button color linked to the new label class
// constraint
jb_labelConstraintClassChooseColor
.
add
(
new
JButton
());
jb_labelConstraintClassChooseColor
.
get
(
classIndex
-
1
)
.
putClientProperty
(
"index"
,
classIndex
-
1
);
jb_labelConstraintClassChooseColor
.
get
(
classIndex
-
1
)
.
setBackground
(
labelConstraintColor
.
get
(
classIndex
-
1
));
.
setBackground
(
labelConstraintColor
.
get
(
classIndex
-
1
));
createLabelColorConstraintsPanel
();
copy
=
clone
(
imagePixel
);
...
...
@@ -1159,6 +1208,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
}
else
{
classIndex
=
Integer
.
parseInt
(
s
);
}
constraints
.
add
(
new
LabelConstraint
(
index
,
classIndex
));
((
JTextArea
)
constraintsPanels
.
get
(
constraintsPanels
.
size
()
-
1
).
getComponent
(
3
))
.
setText
(
""
+
classIndex
);
...
...
@@ -1173,7 +1223,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
doZoomedOp
();
labelContainer
.
updateUI
();
}
currentStep
=
-
1
;
enableAllComponents
();
break
;
...
...
@@ -1210,21 +1259,21 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
linkPixel
(((
CannotLinkConstraint
)
constraints
.
get
(
i
)).
getFirstIndex
(),
((
CannotLinkConstraint
)
constraints
.
get
(
i
)).
getSecondIndex
(),
cannotLinkColor
,
""
);
}
else
if
(
constraints
.
get
(
i
)
instanceof
LabelConstraint
)
{
}
else
if
(
constraints
.
get
(
i
)
instanceof
LabelConstraint
)
{
classID
=
((
LabelConstraint
)
constraints
.
get
(
i
)).
getClassID
();
drawPixel
(((
LabelConstraint
)
constraints
.
get
(
i
)).
getIndex
(),
labelConstraintColor
.
get
(
classID
-
1
),
imageLabelPixel
.
get
(
classID
-
1
));
}
}
this
.
labelImage
.
setIcon
(
new
ImageIcon
(
mNew
));
if
(
previousIndex
>
0
)
{
if
(
currentStep
==
MustLink_step2
)
drawPixel
(
previousIndex
,
mustLinkColor
,
imagePixelML
);
else
drawPixel
(
previousIndex
,
cannotLinkColor
,
imagePixelCL
);
}
//this.doZoomedOp();
this
.
displayPanel
.
repaint
();
}
private
void
linkPixel
(
int
firstIndex
,
int
secondIndex
,
Color
c
,
String
name
)
{
...
...
@@ -1277,6 +1326,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
* temporary color and button indicating the chosen color for the class.
**/
private
void
chooseLabelClassColor
(
int
indexClass
)
{
Color
lblCColorTemp
=
JColorChooser
.
showDialog
(
this
.
jd_colorsChooser
,
"Label Class Color Chooser"
,
Color
.
red
);
//$NON-NLS-1$
this
.
labelConstraintColorTemp
.
set
(
indexClass
,
lblCColorTemp
);
...
...
@@ -1357,7 +1407,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
mNew
=
op
.
filter
(
this
.
imagePoints
,
null
);
displayPixels
();
}
@SuppressWarnings
(
"unchecked"
)
public
Vector
<
Constraint
>
getConstraints
()
{
Vector
<
Constraint
>
fullConstraints
=
(
Vector
<
Constraint
>)
constraints
.
clone
();
...
...
@@ -1385,7 +1435,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
addConstraint
(
c
,
isImageRelated
);
}
displayPixels
();
}
protected
void
createMustLinkConstraint
()
{
...
...
@@ -1432,6 +1481,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
if
(
i
<
constraints
.
size
())
{
constraints
.
remove
(
i
);
}
// constraintsColors.remove(i);
constraintsPanels
.
remove
(
i
);
cannotLinkContainer
.
remove
(
container
);
doZoomedOp
();
...
...
@@ -1516,6 +1566,15 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
System
.
out
.
println
(
Messages
.
getString
(
"ConstraintsSelectionDialog.29"
));
//$NON-NLS-1$
}
public
JPanel
getDisplayPanel
()
{
return
displayPanel
;
}
public
void
setDisplayPanel
(
JPanel
displayPanel
)
{
this
.
displayPanel
=
displayPanel
;
}
private
abstract
class
CustomizedActionListener
implements
ActionListener
{
JPanel
container
;
...
...
@@ -1523,6 +1582,17 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
this
.
container
=
container
;
}
}
@Override
public
Image
getMatchingImage
(
int
x
,
int
y
,
int
width
,
int
height
,
float
zoom
)
{
BufferedImage
subImage
=
this
.
getDisplayedImage
().
getSubimage
(
x
,
y
,
width
,
height
);
return
subImage
.
getScaledInstance
((
int
)
(
width
*
zoom
),
(
int
)
(
height
*
zoom
),
Image
.
SCALE_SMOOTH
);
}
public
BufferedImage
getOriginalImage
()
{
return
imagePoints
;
}
}
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java.orig
0 → 100644
View file @
b59a342a
This diff is collapsed.
Click to expand it.
src/mustic/gui/tools/ZoomBoxPanel.java
0 → 100644
View file @
b59a342a
package
mustic.gui.tools
;
import
java.awt.Color
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Image
;
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.awt.image.BufferedImage
;
import
javax.swing.JPanel
;
/**
* Creates a zoom box over a displayed image
*
* @author Marija Kirandjiska
*
*/
public
class
ZoomBoxPanel
extends
JPanel
{
/** */
private
static
final
long
serialVersionUID
=
1L
;
private
Point
zoomPoint
;
private
Zoomable
dialog
;
private
float
zoom
=
2.0f
;
private
int
zoomArea
=
120
;
private
boolean
zoomBoxEnabled
=
false
;
public
ZoomBoxPanel
(
Zoomable
dialog
,
float
zoom
,
int
zoomArea
)
{
this
(
dialog
);
this
.
zoom
=
zoom
;
this
.
zoomArea
=
zoomArea
;
}
public
ZoomBoxPanel
(
Zoomable
dialog
)
{
this
.
dialog
=
dialog
;
addMouseMotionListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseMoved
(
MouseEvent
e
)
{
zoomPoint
=
e
.
getPoint
();
// method paintComponent() called
repaint
();
}
});
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseEntered
(
MouseEvent
e
)
{
// method paintComponent() called
repaint
();
}
@Override
public
void
mouseExited
(
MouseEvent
e
)
{