{
  "id": 440548,
  "title": "DICOM and NIfTI to TFRecord",
  "url": "/competitions/rsna-2023-abdominal-trauma-detection/discussion/440548",
  "author_name": "Victor Shlepov",
  "post_date": "2023-09-15T10:32:45.646000",
  "votes": 1,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hi!</p>\n<p>If anyone is struggling with misaligned DICOM and NIfTI files - you might find helpful the TFRecords converter, which I just shared in the code section: <a href=\"https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord\" target=\"_blank\">https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord</a>.</p>\n<p>It resamples all images to uniform spacing  along z-axis (3mm by default) and uniform size along x- and y-axis (480x480 pixels). It also aligns images to to a single origin, spacing and directions were 2 images per patient are provided. Exactly the same approach is used with segmentations (where available) and slice-level labels (bowel, extravasation).</p>\n<p>I tried to make the docs self-explanatory to the extent possible. Should I miss something or need any help - feel free to write in comments. Do NOT run this on Kaggle - the output is about 400-500Gb in total. The whole process could take from 12 to 30 hours.</p>\n<p>On side note, I'd greatly appreciate if anyone could help me to port \"resample_sitk\" function in this notebook from SimpleITK to a CuPy library - it should save a LOT of machine time.</p>\n<p>Chers,</p>\n<p>Victor</p>",
  "messages": [
    {
      "id": 2440202,
      "postDate": "2023-09-15T10:32:45.647Z",
      "content": "<p>Hi!</p>\n<p>If anyone is struggling with misaligned DICOM and NIfTI files - you might find helpful the TFRecords converter, which I just shared in the code section: <a href=\"https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord\" target=\"_blank\">https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord</a>.</p>\n<p>It resamples all images to uniform spacing  along z-axis (3mm by default) and uniform size along x- and y-axis (480x480 pixels). It also aligns images to to a single origin, spacing and directions were 2 images per patient are provided. Exactly the same approach is used with segmentations (where available) and slice-level labels (bowel, extravasation).</p>\n<p>I tried to make the docs self-explanatory to the extent possible. Should I miss something or need any help - feel free to write in comments. Do NOT run this on Kaggle - the output is about 400-500Gb in total. The whole process could take from 12 to 30 hours.</p>\n<p>On side note, I'd greatly appreciate if anyone could help me to port \"resample_sitk\" function in this notebook from SimpleITK to a CuPy library - it should save a LOT of machine time.</p>\n<p>Chers,</p>\n<p>Victor</p>",
      "rawMarkdown": "Hi!\n\nIf anyone is struggling with misaligned DICOM and NIfTI files - you might find helpful the TFRecords converter, which I just shared in the code section: https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord.\n\nIt resamples all images to uniform spacing  along z-axis (3mm by default) and uniform size along x- and y-axis (480x480 pixels). It also aligns images to to a single origin, spacing and directions were 2 images per patient are provided. Exactly the same approach is used with segmentations (where available) and slice-level labels (bowel, extravasation).\n\nI tried to make the docs self-explanatory to the extent possible. Should I miss something or need any help - feel free to write in comments. Do NOT run this on Kaggle - the output is about 400-500Gb in total. The whole process could take from 12 to 30 hours.\n\nOn side note, I'd greatly appreciate if anyone could help me to port \"resample_sitk\" function in this notebook from SimpleITK to a CuPy library - it should save a LOT of machine time.\n\nChers,\n\nVictor",
      "votes": 1
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2440202": "Hi!\n\nIf anyone is struggling with misaligned DICOM and NIfTI files - you might find helpful the TFRecords converter, which I just shared in the code section: https://www.kaggle.com/code/victorshlepov/dicom-to-tfrecord.\n\nIt resamples all images to uniform spacing  along z-axis (3mm by default) and uniform size along x- and y-axis (480x480 pixels). It also aligns images to to a single origin, spacing and directions were 2 images per patient are provided. Exactly the same approach is used with segmentations (where available) and slice-level labels (bowel, extravasation).\n\nI tried to make the docs self-explanatory to the extent possible. Should I miss something or need any help - feel free to write in comments. Do NOT run this on Kaggle - the output is about 400-500Gb in total. The whole process could take from 12 to 30 hours.\n\nOn side note, I'd greatly appreciate if anyone could help me to port \"resample_sitk\" function in this notebook from SimpleITK to a CuPy library - it should save a LOT of machine time.\n\nChers,\n\nVictor"
  }
}