...
 
Commits (24)
File deleted
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 Le laboratoire des sciences de l'ingénieur, de l'informatique et de l'imagerie (UMR7357)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# 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 source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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));
}
}
package mustic.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.Vector;
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.gui.MainFrame;
import mustic.utils.filters.ImageFileFilter;
import mustic.utils.image.ImageHelper;
import otbAppWrapping.ExecCommand;
public class WaterIndiceExtractionDialog extends JFrame {
/** */
private static final long serialVersionUID = 1L;
private Vector<JTextField> textInput = new Vector<JTextField>();
private JPanel inPanel;
private JTextField textOutput = new JTextField();
private JComboBox<String> indiceComboBox;
private JSpinner spinnerBand1;
private JSpinner spinnerBand2;
private JSpinner spinnerBand3;
private JSpinner spinnerBand4;
private JSpinner spinnerBand5;
private JLabel labelBand1;
private JLabel labelBand2;
private JLabel labelBand3;
private JLabel labelBand4;
private JLabel labelBand5;
public WaterIndiceExtractionDialog() {
super();
JPanel subPanel1 = new JPanel(new BorderLayout());
JPanel subPanel2 = new JPanel(new BorderLayout());
JPanel mainPanel = new JPanel(new BorderLayout());
inPanel = new JPanel(new GridLayout(0, 2));
addImageInputPanel();
JButton addButton = new JButton(Messages.getString("ConcatenateImagesDialog.7"));
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addImageInputPanel();
}
});
JPanel addPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
addPanel.add(addButton);
JPanel inSubPanel = new JPanel(new BorderLayout());
inSubPanel.add(inPanel, BorderLayout.NORTH);
inSubPanel.add(addPanel, BorderLayout.SOUTH);
subPanel1.add(inSubPanel, BorderLayout.NORTH);
JPanel indicePanel = new JPanel(new GridLayout(0, 2));
// ComboBox
indicePanel.add(new JLabel("Indice"));
String[] indices = new String[]{
"NDWI", "NDWI2", "MNDWI", "NDPI", "NDTI", "AWEIsh", "AWEInsh", "WI"
};
indiceComboBox = new JComboBox<String>(indices);
indiceComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setIndiceLabel();
}
});
indicePanel.add(indiceComboBox);
// FirstBand
labelBand1 = new JLabel("NIR");
indicePanel.add(labelBand1, BorderLayout.WEST); //$NON-NLS-1$
JPanel pBand1 = new JPanel(new BorderLayout());
spinnerBand1 = new JSpinner();
spinnerBand1.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerBand1.setEditor(new JSpinner.NumberEditor(spinnerBand1, "##"));
JFormattedTextField txtBand1 = ((JSpinner.NumberEditor) spinnerBand1.getEditor()).getTextField();
((NumberFormatter) txtBand1.getFormatter()).setAllowsInvalid(false);
pBand1.add(spinnerBand1);
indicePanel.add(pBand1);
// SecondBand
labelBand2 = new JLabel("MIR");
indicePanel.add(labelBand2, BorderLayout.WEST); //$NON-NLS-1$
JPanel pBand2 = new JPanel(new BorderLayout());
spinnerBand2 = new JSpinner();
spinnerBand2.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerBand2.setEditor(new JSpinner.NumberEditor(spinnerBand2, "##"));
JFormattedTextField txtBand2 = ((JSpinner.NumberEditor) spinnerBand2.getEditor()).getTextField();
((NumberFormatter) txtBand2.getFormatter()).setAllowsInvalid(false);
pBand2.add(spinnerBand2);
indicePanel.add(pBand2);
// ThirdBand
labelBand3 = new JLabel("_");
indicePanel.add(labelBand3, BorderLayout.WEST); //$NON-NLS-1$
JPanel pBand3 = new JPanel(new BorderLayout());
spinnerBand3 = new JSpinner();
spinnerBand3.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerBand3.setEditor(new JSpinner.NumberEditor(spinnerBand3, "##"));
JFormattedTextField txtBand3 = ((JSpinner.NumberEditor) spinnerBand3.getEditor()).getTextField();
((NumberFormatter) txtBand3.getFormatter()).setAllowsInvalid(false);
pBand3.add(spinnerBand3);
indicePanel.add(pBand3);
// FourthBand
labelBand4 = new JLabel("_");
indicePanel.add(labelBand4, BorderLayout.WEST); //$NON-NLS-1$
JPanel pBand4 = new JPanel(new BorderLayout());
spinnerBand4 = new JSpinner();
spinnerBand4.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerBand4.setEditor(new JSpinner.NumberEditor(spinnerBand4, "##"));
JFormattedTextField txtBand4 = ((JSpinner.NumberEditor) spinnerBand4.getEditor()).getTextField();
((NumberFormatter) txtBand4.getFormatter()).setAllowsInvalid(false);
pBand4.add(spinnerBand4);
indicePanel.add(pBand4);
// FifthBand
labelBand5 = new JLabel("_");
indicePanel.add(labelBand5, BorderLayout.WEST); //$NON-NLS-1$
JPanel pBand5 = new JPanel(new BorderLayout());
spinnerBand5 = new JSpinner();
spinnerBand5.setModel(new SpinnerNumberModel(1, 1, 500, 1));
spinnerBand5.setEditor(new JSpinner.NumberEditor(spinnerBand5, "##"));
JFormattedTextField txtBand5 = ((JSpinner.NumberEditor) spinnerBand5.getEditor()).getTextField();
((NumberFormatter) txtBand5.getFormatter()).setAllowsInvalid(false);
pBand5.add(spinnerBand5);
indicePanel.add(pBand5);
subPanel1.add(indicePanel, BorderLayout.SOUTH);
setIndiceLabel();
// Output Browse
JPanel outPanel = new JPanel(new BorderLayout());
outPanel.add(new JLabel(Messages.getString("WaterIndiceExtractionDialog.3")), BorderLayout.WEST); //$NON-NLS-1$
outPanel.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(MainFrame.getInstance().getCurrentDirectory());
if (WaterIndiceExtractionDialog.this.textInput.size() > 0 &&
!WaterIndiceExtractionDialog.this.textInput.get(0).getText().isEmpty()) {
fileChooser.setSelectedFile(new File(WaterIndiceExtractionDialog.this.textInput.get(0).getText().substring(0,
WaterIndiceExtractionDialog.this.textInput.get(0).getText().indexOf(".tif"))
+"_"+indiceComboBox.getSelectedItem()+".tif"));
}
ImageFileFilter filter = new ImageFileFilter();
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showSaveDialog(WaterIndiceExtractionDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
MainFrame.getInstance().setCurrentDirectory(fileChooser.getCurrentDirectory());
String path;
if (fileChooser.getSelectedFile().getPath().endsWith(".tif")) {
path = fileChooser.getSelectedFile().getPath();
} else {
path = fileChooser.getSelectedFile().getPath() + ".tif";
}
WaterIndiceExtractionDialog.this.textOutput.setText(path);
}
}
});
outPanel.add(buttonBrowse2, BorderLayout.EAST);
subPanel2.add(subPanel1, BorderLayout.NORTH);
subPanel2.add(outPanel, BorderLayout.SOUTH);
// Panel OK
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(subPanel2, BorderLayout.CENTER);
mainPanel.add(panelButton, BorderLayout.SOUTH);
this.setContentPane(mainPanel);
this.setTitle(Messages.getString("WaterIndiceExtractionDialog.1")); //$NON-NLS-1$
this.setSize(350, 350);
this.setResizable(true);
this.setVisible(true);
}
private void addImageInputPanel() {
JPanel pInput = new JPanel(new BorderLayout());
final JTextField txtField = new JTextField();
//txtField.setPreferredSize(new Dimension(200, 30));
textInput.add(txtField);
// Input browse
inPanel.add(new JLabel(Messages.getString("WaterIndiceExtractionDialog.2")), BorderLayout.WEST); //$NON-NLS-1$
pInput.add(this.textInput.get(textInput.size()-1), BorderLayout.CENTER);
JButton buttonBrowse = new JButton("..."); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser(MainFrame.getInstance().getCurrentDirectory());
ImageFileFilter filter = new ImageFileFilter();
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showOpenDialog(WaterIndiceExtractionDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
MainFrame.getInstance().setCurrentDirectory(fileChooser.getCurrentDirectory());
txtField.setText(fileChooser.getSelectedFile().getPath());
}
}
});
pInput.add(buttonBrowse, BorderLayout.EAST);
inPanel.add(pInput);
inPanel.updateUI();
}
protected void buttonOk_actionPerformed() {
try {
String path;
if (textOutput.getText().endsWith(".tif")) { //$NON-NLS-1$
path = textOutput.getText();
} else {
path = textOutput.getText() + ".tif"; //$NON-NLS-1$
}
for(int i = 0 ; i < textInput.size() ; i++) {
File f = new File(textInput.get(i).getText());
if (f.exists() && !f.isDirectory()) {
String currentPath = path;
currentPath = currentPath.replaceAll("\\*", ImageHelper.stripExtension(f.getName()));
if (indiceComboBox.getSelectedIndex() <= 4) {
ExecCommand.WaterExtraction(textInput.get(i).getText(), currentPath, (int) spinnerBand1.getValue(),
(int) spinnerBand2.getValue(), (String)indiceComboBox.getSelectedItem());
} else {
switch ((String)indiceComboBox.getSelectedItem())
{
case "AWEIsh": //$NON-NLS-1$
ExecCommand.BandMath(new String[]{textInput.get(i).getText()}, currentPath,
" im1b"+ (int) spinnerBand2.getValue() + //$NON-NLS-1$
"+2.5*im1b"+ (int) spinnerBand1.getValue() + //$NON-NLS-1$
"-1.5*(im1b"+ (int) spinnerBand3.getValue() + //$NON-NLS-1$
"+im1b"+ (int) spinnerBand4.getValue() + //$NON-NLS-1$
")-0.25*im1b"+ (int) spinnerBand5.getValue()); //$NON-NLS-1$
break;
case "AWEInsh": //$NON-NLS-1$
ExecCommand.BandMath(new String[]{textInput.get(i).getText()}, currentPath,
"4*(im1b"+ (int) spinnerBand1.getValue() + //$NON-NLS-1$
"-im1b"+ (int) spinnerBand3.getValue() + //$NON-NLS-1$
")-(0.25*im1b"+ (int) spinnerBand2.getValue() + //$NON-NLS-1$
"+2.75*im1b"+ (int) spinnerBand4.getValue() +")"); //$NON-NLS-1$
break;
case "WI":
labelBand1.setText("Red");
labelBand2.setText("Green");
labelBand3.setText("PIR");
labelBand4.setText("MIR1");
labelBand5.setText("MIR2");
spinnerBand3.setEnabled(true);
spinnerBand4.setEnabled(true);
spinnerBand5.setEnabled(true);
ExecCommand.BandMath(new String[]{textInput.get(i).getText()}, currentPath,
"1.7204+171*im1b"+ (int) spinnerBand2.getValue() + //$NON-NLS-1$
"+3*im1b"+ (int) spinnerBand1.getValue() + //$NON-NLS-1$
"-70*im1b"+ (int) spinnerBand3.getValue() + //$NON-NLS-1$
"-45*im1b"+ (int) spinnerBand4.getValue() + //$NON-NLS-1$
"-71*im1b"+ (int) spinnerBand5.getValue()); //$NON-NLS-1$
break;
}
}
}
}
//ExecCommand.Rescale("temporary/water.tif", path);
JOptionPane.showMessageDialog(this, "Water Indice Extraction successful");
this.dispose();
setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
// File Water = new File(path);
// boolean imageOuvre = MainFrame.getInstance().openSession(Water);
// if (!imageOuvre)
// JOptionPane.showMessageDialog(MainFrame.getInstance(), Messages.getString("MainFrame.151"), Messages.getString("MainFrame.152"), //$NON-NLS-1$ //$NON-NLS-2$
// 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));
}
protected void setIndiceLabel(){
switch ((String)indiceComboBox.getSelectedItem())
{
case "NDWI": //$NON-NLS-1$
labelBand1.setText("NIR");
labelBand2.setText("MIR");
labelBand3.setText("_");
labelBand4.setText("_");
labelBand5.setText("_");
spinnerBand3.setEnabled(false);
spinnerBand3.setValue(1);
spinnerBand4.setEnabled(false);
spinnerBand4.setValue(1);
spinnerBand5.setEnabled(false);
spinnerBand5.setValue(1);
break;
case "NDWI2": //$NON-NLS-1$
labelBand1.setText("Green");
labelBand2.setText("NIR");
labelBand3.setText("_"); //$NON-NLS-1$
labelBand4.setText("_"); //$NON-NLS-1$
labelBand5.setText("_"); //$NON-NLS-1$
spinnerBand3.setEnabled(false);
spinnerBand3.setValue(1);
spinnerBand4.setEnabled(false);
spinnerBand4.setValue(1);
spinnerBand5.setEnabled(false);
spinnerBand5.setValue(1);
break;
case "MNDWI": //$NON-NLS-1$
labelBand1.setText("Green");
labelBand2.setText("MIR");
labelBand3.setText("_"); //$NON-NLS-1$
labelBand4.setText("_"); //$NON-NLS-1$
labelBand5.setText("_"); //$NON-NLS-1$
spinnerBand3.setEnabled(false);
spinnerBand3.setValue(1);
spinnerBand4.setEnabled(false);
spinnerBand4.setValue(1);
spinnerBand5.setEnabled(false);
spinnerBand5.setValue(1);
break;
case "NDPI": //$NON-NLS-1$
labelBand1.setText("MIR");
labelBand2.setText("Green");
labelBand3.setText("_"); //$NON-NLS-1$
labelBand4.setText("_"); //$NON-NLS-1$
labelBand5.setText("_"); //$NON-NLS-1$
spinnerBand3.setEnabled(false);
spinnerBand3.setValue(1);
spinnerBand4.setEnabled(false);
spinnerBand4.setValue(1);
spinnerBand5.setEnabled(false);
spinnerBand5.setValue(1);
break;
case "AWEIsh": //$NON-NLS-1$
labelBand1.setText("Green");
labelBand2.setText("Blue");
labelBand3.setText("PIR");
labelBand4.setText("MIR1");
labelBand5.setText("MIR2");
spinnerBand3.setEnabled(true);
spinnerBand4.setEnabled(true);
spinnerBand5.setEnabled(true);
break;
case "AWEInsh": //$NON-NLS-1$
labelBand1.setText("Green");
labelBand2.setText("PIR");
labelBand3.setText("MIR1");
labelBand4.setText("MIR2");
labelBand5.setText("_"); //$NON-NLS-1$
spinnerBand3.setEnabled(true);
spinnerBand4.setEnabled(true);
spinnerBand5.setEnabled(false);
spinnerBand5.setValue(1);
break;
case "WI": //$NON-NLS-1$
labelBand1.setText("Green");
labelBand2.setText("Blue");
labelBand3.setText("PIR");
labelBand4.setText("MIR1");
labelBand5.setText("MIR2");
spinnerBand3.setEnabled(true);
spinnerBand4.setEnabled(true);
spinnerBand5.setEnabled(true);
break;
}
}
}
......@@ -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);
......
package mustic.gui.panels;
import java.io.File;
import java.util.Vector;
import javax.swing.JOptionPane;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.learning.LearningParameters;
import jcl.learning.methods.monostrategy.ahc.ParametersAHC;
import jcl.learning.methods.monostrategy.cobweb.ParametersCobweb;
import jcl.learning.methods.monostrategy.cure.ParametersCure;
import jcl.learning.methods.monostrategy.em.ParametersEM;
import jcl.learning.methods.monostrategy.gng.ParametersGNG;
import jcl.learning.methods.monostrategy.kmeans.ParametersKmeans;
import jcl.learning.methods.monostrategy.perceptron.ParametersPerceptron;
import jcl.learning.methods.monostrategy.random.ParametersRandom;
import jcl.learning.methods.monostrategy.som.ParametersSOM;
import jcl.weights.*;
import mustic.gui.DesktopFrame;
import mustic.gui.MainFrame;
import mustic.gui.panels.classifier.components.HybridClassificationPanel;
import mustic.io.*;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class HybridParametersHandler extends DefaultHandler {
private static final int AHC = 13;
private static final int COBWEB = 1;
private static final int CURE = 12;
private static final int EM = 4;
private static final int FUZZI_C_MEAN = 6;
private static final int FUZZY_GW_C_MEANS = 8;
private static final int FUZZY_LW_C_MEANS = 10;
private static final int GNG = 11;
private static final int GW_K_MEAN = 7;
private static final int K_MEANS = 0;
private static final int LW_K_MEANS = 9;
private static final int PERCEPTRON = 3;
private static final int RANDOM = 5;
private static final int SOM = 2;
private StringBuffer buffer;
private HybridClassificationPanel hybridPanel;
private boolean isHClustering;
private boolean isPanel;
private boolean isSimplifySequence;
private boolean isUseNaiveDist;
// private String data = null;
private Vector<String> listData = new Vector<String>();
private Vector<Double> listParam = new Vector<Double>();
private LearningParameters param = null;
private int type;
private Weights weight;
// simple constructeur
public HybridParametersHandler(HybridClassificationPanel hc, boolean isPanel) {
super();
this.hybridPanel = hc;