Skip to content

Commit

Permalink
Added check for non-existing ResultsTable
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Nov 25, 2021
1 parent 7b7086c commit 1795f18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ A plugin for ImageJ to provide macro extensions to access OMERO.

## How to install

1. Install
the [OMERO.insight plugin for Fiji](https://omero-guides.readthedocs.io/en/latest/fiji/docs/installation.html) (if
you haven't already).
1. Install the [OMERO.insight plugin for Fiji](https://omero-guides.readthedocs.io/en/latest/fiji/docs/installation.html) (if you haven't already).
2. Download the JAR file for this [library](https://github.com/GReD-Clermont/simple-omero-client/releases/latest/).
3. Download the JAR file ([for this plugin](https://github.com/GReD-Clermont/omero_macro-extensions/releases/latest/)).
4. Place these JAR files in your plugins folder.
Expand Down Expand Up @@ -193,8 +191,8 @@ imageplusID = Ext.getImage(imageIds[0]);

ROIs from OMERO can also be added to the ROI manager (and the current image). ROIs composed of multiple shapes (eg
3D/4D) will share the same values in the "ROI" and "ROI_ID" properties in ImageJ. These can be optionnally changed with
the "property" parameter: local indices will be in "property" while OMERO IDs will be in "property + _ID".
This is achieved through:
the "property" parameter: local indices will be in "property" while OMERO IDs will be in "property + _ID". This is
achieved through:

```
nIJROIs = Ext.getROIs(imageIds[0], property);
Expand Down
22 changes: 13 additions & 9 deletions src/main/java/fr/igred/ij/plugin/OMEROMacroExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,20 @@ public void deleteFile(long fileId) {
public void addToTable(String tableName, ResultsTable results, Long imageId, List<Roi> ijRois, String property) {
TableWrapper table = tables.get(tableName);

try {
if (table == null) {
table = new TableWrapper(client, results, imageId, ijRois, property);
table.setName(tableName);
tables.put(tableName, table);
} else {
table.addRows(client, results, imageId, ijRois, property);
if(results == null) {
IJ.error("Results table does not exist.");
} else {
try {
if (table == null) {
table = new TableWrapper(client, results, imageId, ijRois, property);
table.setName(tableName);
tables.put(tableName, table);
} else {
table.addRows(client, results, imageId, ijRois, property);
}
} catch (ExecutionException | ServiceException | AccessException e) {
IJ.error("Could not add results to table: " + e.getMessage());
}
} catch (ExecutionException | ServiceException | AccessException e) {
IJ.error("Could not add results to table: " + e.getMessage());
}
}

Expand Down

0 comments on commit 1795f18

Please sign in to comment.