Skip to content

Commit f831aa0

Browse files
authored
Fix table creation when multiple ROIs share the same name (#64)
* Fix table creation when multiple ROIs share the same name * Improve tests
1 parent bea2171 commit f831aa0

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/fr/igred/omero/annotations/TableWrapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ private static ROIData[] createROIColumn(ResultsTable results,
385385
Map<Long, ROIData> id2roi = rois.stream().collect(toMap(ROIWrapper::getId, GenericObjectWrapper::asDataObject));
386386
Map<String, ROIData> name2roi = rois.stream()
387387
.filter(r -> !r.getName().isEmpty())
388-
.collect(toMap(ROIWrapper::getName, GenericObjectWrapper::asDataObject));
388+
.collect(toMap(ROIWrapper::getName,
389+
GenericObjectWrapper::asDataObject,
390+
(x1, x2) -> x1));
389391

390392
Map<String, ROIData> label2roi = ijRois.stream()
391393
.map(r -> new SimpleEntry<>(r.getProperty(roiProperty),

src/test/java/fr/igred/omero/annotations/ImageJTableTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ void testCreateTableWithROINamesFromIJResults2() throws Exception {
500500
ROIWrapper roi2 = new ROIWrapper();
501501

502502
roi1.setImage(image);
503+
roi1.setName("ROI");
503504
roi2.setImage(image);
505+
roi2.setName("ROI");
504506

505507
final int max = 14;
506508
for (int i = 10; i < max; i++) {

0 commit comments

Comments
 (0)