Skip to content
Snippets Groups Projects
Commit 3c3806b4 authored by Thomas  MUSSET's avatar Thomas MUSSET
Browse files

updated pom to v2.0.0-a.1, fix classes accordingly to new architecture, added...

updated pom to v2.0.0-a.1, fix classes accordingly to new architecture, added icon, updated .gitignore
parent 1a2788e1
No related branches found
No related tags found
No related merge requests found
.idea/ /build*
/workspace
setting.xml
release/
target/ target/
.settings/ !.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
icy.log
### IntelliJ IDEA ###
.idea/
*.iws
*.iml *.iml
.project *.ipr
### Eclipse ###
.apt_generated
.classpath .classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
**/.DS_Store **/.DS_Store
Icon?
\ No newline at end of file
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<parent> <parent>
<artifactId>pom-icy</artifactId> <artifactId>pom-icy</artifactId>
<groupId>org.bioimageanalysis.icy</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<version>2.2.0</version> <version>3.0.0-a.1</version>
</parent> </parent>
<!-- Project Information --> <!-- Project Information -->
<artifactId>track-processor-excel-export</artifactId> <artifactId>track-processor-excel-export</artifactId>
<version>2.0.0</version> <version>2.0.0-a.1</version>
<name>Track Processor Export Track to Excel</name> <name>Track Processor Export Track to Excel</name>
<description>This processor exports the tracks in an xls file (compatible with Protocols)</description> <description>This processor exports the tracks in an xls file (compatible with Protocols)</description>
...@@ -53,16 +53,18 @@ ...@@ -53,16 +53,18 @@
<!-- List of project's dependencies --> <!-- List of project's dependencies -->
<dependencies> <dependencies>
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>ezplug</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.bioimageanalysis.icy</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<artifactId>protocols</artifactId> <artifactId>protocols</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sourceforge.jexcelapi</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<artifactId>jxl</artifactId> <artifactId>spot-detection-utilities</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bioimageanalysis.icy</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<artifactId>track-manager</artifactId> <artifactId>track-manager</artifactId>
...@@ -73,8 +75,7 @@ ...@@ -73,8 +75,7 @@
<repositories> <repositories>
<repository> <repository>
<id>icy</id> <id>icy</id>
<name>Icy's Nexus</name> <url>https://nexus-icy.pasteur.cloud/repository/icy/</url>
<url>https://icy-nexus.pasteur.fr/repository/Icy/</url>
</repository> </repository>
</repositories> </repositories>
</project> </project>
/* /*
* Copyright (c) 2010-2023. Institut Pasteur. * Copyright (c) 2010-2024. Institut Pasteur.
* *
* This file is part of Icy. * This file is part of Icy.
* Icy is free software: you can redistribute it and/or modify * Icy is free software: you can redistribute it and/or modify
...@@ -18,18 +18,17 @@ ...@@ -18,18 +18,17 @@
package plugins.fab.trackmanager.processors; package plugins.fab.trackmanager.processors;
import icy.gui.dialog.MessageDialog; import org.apache.poi.ss.usermodel.Sheet;
import icy.gui.util.GuiUtil; import org.apache.poi.ss.usermodel.Workbook;
import icy.main.Icy; import org.bioimageanalysis.icy.gui.GuiUtil;
import icy.system.IcyExceptionHandler; import org.bioimageanalysis.icy.io.xls.XLSXUtil;
import icy.util.XLSUtil; import org.bioimageanalysis.icy.system.logging.IcyLogger;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import plugins.fab.trackmanager.PluginTrackManagerProcessor; import plugins.fab.trackmanager.PluginTrackManagerProcessor;
import plugins.fab.trackmanager.TrackSegment; import plugins.fab.trackmanager.TrackSegment;
import plugins.nchenouard.spot.Detection; import plugins.nchenouard.spot.Detection;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
...@@ -68,7 +67,9 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor ...@@ -68,7 +67,9 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor
private static void exportToXLS(final List<TrackSegment> tracks) { private static void exportToXLS(final List<TrackSegment> tracks) {
final JFileChooser chooser = new JFileChooser(); final JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Select xls file."); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setFileFilter(new FileNameExtensionFilter("Excel files", "xlsx"));
chooser.setDialogTitle("Select xlsx file.");
final int returnVal = chooser.showOpenDialog(null); final int returnVal = chooser.showOpenDialog(null);
if (returnVal != JFileChooser.APPROVE_OPTION) if (returnVal != JFileChooser.APPROVE_OPTION)
...@@ -79,45 +80,42 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor ...@@ -79,45 +80,42 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor
public static boolean exportToXLS(final List<TrackSegment> trackSegmentList, final File file) { public static boolean exportToXLS(final List<TrackSegment> trackSegmentList, final File file) {
try { try {
final WritableWorkbook doc = XLSUtil.loadWorkbookForWrite(file); final Workbook doc = XLSXUtil.loadWorkbookForWrite(file);
final WritableSheet sh = XLSUtil.createNewPage(doc, "Tracks"); final Sheet sh = XLSXUtil.createNewPage(doc, "Tracks");
int cursorY = 0; int cursorY = 0;
for (final TrackSegment ts : trackSegmentList) { for (final TrackSegment ts : trackSegmentList) {
cursorY++; cursorY++;
XLSUtil.setCellString(sh, 0, cursorY, "track #"); XLSXUtil.setCellString(sh, 0, cursorY, "track #");
XLSUtil.setCellNumber(sh, 1, cursorY, trackSegmentList.indexOf(ts)); XLSXUtil.setCellNumber(sh, 1, cursorY, trackSegmentList.indexOf(ts));
cursorY++; cursorY++;
XLSUtil.setCellString(sh, 2, cursorY, "t"); XLSXUtil.setCellString(sh, 2, cursorY, "t");
XLSUtil.setCellString(sh, 3, cursorY, "x"); XLSXUtil.setCellString(sh, 3, cursorY, "x");
XLSUtil.setCellString(sh, 4, cursorY, "y"); XLSXUtil.setCellString(sh, 4, cursorY, "y");
XLSUtil.setCellString(sh, 5, cursorY, "z"); XLSXUtil.setCellString(sh, 5, cursorY, "z");
XLSUtil.setCellString(sh, 6, cursorY, "virtual"); XLSXUtil.setCellString(sh, 6, cursorY, "virtual");
cursorY++; cursorY++;
final ArrayList<Detection> detectionList = ts.getDetectionList(); final ArrayList<Detection> detectionList = ts.getDetectionList();
for (final Detection d : detectionList) { for (final Detection d : detectionList) {
if (d.isEnabled()) { if (d.isEnabled()) {
XLSUtil.setCellNumber(sh, 2, cursorY, d.getT()); XLSXUtil.setCellNumber(sh, 2, cursorY, d.getT());
XLSUtil.setCellNumber(sh, 3, cursorY, d.getX()); XLSXUtil.setCellNumber(sh, 3, cursorY, d.getX());
XLSUtil.setCellNumber(sh, 4, cursorY, d.getY()); XLSXUtil.setCellNumber(sh, 4, cursorY, d.getY());
XLSUtil.setCellNumber(sh, 5, cursorY, d.getZ()); XLSXUtil.setCellNumber(sh, 5, cursorY, d.getZ());
XLSUtil.setCellNumber(sh, 6, cursorY, (d.getDetectionType() == Detection.DETECTIONTYPE_VIRTUAL_DETECTION) ? 1 : 0); XLSXUtil.setCellNumber(sh, 6, cursorY, (d.getDetectionType() == Detection.DETECTIONTYPE_VIRTUAL_DETECTION) ? 1 : 0);
cursorY++; cursorY++;
} }
} }
} }
XLSUtil.saveAndClose(doc); XLSXUtil.saveAndClose(doc, file);
} }
catch (final Exception e) { catch (final Exception e) {
if (Icy.getMainInterface().isHeadLess()) IcyLogger.error(TrackProcessorExportTrackToXLS.class, e);
IcyExceptionHandler.showErrorMessage(e, true);
else
MessageDialog.showDialog("Cannot open file.", MessageDialog.ERROR_MESSAGE);
return false; return false;
} }
......
/* /*
* Copyright (c) 2010-2023. Institut Pasteur. * Copyright (c) 2010-2024. Institut Pasteur.
* *
* This file is part of Icy. * This file is part of Icy.
* Icy is free software: you can redistribute it and/or modify * Icy is free software: you can redistribute it and/or modify
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
package plugins.fab.trackmanager.processors; package plugins.fab.trackmanager.processors;
import icy.plugin.abstract_.Plugin; import org.bioimageanalysis.icy.extension.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled; import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginIcon;
import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginName;
import org.jetbrains.annotations.NotNull;
import plugins.adufour.blocks.lang.Block; import plugins.adufour.blocks.lang.Block;
import plugins.adufour.blocks.util.VarList; import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.Var; import plugins.adufour.vars.lang.Var;
...@@ -31,9 +33,11 @@ import java.io.File; ...@@ -31,9 +33,11 @@ import java.io.File;
/** /**
* Block (Protocols) to export Tracks (TrackGroup) in XLS format. * Block (Protocols) to export Tracks (TrackGroup) in XLS format.
* *
* @author Stephane * @author Stephane Dallongeville
*/ */
public class TrackXLSExport extends Plugin implements Block, PluginBundled { @IcyPluginName("Track XLSX Export")
@IcyPluginIcon(path = "/track-processor-xls-export.png")
public class TrackXLSExport extends Plugin implements Block {
public final VarMutable file; public final VarMutable file;
public final Var<TrackGroup> tracks; public final Var<TrackGroup> tracks;
...@@ -50,7 +54,7 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled { ...@@ -50,7 +54,7 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled {
} }
@Override @Override
public void declareInput(final VarList inputMap) { public void declareInput(final @NotNull VarList inputMap) {
inputMap.add("tracks", tracks); inputMap.add("tracks", tracks);
inputMap.add("file", file); inputMap.add("file", file);
} }
...@@ -76,9 +80,4 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled { ...@@ -76,9 +80,4 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled {
TrackProcessorExportTrackToXLS.exportToXLS(tg.getTrackSegmentList(), f); TrackProcessorExportTrackToXLS.exportToXLS(tg.getTrackSegmentList(), f);
} }
} }
@Override
public String getMainPluginClassName() {
return TrackProcessorExportTrackToXLS.class.getName();
}
} }
src/main/resources/track-processor-xls-export.png

12.9 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment