Skip to content

Commit

Permalink
Add "IMAGE_ID" property to ImagePlus, and checks for ImageJ version (#51
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ppouchin authored Feb 26, 2023
1 parent 2841824 commit 1d90cc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/fr/igred/omero/repository/ImageWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ public ImagePlus toImagePlus(Client client,
pixels.destroyRawDataFacility();
}
imp.setPosition(1);
if (IJ.getVersion().compareTo("1.53a") >= 0) {
imp.setProp("IMAGE_ID", getId());
}
return imp;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/fr/igred/omero/roi/ROIWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import fr.igred.omero.repository.ImageWrapper;
import fr.igred.omero.repository.PixelsWrapper.Bounds;
import fr.igred.omero.repository.PixelsWrapper.Coordinates;
import ij.IJ;
import ij.gui.ShapeRoi;
import omero.RString;
import omero.gateway.model.AnnotationData;
Expand Down Expand Up @@ -249,7 +250,7 @@ public static List<ij.gui.Roi> toImageJ(List<? extends ROIWrapper> rois, String
public static List<ij.gui.Roi> toImageJ(Collection<? extends ROIWrapper> rois, String property, boolean groupRois) {
property = checkProperty(property);
final int maxGroups = 255;
groupRois = groupRois && rois.size() < maxGroups;
groupRois = groupRois && rois.size() < maxGroups && IJ.getVersion().compareTo("1.52t") >= 0;

int nShapes = rois.stream().map(GenericObjectWrapper::asDataObject).mapToInt(ROIData::getShapeCount).sum();

Expand Down
1 change: 1 addition & 0 deletions src/test/java/fr/igred/omero/repository/ImageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ void testToImagePlus() throws Exception {
ImageStatistics stats = difference.getStatistics();

assertEquals(0, (int) stats.max);
assertEquals(String.valueOf(IMAGE2.id), imp.getProp("IMAGE_ID"));
}


Expand Down

0 comments on commit 1d90cc0

Please sign in to comment.