Closed jlause closed 4 years ago
I am having a similar issue with both versions 1.4.2 and 1.5.0. Here is an image of bounding boxes plotted on the original image (the y-axis is inverted in comparison to ImageJ). As you can see, when the roi value goes above ~4500 read_roi (both zipped and unzipped) returns wildly large numbers.... suspiciously close to 65000...
To me; it appears that some sort of bit-wise function in read_roi is getting its bits confused and converting from 12bit to 16bit depths (4096 vs 65536). I never learned binary (zzzzzzzz) so I dont have a solution for this other than adding 65536 to that super negative number (like -59043).
Hope this helps yall find a fix.
-JT
Hello both and thank you for the report. I don't have time to look into that in the short term. If you have an idea what is going on please feel free to submit a PR. Thank you!
Here is how to get rid of the unexpected large negative offsets:
This is caused by a part of the code for which I did not understand the intention (in _read_roi.py around line 140):
if top > 6000:
top -= 2**16
if left > 6000:
left -= 2**16
Removing those lines solved the issue for me; I did not notice any other issues that would be introduced by removing those lines.
Hope this helps!
Thank you @OSchoppe. I'll have a look at any PRs someone could submit with this fix.
I have similar issues as attached. @OSchoppe I did not find the code part you mentioned in 1.5.2. Have it been fixed? I still have this issue though.
Fixed!
Hey, I have been using your function to read cell outlines marked in ImageJ into my python pipeline without problems for a year now. Now I moved to considerably larger images (10.000 x 10.000 pixels, before 1.000 x 1.000 pixels). I marked a couple of ROIs, saved as zip, and used the read_roi_zip() function to read. I got a weird pattern of errors:
-Some polygon ROIs are read in correctly. -For some polygon ROIs, all x coordinates have a large negative offset (ca -60.000), while the y is correct -With the freehand ROIs, I observed all four cases: correct ROIs, large negative offsets in x while y is ok, the reverse, and both x and y with large negative offsets.
I also found out that the following function from another github user works correctly on the same ROI file: https://github.com/tdsmith/ijroi
I attach my ROI file, a screenshot of the correct ROIs in Image J and the incorrectly read-in ROIs plotted in python.
First five coordinates of the read in ROIs (ID refers to legend in above figure). Note that for all plots, I inverted the y coordinate to have the ROIs oriented as they are on the ImageJ screenshot below.
Original ROIs in imageJ:
My code for plotting/reading in:
The ROI file used to obtain the above plots: hajdu_20180205_0_RBPMS_referenceROIs_day2_nozoom.zip
I hope this helps to improve your code! Cheers, Jan.