Skip to content

drawing segmentation points on png images #25

Description

@senemaktas

Hello,
Thank you for the dataset. I have download the dataset, annotations, masks, images.

I am trying to write points to images in png format by taking points from annotations json files.
However, I cannot see the "points" on the image. (segmentation points).

How can i draw segmentations points on png images? Aren't the "points" specified in json files segmentation points?

The piece of code I use is as follows:

      xyz_points = each_element["points"]
      # get x and y as integer
      xy_points = [[int(each[:2][0]), int(each[:2][1])] for each in xyz_points]
      # drawing
      pts = np.array(xy_points, np.int32)
      pts = pts.reshape((-1, 1, 2))
      cv2.polylines(img, [pts], isClosed=True, color=(0, 255, 0), thickness=80)
      cv2.drawContours(img, pts, -1, (0, 255, 0), 80)

Sample image and json matches:
name: TCGA-OL-A66I-DX1_xmin38433_ymin22957_MPP-0.2500.png TCGA-OL-A66I-01Z-00-DX1.8CE9DCAB-98D3-4163-94AC-1557D86C1E25.json
name: TCGA-OL-A66P-DX1_xmin30143_ymin20310_MPP-0.2500.png TCGA-OL-A66P-01Z-00-DX1.5ADD0D6D-37C6-4BC9-8C2B-64DB18BE99B3.json
name: TCGA-OL-A6VO-DX1_xmin88416_ymin188485_MPP-0.2500.png TCGA-OL-A6VO-01Z-00-DX1.291D54D6-EBAF-4622-BD42-97AA5997F014.json
name: TCGA-OL-A97C-DX1_xmin68058_ymin32495_MPP-0.2500.png TCGA-OL-A97C-01Z-00-DX1.BDEEDEE2-6D07-4046-A8A9-D6FF8F337393.json
name: TCGA-S3-AA10-DX1_xmin43039_ymin23986_MPP-0.2500.png TCGA-S3-AA10-01Z-00-DX1.C0468882-0DD8-4FC5-8C2F-E18BE8000F69.json
name: TCGA-S3-AA15-DX1_xmin55486_ymin28926_MPP-0.2500.png TCGA-S3-AA15-01Z-00-DX1.A2456A4A-E6E8-4429-8F09-B997AA497BB0.json

thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions