{
  "id": 355738,
  "title": "Noise in Segmentation Data",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/355738",
  "author_name": "",
  "post_date": "2022-09-28T00:44:48.890947900Z",
  "votes": 12,
  "comment_count": 3,
  "views": 0,
  "content": "<p>There are 4 cases with random nonzero pixels that prevent bounding box access via the function cv2.boundingRect(cv2.findNonZero(img)). These are the ones I found so far: '1.2.826.0.1.3680043.6125', '1.2.826.0.1.3680043.1542',  '1.2.826.0.1.3680043.24891', '1.2.826.0.1.3680043.11827'</p>\n<p>Also '1.2.826.0.1.3680043.1363' has random labels for C5 and C6 on the first slice. There are likely other cases. I'm trying to find a simple way to denoise these.</p>",
  "messages": [
    {
      "id": "1959113",
      "postDate": "09/28/2022 00:44:48",
      "content": "<p>There are 4 cases with random nonzero pixels that prevent bounding box access via the function cv2.boundingRect(cv2.findNonZero(img)). These are the ones I found so far: '1.2.826.0.1.3680043.6125', '1.2.826.0.1.3680043.1542',  '1.2.826.0.1.3680043.24891', '1.2.826.0.1.3680043.11827'</p>\n<p>Also '1.2.826.0.1.3680043.1363' has random labels for C5 and C6 on the first slice. There are likely other cases. I'm trying to find a simple way to denoise these.</p>",
      "rawMarkdown": "There are 4 cases with random nonzero pixels that prevent bounding box access via the function cv2.boundingRect(cv2.findNonZero(img)). These are the ones I found so far: '1.2.826.0.1.3680043.6125', '1.2.826.0.1.3680043.1542',  '1.2.826.0.1.3680043.24891', '1.2.826.0.1.3680043.11827'\n\nAlso '1.2.826.0.1.3680043.1363' has random labels for C5 and C6 on the first slice. There are likely other cases. I'm trying to find a simple way to denoise these.",
      "votes": null
    },
    {
      "id": "1960078",
      "postDate": "09/28/2022 13:22:06",
      "content": "<p>I've found the same. It's a lot more than 4 cases though. I'd estimate about 40% of the segmentations have small errors in them. </p>\n<p><a href=\"https://postimg.cc/QFcPPVPB\" target=\"_blank\"><img src=\"https://i.postimg.cc/6pPX8vfh/8884.png\" alt=\"8884.png\"></a></p>\n<p><a href=\"https://postimg.cc/xXHD26k1\" target=\"_blank\"><img src=\"https://i.postimg.cc/CxrFbtSk/mask2.png\" alt=\"mask2.png\"></a></p>",
      "rawMarkdown": "I've found the same. It's a lot more than 4 cases though. I'd estimate about 40% of the segmentations have small errors in them. \n\n[![8884.png](https://i.postimg.cc/6pPX8vfh/8884.png)](https://postimg.cc/QFcPPVPB)\n\n[![mask2.png](https://i.postimg.cc/CxrFbtSk/mask2.png)](https://postimg.cc/xXHD26k1)",
      "votes": null
    },
    {
      "id": "1960707",
      "postDate": "09/28/2022 18:06:29",
      "content": "<p>You could get rid of single pixel lines and other small features with something like this,<br>\nwhere img is a 512 x 512 array of segmentation values (0…)</p>\n<pre><code>img2 = img.copy\nimg2[img2 &gt; 0] = 1    # make the image 0 or 1 only\n#filter with 3x3 array of 1's  \nimg2=scipy.signal.convolve2d(img2.astype(np.float32), np.ones((3,3)), mode='same', boundary='symm')\n#remove anything that is 4 or less\nimg[img2 &lt; 5] = 0  # remove single pixel lines and other small features\n</code></pre>\n<p>For example, this would remove the middle 1 from a 3x3 section that looked like:</p>\n<pre><code>010\n110\n010\n</code></pre>\n<p>but would not remove the middle of:</p>\n<pre><code>010\n111\n010\n</code></pre>\n<p>As a side note, there are values in the segmentation file that go higher than 7 (I forget the exact maximum), so watch for 8s and 9s!</p>",
      "rawMarkdown": "You could get rid of single pixel lines and other small features with something like this,\nwhere img is a 512 x 512 array of segmentation values (0...)\n```\nimg2 = img.copy\nimg2[img2 > 0] = 1    # make the image 0 or 1 only\n#filter with 3x3 array of 1's  \nimg2=scipy.signal.convolve2d(img2.astype(np.float32), np.ones((3,3)), mode='same', boundary='symm')\n#remove anything that is 4 or less\nimg[img2 < 5] = 0  # remove single pixel lines and other small features\n\n```\nFor example, this would remove the middle 1 from a 3x3 section that looked like:\n```\n010\n110\n010\n```\nbut would not remove the middle of:\n```\n010\n111\n010\n```\nAs a side note, there are values in the segmentation file that go higher than 7 (I forget the exact maximum), so watch for 8s and 9s!",
      "votes": null
    },
    {
      "id": "1960931",
      "postDate": "09/28/2022 22:00:47",
      "content": "<p>Nice! Thank you!</p>",
      "rawMarkdown": "Nice! Thank you!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1960078,
      "author_name": "samuelcortinhas",
      "author_url": "",
      "post_date": "09/28/2022 13:22:06",
      "content": "<p>I've found the same. It's a lot more than 4 cases though. I'd estimate about 40% of the segmentations have small errors in them. </p>\n<p><a href=\"https://postimg.cc/QFcPPVPB\" target=\"_blank\"><img src=\"https://i.postimg.cc/6pPX8vfh/8884.png\" alt=\"8884.png\"></a></p>\n<p><a href=\"https://postimg.cc/xXHD26k1\" target=\"_blank\"><img src=\"https://i.postimg.cc/CxrFbtSk/mask2.png\" alt=\"mask2.png\"></a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1960707,
      "author_name": "solverworld",
      "author_url": "",
      "post_date": "09/28/2022 18:06:29",
      "content": "<p>You could get rid of single pixel lines and other small features with something like this,<br>\nwhere img is a 512 x 512 array of segmentation values (0…)</p>\n<pre><code>img2 = img.copy\nimg2[img2 &gt; 0] = 1    # make the image 0 or 1 only\n#filter with 3x3 array of 1's  \nimg2=scipy.signal.convolve2d(img2.astype(np.float32), np.ones((3,3)), mode='same', boundary='symm')\n#remove anything that is 4 or less\nimg[img2 &lt; 5] = 0  # remove single pixel lines and other small features\n</code></pre>\n<p>For example, this would remove the middle 1 from a 3x3 section that looked like:</p>\n<pre><code>010\n110\n010\n</code></pre>\n<p>but would not remove the middle of:</p>\n<pre><code>010\n111\n010\n</code></pre>\n<p>As a side note, there are values in the segmentation file that go higher than 7 (I forget the exact maximum), so watch for 8s and 9s!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1960931,
          "author_name": "anoukstein",
          "author_url": "",
          "post_date": "09/28/2022 22:00:47",
          "content": "<p>Nice! Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1959113": "There are 4 cases with random nonzero pixels that prevent bounding box access via the function cv2.boundingRect(cv2.findNonZero(img)). These are the ones I found so far: '1.2.826.0.1.3680043.6125', '1.2.826.0.1.3680043.1542',  '1.2.826.0.1.3680043.24891', '1.2.826.0.1.3680043.11827'\n\nAlso '1.2.826.0.1.3680043.1363' has random labels for C5 and C6 on the first slice. There are likely other cases. I'm trying to find a simple way to denoise these.",
    "1960078": "I've found the same. It's a lot more than 4 cases though. I'd estimate about 40% of the segmentations have small errors in them. \n\n[![8884.png](https://i.postimg.cc/6pPX8vfh/8884.png)](https://postimg.cc/QFcPPVPB)\n\n[![mask2.png](https://i.postimg.cc/CxrFbtSk/mask2.png)](https://postimg.cc/xXHD26k1)",
    "1960707": "You could get rid of single pixel lines and other small features with something like this,\nwhere img is a 512 x 512 array of segmentation values (0...)\n```\nimg2 = img.copy\nimg2[img2 > 0] = 1    # make the image 0 or 1 only\n#filter with 3x3 array of 1's  \nimg2=scipy.signal.convolve2d(img2.astype(np.float32), np.ones((3,3)), mode='same', boundary='symm')\n#remove anything that is 4 or less\nimg[img2 < 5] = 0  # remove single pixel lines and other small features\n\n```\nFor example, this would remove the middle 1 from a 3x3 section that looked like:\n```\n010\n110\n010\n```\nbut would not remove the middle of:\n```\n010\n111\n010\n```\nAs a side note, there are values in the segmentation file that go higher than 7 (I forget the exact maximum), so watch for 8s and 9s!",
    "1960931": "Nice! Thank you!"
  },
  "source": "meta"
}