-
Notifications
You must be signed in to change notification settings - Fork 7
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
set plane coordinates #65
Conversation
Ok. It fails because in some tests, ROIs exist without images. |
If the image is accessible from the roi it will work |
I have a proposition (currently running test locally): protected void copyFromIJRoi(ij.gui.Roi ijRoi) {
LengthI size = new LengthI(ijRoi.getStrokeWidth(), UnitsLength.POINT);
Color defaultStroke = Optional.ofNullable(Roi.getColor()).orElse(Color.YELLOW);
Color defaultFill = Optional.ofNullable(Roi.getDefaultFillColor()).orElse(TRANSPARENT);
Color stroke = Optional.ofNullable(ijRoi.getStrokeColor()).orElse(defaultStroke);
Color fill = Optional.ofNullable(ijRoi.getFillColor()).orElse(defaultFill);
data.getShapeSettings().setStrokeWidth(size);
data.getShapeSettings().setStroke(stroke);
data.getShapeSettings().setFill(fill);
// Set the plane
int c = ijRoi.getCPosition();
int z = ijRoi.getZPosition();
int t = ijRoi.getTPosition();
ij.ImagePlus ip = ij.WindowManager.getImage(ijRoi.getImageID()); //ijRoi.getImage() returns null
if (ip != null) {
int pos = ijRoi.getPosition();
int stackSize = ip.getStackSize();
int imageC = ip.getNChannels();
int imageT = ip.getNFrames();
int imageZ = ip.getNSlices();
if (stackSize == imageZ) {
z = pos;
//reset values
c = 1;
t = 1;
} else if (stackSize == imageC) {
c = pos;
//reset values
z = 1;
t = 1;
} else if (stackSize == imageT) {
t = pos;
//reset values
c = 1;
z = 1;
}
}
data.setC(Math.max(-1, c - 1));
data.setZ(Math.max(-1, z - 1));
data.setT(Math.max(-1, t - 1));
} |
Feel free to close the PR if your suggestion works or adjust my commits |
Ok. I need to check in ImageJ if it works to be sure, but the tests pass. |
… corresponding image can be retrieved
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
============================================
- Coverage 95.53% 95.50% -0.04%
- Complexity 1139 1143 +4
============================================
Files 45 45
Lines 3026 3048 +22
Branches 236 242 +6
============================================
+ Hits 2891 2911 +20
Misses 78 78
- Partials 57 59 +2
☔ View full report in Codecov by Sentry. |
@ppouchin I will do some tests with the workflow I have in place already later on |
With the latest set of commits, using the workflow I used for testing, the problem is no longer visible |
This PR fixes an issue when setting the plane associated to a given shape.
The current implementation does not handle images with for example
t=1
,z=1
andc>1
.This is based on https://github.com/ome/omero-insight/blob/master/src/main/java/org/openmicroscopy/shoola/util/roi/io/ROIReader.java#L227