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

I hava some errors when I load ImageJ RoiSet.zip #71

Open
FengZhiheng opened this issue Oct 24, 2019 · 9 comments
Open

I hava some errors when I load ImageJ RoiSet.zip #71

FengZhiheng opened this issue Oct 24, 2019 · 9 comments

Comments

@FengZhiheng
Copy link
Contributor

image

error information is

'self.run(para)
File "C:\Users\XXX\Desktop\ImagePy-64\ImagePy\programs\lib\site-packages\imagepy\menus\File\Import\roi_plg.py", line 30, in run
img[polygon(ls[i]['y'], ls[i]['x'], img.shape)] = int(i)
KeyError: 'y''

@BioinfoTongLI
Copy link
Contributor

Hi, @FengZhiheng,
Thank you for filing the issue.
It seems that some features such as "x" and "y" are not saved when you save the roiset in ij.
Can you maybe send an example of your RoiSet.zip?
Tong

@FengZhiheng
Copy link
Contributor Author

Hi, @FengZhiheng,
Thank you for filing the issue.
It seems that some features such as "x" and "y" are not saved when you save the roiset in ij.
Can you maybe send an example of your RoiSet.zip?
Tong

Ok! It's very kind of you for helping me out.

@BioinfoTongLI
Copy link
Contributor

I successfully opened the RoiSet.zip you sent to me. Is it the same one that caused the error? It seems that the one you sent to me has no problem.

@FengZhiheng
Copy link
Contributor Author

RoiSet1.zip
Please try this one. This one can cause the error I met a few days ago. I used Fiji ROI manager and saves this ROI.zip file.

@BioinfoTongLI
Copy link
Contributor

Ok, I confirm it's a glitch. By default, imagepy takes the xy coordinates to draw a polygon. However, IJ sometimes save the bounding box instead of the coordinates. @yxdragon , is there a way to draw a polygon with bounding box?

@yxdragon
Copy link
Member

yxdragon commented Nov 3, 2019

just using slice to fill bounding box, such as img[top:bot, left:right] = lab.
the trouble is, bounding boxes may cross with each other, but for the labled image, one pixel just has one value.

@yxdragon
Copy link
Member

yxdragon commented Nov 4, 2019

I saw the roi file is a collection of oval object like this:
{'type': 'oval', 'left': 154, 'top': 115, 'width': 39, 'height': 38, 'name': '0134-0173', 'position': 0}
It is not a polygon object, so we need draw it by skimage.draw.ellipse

rs, cs = ellipse(top+height/2, left+width/2, height/2, width/2)
img[rs, cs] = lab

@BioinfoTongLI
Copy link
Contributor

#72 (comment)
PR created for a quick-fix
@FengZhiheng

@yxdragon
Copy link
Member

yxdragon commented Nov 5, 2019

@FengZhiheng merged, have a try.
@BioinfoTongLI ellipse method need a shape parameter to cut the rs, cs out of image to make sure that img[rs, cs] is safe.

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

No branches or pull requests

3 participants