{
  "id": 444399,
  "title": "How can I create training data for the semantic segmentation model?",
  "url": "/competitions/rsna-2023-abdominal-trauma-detection/discussion/444399",
  "author_name": "Ataracsia",
  "post_date": "2023-10-01T19:13:21.682000",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>The overview of this competition states the following as a description of <code>segmentations</code>:</p>\n<blockquote>\n  <p>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set.</p>\n</blockquote>\n<p>I can see a series of masked CT images and meta-information in the .nii file in <code>segmentations</code>, but I do not know how to use this to create training data for the Semantic Segmentation Model.</p>\n<p>For example, in the 397.nii file I get the following images and information, but how can I use this to annotate which organ is which color?</p>\n<p>Image 31 of 397.nii:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc598cd637b107cd5062e3ecad5c309aa%2Foutput.png?generation=1696187248406329&amp;alt=media\" alt=\"\"></p>\n<pre><code>&lt;class '&gt;\ndata shape (, , )\naffine:\n[[  -   -.            .           ]\n [  -.               -.         -]\n [   .            .                    -]\n [   .            .            .            .        ]]\nmetadata:\n&lt;class '&gt; object, endian=\nsizeof_hdr      : 348\ndata_type       : ''\ndb_name         : ''\nextents         : 16384\nsession_error   : 0\nregular         : \ndim_info        : 0\ndim             : [  3 512 512  64   1   1   1   1]\nintent_p1       : 0.0\nintent_p2       : 0.0\nintent_p3       : 0.0\nintent_code     : \ndatatype        : \nbitpix          : 32\nslice_start     : 0\npixdim          : [-1.        0.904297  0.904297  2.5       0.        0.        0.\n  .      ]\nvox_offset      : 0.0\nscl_slope       : \nscl_inter       : \nslice_end       : 0\nslice_code      : \nxyzt_units      : 10\ncal_max         : 0.0\ncal_min         : 0.0\nslice_duration  : 0.0\ntoffset         : 0.0\nglmax           : 0\nglmin           : 0\ndescrip         : '-dirty --T15::+:'\naux_file        : ''\nqform_code      : \nsform_code      : \nquatern_b       : 0.0\nquatern_c       : 1.0\nquatern_d       : 0.0\nqoffset_x       : 232.252\nqoffset_y       : -223.81377\nqoffset_z       : -315.199\nsrow_x          : [ -0.904297  -0.         0.       232.252   ]\nsrow_y          : [  -0.          0.904297   -0.       -223.81377 ]\nsrow_z          : [   0.       0.       2.5   -315.199]\nintent_name     : ''\nmagic           : +'\n</code></pre>",
  "messages": [
    {
      "id": 2463983,
      "postDate": "2023-10-01T19:13:21.683Z",
      "content": "<p>The overview of this competition states the following as a description of <code>segmentations</code>:</p>\n<blockquote>\n  <p>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set.</p>\n</blockquote>\n<p>I can see a series of masked CT images and meta-information in the .nii file in <code>segmentations</code>, but I do not know how to use this to create training data for the Semantic Segmentation Model.</p>\n<p>For example, in the 397.nii file I get the following images and information, but how can I use this to annotate which organ is which color?</p>\n<p>Image 31 of 397.nii:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc598cd637b107cd5062e3ecad5c309aa%2Foutput.png?generation=1696187248406329&amp;alt=media\" alt=\"\"></p>\n<pre><code>&lt;class '&gt;\ndata shape (, , )\naffine:\n[[  -   -.            .           ]\n [  -.               -.         -]\n [   .            .                    -]\n [   .            .            .            .        ]]\nmetadata:\n&lt;class '&gt; object, endian=\nsizeof_hdr      : 348\ndata_type       : ''\ndb_name         : ''\nextents         : 16384\nsession_error   : 0\nregular         : \ndim_info        : 0\ndim             : [  3 512 512  64   1   1   1   1]\nintent_p1       : 0.0\nintent_p2       : 0.0\nintent_p3       : 0.0\nintent_code     : \ndatatype        : \nbitpix          : 32\nslice_start     : 0\npixdim          : [-1.        0.904297  0.904297  2.5       0.        0.        0.\n  .      ]\nvox_offset      : 0.0\nscl_slope       : \nscl_inter       : \nslice_end       : 0\nslice_code      : \nxyzt_units      : 10\ncal_max         : 0.0\ncal_min         : 0.0\nslice_duration  : 0.0\ntoffset         : 0.0\nglmax           : 0\nglmin           : 0\ndescrip         : '-dirty --T15::+:'\naux_file        : ''\nqform_code      : \nsform_code      : \nquatern_b       : 0.0\nquatern_c       : 1.0\nquatern_d       : 0.0\nqoffset_x       : 232.252\nqoffset_y       : -223.81377\nqoffset_z       : -315.199\nsrow_x          : [ -0.904297  -0.         0.       232.252   ]\nsrow_y          : [  -0.          0.904297   -0.       -223.81377 ]\nsrow_z          : [   0.       0.       2.5   -315.199]\nintent_name     : ''\nmagic           : +'\n</code></pre>",
      "rawMarkdown": "The overview of this competition states the following as a description of `segmentations`:\n\n>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set.\n\nI can see a series of masked CT images and meta-information in the .nii file in `segmentations`, but I do not know how to use this to create training data for the Semantic Segmentation Model.\n\nFor example, in the 397.nii file I get the following images and information, but how can I use this to annotate which organ is which color?\n\nImage 31 of 397.nii:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc598cd637b107cd5062e3ecad5c309aa%2Foutput.png?generation=1696187248406329&alt=media)\n\n```\n<class 'nibabel.nifti1.Nifti1Image'>\ndata shape (512, 512, 64)\naffine:\n[[  -0.90429699   -0.            0.          232.2519989 ]\n [  -0.            0.90429699   -0.         -223.81376648]\n [   0.            0.            2.5        -315.19900513]\n [   0.            0.            0.            1.        ]]\nmetadata:\n<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'\nsizeof_hdr      : 348\ndata_type       : b''\ndb_name         : b''\nextents         : 16384\nsession_error   : 0\nregular         : b'r'\ndim_info        : 0\ndim             : [  3 512 512  64   1   1   1   1]\nintent_p1       : 0.0\nintent_p2       : 0.0\nintent_p3       : 0.0\nintent_code     : none\ndatatype        : float32\nbitpix          : 32\nslice_start     : 0\npixdim          : [-1.        0.904297  0.904297  2.5       0.        0.        0.\n  0.      ]\nvox_offset      : 0.0\nscl_slope       : nan\nscl_inter       : nan\nslice_end       : 0\nslice_code      : unknown\nxyzt_units      : 10\ncal_max         : 0.0\ncal_min         : 0.0\nslice_duration  : 0.0\ntoffset         : 0.0\nglmax           : 0\nglmin           : 0\ndescrip         : b'2203.6-dirty 2022-09-08T15:38:56+01:00'\naux_file        : b''\nqform_code      : scanner\nsform_code      : scanner\nquatern_b       : 0.0\nquatern_c       : 1.0\nquatern_d       : 0.0\nqoffset_x       : 232.252\nqoffset_y       : -223.81377\nqoffset_z       : -315.199\nsrow_x          : [ -0.904297  -0.         0.       232.252   ]\nsrow_y          : [  -0.          0.904297   -0.       -223.81377 ]\nsrow_z          : [   0.       0.       2.5   -315.199]\nintent_name     : b''\nmagic           : b'n+1'\n```",
      "votes": 2
    },
    {
      "id": 2473061,
      "postDate": "2023-10-07T20:43:39.353Z",
      "content": "<p>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set. This data is provided in the nifti file format. The filenames are series IDs. You can find a description of the source model (total segmentator) <a href=\"https://pubs.rsna.org/doi/10.1148/ryai.230024\" target=\"_blank\">here </a>and the data used to train that model <a href=\"https://github.com/wasserth/TotalSegmentator\" target=\"_blank\">here</a>.</p>\n<p><a href=\"https://github.com/wasserth/TotalSegmentator/blob/master/resources/totalsegmentator_snomed_mapping.csv\" target=\"_blank\">Here</a> you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes.</p>",
      "rawMarkdown": "segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set. This data is provided in the nifti file format. The filenames are series IDs. You can find a description of the source model (total segmentator) [here ](https://pubs.rsna.org/doi/10.1148/ryai.230024)and the data used to train that model [here](https://github.com/wasserth/TotalSegmentator).\n\n[Here](https://github.com/wasserth/TotalSegmentator/blob/master/resources/totalsegmentator_snomed_mapping.csv) you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes."
    },
    {
      "id": 2473044,
      "postDate": "2023-10-07T20:12:49.337Z",
      "content": "<p>Hello. I think those masks should be usefull although you couldn't tell what organs they belong to. </p>",
      "rawMarkdown": "Hello. I think those masks should be usefull although you couldn't tell what organs they belong to. ",
      "replies": [
        {
          "id": 2475103,
          "postDate": "2023-10-09T16:30:36.223Z",
          "content": "<p>Thank you. I understood it when I looked at the pixel values instead of looking at it as an image.</p>",
          "rawMarkdown": "Thank you. I understood it when I looked at the pixel values instead of looking at it as an image."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2473061,
      "author_name": "Ruy Diaz",
      "author_url": "",
      "post_date": "2023-10-07T20:43:39.353000",
      "content": "<p>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set. This data is provided in the nifti file format. The filenames are series IDs. You can find a description of the source model (total segmentator) <a href=\"https://pubs.rsna.org/doi/10.1148/ryai.230024\" target=\"_blank\">here </a>and the data used to train that model <a href=\"https://github.com/wasserth/TotalSegmentator\" target=\"_blank\">here</a>.</p>\n<p><a href=\"https://github.com/wasserth/TotalSegmentator/blob/master/resources/totalsegmentator_snomed_mapping.csv\" target=\"_blank\">Here</a> you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 2473044,
      "author_name": "Ruy Diaz",
      "author_url": "",
      "post_date": "2023-10-07T20:12:49.337000",
      "content": "<p>Hello. I think those masks should be usefull although you couldn't tell what organs they belong to. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 2475103,
          "author_name": "Ataracsia",
          "author_url": "",
          "post_date": "2023-10-09T16:30:36.223000",
          "content": "<p>Thank you. I understood it when I looked at the pixel values instead of looking at it as an image.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2463983": "The overview of this competition states the following as a description of `segmentations`:\n\n>segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set.\n\nI can see a series of masked CT images and meta-information in the .nii file in `segmentations`, but I do not know how to use this to create training data for the Semantic Segmentation Model.\n\nFor example, in the 397.nii file I get the following images and information, but how can I use this to annotate which organ is which color?\n\nImage 31 of 397.nii:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc598cd637b107cd5062e3ecad5c309aa%2Foutput.png?generation=1696187248406329&alt=media)\n\n```\n<class 'nibabel.nifti1.Nifti1Image'>\ndata shape (512, 512, 64)\naffine:\n[[  -0.90429699   -0.            0.          232.2519989 ]\n [  -0.            0.90429699   -0.         -223.81376648]\n [   0.            0.            2.5        -315.19900513]\n [   0.            0.            0.            1.        ]]\nmetadata:\n<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'\nsizeof_hdr      : 348\ndata_type       : b''\ndb_name         : b''\nextents         : 16384\nsession_error   : 0\nregular         : b'r'\ndim_info        : 0\ndim             : [  3 512 512  64   1   1   1   1]\nintent_p1       : 0.0\nintent_p2       : 0.0\nintent_p3       : 0.0\nintent_code     : none\ndatatype        : float32\nbitpix          : 32\nslice_start     : 0\npixdim          : [-1.        0.904297  0.904297  2.5       0.        0.        0.\n  0.      ]\nvox_offset      : 0.0\nscl_slope       : nan\nscl_inter       : nan\nslice_end       : 0\nslice_code      : unknown\nxyzt_units      : 10\ncal_max         : 0.0\ncal_min         : 0.0\nslice_duration  : 0.0\ntoffset         : 0.0\nglmax           : 0\nglmin           : 0\ndescrip         : b'2203.6-dirty 2022-09-08T15:38:56+01:00'\naux_file        : b''\nqform_code      : scanner\nsform_code      : scanner\nquatern_b       : 0.0\nquatern_c       : 1.0\nquatern_d       : 0.0\nqoffset_x       : 232.252\nqoffset_y       : -223.81377\nqoffset_z       : -315.199\nsrow_x          : [ -0.904297  -0.         0.       232.252   ]\nsrow_y          : [  -0.          0.904297   -0.       -223.81377 ]\nsrow_z          : [   0.       0.       2.5   -315.199]\nintent_name     : b''\nmagic           : b'n+1'\n```",
    "2473061": "segmentations/ Model generated pixel-level annotations of the relevant organs and some major bones for a subset of the scans in the training set. This data is provided in the nifti file format. The filenames are series IDs. You can find a description of the source model (total segmentator) [here ](https://pubs.rsna.org/doi/10.1148/ryai.230024)and the data used to train that model [here](https://github.com/wasserth/TotalSegmentator).\n\n[Here](https://github.com/wasserth/TotalSegmentator/blob/master/resources/totalsegmentator_snomed_mapping.csv) you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes.",
    "2473044": "Hello. I think those masks should be usefull although you couldn't tell what organs they belong to. "
  }
}