Closed alissa777 closed 3 years ago
Hi Alissa,
You can simply calculate the conversion as 20/83.5. This will be in units of nm/px. Change the line
conversion = data.scalebar.conversion
to
conversion = 20 / 83.5
.
Then change the lines
sizes = sizes / conversion
sizes = sizes * 1e-9
to
sizes = sizes * conversion
Since sizes
was originally in units of px, and conversion
is in units of nm/px, multiplying the two gives you the result in nm.
Hope this helps. Let me know if this solves your problem so that I can close the issue.
Batuhan
Hi Batuhan,
Thank you for your reply.
I tried to follow the instruction and changed the these lines. However I got same error.
I was confused that I should just input the line: conversion = 20 / 83.5 Or I should calculate it by myself and input the results, so I tried both.
But the errors I got were same, as figure 2 shown.
Thank you again for helping me. Alissa
You're trying to draw scalebar contours which do not exist onto the image. Because imagedataextractor's scalebar detection failed, data.scalebar.scalebar_contour
is None
, which is why you're getting this error. Remove these lines
sb_image = cv2.drawContours(image, [data.scalebar.scalebar_contour], 0, (0, 255, 0), 2)
plt.imshow(sb_image[700:, 700:])
plt.axis('off')
plt.show()
Thank you. It succeeded! I got output results. And there are some lines as well. I wonder it could affect the result or not.
Thank you for your replying! Take care!
Hi
My name is Alissa. Sorry for bother you. It's me agian. I use ImageJ to measure the scalebar in pixel.
As the image 1 shown, this 20nm scalebar was converted to distance in pixels of 83.5. I think its right. However, I dont know how to input this figure into the code to make the tool process smoothly.
Could I input this 83.5 manually into the original code?
Thank you!