Commit 2324f382 authored by lafabregue's avatar lafabregue

fix merge with new constrained samarah

parents 33a0b68d bd1cc665
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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
......
......@@ -24,6 +24,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 multiCube.tools.image.ImageHelper;
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
......@@ -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(
......
package mustic.gui.dialog.csv;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.DistanceModel;
import jcl.data.SimpleData;
import jcl.data.attribute.AttributeMultiDimSequence;
<<<<<<< HEAD
import jcl.data.distance.DistanceParameter;
import jcl.weights.GlobalWeights;
=======
import multiCube.tools.image.ImageHelper;
>>>>>>> master
import mustic.gui.MainFrame;
import mustic.gui.dialog.Messages;
import mustic.utils.documentFilter.ToUpdateObject;
import mustic.utils.io.CSVUtils;
/**
* Dialog that allow the user to generate a Data from an arff file
*
* @author Baptiste LAFABREGUE
*
*/
public class CSVToDataDialog extends JInternalFrame implements ToUpdateObject {
private static final long serialVersionUID = 1L;
private JTextField textFile = new JTextField();
private JTextField textData = new JTextField();
private JTextField textSeparator = new JTextField();
public CSVToDataDialog() {
super();
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(3, 2));
JPanel pInpout = new JPanel(new BorderLayout());
panel.add(new JLabel(Messages.getString("CSVToDataDialog.0")), BorderLayout.WEST); //$NON-NLS-1$
pInpout.add(this.textFile, BorderLayout.CENTER);
this.textFile.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
updateOutputName();
}
@Override
public void focusGained(FocusEvent e) {
}
});
JButton buttonBrowse = new JButton("..."); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
int returnVal = fileChooser
.showOpenDialog(CSVToDataDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
CSVToDataDialog.this.textFile.setText(fileChooser
.getSelectedFile().getPath());
updateOutputName();
if (!fileChooser.getSelectedFile().getPath()
.endsWith(".csv")) { //$NON-NLS-1$
JOptionPane.showMessageDialog(CSVToDataDialog.this,
Messages.getString("CSVToDataDialog.3"), //$NON-NLS-1$
Messages.getString("CSVToDataDialog.4"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
}
}
}
});
pInpout.add(buttonBrowse, BorderLayout.EAST);
panel.add(pInpout);
JPanel pSeparator = new JPanel(new BorderLayout());
panel.add(new JLabel(Messages.getString("CSVToDataDialog.2")), BorderLayout.WEST); //$NON-NLS-1$
pSeparator.add(this.textSeparator, BorderLayout.CENTER);
panel.add(pSeparator);
this.textSeparator.setText(";");
JPanel pOutpout = new JPanel(new BorderLayout());
panel.add(new JLabel(Messages.getString("CSVToDataDialog.5")), BorderLayout.WEST); //$NON-NLS-1$
pOutpout.add(this.textData, BorderLayout.CENTER);
panel.add(pOutpout);
this.textFile.setPreferredSize(new Dimension(200, 30));
JPanel panelButton = new JPanel();
JButton buttonOk = new JButton(Messages.getString("CSVToDataDialog.7")); //$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("CSVToDataDialog.8")); //$NON-NLS-1$
this.setSize(300, 180);
this.setResizable(true);
this.setMaximizable(true);
this.setIconifiable(true);
this.setClosable(true);
this.setVisible(true);
this.requestFocus();
}
private void updateOutputName() {
if (this.textData.getText() != null && this.textData.getText() != "") { //$NON-NLS-1$
// we don't update if there is already a value
return;
}
if (this.textFile.getText() != null && this.textFile.getText() != "") { //$NON-NLS-1$
this.textData.setText(ImageHelper.extractFileName(
ImageHelper.stripExtension(this.textData.getText())));
}
}
protected void buttonOk_actionPerformed() {
try {
List<DataObject> result = new ArrayList<DataObject>();
Data data = null;
CSVUtils reader = null;
try {
File file = new File(this.textFile.getText());
reader = new CSVUtils(file, this.textSeparator.getText().charAt(0));
List<String> line;
while((line = reader.readNext()) != null) {
extractObjectFromLine(result, line);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
result = null;
}
if(result != null) {
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(
ImageHelper.stripExtension(this.textData.getText())));
}
data.setDataName(this.textData.getText());
MainFrame.getInstance().createDataSession(data);
JOptionPane.showMessageDialog(this,
Messages.getString("CSVToDataDialog.151") + this.textData.getText() //$NON-NLS-1$
+ " " + Messages.getString("CSVToDataDialog.152"), //$NON-NLS-1$
Messages.getString("CSVToDataDialog.16"), //$NON-NLS-1$
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(this,
Messages.getString("CSVToDataDialog.41"), //$NON-NLS-1$
Messages.getString("CSVToDataDialog.4"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
}
this.dispose();
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
Messages.getString("CSVToDataDialog.41"), //$NON-NLS-1$
Messages.getString("CSVToDataDialog.4"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
e.printStackTrace();
}
}
/**
* Construct a DataObject from a set of Strings and add it to a List
* @param list
* the list to add the DataObject to
* @param line
* the line to interpret
*/
private void extractObjectFromLine(List<DataObject> list, List<String> line) {
DataObject obj = new DataObject(1);
double[][] seq = new double[line.size()][];
for (int i = 0 ; i < line.size() ; i++) {
seq[i] = new double[1];
seq[i][0] = Double.parseDouble(line.get(i));
}
obj.setAttribute(0, new AttributeMultiDimSequence(seq));
list.add(obj);
}
@Override
public void update(String s) {
}
}
......@@ -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.
......@@ -4,8 +4,6 @@ import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Observable;
import java.util.Observer;
import java.util.Vector;
......@@ -949,10 +947,11 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
*/
public void hClustering_actionPerformed(boolean newResult) {
try {
LearningParameters learningParameters = new ParametersAHC(null);
LearningParameters learningParameters = new ParametersAHC(imgData.getDistanceModel(),
imgData.getDistanceParameters());
LearningMethod learningMethod = learningParameters.getLearningMethodInstance();
@SuppressWarnings("deprecation")
Data classificationData = new SimpleData(this.result.getClusterCenters());
Data classificationData = new SimpleData(this.result.getClusterCenters(),
imgData.getDistanceModel(), imgData.getDistanceParameters());
LearningResult learningResult = learningMethod.learn(classificationData);
this.result.hierarchy = ((LearningResultAHC) learningResult).getHierarchy();
Classification classif = new SingleClassification("", classificationData, learningMethod, this.result);
......@@ -1199,12 +1198,6 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
out.closeEntry();
}
out.putNextEntry(new ZipEntry(name + '/' + "ParameterMode.ser"));
oos = new ObjectOutputStream(out);
oos.writeObject(AttributeMultiDimSequence.getMode());
oos.flush();
out.closeEntry();
out.putNextEntry(new ZipEntry(name + '/' + "ParameterSimplify.ser"));
oos = new ObjectOutputStream(out);
oos.writeObject(AttributeMultiDimSequence.getSimplifyFrom());
......@@ -1311,12 +1304,6 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
out.closeEntry();
}
out.putNextEntry(new ZipEntry(name + '/' + "ParameterMode.ser"));
oos = new ObjectOutputStream(out);
oos.writeObject(AttributeMultiDimSequence.getMode());
oos.flush();
out.closeEntry();
out.putNextEntry(new ZipEntry(name + '/' + "ParameterSimplify.ser"));
oos = new ObjectOutputStream(out);
oos.writeObject(AttributeMultiDimSequence.getSimplifyFrom());
......
......@@ -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
......
......@@ -20,6 +20,7 @@ import jcl.learning.methods.monostrategy.som.ParametersSOM;
import jcl.weights.ClassificationWeights;
import jcl.weights.GlobalWeights;
import jcl.weights.Weights;
import mustic.gui.DataDesktopFrame;
import mustic.gui.DesktopFrame;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame;
......@@ -861,52 +862,52 @@ public class ClassifierHandler extends DefaultHandler {
} else if (qName.equals("InitMethod")) { //$NON-NLS-1$
Data data = null;
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames();
DataDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDataDesktopFrames();
int nbSessions = desktopFrames.length;
for (int i = 0; i < nbSessions; i++) {
if (this.listData.get(0).equals(
desktopFrames[i].getImageSession().getRawImage()
.getPath())) {
data = desktopFrames[i].getImageSession().getImageData();
desktopFrames[i].getDataSession().getAssociatedImageSessions().get(0)
.getRawImage().getPath())) {
data = desktopFrames[i].getDataSession().getData();
break;
}
}
if (data == null) {
File f = new File(this.listData.get(0));
try {
MainFrame.getInstance().createSession(
MainFrame.getInstance().createImageSession(
MainFrame.getInstance().open(f), null);
if (MainFrame.getInstance().getCurrentSession()
if (MainFrame.getInstance().getCurrentImageSession()
.getRawImage().getNbBands() > 1) {
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setR(0);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setG(1);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setB(2);
MainFrame
.getInstance()
.getCurrentSession()
.getCurrentImageSession()
.getBirdViewPanel()
.syncImage(
MainFrame.getInstance()
.getCurrentSession());
.getCurrentImageSession());
PictureTool.setR(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 0);
PictureTool.setG(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 1);
PictureTool.setB(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 2);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().refresh();
MainFrame.getInstance().getCurrentSession().associatedFrame
MainFrame.getInstance().getCurrentImageSession().associatedFrame
.toBack();
data = MainFrame.getInstance().getCurrentSession()
data = MainFrame.getInstance().getCurrentImageSession()
.getData();
}
} catch (Exception e) {
......
......@@ -10,9 +10,15 @@ import javax.swing.*;
import javax.swing.border.TitledBorder;
import jcl.data.Data;
import jcl.data.attribute.Attribute;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.data.distance.sequential.DistanceEuclidean;
import jcl.learning.LearningParameters;
import jcl.learning.methods.multistrategy.samarah.*;
import jcl.weights.GlobalWeights;
import mustic.gui.MainFrame;
import mustic.gui.dialog.classifier.AgentDialog;
import mustic.gui.panels.classifier.*;
......@@ -74,7 +80,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 HybridClassification(null, null);
if (MainFrame.DEBUG_MODE)
System.out.println(" in HybridClassificationParametersPanel() ");
this.samarah.config.printInfo();
......@@ -98,7 +104,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 HybridClassification(model, parameters);
}
@Override
......@@ -151,12 +161,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();
......
......@@ -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();
......
......@@ -6,8 +6,9 @@ import java.util.Vector;
import jcl.data.DataObject;
import jcl.data.SimpleData;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.attribute.AttributeNumerical;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.data.mask.Mask;
import jcl.data.sampling.Sampler;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
......@@ -58,7 +59,8 @@ public class ImageData extends SimpleData implements Serializable {
* @param image the image to convert
*/
@Deprecated
public ImageData(RawImage image) {
public ImageData(RawImage image, DistanceModel model, DistanceParameter[][] parameters) {
super(model, parameters);
if (MainFrame.DEBUG_MODE) {
System.out.println(">> ImageData(RawImage) <<");
}
......@@ -167,7 +169,8 @@ public class ImageData extends SimpleData implements Serializable {
* @param percent le pourcentage de pixels a choisir parmi l'image
*/
@Deprecated
public ImageData(RawImage image, double percent) {
public ImageData(RawImage image, double percent, DistanceModel model, DistanceParameter[][] parameters) {
super(model, parameters);
if (MainFrame.DEBUG_MODE)
System.out.println(">> ImageData(RawImage, double) <<");
......@@ -236,8 +239,12 @@ public class ImageData extends SimpleData implements Serializable {
* the path of the image
* @param mask
* a mask to apply to the sampler
* @param model
* the model to use with the data
*/
public ImageData(Sampler sampler, RawImage path, Mask mask) {
public ImageData(Sampler sampler, RawImage path, Mask mask,
DistanceModel model, DistanceParameter[][] parameters) {
super(model, parameters);
if (MainFrame.DEBUG_MODE) {
System.out.println(">> ImageData(Sampler,String) <<");
}
......@@ -289,7 +296,6 @@ public class ImageData extends SimpleData implements Serializable {
long endTime = System.currentTimeMillis();
System.out.println("___________________Total elapsed time in execution of loading image is :" + ((endTime - startTime)));
}
}
/**
......@@ -302,15 +308,16 @@ public class ImageData extends SimpleData implements Serializable {
* The sample to extract data from
* @param path
* the path of the image
* @param model
* the model to use with the data
*/
public ImageData(Sampler sampler, RawImage path) {
this(sampler, path, null);
public ImageData(Sampler sampler, RawImage path, DistanceModel model, DistanceParameter[][] parameters) {
this(sampler, path, null, model, parameters);
}
/**
* <p>
* Construcor from an already built set of DataObject of a sampler,
* Constructor from an already built set of DataObject of a sampler,
* paths are only used to gather the image informations
* </p>
*
......@@ -320,9 +327,12 @@ public class ImageData extends SimpleData implements Serializable {
* paths of the images
* @param mask
* a mask to apply to the sampler