Comments (9)
Dear StormyaP,
is "closed" set in your settings?
from exact.
from exact.
this is my setting
from exact.
@OettlM do you have an idea?
With kind regards,
Christian
from exact.
@MingxuanGu can you share the way the second image is created? How to you convert the polygon vector to pixel wise segmentations?
from exact.
I first exported the annotation.
Then I read in the .txt file with
csv_file = pd.read_csv(annotation_dir, sep='|', header=None, names=columns, index_col=False)
I created a label array to be filled with labels
anno = np.zeros((20, 2038, 1996))
Then I loop over the "csv_file" and get the vector, class name, and frame number of each row in the "csv_file"
for i in range(len(csv_file)):
vector_dir = csv_file.loc[[i]].vector[i]
vector_dir = ast.literal_eval(vector_dir)
class_name = csv_file.loc[[i]].class_name[i]
class_num = 1 if class_name == 'Blood_vessel_polygon' else 2
frame_num = csv_file.loc[[i]].frame[i]
j = 0
while 1:
try:
coordx = vector_dir['x' + str(j)]
coordy = vector_dir['y' + str(j)]
anno[frame_num - 1, coordy, coordx] = class_num
except KeyError:
break
j += 1
After that, I fill the holes for each object in both class:
from scipy.ndimage.morphology import binary_fill_holes
anno1 = np.where(anno == 1, 1, 0)
anno2 = np.where(anno == 2, 1, 0)
for i in range(len(anno1)):
anno1[i] = binary_fill_holes(anno1[i])
anno2[i] = binary_fill_holes(anno2[i])
anno = np.where(anno1 == 1, 1, anno)
anno = np.where(anno2 == 1, 2, anno)
At the end, I get this "anno" as the label.
from exact.
Okay, I think I see where the issue is here.
The data you get is a vector containing each point that is part of the polygon annotation.
What you do in your code is to assign each pixel the value of the point it contains. However, the annotations in EXACT are polygons, so you dont nessesarly have a point for every pixel of the contour, since it just connects each point to the next.
A solution to this behaviour would be to use a function that interprets the vector as a polygon and draws it into your image.
OpenCV offers functionality to easily do that. https://docs.opencv.org/3.4/d4/d73/tutorial_py_contours_begin.html
Here is an example how you can use cv2.drawContours to draw the polygons. You can ignore the middle part where I sort the annotations, depending on the area size, which is only relevant if you have overlapping annotations.
In this case the function is also parameterized to directly draw filled polygons, so you dont have to do that yourself afterwards.
from exact.
Amazing, it works! Thanks!
from exact.
Big thanks to @OettlM
from exact.
Related Issues (20)
- Verification skips images
- Annotations being only partially saved if <enter> not hit HOT 2
- cannot make sync work HOT 2
- Internal Server Error (500) HOT 1
- Optional automatic overlay of registered images HOT 2
- Screening mode has stopped working HOT 1
- Thumbnail not deleted -> registration problems after reupload HOT 1
- Creation of images directory required. HOT 2
- Scale bar does not show up any more for non-WSI images HOT 3
- Incorrect display of images HOT 4
- Tried a lot to figure out the error but couldn't
- Trouble with installation on Ubuntu HOT 5
- How to run exact as server / allow access via the web? HOT 1
- Docker build not feasible HOT 8
- Logout is not working. HOT 1
- Feature request: Flush Cache
- Feature request: Two-stage docker build
- Feature request: Renaming in the UI HOT 1
- Registration is not working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exact.