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/
.settings/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
icy.log
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
.project
*.ipr
### Eclipse ###
.apt_generated
.classpath
**/.DS_Store
\ No newline at end of file
.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
Icon?
\ No newline at end of file
......@@ -8,12 +8,12 @@
<parent>
<artifactId>pom-icy</artifactId>
<groupId>org.bioimageanalysis.icy</groupId>
<version>2.2.0</version>
<version>3.0.0-a.1</version>
</parent>
<!-- Project Information -->
<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>
<description>This processor exports the tracks in an xls file (compatible with Protocols)</description>
......@@ -53,16 +53,18 @@
<!-- List of project's dependencies -->
<dependencies>
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>ezplug</artifactId>
</dependency>
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>protocols</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>spot-detection-utilities</artifactId>
</dependency>
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>track-manager</artifactId>
......@@ -73,8 +75,7 @@
<repositories>
<repository>
<id>icy</id>
<name>Icy's Nexus</name>
<url>https://icy-nexus.pasteur.fr/repository/Icy/</url>
<url>https://nexus-icy.pasteur.cloud/repository/icy/</url>
</repository>
</repositories>
</project>
/*
* Copyright (c) 2010-2023. Institut Pasteur.
* Copyright (c) 2010-2024. Institut Pasteur.
*
* This file is part of Icy.
* Icy is free software: you can redistribute it and/or modify
......@@ -18,18 +18,17 @@
package plugins.fab.trackmanager.processors;
import icy.gui.dialog.MessageDialog;
import icy.gui.util.GuiUtil;
import icy.main.Icy;
import icy.system.IcyExceptionHandler;
import icy.util.XLSUtil;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.bioimageanalysis.icy.gui.GuiUtil;
import org.bioimageanalysis.icy.io.xls.XLSXUtil;
import org.bioimageanalysis.icy.system.logging.IcyLogger;
import plugins.fab.trackmanager.PluginTrackManagerProcessor;
import plugins.fab.trackmanager.TrackSegment;
import plugins.nchenouard.spot.Detection;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
......@@ -68,7 +67,9 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor
private static void exportToXLS(final List<TrackSegment> tracks) {
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);
if (returnVal != JFileChooser.APPROVE_OPTION)
......@@ -79,45 +80,42 @@ public class TrackProcessorExportTrackToXLS extends PluginTrackManagerProcessor
public static boolean exportToXLS(final List<TrackSegment> trackSegmentList, final File file) {
try {
final WritableWorkbook doc = XLSUtil.loadWorkbookForWrite(file);
final WritableSheet sh = XLSUtil.createNewPage(doc, "Tracks");
final Workbook doc = XLSXUtil.loadWorkbookForWrite(file);
final Sheet sh = XLSXUtil.createNewPage(doc, "Tracks");
int cursorY = 0;
for (final TrackSegment ts : trackSegmentList) {
cursorY++;
XLSUtil.setCellString(sh, 0, cursorY, "track #");
XLSUtil.setCellNumber(sh, 1, cursorY, trackSegmentList.indexOf(ts));
XLSXUtil.setCellString(sh, 0, cursorY, "track #");
XLSXUtil.setCellNumber(sh, 1, cursorY, trackSegmentList.indexOf(ts));
cursorY++;
XLSUtil.setCellString(sh, 2, cursorY, "t");
XLSUtil.setCellString(sh, 3, cursorY, "x");
XLSUtil.setCellString(sh, 4, cursorY, "y");
XLSUtil.setCellString(sh, 5, cursorY, "z");
XLSUtil.setCellString(sh, 6, cursorY, "virtual");
XLSXUtil.setCellString(sh, 2, cursorY, "t");
XLSXUtil.setCellString(sh, 3, cursorY, "x");
XLSXUtil.setCellString(sh, 4, cursorY, "y");
XLSXUtil.setCellString(sh, 5, cursorY, "z");
XLSXUtil.setCellString(sh, 6, cursorY, "virtual");
cursorY++;
final ArrayList<Detection> detectionList = ts.getDetectionList();
for (final Detection d : detectionList) {
if (d.isEnabled()) {
XLSUtil.setCellNumber(sh, 2, cursorY, d.getT());
XLSUtil.setCellNumber(sh, 3, cursorY, d.getX());
XLSUtil.setCellNumber(sh, 4, cursorY, d.getY());
XLSUtil.setCellNumber(sh, 5, cursorY, d.getZ());
XLSUtil.setCellNumber(sh, 6, cursorY, (d.getDetectionType() == Detection.DETECTIONTYPE_VIRTUAL_DETECTION) ? 1 : 0);
XLSXUtil.setCellNumber(sh, 2, cursorY, d.getT());
XLSXUtil.setCellNumber(sh, 3, cursorY, d.getX());
XLSXUtil.setCellNumber(sh, 4, cursorY, d.getY());
XLSXUtil.setCellNumber(sh, 5, cursorY, d.getZ());
XLSXUtil.setCellNumber(sh, 6, cursorY, (d.getDetectionType() == Detection.DETECTIONTYPE_VIRTUAL_DETECTION) ? 1 : 0);
cursorY++;
}
}
}
XLSUtil.saveAndClose(doc);
XLSXUtil.saveAndClose(doc, file);
}
catch (final Exception e) {
if (Icy.getMainInterface().isHeadLess())
IcyExceptionHandler.showErrorMessage(e, true);
else
MessageDialog.showDialog("Cannot open file.", MessageDialog.ERROR_MESSAGE);
IcyLogger.error(TrackProcessorExportTrackToXLS.class, e);
return false;
}
......
/*
* Copyright (c) 2010-2023. Institut Pasteur.
* Copyright (c) 2010-2024. Institut Pasteur.
*
* This file is part of Icy.
* Icy is free software: you can redistribute it and/or modify
......@@ -18,8 +18,10 @@
package plugins.fab.trackmanager.processors;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import org.bioimageanalysis.icy.extension.plugin.abstract_.Plugin;
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.util.VarList;
import plugins.adufour.vars.lang.Var;
......@@ -31,9 +33,11 @@ import java.io.File;
/**
* 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 Var<TrackGroup> tracks;
......@@ -50,7 +54,7 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled {
}
@Override
public void declareInput(final VarList inputMap) {
public void declareInput(final @NotNull VarList inputMap) {
inputMap.add("tracks", tracks);
inputMap.add("file", file);
}
......@@ -76,9 +80,4 @@ public class TrackXLSExport extends Plugin implements Block, PluginBundled {
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