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
8777df20
Commit
8777df20
authored
Aug 28, 2017
by
lafabregue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fix
parent
256c8146
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
16 deletions
+69
-16
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
...tic/gui/dialog/classifier/ConstraintsSelectionDialog.java
+69
-16
No files found.
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
View file @
8777df20
...
...
@@ -27,8 +27,10 @@ import java.awt.geom.AffineTransform;
import
java.awt.image.AffineTransformOp
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.Date
;
import
java.io.LineNumberReader
;
import
java.util.List
;
...
...
@@ -37,9 +39,11 @@ import java.util.Vector;
import
javax.imageio.ImageIO
;
import
javax.swing.BorderFactory
;
import
javax.swing.ImageIcon
;
import
javax.swing.JButton
;
import
javax.swing.JCheckBox
;
import
javax.swing.JDialog
;
import
javax.swing.JFileChooser
;
import
javax.swing.JInternalFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JOptionPane
;
...
...
@@ -65,10 +69,9 @@ import jcl.data.Data;
import
jcl.utils.Images.StreamedImageReaderWrapper
;
import
mustic.gui.ProgressPropertyChangeListener
;
import
mustic.io.RawImage
;
import
mustic.utils.image.ImageViewer
;
import
mustic.utils.image.PyramidImageViewer
;
import
mustic.utils.filters.CSVFileFilter
;
import
mustic.utils.image.ZoomBoxPanel
;
import
mustic.utils.i
mage.Zoomable
;
import
mustic.utils.i
o.CSVUtils
;
/**
* Dialog window that allows the user to generate a set of constraints
...
...
@@ -76,7 +79,7 @@ import mustic.utils.image.Zoomable;
* @author Baptiste LAFABREGUE
*
*/
public
class
ConstraintsSelectionDialog
extends
JInternalFrame
implements
Zoomable
{
public
class
ConstraintsSelectionDialog
extends
JInternalFrame
implements
mustic
.
utils
.
image
.
Zoomable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -98,9 +101,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements Zoomab
/** Image displayed */
private
BufferedImage
mNew
=
null
;
/** Image viewer that handle image read operations */
private
ImageViewer
viewer
=
null
;
/** Panel that contains the displayed image */
private
JPanel
displayPanel
=
null
;
...
...
@@ -504,7 +504,47 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements Zoomab
}
protected
void
addConstraint
(
List
<
String
>
line
,
boolean
isImageRelated
)
{
private
boolean
openFile
(
File
file
)
{
System
.
out
.
println
(
"__________________________________________________________________________________________\n"
);
//$NON-NLS-1$
System
.
out
.
println
(
"Opening file : "
+
file
.
getPath
());
//$NON-NLS-1$
System
.
out
.
println
(
"__________________________________________________________________________________________"
);
//$NON-NLS-1$
boolean
isImageRelated
=
true
;
if
(
data
!=
null
)
{
// choose between image or data indexes
String
[]
possibilities
=
{
Messages
.
getString
(
"ConstraintsSelectionDialog.521"
),
Messages
.
getString
(
"ConstraintsSelectionDialog.522"
)
};
String
s
=
(
String
)
JOptionPane
.
showInputDialog
(
this
,
Messages
.
getString
(
"ConstraintsSelectionDialog.524"
),
Messages
.
getString
(
"ConstraintsSelectionDialog.523"
),
JOptionPane
.
PLAIN_MESSAGE
,
null
,
possibilities
,
Messages
.
getString
(
"ConstraintsSelectionDialog.522"
));
// if data is selected
if
(
s
.
equals
(
Messages
.
getString
(
"ConstraintsSelectionDialog.522"
)))
{
isImageRelated
=
false
;
}
}
CSVUtils
reader
=
null
;
try
{
reader
=
new
CSVUtils
(
file
);
clear
();
List
<
String
>
line
;
while
((
line
=
reader
.
readNext
())
!=
null
)
{
addConstraint
(
line
,
isImageRelated
);
}
enableAllComponents
();
displayPixels
();
updateUI
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
return
false
;
}
return
true
;
}
private
void
addConstraint
(
List
<
String
>
line
,
boolean
isImageRelated
)
{
switch
(
Integer
.
parseInt
(
line
.
get
(
line
.
size
()
-
1
)))
{
case
Constraint
.
MUST_LINK_TYPE
:
try
{
...
...
@@ -810,9 +850,6 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements Zoomab
if
(
img
==
null
)
{
return
;
}
// this.viewer = new PyramidImageViewer(img.getFilename(), true);
if
(
this
.
image
!=
null
&&
!
this
.
image
.
getPath
().
equals
(
img
.
getPath
()))
this
.
clear
();
this
.
width
=
img
.
getWidth
();
...
...
@@ -887,7 +924,11 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements Zoomab
}
this
.
image
=
img
;
doZoomedOp
();
// TODO : Solve conflict
// <<
displayPixels
();
// doZoomedOp();
//>>
}
protected
void
addSecondPixel
(
int
x
,
int
y
)
{
...
...
@@ -1293,13 +1334,25 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements Zoomab
// coordinates in original image
int
xo
=
(
int
)
(
x
/
mZoomRate
);
int
yo
=
(
int
)
(
y
/
mZoomRate
);
//
int widthOrigin = (int) (width/mZoomRate);
//
int heightOrigin= (int) (height/mZoomRate);
int
widthOrigin
=
(
int
)
(
width
/
mZoomRate
);
int
heightOrigin
=
(
int
)
(
height
/
mZoomRate
);
float
zoomOrigin
=
zoom
*
mZoomRate
;
BufferedImage
subImage
=
viewer
.
getScreenImage
(
xo
,
yo
,
width
,
height
,
zoomOrigin
,
false
);
return
subImage
;
int
widthSubImage
=
widthOrigin
;
int
heightSubImage
=
heightOrigin
;
// manage integer precision rounding problem
if
(
widthSubImage
+
xo
>
this
.
getOriginalImage
().
getWidth
())
{
widthSubImage
=
this
.
getOriginalImage
().
getWidth
()
-
xo
;
}
if
(
heightSubImage
+
yo
>
this
.
getOriginalImage
().
getHeight
())
{
heightSubImage
=
this
.
getOriginalImage
().
getHeight
()
-
yo
;
}
BufferedImage
subImage
=
this
.
getOriginalImage
().
getSubimage
(
xo
,
yo
,
widthSubImage
,
heightSubImage
);
return
subImage
.
getScaledInstance
((
int
)
(
widthSubImage
*
zoomOrigin
),
(
int
)
(
heightSubImage
*
zoomOrigin
),
Image
.
SCALE_SMOOTH
);
}
public
BufferedImage
getOriginalImage
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment