{
  "id": 268520,
  "title": "Is it possible to convert NIFTI to DICOM files?",
  "url": "/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/discussion/268520",
  "author_name": "",
  "post_date": "2021-08-27T17:01:23.768742200Z",
  "votes": 13,
  "comment_count": 19,
  "views": 0,
  "content": "<p>I've seen some tools that allow transforming from <strong>DICOM to NIFTI</strong> and this is what most discussion posts are talking about as well. I was wondering however if it would be possible to go from <strong>NIFTI to DICOM</strong> with a python tool such as SimpleITK or otherwise. <br>\nIs it possible or should it be avoided for some reason?</p>\n<p>The main issue seems to be that there are differences in the coordinate system and the spatial information between the two formats.</p>\n<p>Any help or ideas are much appreciated!</p>\n<p>Thanks</p>",
  "messages": [
    {
      "id": "1493160",
      "postDate": "08/27/2021 17:01:23",
      "content": "<p>I've seen some tools that allow transforming from <strong>DICOM to NIFTI</strong> and this is what most discussion posts are talking about as well. I was wondering however if it would be possible to go from <strong>NIFTI to DICOM</strong> with a python tool such as SimpleITK or otherwise. <br>\nIs it possible or should it be avoided for some reason?</p>\n<p>The main issue seems to be that there are differences in the coordinate system and the spatial information between the two formats.</p>\n<p>Any help or ideas are much appreciated!</p>\n<p>Thanks</p>",
      "rawMarkdown": "I've seen some tools that allow transforming from **DICOM to NIFTI** and this is what most discussion posts are talking about as well. I was wondering however if it would be possible to go from **NIFTI to DICOM** with a python tool such as SimpleITK or otherwise. \nIs it possible or should it be avoided for some reason?\n\nThe main issue seems to be that there are differences in the coordinate system and the spatial information between the two formats.\n\nAny help or ideas are much appreciated!\n\nThanks",
      "votes": null
    },
    {
      "id": "1493177",
      "postDate": "08/27/2021 17:13:17",
      "content": "<p>+1   I would be interested to see any solutions/ideas around this.</p>",
      "rawMarkdown": "1   I would be interested to see any solutions/ideas around this.",
      "votes": null
    },
    {
      "id": "1493203",
      "postDate": "08/27/2021 17:34:32",
      "content": "<p>Thanks for opening up this discussion!</p>\n<p>The base dataset is in DICOM format, but the Segmentation dataset hosted on Synapse is in NIFTI format. Grabbing the array from nifti is pretty straightforward :-</p>\n<p><code>t2_nib = nib.load('t2.nii.gz')</code><br>\n<code>t2_nib_array = t2_nib.get_fdata()</code></p>\n<p>assuming you're using a 3D dataset, what would be the benefit of using 2D dicom slices?</p>",
      "rawMarkdown": "Thanks for opening up this discussion!\n\nThe base dataset is in DICOM format, but the Segmentation dataset hosted on Synapse is in NIFTI format. Grabbing the array from nifti is pretty straightforward :-\n\n`t2_nib = nib.load('t2.nii.gz')`\n`t2_nib_array = t2_nib.get_fdata()`\n\nassuming you're using a 3D dataset, what would be the benefit of using 2D dicom slices?",
      "votes": null
    },
    {
      "id": "1493587",
      "postDate": "08/28/2021 03:44:27",
      "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> my two cents: just go from dicom to nifti one time and then do all processing in nifti. <br>\nfor example I ran this binary: it can take dicom and converts correctly to nifti: <br>\n<a href=\"https://cbica.github.io/CaPTk/preprocessing_brats.html\" target=\"_blank\">https://cbica.github.io/CaPTk/preprocessing_brats.html</a><br>\nall images are registered to a standard atlas called SRI24. </p>",
      "rawMarkdown": "smoschou55 my two cents: just go from dicom to nifti one time and then do all processing in nifti. \nfor example I ran this binary: it can take dicom and converts correctly to nifti: \nhttps://cbica.github.io/CaPTk/preprocessing_brats.html\nall images are registered to a standard atlas called SRI24.",
      "votes": null
    },
    {
      "id": "1493589",
      "postDate": "08/28/2021 03:48:14",
      "content": "<p>yup. same question: not sure of the benefit of 2D dicom slices; you can crop the 3d NIFTI volumes if needed. </p>",
      "rawMarkdown": "yup. same question: not sure of the benefit of 2D dicom slices; you can crop the 3d NIFTI volumes if needed.",
      "votes": null
    },
    {
      "id": "1494272",
      "postDate": "08/28/2021 14:38:26",
      "content": "<p>The idea is: if we can convert the NIFTI to DICOM (and translate to the same orientation and all that), then we can overlay the segmentation maps on the provided dicom slices.</p>\n<p>This gives us two sets of ground truth information that can be used to determine MGMT promoter methylation status.</p>\n<p>I believe the code you showed is just to open the NIFTI file as an array without any translation or co-registration, etc… therefore this doesn't allow for the use of the segmentation maps.</p>",
      "rawMarkdown": "The idea is: if we can convert the NIFTI to DICOM (and translate to the same orientation and all that), then we can overlay the segmentation maps on the provided dicom slices.\n\nThis gives us two sets of ground truth information that can be used to determine MGMT promoter methylation status.\n\nI believe the code you showed is just to open the NIFTI file as an array without any translation or co-registration, etc... therefore this doesn't allow for the use of the segmentation maps.",
      "votes": null
    },
    {
      "id": "1494475",
      "postDate": "08/28/2021 17:39:06",
      "content": "<p>A practical approach would be to multiply the specific modality array with the segmentation mask array as they are all the same size</p>",
      "rawMarkdown": "A practical approach would be to multiply the specific modality array with the segmentation mask array as they are all the same size",
      "votes": null
    },
    {
      "id": "1494511",
      "postDate": "08/28/2021 18:15:49",
      "content": "<p>Thanks for your input <a href=\"https://www.kaggle.com/snish9\" target=\"_blank\">@snish9</a> and fair question.</p>\n<p>Another reason on top of what <a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> mentioned would be to allow for some complementary 2D modelling approaches as well. </p>\n<p>I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. Or maybe this is not done for some practical or other reason that is not obvious to me right now.</p>",
      "rawMarkdown": "Thanks for your input @snish9 and fair question.\n\nAnother reason on top of what @dschettler8845 mentioned would be to allow for some complementary 2D modelling approaches as well. \n\nI imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. Or maybe this is not done for some practical or other reason that is not obvious to me right now.",
      "votes": null
    },
    {
      "id": "1494512",
      "postDate": "08/28/2021 18:20:56",
      "content": "<p>Thanks very much for this <a href=\"https://www.kaggle.com/mpsampat\" target=\"_blank\">@mpsampat</a>! </p>\n<p>I was really looking for the opposite process. I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. But if this can't be done properly, I might have to do an intermediate step of converting everything to NIFTI first.</p>",
      "rawMarkdown": "Thanks very much for this @mpsampat! \n\nI was really looking for the opposite process. I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. But if this can't be done properly, I might have to do an intermediate step of converting everything to NIFTI first.",
      "votes": null
    },
    {
      "id": "1494514",
      "postDate": "08/28/2021 18:21:43",
      "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> , i found this link, hope this answers something relevant .👍<br>\n<a href=\"https://discourse.slicer.org/t/nifti-to-dicom-conversion/11895\" target=\"_blank\">https://discourse.slicer.org/t/nifti-to-dicom-conversion/11895</a></p>",
      "rawMarkdown": "smoschou55 , i found this link, hope this answers something relevant .👍\nhttps://discourse.slicer.org/t/nifti-to-dicom-conversion/11895",
      "votes": null
    },
    {
      "id": "1494517",
      "postDate": "08/28/2021 18:29:37",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/susant4learning\" target=\"_blank\">@susant4learning</a>, I think you might have forgotten to paste the link.</p>",
      "rawMarkdown": "Hi @susant4learning, I think you might have forgotten to paste the link.",
      "votes": null
    },
    {
      "id": "1494532",
      "postDate": "08/28/2021 18:42:03",
      "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> , Updated the link . </p>",
      "rawMarkdown": "smoschou55 , Updated the link .",
      "votes": null
    },
    {
      "id": "1494887",
      "postDate": "08/29/2021 06:39:27",
      "content": "<p>Yes, I agree, 2D modelling is definitely something i wanna try too. Something like the following should work :-</p>\n<p><code>import nibabel as nib</code><br>\n<code>t2_nib = nib.load(f'{path}\\\\{t2}')</code><br>\n<code>seg_nib = nib.load(f'{path}\\\\{seg}')</code><br>\n<code>t2_arr = t2_nib.get_fdata()</code><br>\n<code>seg_arr = seg_nib.get_fdata()</code><br>\n<code>print(np.unique(seg_arr))</code><br>\n<code>&gt;&gt;&gt; [0. 1. 2. 4.]</code><br>\n<code>assert t2_arr.shape == seg_arr.shape</code><br>\n<code>t2_seg_arr = np.multiply(t2_arr, seg_arr)</code></p>\n<p><code>t2_seg_arr</code> is the array containing the t2 modality voxels but only at the coordinates where the tumor mask exists.</p>\n<p>unique values in segmentation mask can be interpreted as mask brightness.</p>\n<p>kindly let me know if this helps!</p>",
      "rawMarkdown": "Yes, I agree, 2D modelling is definitely something i wanna try too. Something like the following should work :-\n\n`import nibabel as nib`\n`t2_nib = nib.load(f'{path}\\\\{t2}')`\n`seg_nib = nib.load(f'{path}\\\\{seg}')`\n`t2_arr = t2_nib.get_fdata()`\n`seg_arr = seg_nib.get_fdata()`\n`print(np.unique(seg_arr))`\n`>>> [0. 1. 2. 4.]`\n`assert t2_arr.shape == seg_arr.shape`\n`t2_seg_arr = np.multiply(t2_arr, seg_arr)`\n\n`t2_seg_arr` is the array containing the t2 modality voxels but only at the coordinates where the tumor mask exists.\n\nunique values in segmentation mask can be interpreted as mask brightness.\n\nkindly let me know if this helps!",
      "votes": null
    },
    {
      "id": "1495290",
      "postDate": "08/29/2021 12:48:57",
      "content": "<p>good work,keep going</p>",
      "rawMarkdown": "good work,keep going",
      "votes": null
    },
    {
      "id": "1495994",
      "postDate": "08/30/2021 01:55:40",
      "content": "<p>Segmentation maps are the only benefit I see from such a transformation. And, coincidentally, it is not that hard to transfer them between tasks. All you need is a 2d segmentation model and a few augmentations mimicking the difference between Task1 and Task2. I might even get to implementing and publishing something like that myself… someday.</p>",
      "rawMarkdown": "Segmentation maps are the only benefit I see from such a transformation. And, coincidentally, it is not that hard to transfer them between tasks. All you need is a 2d segmentation model and a few augmentations mimicking the difference between Task1 and Task2. I might even get to implementing and publishing something like that myself... someday.",
      "votes": null
    },
    {
      "id": "1496019",
      "postDate": "08/30/2021 03:00:26",
      "content": "<p>I don't really understand what you mean? The tasks are in different orientations, in different sizes, etc.</p>\n<p>How would you transfer the GT segmentation masks ?</p>",
      "rawMarkdown": "I don't really understand what you mean? The tasks are in different orientations, in different sizes, etc.\n\nHow would you transfer the GT segmentation masks ?",
      "votes": null
    },
    {
      "id": "1496030",
      "postDate": "08/30/2021 03:21:33",
      "content": "<p>At the end of the day, a tumor is represented as a high-contrast pixel area in both tasks. A properly trained model will learn what part of an image (2d scan slice) is \"anomalous\" regardless of its rotation or rescaling. </p>",
      "rawMarkdown": "At the end of the day, a tumor is represented as a high-contrast pixel area in both tasks. A properly trained model will learn what part of an image (2d scan slice) is \"anomalous\" regardless of its rotation or rescaling.",
      "votes": null
    },
    {
      "id": "1497489",
      "postDate": "08/31/2021 08:32:39",
      "content": "<p>Thanks, <a href=\"https://www.kaggle.com/susant4learning\" target=\"_blank\">@susant4learning</a>! That was a very helpful thing in that it clarified that there were other people in the past pointing out the importance and requesting for a tool that takes care of the opposite conversion (NIFTI -&gt; DICOM), but without much luck. Which is bummer! :(</p>",
      "rawMarkdown": "Thanks, @susant4learning! That was a very helpful thing in that it clarified that there were other people in the past pointing out the importance and requesting for a tool that takes care of the opposite conversion (NIFTI -> DICOM), but without much luck. Which is bummer! :(",
      "votes": null
    },
    {
      "id": "1507382",
      "postDate": "09/09/2021 06:36:53",
      "content": "<p>It is possible, if you know which NIFTI corresponds to which patient from the train set. </p>",
      "rawMarkdown": "It is possible, if you know which NIFTI corresponds to which patient from the train set.",
      "votes": null
    },
    {
      "id": "1507447",
      "postDate": "09/09/2021 08:00:44",
      "content": "<p>If I'm not mistaken, they seem to have the same naming convention and thus the BraTSIDs would be the same between the two datasets (Task 1 / Task 2).</p>",
      "rawMarkdown": "If I'm not mistaken, they seem to have the same naming convention and thus the BraTSIDs would be the same between the two datasets (Task 1 / Task 2).",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1493177,
      "author_name": "dschettler8845",
      "author_url": "",
      "post_date": "08/27/2021 17:13:17",
      "content": "<p>+1   I would be interested to see any solutions/ideas around this.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1493203,
      "author_name": "snish9",
      "author_url": "",
      "post_date": "08/27/2021 17:34:32",
      "content": "<p>Thanks for opening up this discussion!</p>\n<p>The base dataset is in DICOM format, but the Segmentation dataset hosted on Synapse is in NIFTI format. Grabbing the array from nifti is pretty straightforward :-</p>\n<p><code>t2_nib = nib.load('t2.nii.gz')</code><br>\n<code>t2_nib_array = t2_nib.get_fdata()</code></p>\n<p>assuming you're using a 3D dataset, what would be the benefit of using 2D dicom slices?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1493589,
          "author_name": "mpsampat",
          "author_url": "",
          "post_date": "08/28/2021 03:48:14",
          "content": "<p>yup. same question: not sure of the benefit of 2D dicom slices; you can crop the 3d NIFTI volumes if needed. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1494272,
          "author_name": "dschettler8845",
          "author_url": "",
          "post_date": "08/28/2021 14:38:26",
          "content": "<p>The idea is: if we can convert the NIFTI to DICOM (and translate to the same orientation and all that), then we can overlay the segmentation maps on the provided dicom slices.</p>\n<p>This gives us two sets of ground truth information that can be used to determine MGMT promoter methylation status.</p>\n<p>I believe the code you showed is just to open the NIFTI file as an array without any translation or co-registration, etc… therefore this doesn't allow for the use of the segmentation maps.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1494475,
          "author_name": "snish9",
          "author_url": "",
          "post_date": "08/28/2021 17:39:06",
          "content": "<p>A practical approach would be to multiply the specific modality array with the segmentation mask array as they are all the same size</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1494511,
          "author_name": "smoschou55",
          "author_url": "",
          "post_date": "08/28/2021 18:15:49",
          "content": "<p>Thanks for your input <a href=\"https://www.kaggle.com/snish9\" target=\"_blank\">@snish9</a> and fair question.</p>\n<p>Another reason on top of what <a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> mentioned would be to allow for some complementary 2D modelling approaches as well. </p>\n<p>I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. Or maybe this is not done for some practical or other reason that is not obvious to me right now.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1494887,
          "author_name": "snish9",
          "author_url": "",
          "post_date": "08/29/2021 06:39:27",
          "content": "<p>Yes, I agree, 2D modelling is definitely something i wanna try too. Something like the following should work :-</p>\n<p><code>import nibabel as nib</code><br>\n<code>t2_nib = nib.load(f'{path}\\\\{t2}')</code><br>\n<code>seg_nib = nib.load(f'{path}\\\\{seg}')</code><br>\n<code>t2_arr = t2_nib.get_fdata()</code><br>\n<code>seg_arr = seg_nib.get_fdata()</code><br>\n<code>print(np.unique(seg_arr))</code><br>\n<code>&gt;&gt;&gt; [0. 1. 2. 4.]</code><br>\n<code>assert t2_arr.shape == seg_arr.shape</code><br>\n<code>t2_seg_arr = np.multiply(t2_arr, seg_arr)</code></p>\n<p><code>t2_seg_arr</code> is the array containing the t2 modality voxels but only at the coordinates where the tumor mask exists.</p>\n<p>unique values in segmentation mask can be interpreted as mask brightness.</p>\n<p>kindly let me know if this helps!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1493587,
      "author_name": "mpsampat",
      "author_url": "",
      "post_date": "08/28/2021 03:44:27",
      "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> my two cents: just go from dicom to nifti one time and then do all processing in nifti. <br>\nfor example I ran this binary: it can take dicom and converts correctly to nifti: <br>\n<a href=\"https://cbica.github.io/CaPTk/preprocessing_brats.html\" target=\"_blank\">https://cbica.github.io/CaPTk/preprocessing_brats.html</a><br>\nall images are registered to a standard atlas called SRI24. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1494512,
          "author_name": "smoschou55",
          "author_url": "",
          "post_date": "08/28/2021 18:20:56",
          "content": "<p>Thanks very much for this <a href=\"https://www.kaggle.com/mpsampat\" target=\"_blank\">@mpsampat</a>! </p>\n<p>I was really looking for the opposite process. I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. But if this can't be done properly, I might have to do an intermediate step of converting everything to NIFTI first.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1494514,
      "author_name": "susant4learning",
      "author_url": "",
      "post_date": "08/28/2021 18:21:43",
      "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> , i found this link, hope this answers something relevant .👍<br>\n<a href=\"https://discourse.slicer.org/t/nifti-to-dicom-conversion/11895\" target=\"_blank\">https://discourse.slicer.org/t/nifti-to-dicom-conversion/11895</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1494517,
          "author_name": "smoschou55",
          "author_url": "",
          "post_date": "08/28/2021 18:29:37",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/susant4learning\" target=\"_blank\">@susant4learning</a>, I think you might have forgotten to paste the link.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1494532,
          "author_name": "susant4learning",
          "author_url": "",
          "post_date": "08/28/2021 18:42:03",
          "content": "<p><a href=\"https://www.kaggle.com/smoschou55\" target=\"_blank\">@smoschou55</a> , Updated the link . </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1497489,
          "author_name": "smoschou55",
          "author_url": "",
          "post_date": "08/31/2021 08:32:39",
          "content": "<p>Thanks, <a href=\"https://www.kaggle.com/susant4learning\" target=\"_blank\">@susant4learning</a>! That was a very helpful thing in that it clarified that there were other people in the past pointing out the importance and requesting for a tool that takes care of the opposite conversion (NIFTI -&gt; DICOM), but without much luck. Which is bummer! :(</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1495290,
      "author_name": "nimajehanmothafar",
      "author_url": "",
      "post_date": "08/29/2021 12:48:57",
      "content": "<p>good work,keep going</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1495994,
      "author_name": "spacedoge",
      "author_url": "",
      "post_date": "08/30/2021 01:55:40",
      "content": "<p>Segmentation maps are the only benefit I see from such a transformation. And, coincidentally, it is not that hard to transfer them between tasks. All you need is a 2d segmentation model and a few augmentations mimicking the difference between Task1 and Task2. I might even get to implementing and publishing something like that myself… someday.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1496019,
          "author_name": "dschettler8845",
          "author_url": "",
          "post_date": "08/30/2021 03:00:26",
          "content": "<p>I don't really understand what you mean? The tasks are in different orientations, in different sizes, etc.</p>\n<p>How would you transfer the GT segmentation masks ?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1496030,
          "author_name": "spacedoge",
          "author_url": "",
          "post_date": "08/30/2021 03:21:33",
          "content": "<p>At the end of the day, a tumor is represented as a high-contrast pixel area in both tasks. A properly trained model will learn what part of an image (2d scan slice) is \"anomalous\" regardless of its rotation or rescaling. </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1507382,
      "author_name": "boojum",
      "author_url": "",
      "post_date": "09/09/2021 06:36:53",
      "content": "<p>It is possible, if you know which NIFTI corresponds to which patient from the train set. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1507447,
          "author_name": "smoschou55",
          "author_url": "",
          "post_date": "09/09/2021 08:00:44",
          "content": "<p>If I'm not mistaken, they seem to have the same naming convention and thus the BraTSIDs would be the same between the two datasets (Task 1 / Task 2).</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1493160": "I've seen some tools that allow transforming from **DICOM to NIFTI** and this is what most discussion posts are talking about as well. I was wondering however if it would be possible to go from **NIFTI to DICOM** with a python tool such as SimpleITK or otherwise. \nIs it possible or should it be avoided for some reason?\n\nThe main issue seems to be that there are differences in the coordinate system and the spatial information between the two formats.\n\nAny help or ideas are much appreciated!\n\nThanks",
    "1493177": "1   I would be interested to see any solutions/ideas around this.",
    "1493203": "Thanks for opening up this discussion!\n\nThe base dataset is in DICOM format, but the Segmentation dataset hosted on Synapse is in NIFTI format. Grabbing the array from nifti is pretty straightforward :-\n\n`t2_nib = nib.load('t2.nii.gz')`\n`t2_nib_array = t2_nib.get_fdata()`\n\nassuming you're using a 3D dataset, what would be the benefit of using 2D dicom slices?",
    "1493587": "smoschou55 my two cents: just go from dicom to nifti one time and then do all processing in nifti. \nfor example I ran this binary: it can take dicom and converts correctly to nifti: \nhttps://cbica.github.io/CaPTk/preprocessing_brats.html\nall images are registered to a standard atlas called SRI24.",
    "1493589": "yup. same question: not sure of the benefit of 2D dicom slices; you can crop the 3d NIFTI volumes if needed.",
    "1494272": "The idea is: if we can convert the NIFTI to DICOM (and translate to the same orientation and all that), then we can overlay the segmentation maps on the provided dicom slices.\n\nThis gives us two sets of ground truth information that can be used to determine MGMT promoter methylation status.\n\nI believe the code you showed is just to open the NIFTI file as an array without any translation or co-registration, etc... therefore this doesn't allow for the use of the segmentation maps.",
    "1494475": "A practical approach would be to multiply the specific modality array with the segmentation mask array as they are all the same size",
    "1494511": "Thanks for your input @snish9 and fair question.\n\nAnother reason on top of what @dschettler8845 mentioned would be to allow for some complementary 2D modelling approaches as well. \n\nI imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. Or maybe this is not done for some practical or other reason that is not obvious to me right now.",
    "1494512": "Thanks very much for this @mpsampat! \n\nI was really looking for the opposite process. I imagine that there must be a way to go from NIFTI to DICOM, since the opposite mathematical transformation exists. But if this can't be done properly, I might have to do an intermediate step of converting everything to NIFTI first.",
    "1494514": "smoschou55 , i found this link, hope this answers something relevant .👍\nhttps://discourse.slicer.org/t/nifti-to-dicom-conversion/11895",
    "1494517": "Hi @susant4learning, I think you might have forgotten to paste the link.",
    "1494532": "smoschou55 , Updated the link .",
    "1494887": "Yes, I agree, 2D modelling is definitely something i wanna try too. Something like the following should work :-\n\n`import nibabel as nib`\n`t2_nib = nib.load(f'{path}\\\\{t2}')`\n`seg_nib = nib.load(f'{path}\\\\{seg}')`\n`t2_arr = t2_nib.get_fdata()`\n`seg_arr = seg_nib.get_fdata()`\n`print(np.unique(seg_arr))`\n`>>> [0. 1. 2. 4.]`\n`assert t2_arr.shape == seg_arr.shape`\n`t2_seg_arr = np.multiply(t2_arr, seg_arr)`\n\n`t2_seg_arr` is the array containing the t2 modality voxels but only at the coordinates where the tumor mask exists.\n\nunique values in segmentation mask can be interpreted as mask brightness.\n\nkindly let me know if this helps!",
    "1495290": "good work,keep going",
    "1495994": "Segmentation maps are the only benefit I see from such a transformation. And, coincidentally, it is not that hard to transfer them between tasks. All you need is a 2d segmentation model and a few augmentations mimicking the difference between Task1 and Task2. I might even get to implementing and publishing something like that myself... someday.",
    "1496019": "I don't really understand what you mean? The tasks are in different orientations, in different sizes, etc.\n\nHow would you transfer the GT segmentation masks ?",
    "1496030": "At the end of the day, a tumor is represented as a high-contrast pixel area in both tasks. A properly trained model will learn what part of an image (2d scan slice) is \"anomalous\" regardless of its rotation or rescaling.",
    "1497489": "Thanks, @susant4learning! That was a very helpful thing in that it clarified that there were other people in the past pointing out the importance and requesting for a tool that takes care of the opposite conversion (NIFTI -> DICOM), but without much luck. Which is bummer! :(",
    "1507382": "It is possible, if you know which NIFTI corresponds to which patient from the train set.",
    "1507447": "If I'm not mistaken, they seem to have the same naming convention and thus the BraTSIDs would be the same between the two datasets (Task 1 / Task 2)."
  },
  "source": "meta"
}