questions > DICOM to PNG/JPG/JPEG Conversion for CNN Input
Showing 1-5 of 5 posts
Display:
Results per page:
Dec 20, 2023  09:12 AM | skhans
DICOM to PNG/JPG/JPEG Conversion for CNN Input

How to get images from the DICOM (.dcm) files. I'm using COBRE data that contains numerous .nii and .dcm (DICOM) files, and each DICOM file contains 30 scans of the brain. I want the PNG/JPG of each scan that is 30 images (in PNG/JPG) from a single DICOM file to use as an input for the CNN model. How to get it?

Dec 20, 2023  11:12 AM | Chris Rorden
RE: DICOM to PNG/JPG/JPEG Conversion for CNN Input

This is outside the scope of dcm2niix, which is a DICOM to NIfTI converter. You may also consider training your model directly on NIfTI images, to see an example ask ChatGPT "create a python script that opens a series of NIfTI format images and uses them with deep learning to predict participant age listed in the first column of a tsv format file." In addition, you may want to spatially normalize images prior to training to ensure a similar field of view and orientation.


 


If you want to convert 3D images to PNG or JPG can use a tool like med2image


  https://pypi.org/project/med2image/0.2/


 


Be aware that JPEGs are lossy and that PNG files typically use 32-bit RGBA that only provide 256 levels of gray. Converting 16-bit scalar data common to medical imaging to 8-bit gray will incur loss, and you need to consider the contrast and brightness (window center and window width in medical imaging parlance).

Mar 1, 2024  12:03 PM | skhans
RE: DICOM to PNG/JPG/JPEG Conversion for CNN Input

I've downloaded the COBRE datasets (that contains control AND schizophrenia data only) from Schizoconnect. It is my first time to train model with .nii file. I am confused about how to make a model from .nii dataset. So, can anyone tell me the complete steps from extracting dataset file to predicting schizophrenia? That is, after extracting, I got 90 subjects (of no_known_disorder) and similarily for schizophrenia data, and in each subject there are multiple files, so which one I have to select for training model only .nii or others too?, How to make two folders so that one folder contains only .nii files of schizophrenia and second folder contains only no_known_disorder (i.e. healthy/control files of .nii), now how to preprocess data, how to read and open/display nii files using python script, then how to divide whole data into training and test set and then apply simple CNN model to get predictions that is, whether person is schizophrenic or not? Please help me to solve this issue using python script.

Mar 1, 2024  01:03 PM | skhans
RE: DICOM to PNG/JPG/JPEG Conversion for CNN Input

In addition, you may want to spatially normalize images prior to training to ensure a similar field of view and orientation. How to do this, sir?

Mar 1, 2024  02:03 PM | Chris Rorden
RE: DICOM to PNG/JPG/JPEG Conversion for CNN Input

AFNI, ANTS, FSL, SPM all have popular normalization routines. You can see their respective web pages for more details. I strongly recommend the FSL training course and its included materials.