...
 
Commits (24)
File deleted
This diff is collapsed.
# libgdalconstjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgdalconstjni.so.20'
# Names of this library.
library_names='libgdalconstjni.so.20.3.1 libgdalconstjni.so.20 libgdalconstjni.so'
# The name of the static archive.
old_library='libgdalconstjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgdalconstjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gdalconst_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgdalconstjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libgdaljni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgdaljni.so.20'
# Names of this library.
library_names='libgdaljni.so.20.3.1 libgdaljni.so.20 libgdaljni.so'
# The name of the static archive.
old_library='libgdaljni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgdaljni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gdal_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgdaljni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libgnmjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgnmjni.so.20'
# Names of this library.
library_names='libgnmjni.so.20.3.1 libgnmjni.so.20 libgnmjni.so'
# The name of the static archive.
old_library='libgnmjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgnmjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gnm_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgnmjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libogrjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libogrjni.so.20'
# Names of this library.
library_names='libogrjni.so.20.3.1 libogrjni.so.20 libogrjni.so'
# The name of the static archive.
old_library='libogrjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libogrjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 ogr_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libogrjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libosrjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libosrjni.so.20'
# Names of this library.
library_names='libosrjni.so.20.3.1 libosrjni.so.20 libosrjni.so'
# The name of the static archive.
old_library='libosrjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libosrjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 osr_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libosrjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
No preview for this file type
This diff is collapsed.
......@@ -16,8 +16,10 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.gdal.gdal.Driver;
import org.gdal.gdal.gdal;
import mustic.utils.filters.ImageFileFilter;
import otbAppWrapping.ExecCommand;
public class ConcatenateImagesDialog extends JFrame {
......@@ -166,7 +168,10 @@ public class ConcatenateImagesDialog extends JFrame {
index++;
}
}
ExecCommand.ConcatenateImages(il, path);
gdal.AllRegister();
Driver driver = gdal.GetDriverByName("GTiff");
// gdal.Warp(dstDS, object_list_count, warpAppOptions);
JOptionPane.showMessageDialog(this, "Concatenation successful");
......
......@@ -6,13 +6,11 @@ import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.swing.*;
import mustic.gui.ImageSession;
import mustic.gui.MainFrame;
import mustic.io.Picture;
import mustic.io.RawImage;
public class CropDialog extends JInternalFrame {
......@@ -58,7 +56,6 @@ public class CropDialog extends JInternalFrame {
int band = 0;
double[][][] dataSource = img.load(rec.x, rec.y, rec.width, rec.height);
this.setReplacer(img.getReplacer());
for (int x = 0; x < rec.width; x++) {
for (int y = 0; y < rec.height; y++) {
band = 0;
......
......@@ -18,11 +18,11 @@ import javax.swing.JTextField;
import jcl.data.mask.IntArrayMask;
import jcl.data.mask.Mask;
import jcl.data.mask.MultiIDIntArrayMask;
import multiCube.tools.image.reader.GDALImageReaderWrapper;
import multiCube.tools.image.reader.ReaderWrapper;
import mustic.gui.dialog.Messages;
import mustic.gui.panels.data.DataConstructPanel;
import mustic.io.RawImage;
import mustic.utils.image.reader.GDALImageReaderWrapper;
import mustic.utils.image.reader.ReaderWrapper;
import mustic.utils.io.CSVUtils;
......
......@@ -29,11 +29,9 @@ import javax.swing.JScrollPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import loci.formats.FormatException;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.ImageSession;
import mustic.gui.MainFrame;
import mustic.io.PictureTool;
import mustic.io.RawImage;
import mustic.utils.documentFilter.ToUpdateObject;
......@@ -297,11 +295,8 @@ public class SequenceDialog extends JDialog {
* Return the list of image path constituting the selected sequence
*
* @return the list of ordered file path
*
* @throws FormatException
* if the images don't have the same dimensions
*/
public Vector<RawImage> getSequenceData() throws FormatException {
public Vector<RawImage> getSequenceData() {
int nb = this.dlmSeq.getSize();
Donnee donnee;
Vector<RawImage> paths = new Vector<RawImage>();
......@@ -325,11 +320,8 @@ public class SequenceDialog extends JDialog {
* Return the list of image sessions constituting the selected sequence
*
* @return the list of ordered session
*
* @throws FormatException
* if the images don't have the same dimensions
*/
public Vector<ImageSession> getSequenceSessions() throws FormatException {
public Vector<ImageSession> getSequenceSessions() {
int nb = this.dlmSeq.getSize();
Donnee donnee;
Vector<ImageSession> paths = new Vector<ImageSession>();
......
package mustic.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.text.NumberFormatter;
import mustic.utils.filters.ImageFileFilter;
import otbAppWrapping.ExecCommand;
public class VegetationIndiceExtractionDialog extends JFrame {
/** */
private static final long serialVersionUID = 1L;
private JTextField textInput = new JTextField();
private JTextField textOutput = new JTextField();
private JComboBox<String> indiceComboBox;
private JSpinner spinnerRed;
private JSpinner spinnerNir;
public VegetationIndiceExtractionDialog() {
super();
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(5, 2));
JPanel pInput = new JPanel(new BorderLayout());
// Input browse
panel.add(new JLabel(Messages.getString("VegetationIndiceExtractionDialog.2")), BorderLayout.WEST); //$NON-NLS-1$
pInput.add(this.textInput, BorderLayout.CENTER);
JButton buttonBrowse = new JButton("..."); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
ImageFileFilter filter = new ImageFileFilter();
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showOpenDialog(VegetationIndiceExtractionDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
if (fileChooser.getSelectedFile().getPath().endsWith(".tif")) //$NON-NLS-1$
VegetationIndiceExtractionDialog.this.textInput.setText(fileChooser.getSelectedFile().getPath());
else {
JOptionPane.showMessageDialog(VegetationIndiceExtractionDialog.this, Messages.getString("VegetationIndiceExtractionDialog.21"), Messages.getString("VegetationIndiceExtractionDialog.22"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.WARNING_MESSAGE);
}
}
}
});
pInput.add(buttonBrowse, BorderLayout.EAST);
panel.add(pInput);
// ComboBox
panel.add(new JLabel("Indice"));
String[] indices = new String[]{
"NDVI", "TNDVI", "RVI", "SAVI", "TSAVI", "MSAVI", "MSAVI2", "GEMI", "IPVI"
};
indiceComboBox = new JComboBox<String>(indices);
panel.add(indiceComboBox);
// Red
panel.add(new JLabel(Messages.getString("VegetationIndiceExtractionDialog.4")), BorderLayout.WEST); //$NON-NLS-1$
JPanel pRed = new JPanel(new BorderLayout());
spinnerRed = new JSpinner();
spinnerRed.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerRed.setEditor(new JSpinner.NumberEditor(spinnerRed, "##"));
JFormattedTextField txtRed = ((JSpinner.NumberEditor) spinnerRed.getEditor()).getTextField();
((NumberFormatter) txtRed.getFormatter()).setAllowsInvalid(false);
pRed.add(spinnerRed);
panel.add(pRed);
// NIR
panel.add(new JLabel(Messages.getString("VegetationIndiceExtractionDialog.5")), BorderLayout.WEST); //$NON-NLS-1$
JPanel pNIR = new JPanel(new BorderLayout());
spinnerNir = new JSpinner();
spinnerNir.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerNir.setEditor(new JSpinner.NumberEditor(spinnerNir, "##"));
JFormattedTextField txtNir = ((JSpinner.NumberEditor) spinnerNir.getEditor()).getTextField();
((NumberFormatter) txtNir.getFormatter()).setAllowsInvalid(false);
pNIR.add(spinnerNir);
panel.add(pNIR);
// Output Browse
panel.add(new JLabel(Messages.getString("VegetationIndiceExtractionDialog.3")), BorderLayout.WEST); //$NON-NLS-1$
JPanel pOutput = new JPanel(new BorderLayout());
pOutput.add(this.textOutput, BorderLayout.CENTER);
JButton buttonBrowse2 = new JButton("..."); //$NON-NLS-1$
buttonBrowse2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
if (!VegetationIndiceExtractionDialog.this.textInput.getText().isEmpty())
fileChooser.setSelectedFile(new File(VegetationIndiceExtractionDialog.this.textInput.getText().substring(0,
VegetationIndiceExtractionDialog.this.textInput.getText().indexOf(".tif"))
+"_"+indiceComboBox.getSelectedItem()+".tif"));
ImageFileFilter filter = new ImageFileFilter();
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showSaveDialog(VegetationIndiceExtractionDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
String path;
if (fileChooser.getSelectedFile().getPath().endsWith(".tif")) {
path = fileChooser.getSelectedFile().getPath();
} else {
path = fileChooser.getSelectedFile().getPath() + ".tif";
}
VegetationIndiceExtractionDialog.this.textOutput.setText(path);
}
}
});
pOutput.add(buttonBrowse2, BorderLayout.EAST);
panel.add(pOutput);
// Panel OK
this.textInput.setPreferredSize(new Dimension(200, 30));
JPanel panelButton = new JPanel();
JButton buttonOk = new JButton("Ok"); //$NON-NLS-1$
panelButton.add(buttonOk);
buttonOk.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
buttonOk_actionPerformed();
}
});
mainPanel.add(panel, BorderLayout.NORTH);
mainPanel.add(panelButton, BorderLayout.SOUTH);
this.setContentPane(mainPanel);
this.setTitle(Messages.getString("VegetationIndiceExtractionDialog.1")); //$NON-NLS-1$
this.setSize(350, 200);
this.setResizable(true);
this.setVisible(true);
}
protected void buttonOk_actionPerformed() {
try {
File temp = new File("temporary");
temp.mkdir();
String path;
if (textOutput.getText().endsWith(".tif")) {
path = textOutput.getText();
} else {
path = textOutput.getText() + ".tif";
}
ExecCommand.NdviExtraction(textInput.getText(), "temporary/vegetation.tif", (int) spinnerRed.getValue(), (int) spinnerNir.getValue(), (String) indiceComboBox.getSelectedItem());
ExecCommand.Rescale("temporary/vegetation.tif", path, 0, 255);
JOptionPane.showMessageDialog(this, "Vegetation indice extraction successful");
this.dispose();
setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
// cccccccccccccc JOptionPane.ERROR_MESSAGE);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "An error has occured", "Error", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
}
}
This diff is collapsed.
......@@ -23,6 +23,9 @@ import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.SimpleData;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.weights.GlobalWeights;
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
import mustic.gui.dialog.SequenceDialog;
......@@ -138,7 +141,7 @@ public class ArffToDataDialog extends JInternalFrame implements ToUpdateObject {
}
}
@SuppressWarnings({ "unchecked", "deprecation" })
@SuppressWarnings({ "unchecked" })
protected void buttonOk_actionPerformed() {
try {
Object[] result = DataArffExchange.arffToData(this.textFile.getText());
......@@ -212,16 +215,23 @@ public class ArffToDataDialog extends JInternalFrame implements ToUpdateObject {
// test if we have one or multiples images
if (sequenceFiles.size() > 1) {
data = new ImageData(new ImportedImageSampler(sequenceFilesPath,
(List<DataObject>) result[1], (List<Integer>) result[0]), sequenceFiles);
(List<DataObject>) result[1], (List<Integer>) result[0]), sequenceFiles, null, null);
} else {
data = new ImageData(new ImportedImageSampler(sequenceFilesPath.get(0),
(List<DataObject>) result[1], (List<Integer>) result[0]), sequenceFiles.get(0));
(List<DataObject>) result[1], (List<Integer>) result[0]), sequenceFiles.get(0),
null, null);
}
} else {
// if no images is associated we create a SimpleData
data = new SimpleData((List<DataObject>) result[1]);
data = new SimpleData((List<DataObject>) result[1], null, null);
}
DistanceModel distanceModel = DistanceModel.generateDefaultModel(
data.getOneDataObject(), new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] distanceParameters = DistanceModel
.generateDefaultDistanceParameters(1, distanceModel, data);
data.setDistanceModel(distanceModel, distanceParameters);
if (this.textData.getText().length() == 0) {
this.textData.setText(DataArffExchange.getRelationName(this.textFile.getText()));
......
......@@ -56,6 +56,9 @@ import jcl.clustering.constraints.LabelConstraint;
import jcl.clustering.constraints.MustLinkConstraint;
import jcl.clustering.constraints.NbClusterConstraint;
import jcl.data.Data;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.weights.GlobalWeights;
import mustic.utils.image.ImageAddOn;
import mustic.utils.image.ImageDisplayer;
import mustic.utils.tools.ProgressPropertyChangeListener;
......@@ -161,11 +164,15 @@ public class ConstraintsSelectionFrame extends JFrame implements ImageAddOn {
this.imageDisplayer = imgDisplayer;
this.constraintsContainer = constraintsContainer;
if (data != null) {
// case of Data provided
minDistance = data.getEstimatedMinDistance();
maxDistance = data.getEstimatedMaxDistance();
DistanceModel model = DistanceModel.generateDefaultModel(data.getOneDataObject(),
new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] parameters = DistanceModel.generateDefaultDistanceParameters(1,model, data);
minDistance = data.getEstimatedMinDistance(model, parameters[0]);
maxDistance = data.getEstimatedMaxDistance(model, parameters[0]);
this.data = data;
} else {
// otherwise we base our estimation on the image
......@@ -1012,7 +1019,9 @@ public class ConstraintsSelectionFrame extends JFrame implements ImageAddOn {
}
public void refresh() {
container.updateUI();
if (container != null) {
container.updateUI();
}
imageDisplayer.refresh(false);
}
......
......@@ -24,10 +24,13 @@ import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.SimpleData;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.weights.GlobalWeights;
import multiCube.tools.image.ImageHelper;
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
import mustic.utils.documentFilter.ToUpdateObject;
import mustic.utils.image.ImageHelper;
import mustic.utils.io.CSVUtils;
......@@ -140,7 +143,6 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
}
}
@SuppressWarnings({"deprecation"})
protected void buttonOk_actionPerformed() {
try {
List<DataObject> result = new ArrayList<DataObject>();
......@@ -160,7 +162,11 @@ public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
}
if(result != null) {
data = new SimpleData(result);
data = new SimpleData(result, null, null);
DistanceModel model = DistanceModel.generateDefaultModel(data.getOneDataObject(),
new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] parameters = DistanceModel.generateDefaultDistanceParameters(1,model, data);
data.setDistanceModel(model, parameters);
if (this.textData.getText().length() == 0) {
this.textData.setText(ImageHelper.extractFileName(
......
......@@ -20,10 +20,10 @@ import javax.swing.JPanel;
import javax.swing.JTextField;
import jcl.data.Data;
import multiCube.tools.image.ImageHelper;
import mustic.gui.DataDesktopFrame;
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
import mustic.utils.image.ImageHelper;
import mustic.utils.io.dataExchange.DataOGRExchange;
/**
......
......@@ -21,6 +21,9 @@ import javax.swing.text.PlainDocument;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.SimpleData;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.weights.GlobalWeights;
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
import mustic.utils.documentFilter.BasicIntDocumentFilter;
......@@ -158,7 +161,13 @@ public class OGRToDataDialog extends JInternalFrame implements ToUpdateObject {
if(result != null) {
data = new SimpleData(result);
data = new SimpleData(result, null, null);
DistanceModel distanceModel = DistanceModel.generateDefaultModel(
data.getOneDataObject(), new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] distanceParameters = DistanceModel
.generateDefaultDistanceParameters(1, distanceModel, data);
data.setDistanceModel(distanceModel, distanceParameters);
data.setDataName(this.textData.getText());
MainFrame.getInstance().createDataSession(data);
......
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,10 @@ import java.awt.event.ActionEvent;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.learning.LearningParameters;
import jcl.weights.GlobalWeights;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame;
import mustic.io.ImageData;
......@@ -79,7 +82,13 @@ class RemoteSensingClassifierDialog extends ClassifierDialog {
if (this.bidouille == null) {
img = MainFrame.getInstance().getDesktop().getAllImageDesktopFrames()[this.dataBox
.getSelectedIndex()].getImageSession().getRawImage();
this.bidouille = new ImageData(img);
this.bidouille = new ImageData(img, null, null);
DistanceModel distanceModel = DistanceModel.generateDefaultModel(
this.bidouille.getOneDataObject(), new GlobalWeights(this.bidouille.getOneDataObject()));
DistanceParameter[][] distanceParameters = DistanceModel
.generateDefaultDistanceParameters(1, distanceModel, this.bidouille);
this.bidouille.setDistanceModel(distanceModel, distanceParameters);
}
LearningParameters params = this.classifiersPanel
......
......@@ -11,8 +11,12 @@ import javax.swing.border.TitledBorder;
import jcl.data.Data;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.learning.LearningParameters;
import jcl.learning.methods.multistrategy.samarah.*;
import jcl.learning.methods.multistrategy.samarahConstrained.HybridClassificationConstrained;
import jcl.weights.GlobalWeights;
import mustic.gui.MainFrame;
import mustic.gui.dialog.classifier.AgentDialog;
import mustic.gui.panels.classifier.*;
......@@ -55,7 +59,7 @@ public class HybridClassificationPanel extends JPanel implements AgentListManage
JScrollPane jScrollPaneAgents = new JScrollPane();
/** La classification hybride vue par cette interface */
private HybridClassification samarah = null;
private HybridClassificationConstrained samarah = null;
private boolean selectData = true;
......@@ -74,7 +78,7 @@ public class HybridClassificationPanel extends JPanel implements AgentListManage
this.title = this.title + "." + HybridClassificationPanel.nbSamarah;
HybridClassificationPanel.nbSamarah++;
// this.samarah = new HybridClassification("TEST", data, null);
this.samarah = new HybridClassification();
this.samarah = new HybridClassificationConstrained(null, null);
if (MainFrame.DEBUG_MODE)
System.out.println(" in HybridClassificationParametersPanel() ");
this.samarah.config.printInfo();
......@@ -98,7 +102,11 @@ public class HybridClassificationPanel extends JPanel implements AgentListManage
jbInit();
HybridClassificationPanel.nbSamarah++;
// this.samarah = new HybridClassification("TEST", data, null);
this.samarah = new HybridClassification();
DistanceModel model = DistanceModel.generateDefaultModel(data.getOneDataObject(),
new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] parameters = DistanceModel.generateDefaultDistanceParameters(1,model, data);
this.samarah = new HybridClassificationConstrained(model, parameters);
}
@Override
......@@ -151,12 +159,17 @@ public class HybridClassificationPanel extends JPanel implements AgentListManage
else {
file += "\t\t<isSimplifySequence>true</isSimplifySequence>\n";
}
if (AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.EUCLIDIEN) {
file += "\t\t<isUseNaiveDist>true</isUseNaiveDist>\n";
}
else {
file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
}
//TODO try to match with the new distanceModel
// for (Distance<Attribute, DistanceParameter> d : agent.getParams().getModel().getDistances()) {
// if(!(d instanceof DistanceEuclidean))
//
// }
// if (AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.EUCLIDIEN && agent.getParams().getModel()) {
// file += "\t\t<isUseNaiveDist>true</isUseNaiveDist>\n";
// }
// else {
// file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
// }
if (agent.getParams().weights != null) {
file += "\t\t<weight>";
double weights[] = agent.getParams().weights.getGlobalWeights().getWeights();
......
......@@ -11,6 +11,8 @@ import javax.swing.*;
import jcl.Classification;
import jcl.data.Data;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.evaluation.clustering.ClusteringEvaluation;
import jcl.learning.LearningParameters;
import jcl.learning.methods.monostrategy.SingleClassification;
......@@ -18,7 +20,6 @@ import jcl.learning.methods.multistrategy.modular.ClassifierModular;
import jcl.learning.methods.multistrategy.modular.maclaw.ClassifierMaclaw;
import jcl.learning.methods.multistrategy.modular.maclaw.ParametersMaclaw;
import jcl.weights.*;
import loci.formats.FormatException;
import mustic.gui.*;
import mustic.gui.dialog.classifier.ClassifierDialog;
import mustic.gui.panels.classifier.SelectionModel;
......@@ -102,7 +103,7 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
else
imgSession = desktopFrames[0].getImageSession();
Data data = this.getData();
Data data = MainFrame.getInstance().getCurrentDataSession().getData();
classification = new SingleClassification(data, this.getParameters());
System.out.println(" Classification MACLAW :");
......@@ -112,26 +113,6 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
}
}
public Data getData() {
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop().getAllDesktopFrames();
int nbSessions = desktopFrames.length;
if (this.data == null) {
if (this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox().getSelectedIndex() == nbSessions) {
this.data = desktopFrames[this.initMethodClassifierDialog.classifiersPanel.sequenceDialog.getFirstIndex()].getImageSession()
.getImageData();
try {
this.data.setSequence(this.initMethodClassifierDialog.classifiersPanel.sequenceDialog.getSequenceData());
} catch (FormatException e) {
e.printStackTrace();
}
}
else {
this.data = desktopFrames[this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox()
.getSelectedIndex()].getImageSession().getImageData();
}
}
return this.data;
}
public ClassifierDialog getInitMethodClassifierDialog() {
return initMethodClassifierDialog;
......@@ -167,23 +148,7 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
boolean fuzzy = this.jCheckBoxFuzzy.isSelected();
double phi = Double.parseDouble(this.jTextFieldPhi.getText());
double alpha = Double.parseDouble(this.jTextFieldAlpha.getText());
ImageSession imgSession = null;
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop().getAllDesktopFrames();
int nbSession = desktopFrames.length;
if (this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox().getSelectedIndex() == nbSession) {
this.data = desktopFrames[this.initMethodClassifierDialog.classifiersPanel.sequenceDialog.getFirstIndex()].getImageSession()
.getImageData();
try {
this.data.setSequence(this.initMethodClassifierDialog.classifiersPanel.sequenceDialog.getSequenceData());
} catch (FormatException e) {
e.printStackTrace();
}
}
else {
imgSession = desktopFrames[this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox()
.getSelectedIndex()].getImageSession();
this.data = imgSession.getImageData();
}
this.data = MainFrame.getInstance().getCurrentDataSession().getData();
LearningParameters initParams = this.initMethodClassifierDialog.classifiersPanel.getParameters(this.data);
int clusterQualityCriterion = ClusteringEvaluation.WG;
switch (this.jComboBoxQuality.getSelectedIndex()) {
......@@ -194,11 +159,21 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
clusterQualityCriterion = ClusteringEvaluation.WG;
break;
}
ClassificationWeights weights = new GlobalWeights(new Weights(this.data.getOneDataObject().getNbAttributes()));
return new ParametersMaclaw(distributed, nbGenerations, nbIndividuals, nbClusters, nbRefs, ClassifierModular.PRODUCT, nbCpu, initParams,
initParams, fuzzy, alpha, phi, clusterQualityCriterion, ClassifierMaclaw.GENETIC, ClassifierMaclaw.WEIGHTING, 1.0, weights);
DistanceModel distanceModel = DistanceModel.generateDefaultModel(
data.getOneDataObject(), new GlobalWeights(data.getOneDataObject()));
// if (this.isUseNaiveDist) {
// distanceModel = DistanceModel.generateNaiveModel(
// data.getOneDataObject(), new GlobalWeights(data.getOneDataObject()));
// }
int nbThreads = Runtime.getRuntime().availableProcessors();
DistanceParameter[][] distanceParameters = DistanceModel.generateDefaultDistanceParameters(
nbThreads, distanceModel, data);
return new ParametersMaclaw(distributed, nbGenerations, nbIndividuals, nbClusters,
nbRefs, ClassifierModular.PRODUCT, nbCpu, initParams,
initParams, fuzzy, alpha, phi, clusterQualityCriterion,
ClassifierMaclaw.GENETIC, ClassifierMaclaw.WEIGHTING, 1.0, null, null);
}
}
......@@ -220,12 +195,7 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
else {
file += "\t\t<isSimplifySequence>true</isSimplifySequence>\n";
}
if (AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.EUCLIDIEN) {
file += "\t\t<isUseNaiveDist>true</isUseNaiveDist>\n";
}
else {
file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
}
file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
if (parameters.weights != null) {
file += "\t\t<weight>";
......@@ -237,12 +207,10 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
file += "</weight>\n";
}
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop().getAllDesktopFrames();
int nbSessions = desktopFrames.length;
DataSession session = MainFrame.getInstance().getCurrentDataSession();
file += "\t\t<data>"
+ desktopFrames[this.learningMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox().getSelectedIndex()]
.getImageSession().getRawImage().getPath() + "</data>\n";
+ session.getAssociatedImageSessions().get(0).getRawImage().getPath() + "</data>\n";
file += "\t</LearningMethod>\n";
......@@ -262,12 +230,7 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
else {
file += "\t\t<isSimplifySequence>true</isSimplifySequence>\n";
}
if (AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.EUCLIDIEN) {
file += "\t\t<isUseNaiveDist>true</isUseNaiveDist>\n";
}
else {
file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
}
file += "\t\t<isUseNaiveDist>false</isUseNaiveDist>\n";
if (parameters.weights != null) {
file += "\t\t<weight>";
......@@ -278,16 +241,8 @@ public class MaclawClassificationParametersPanel extends JPanel implements Param
}
file += "</weight>\n";
}
if (this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox().getSelectedIndex() == nbSessions) {
int index[] = this.initMethodClassifierDialog.classifiersPanel.sequenceDialog.getSequenceIndex();
for (int id = 0; id < index.length; id++) {
file += "\t\t<data>" + desktopFrames[index[id]].getImageSession().getRawImage().getPath() + "</data>\n";
}
}
else {
file += "\t\t<data>"
+ desktopFrames[this.initMethodClassifierDialog.classifiersPanel.getApproachPanel().getDataComboBox().getSelectedIndex()]
.getImageSession().getRawImage().getPath() + "</data>\n";
for (int id = 0; id < session.getAssociatedImageSessions().size(); id++) {
file += "\t\t<data>" + session.getAssociatedImageSessions().get(id).getRawImage().getPath() + "</data>\n";
}
file += "\t</InitMethod>\n";
file += "\t<nbClusters>" + this.jTextFieldNbClusters.getText() + "</nbClusters>\n";
......
......@@ -85,7 +85,7 @@ ClassifierPanel.32=<li><b>pour une machine linux : </b>
ClassifierPanel.33=lancer le script jcld.sh sur une machine distante. Par defaut le port sur lequel sera lanc&eacute; le serveur est demand&eacute; au d&eacute;marrage. Vous pouvez pr&eacute;d&eacute;finir le num&eacute;ro de port en le donnant en argument du script <br> par exemple : <em> ./jcld.sh &lt;numero_de_port&gt;</em>
ClassifierPanel.34=<br>Le num&eacute;ro de port conseill&eacute; est 10099.</li></ul></p></html>
ClassifierPanel.35=OK
ClassifierPanel.36=Installer un serveur
ClassifierPanel.36=Install a server
ClassifierPanel.37=Attributes selection and weigths configuration
ClassifierPanel.38=Sequence options
ClassifierPanel.39=Method
......
......@@ -15,8 +15,11 @@ import javax.swing.JScrollPane;
import com.l2fprod.common.swing.JTaskPane;
import com.l2fprod.common.swing.JTaskPaneGroup;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.data.mask.Mask;
import jcl.data.sampling.Sampler;
import jcl.weights.GlobalWeights;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.ImageSession;
import mustic.gui.MainFrame;
......@@ -143,12 +146,19 @@ public class DataConstructPanel extends JPanel implements ToUpdateObject {
if (containsAtLeastOne) {
((ImageSampler) sample).setMaskSequence(maskSequence);
}
}
}
if (filesPaths.size() > 1) {
data = new ImageData(sample, filesPaths);
data = new ImageData(sample, filesPaths, null, null, null);
} else {
data = new ImageData(sample, filesPaths.get(0));
data = new ImageData(sample, filesPaths.get(0), null, null);
}
DistanceModel distModel = DistanceModel.generateDefaultModel(data.getOneDataObject(),
new GlobalWeights(data.getOneDataObject()));
DistanceParameter[][] distParameters = DistanceModel
.generateDefaultDistanceParameters(1, distModel, data);
data.setDistanceModel(distModel, distParameters);
MainFrame.getInstance().createDataSession(data);
DataConstructFrame.getInstance().updateDataConstructPanel();
......
......@@ -4,6 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
......@@ -135,6 +136,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);
......@@ -289,7 +291,7 @@ public class DataPanel extends JPanel implements ChangeListener {
this.statsTable = new JTable();
this.statsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.statsTable.setFocusable(false);
updateStatsTable(0);
//updateStatsTable(0);
JScrollPane stastScrollPane = new JScrollPane(this.statsTable);
stastScrollPane.setPreferredSize(new Dimension(200, 100));
......
......@@ -64,10 +64,10 @@ public class SegmentationPanel extends JPanel implements ActionListener, MouseLi
/*** truc ImageSession */
/** zoom level */
protected float mZoomRate = 1.0f; // 1.9f;
protected double mZoomRate = 1.0; // 1.9f;
/** zoom step */
protected float mZoomStep = 0.1f; // 0.2f;
protected double mZoomStep = 0.1; // 0.2f;
/** brightness value */
float offset = 10;
......
......@@ -264,7 +264,7 @@ public class SegmentationPanelResultatImage extends JPanel {
* Apply the zoom factor. And display the image. When another operation is finished, this method
* <b>must be called<b>.
*/
public void doZoomOp(float mZoomRate) {
public void doZoomOp(double mZoomRate) {
AffineTransform trans = AffineTransform.getScaleInstance(mZoomRate, mZoomRate);
AffineTransformOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
this.zoomed = op.filter(this.imageContours, null); // this.colored
......@@ -459,7 +459,7 @@ public class SegmentationPanelResultatImage extends JPanel {
}
public void clickSurImage(int x, int y, float mZoomRate) {
public void clickSurImage(int x, int y, double mZoomRate) {
if (x >= 0 && x < this.zoomed.getWidth() && y >= 0 && y < this.zoomed.getHeight()) {
this.setClicked(this.getPointWithReelCoordinates(x, y, mZoomRate));
this.updateInformationPanel(x, y, mZoomRate);
......@@ -472,7 +472,7 @@ public class SegmentationPanelResultatImage extends JPanel {
* @param y the y co-ordinate of the point which is clicked.
* @return the point with the reel co-ordinates.
*/
public Point getPointWithReelCoordinates(int x, int y, float mZoomRate) {
public Point getPointWithReelCoordinates(int x, int y, double mZoomRate) {
int xreel, yreel;
xreel = (int) (((double) x / mZoomRate) + this.rx);
yreel = (int) (((double) y / mZoomRate) + this.ry);
......@@ -520,7 +520,7 @@ public class SegmentationPanelResultatImage extends JPanel {
* @param x x coord.
* @param y y coord.
*/
private void updateInformationPanel(int ex, int ey, float mZoomRate) {
private void updateInformationPanel(int ex, int ey, double mZoomRate) {
double w1 = contoursLabel.getWidth();
double w2 = contoursLabel.getIcon().getIconWidth();
......@@ -566,7 +566,7 @@ public class SegmentationPanelResultatImage extends JPanel {
}
}
public void setRegionToolTip(int x, int y, float mZoomRate) {
public void setRegionToolTip(int x, int y, double mZoomRate) {
if (x >= 0 && x < this.zoomed.getWidth() && y >= 0 && y < this.zoomed.getHeight()) {
Point clicked = this.getPointWithReelCoordinates(x, y, mZoomRate);
this.updateRegionInfos(clicked);
......@@ -977,7 +977,7 @@ public class SegmentationPanelResultatImage extends JPanel {
List<Descripteur> listDescr = s.getResultat().getObjectsImage().get(0).getListe_objetsDescripteur();
Descripteur d = null;
List<String> nomAttrib = new ArrayList<String>();
ImageData imageData = new ImageData(mRawImage);
ImageData imageData = new ImageData(mRawImage, null, null);
int nbPixels = imageData.getNbObjects();
int nbAttributues = imageData.getPixel(0).getNbAttributes();
double[] moyenne = new double[nbAttributues];
......
......@@ -11,22 +11,18 @@ import java.util.zip.ZipOutputStream;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import jcl.Classification;
import jcl.clustering.Cluster;
import jsl.Segmentation;
import jsl.io.ObjetImage;
import jsl.utils.PointDiscret;
import mustic.gui.DesktopFrame;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame;
import mustic.gui.panels.ImageResultPanel;
import mustic.io.ImageData;
import mustic.io.RawImage;
import mustic.models.gui.ClassificationModel;
import mustic.models.gui.panels.ClassConfigPanel;
import mustic.utils.filters.ZipFileFilter;
import org.apache.batik.svggen.SVGGraphics2DIOException;
......@@ -104,7 +100,8 @@ public class SegmentationResultPanel extends ImageResultPanel {
// On update le boutton Border mode activate
@Override
public void actionPerformed(ActionEvent e) {
updateButtonBorder();
//TODO - old version was not compatible anymore
// updateButtonBorder();
}
});
}
......@@ -195,29 +192,9 @@ public class SegmentationResultPanel extends ImageResultPanel {
.getTabAt(MainFrame.getInstance().getCurrentImageSession().getWorkSpace().getTabCount() - 1));
}
@Override
public int[] getClusterMap() {
int width = this.getImgData().getWidth();
int height = this.getImgData().getHeight();
this.map = new int[width * height];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
Color c = new Color(this.colored.getRGB(x, y));
for (int i = 0; i < this.classification.getNbClusters(); i++) {
if (c.equals(this.classification.getClusteringResult().getClustersColors()[i])) {
map[x + y * width] = i;
break;
}
}
}
}
return this.map;
return this.classification.getClusteringResult().getClusterMap();
}
/**
......@@ -450,14 +427,9 @@ public class SegmentationResultPanel extends ImageResultPanel {
}
}
}
doZoomOp();
refresh(true);
}
@Override
public void setImage(BufferedImage image, int rx, int ry) {
System.out.println("setImage from SRP");
}
/**
* Surcharge des ecouteurs de ImageResultPanel
......@@ -471,198 +443,28 @@ public class SegmentationResultPanel extends ImageResultPanel {
// Pour trouver la couleur du cluster correpondant au point sur
// lequel on a cliquer
int x = ev.getX() - ((labelImage.getWidth() - zoomed.getWidth()) / 2);
int y = ev.getY() - ((labelImage.getHeight() - zoomed.getHeight()) / 2);
if (x >= 0 && x < zoomed.getWidth() && y >= 0 && y < zoomed.getHeight()) {
int coul = zoomed.getRGB(x, y);
Color couleur = new Color(coul);
JTree arbre = classPanel.getTree();
TreePath path = ClassConfigPanel.selectionneCluster(couleur, (DefaultMutableTreeNode) arbre.getModel().getRoot());
arbre.scrollPathToVisible(path);
arbre.setSelectionPath(path);
}
// Pour entourer la region sur laquelle on a cliqué
clicked = getPointWithReelCoordinates(x, y);
selectRegion();
if (MainFrame.DEBUG_MODE)
System.out.println("updateImageColors from mouse listener");
updateImageColors();
// Point p = converteCoordinatesToImage(ev.getX(), ev.getY());
//
// if (p.x >= 0 && p.x < zoomed.getWidth() && y >= 0 && y < zoomed.getHeight()) {
// int coul = zoomed.getRGB(x, y);
// Color couleur = new Color(coul);
// JTree arbre = classPanel.getTree();
// TreePath path = ClassConfigPanel.selectionneCluster(couleur, (DefaultMutableTreeNode) arbre.getModel().getRoot());
// arbre.scrollPathToVisible(path);
// arbre.setSelectionPath(path);
//
// }
//
// // Pour entourer la region sur laquelle on a cliqué
// clicked = getPointWithReelCoordinates(x, y);
// selectRegion();
// if (MainFrame.DEBUG_MODE)
// System.out.println("updateImageColors from mouse listener");
}
});
this.labelImage.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getUnitsToScroll() > 0) {
zoomIn();
}
else {
zoomOut();
}
}
});
}
private void updateButtonBorder() {
System.out.println("updateButtonBorder()");
if (super.classPanel.cbBorderMode.isSelected()) {
bouttonBorderIsSelected = true;
updateImageColors();
}
else {
bouttonBorderIsSelected = false;
updateImageColors();
}
}
/**
* Surcharge de la méthode de ImageResultPanel
*/
@Override
public void updateImageColors() {
int w = this.colored.getWidth();
int h = this.colored.getHeight();
int width = this.getImgData().getWidth();
int height = this.getImgData().getHeight();
System.out.println(" Nb clusters " + classification.getClusteringResult().getNbClusters());
int[] map = classification.getClusteringResult().getClusterMap();
System.out.println(" 1***************> " + map.length);
Color[] couleurs = classification.getClusteringResult().getClustersColors();
System.out.println(" 2***************> " + couleurs.length);
this.panelImage.removeAll();
// On dessine la region selectionnée en rouge
if (mapContoursBlanc == null)
constructImageFrontiere();
dessinerRegionSelectionne();
// On fait une image colorée de la taille du carré selectionnée dans la
// birdView
this.colored = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
int a = 0;
for (int i = 0; i < this.s.getResultat().getNombreRegions(); i++) {
ObjetImage regionCourante = this.s.getResultat().getRegion(i);
if (regionCourante.getPixels().size() <= 3) {
// System.out.println("region vide");
}
else {
Cluster c = this.classification.getClusteringResult().getCluster(map[a]);
if (c != null) {
boolean visibility = c.isVisible();
for (Point p : regionCourante.getPixels()) {
// On test si le pixel rentre bien dans le cadre
// selectionnée dasn la birdView
if (p.x > this.rx && p.x < (this.rx + w) && p.y > this.ry && p.y < (this.ry + h)) {
int value = imageContours.getRGB(p.x, p.y);
Color colorFather = c.getCouleurPere();
int coul = colorFather.getRGB();
if (visibility) {
// Image de Resultat de classif sur laquelle on
// plaque les frontieres des régions
if (value != 0) {
if (value == Color.RED.getRGB()) {
// si on est sur une frontière rouge
this.colored.setRGB(p.x - rx, p.y - ry, value);
}
else {
// si les frontières sont activés on
// dessine les blanches
if (bouttonBorderIsSelected) {
this.colored.setRGB(p.x - rx, p.y - ry, value);
}
else {
// Les frontières ne sont pas activé
this.colored.setRGB(p.x - rx, p.y - ry, couleurs[map[a]].getRGB());
}
}
}
else {
// sinon on pose la couleur de la classe
this.colored.setRGB(p.x - rx, p.y - ry, couleurs[map[a]].getRGB());
}
}
else {
// Mode Multi
if (this.classPanel.getSelectionMode() == ClassConfigPanel.MODE_MULTI) {
// Si le pere est blanc on dessine la vraie
// image
if (colorFather.getRed() == 255 && colorFather.getGreen() == 255 && colorFather.getBlue() == 255) {
if (value != 0 && bouttonBorderIsSelected) {
// si on est sur une frontière