{
  "id": 171822,
  "title": "How to deal with varying channel(images) length for each patient for a CNN",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/171822",
  "author_name": "",
  "post_date": "2020-08-02T15:46:25.445537200Z",
  "votes": 3,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hey all! I have been trying to work with the image data. Each patient has multiple images in the z direction(multiple varying channels).I was wondering if any of you guys could point me to any example of how we can work withvarying channels in a CNN or am I looking at this all wrong? I am guessing that there is no way to work with varying channels using Keras? Is there any way to resize the stack of images without losing information?</p>",
  "messages": [
    {
      "id": "955393",
      "postDate": "08/02/2020 15:46:25",
      "content": "<p>Hey all! I have been trying to work with the image data. Each patient has multiple images in the z direction(multiple varying channels).I was wondering if any of you guys could point me to any example of how we can work withvarying channels in a CNN or am I looking at this all wrong? I am guessing that there is no way to work with varying channels using Keras? Is there any way to resize the stack of images without losing information?</p>",
      "rawMarkdown": "Hey all! I have been trying to work with the image data. Each patient has multiple images in the z direction(multiple varying channels).I was wondering if any of you guys could point me to any example of how we can work withvarying channels in a CNN or am I looking at this all wrong? I am guessing that there is no way to work with varying channels using Keras? Is there any way to resize the stack of images without losing information?",
      "votes": null
    },
    {
      "id": "955422",
      "postDate": "08/02/2020 16:16:40",
      "content": "<p>1) pad the stacks of images to the same length in z-axis</p>\n\n<p>2) generate 'candidate' slices/frames for each patient (a lot of that in data science bowl 2017). Perhaps by learning to identify anomalous looking scans with one model and then using that to generate inputs for an fvc prediction model?</p>\n\n<p>3) some kind of loop in the forward pass of the model that loops over all the images for a patient and maybe sums the outputs of the N images so that after the dimensionality is the same?</p>\n\n<p>These are the routes I've been thinking of exploring. I've tried 1) but struggled to get good results so far</p>",
      "rawMarkdown": "1) pad the stacks of images to the same length in z-axis\n\n2) generate 'candidate' slices/frames for each patient (a lot of that in data science bowl 2017). Perhaps by learning to identify anomalous looking scans with one model and then using that to generate inputs for an fvc prediction model?\n\n3) some kind of loop in the forward pass of the model that loops over all the images for a patient and maybe sums the outputs of the N images so that after the dimensionality is the same?\n\nThese are the routes I've been thinking of exploring. I've tried 1) but struggled to get good results so far",
      "votes": null
    },
    {
      "id": "955448",
      "postDate": "08/02/2020 16:32:27",
      "content": "<p>Really interesting takes. I think 2) looks promising!  Thanks!  I did think of padding but seemed a little problematic considering that it feels like the channels are going to be very unrelated image to image for the NN. I will definitely check them out!</p>",
      "rawMarkdown": "Really interesting takes. I think 2) looks promising!  Thanks!  I did think of padding but seemed a little problematic considering that it feels like the channels are going to be very unrelated image to image for the NN. I will definitely check them out!",
      "votes": null
    },
    {
      "id": "956711",
      "postDate": "08/03/2020 17:52:32",
      "content": "<p>you can also <a href=\"https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize\">resize</a></p>",
      "rawMarkdown": "you can also [resize](https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize)",
      "votes": null
    },
    {
      "id": "957688",
      "postDate": "08/04/2020 13:48:03",
      "content": "<p>thanks! ill check it out!</p>",
      "rawMarkdown": "thanks! ill check it out!",
      "votes": null
    },
    {
      "id": "960833",
      "postDate": "08/06/2020 17:50:41",
      "content": "<p>One way is to fit the images in a 3D object of same size and pixel slicing for all patients</p>",
      "rawMarkdown": "One way is to fit the images in a 3D object of same size and pixel slicing for all patients",
      "votes": null
    },
    {
      "id": "964156",
      "postDate": "08/09/2020 16:32:40",
      "content": "<p>you need to resize them, all of them to a fixed size.<a href=\"https://www.kaggle.com/zainahmad/preprocessing-the-dicom-data\" target=\"_blank\"> here</a> I have created a notebook which shows how to do it and also saves the processed CTs from the training into an npy format.you can fork it download the output file npy file but remember there are just for training set you need to look at the process in the notebook to process the testing set CTs</p>",
      "rawMarkdown": "you need to resize them, all of them to a fixed size.[ here](https://www.kaggle.com/zainahmad/preprocessing-the-dicom-data) I have created a notebook which shows how to do it and also saves the processed CTs from the training into an npy format.you can fork it download the output file npy file but remember there are just for training set you need to look at the process in the notebook to process the testing set CTs",
      "votes": null
    },
    {
      "id": "965492",
      "postDate": "08/10/2020 17:10:18",
      "content": "<p>Ill check the notebook!</p>",
      "rawMarkdown": "Ill check the notebook!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 964156,
      "author_name": "zainahmad",
      "author_url": "",
      "post_date": "08/09/2020 16:32:40",
      "content": "<p>you need to resize them, all of them to a fixed size.<a href=\"https://www.kaggle.com/zainahmad/preprocessing-the-dicom-data\" target=\"_blank\"> here</a> I have created a notebook which shows how to do it and also saves the processed CTs from the training into an npy format.you can fork it download the output file npy file but remember there are just for training set you need to look at the process in the notebook to process the testing set CTs</p>",
      "votes": null,
      "replies": [
        {
          "id": 965492,
          "author_name": "melvin97n",
          "author_url": "",
          "post_date": "08/10/2020 17:10:18",
          "content": "<p>Ill check the notebook!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 955422,
      "author_name": "jameschapman19",
      "author_url": "",
      "post_date": "08/02/2020 16:16:40",
      "content": "<p>1) pad the stacks of images to the same length in z-axis</p>\n\n<p>2) generate 'candidate' slices/frames for each patient (a lot of that in data science bowl 2017). Perhaps by learning to identify anomalous looking scans with one model and then using that to generate inputs for an fvc prediction model?</p>\n\n<p>3) some kind of loop in the forward pass of the model that loops over all the images for a patient and maybe sums the outputs of the N images so that after the dimensionality is the same?</p>\n\n<p>These are the routes I've been thinking of exploring. I've tried 1) but struggled to get good results so far</p>",
      "votes": null,
      "replies": [
        {
          "id": 955448,
          "author_name": "melvin97n",
          "author_url": "",
          "post_date": "08/02/2020 16:32:27",
          "content": "<p>Really interesting takes. I think 2) looks promising!  Thanks!  I did think of padding but seemed a little problematic considering that it feels like the channels are going to be very unrelated image to image for the NN. I will definitely check them out!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 956711,
          "author_name": "ahmedhshahin",
          "author_url": "",
          "post_date": "08/03/2020 17:52:32",
          "content": "<p>you can also <a href=\"https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize\">resize</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 957688,
          "author_name": "melvin97n",
          "author_url": "",
          "post_date": "08/04/2020 13:48:03",
          "content": "<p>thanks! ill check it out!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 960833,
      "author_name": "nickgm",
      "author_url": "",
      "post_date": "08/06/2020 17:50:41",
      "content": "<p>One way is to fit the images in a 3D object of same size and pixel slicing for all patients</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "955393": "Hey all! I have been trying to work with the image data. Each patient has multiple images in the z direction(multiple varying channels).I was wondering if any of you guys could point me to any example of how we can work withvarying channels in a CNN or am I looking at this all wrong? I am guessing that there is no way to work with varying channels using Keras? Is there any way to resize the stack of images without losing information?",
    "955422": "1) pad the stacks of images to the same length in z-axis\n\n2) generate 'candidate' slices/frames for each patient (a lot of that in data science bowl 2017). Perhaps by learning to identify anomalous looking scans with one model and then using that to generate inputs for an fvc prediction model?\n\n3) some kind of loop in the forward pass of the model that loops over all the images for a patient and maybe sums the outputs of the N images so that after the dimensionality is the same?\n\nThese are the routes I've been thinking of exploring. I've tried 1) but struggled to get good results so far",
    "955448": "Really interesting takes. I think 2) looks promising!  Thanks!  I did think of padding but seemed a little problematic considering that it feels like the channels are going to be very unrelated image to image for the NN. I will definitely check them out!",
    "956711": "you can also [resize](https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize)",
    "957688": "thanks! ill check it out!",
    "960833": "One way is to fit the images in a 3D object of same size and pixel slicing for all patients",
    "964156": "you need to resize them, all of them to a fixed size.[ here](https://www.kaggle.com/zainahmad/preprocessing-the-dicom-data) I have created a notebook which shows how to do it and also saves the processed CTs from the training into an npy format.you can fork it download the output file npy file but remember there are just for training set you need to look at the process in the notebook to process the testing set CTs",
    "965492": "Ill check the notebook!"
  },
  "source": "meta"
}