{
  "id": 460691,
  "title": "Segmentations Tumor Only (Code Implementation)",
  "url": "/competitions/UBC-OCEAN/discussion/460691",
  "author_name": "SSS",
  "post_date": "2023-12-10T16:39:13.301000",
  "votes": 14,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi, </p>\n<p>Here is my hacky solution for Seg Tumor only. Do you have any better ideas?</p>\n<h1>Red: Tumor Only</h1>\n<pre><code>lower = np.array([, , ])\nupper = np.array([, , ])\nthresh = cv2.inRange(mask, lower, upper)\nres = mask.copy()\nres[thresh != ] = (,,)\n\nvisualize(seg_orignal=mask, seg_processed=res)\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F813a29f8577cad62b4682ec8c43b0404%2FUBC%20Tumor%20Only%20Mask.png?generation=1702226014561425&amp;alt=media\" alt=\"\"></p>\n<h1>Green/Blue: Stroma/Necrosis Only</h1>\n<pre><code>res = mask.copy()\nres[thresh &lt; ] = (,,)\nvisualize(seg_orignal=mask, seg_processed=res)\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F34e2b9d9a1da4789478bf1a64e1cb53c%2FUBC%20Stroma%20-%20Necrosis%20Only%20Mask.png?generation=1702226337032319&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": 2556400,
      "postDate": "2023-12-10T16:39:13.300Z",
      "content": "<p>Hi, </p>\n<p>Here is my hacky solution for Seg Tumor only. Do you have any better ideas?</p>\n<h1>Red: Tumor Only</h1>\n<pre><code>lower = np.array([, , ])\nupper = np.array([, , ])\nthresh = cv2.inRange(mask, lower, upper)\nres = mask.copy()\nres[thresh != ] = (,,)\n\nvisualize(seg_orignal=mask, seg_processed=res)\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F813a29f8577cad62b4682ec8c43b0404%2FUBC%20Tumor%20Only%20Mask.png?generation=1702226014561425&amp;alt=media\" alt=\"\"></p>\n<h1>Green/Blue: Stroma/Necrosis Only</h1>\n<pre><code>res = mask.copy()\nres[thresh &lt; ] = (,,)\nvisualize(seg_orignal=mask, seg_processed=res)\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F34e2b9d9a1da4789478bf1a64e1cb53c%2FUBC%20Stroma%20-%20Necrosis%20Only%20Mask.png?generation=1702226337032319&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Hi, \n\nHere is my hacky solution for Seg Tumor only. Do you have any better ideas?\n\n# Red: Tumor Only\n\n```python\nlower = np.array([250, 0, 0])\nupper = np.array([255, 0, 0])\nthresh = cv2.inRange(mask, lower, upper)\nres = mask.copy()\nres[thresh != 255] = (0,0,0)\n\nvisualize(seg_orignal=mask, seg_processed=res)\n```\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F813a29f8577cad62b4682ec8c43b0404%2FUBC%20Tumor%20Only%20Mask.png?generation=1702226014561425&alt=media)\n\n\n# Green/Blue: Stroma/Necrosis Only\n\n```python\nres = mask.copy()\nres[thresh < 250] = (0,0,0)\nvisualize(seg_orignal=mask, seg_processed=res)\n```\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F34e2b9d9a1da4789478bf1a64e1cb53c%2FUBC%20Stroma%20-%20Necrosis%20Only%20Mask.png?generation=1702226337032319&alt=media)",
      "votes": 14
    },
    {
      "id": 2556580,
      "postDate": "2023-12-10T19:55:01.633Z",
      "content": "<p>using numpy, </p>\n<p><code>mask[np.where(mask[:,:,0]==255)]</code></p>\n<p>will segment out Tumor areas </p>",
      "rawMarkdown": "using numpy, \n\n`mask[np.where(mask[:,:,0]==255)]`\n\nwill segment out Tumor areas ",
      "votes": 1,
      "replies": [
        {
          "id": 2556631,
          "postDate": "2023-12-10T21:38:33.097Z",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/aliabbasi\" target=\"_blank\">@aliabbasi</a>, </p>\n<p>Thank you for your suggestion.<br>\nThough it is not that simple, red channel pixels are not always 255, there are some values &lt;255. It can be easily verified. <a href=\"https://www.kaggle.com/yukkyo\" target=\"_blank\">@yukkyo</a> mentioned it <a href=\"https://www.kaggle.com/competitions/UBC-OCEAN/discussion/455890#2528303\" target=\"_blank\">here</a> also.</p>",
          "rawMarkdown": "Hi @aliabbasi, \n\nThank you for your suggestion.\nThough it is not that simple, red channel pixels are not always 255, there are some values <255. It can be easily verified. @yukkyo mentioned it [here](https://www.kaggle.com/competitions/UBC-OCEAN/discussion/455890#2528303) also.",
          "votes": 3
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2556580,
      "author_name": "Ali",
      "author_url": "",
      "post_date": "2023-12-10T19:55:01.633000",
      "content": "<p>using numpy, </p>\n<p><code>mask[np.where(mask[:,:,0]==255)]</code></p>\n<p>will segment out Tumor areas </p>",
      "votes": 1,
      "replies": [
        {
          "id": 2556631,
          "author_name": "SSS",
          "author_url": "",
          "post_date": "2023-12-10T21:38:33.097000",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/aliabbasi\" target=\"_blank\">@aliabbasi</a>, </p>\n<p>Thank you for your suggestion.<br>\nThough it is not that simple, red channel pixels are not always 255, there are some values &lt;255. It can be easily verified. <a href=\"https://www.kaggle.com/yukkyo\" target=\"_blank\">@yukkyo</a> mentioned it <a href=\"https://www.kaggle.com/competitions/UBC-OCEAN/discussion/455890#2528303\" target=\"_blank\">here</a> also.</p>",
          "votes": 3,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2556400": "Hi, \n\nHere is my hacky solution for Seg Tumor only. Do you have any better ideas?\n\n# Red: Tumor Only\n\n```python\nlower = np.array([250, 0, 0])\nupper = np.array([255, 0, 0])\nthresh = cv2.inRange(mask, lower, upper)\nres = mask.copy()\nres[thresh != 255] = (0,0,0)\n\nvisualize(seg_orignal=mask, seg_processed=res)\n```\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F813a29f8577cad62b4682ec8c43b0404%2FUBC%20Tumor%20Only%20Mask.png?generation=1702226014561425&alt=media)\n\n\n# Green/Blue: Stroma/Necrosis Only\n\n```python\nres = mask.copy()\nres[thresh < 250] = (0,0,0)\nvisualize(seg_orignal=mask, seg_processed=res)\n```\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F34e2b9d9a1da4789478bf1a64e1cb53c%2FUBC%20Stroma%20-%20Necrosis%20Only%20Mask.png?generation=1702226337032319&alt=media)",
    "2556580": "using numpy, \n\n`mask[np.where(mask[:,:,0]==255)]`\n\nwill segment out Tumor areas "
  }
}