Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapedata bugfix #5761

Merged
merged 13 commits into from Jul 6, 2018
Merged

Shapedata bugfix #5761

merged 13 commits into from Jul 6, 2018

Conversation

dominikl
Copy link
Member

@dominikl dominikl commented May 8, 2018

What this PR does

Allows to remove the C, Z and T of a Shape. Previously when a negative value was passed to ShapeData.setC() (etc.) the value was set to 0. With this PR passing a negative value will set the underlying Ice Shape object's C, Z, T to null. And for the other way round, if the Shape object's C, Z, T is null, ShapeData.getC() (etc.) will return -1, indicating that the value has not been set, so that getters and setters now also behave in a consistent way.

Had to modify the ROIData pojo, too, e.g. remove methods like firstPlane() (which isn't used anywhere), because these wouldn't work properly with null CZT ROIs (which are supposed to be present on all planes).

Also updated the integration test accordingly.

Another bug was noticed: The various setters (setX(), setY(), etc.) on the ShapeData subclasses (RectangleData, etc.) didn't set the dirty flag, that's why the ROIFacility didn't save them back to the server when saveROIs was called. Fixed the setters and added an unit test for all setters of all ShapeData classes.

Testing this PR

  • Check ROIFacility integration test.
  • Check ShapeData unit test.
  • Check that ROI tool in Insight still works as before.

Related reading

http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2018-May/004199.html

/cc @awalter17

@dominikl
Copy link
Member Author

@awalter17 spotted another ROI related bug, will fix it within this PR, too.
( http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2018-May/004214.html )

awalter17 added a commit to imagej/imagej-omero that referenced this pull request May 18, 2018
@mtbc
Copy link
Member

mtbc commented Jun 5, 2018

remove ... which isn't used anywhere

How do we know? Should we deprecate here and remove after 5.4?

Update: Ha, actually that's what you did, 👍

return roiShapes.get(new ROICoordinate(z, t));
List<ShapeData> res = roiShapes.get(new ROICoordinate(z, t));
res.addAll(roiShapes.get(new ROICoordinate(-1, -1)));
return res;
Copy link
Member

@mtbc mtbc Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also covers if only one of z or t is -1?

@joshmoore joshmoore added this to the 5.4.7 milestone Jun 29, 2018
@sbesson
Copy link
Member

sbesson commented Jul 2, 2018

It seems that with this PR included, several UpdateService and RoiService integration tests underwent some regression - see https://ci.openmicroscopy.org/job/OMERO-DEV-merge-integration-java/892/

@dominikl
Copy link
Member Author

dominikl commented Jul 2, 2018

Thanks @sbesson ! Strange that I didn't spot that earlier.

ROICoordinate end) {
List<List<ShapeData>> res = new ArrayList<List<ShapeData>>();
res.addAll(roiShapes.subMap(start, end).values());
res.add(roiShapes.get(new ROICoordinate(-1, -1)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this end up adding a null? (If so, that's okay?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks, that needs a null check, too.

@dominikl
Copy link
Member Author

dominikl commented Jul 4, 2018

Integration tests are green, tested the Insight ROITool again, I think the PR is ready to merge.

List<ShapeData> allZT = roiShapes.get(new ROICoordinate(-1, -1));
if (allZT != null)
res.addAll(allZT);
return res;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if only one of z or t is -1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, that's true, these cases have to be considered, too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Longer-term for the API might be nice to say something like: new ROICoordinate(new Optional(z), new Optional(t)) or new LenientROICoordinate(z, t) or new ROICoordinate(z, t, lenient=true)

}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid trailing space

@dominikl
Copy link
Member Author

dominikl commented Jul 5, 2018

Fixed issue #5761 (comment) and also deprecated getShapesInRange method, can't imagine anyone uses that anyway.

@@ -209,9 +209,11 @@ public void removeShapeData(ShapeData shape)
ROICoordinate coord = shape.getROICoordinate();
List<ShapeData> shapeList;
shapeList = roiShapes.get(coord);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List<ShapeData> shapeList = roiShapes.get(coord); in one line would look better

@rgozim
Copy link
Member

rgozim commented Jul 5, 2018

Looks okay to me

@joshmoore
Copy link
Member

Merging for inclusion in 5.4.7

@joshmoore joshmoore merged commit 69e49a7 into ome:develop Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants