I want to carry out transfer learning using AlexNet for a set of 128x128 DICOM images. It looks like on of the most efficient methods of storing and labeling images is using imageDatastore, however I don't think this supports DICOM formats, I can create the store with no errors using: images = imageDatastore(fullfile(pwd,'Project_Segmentations'),... 'IncludeSubfolders',true,'FileExtensions','.dcm',... 'LabelSource','foldernames'); This correctly labels the DICOMs based on the name of the folder they are in, however, when I try to use this data for training I'm met with the error: Error using matlab.io.datastore.ImageDatastore/readimage (line 32) Error using ReadFcn @readDatastoreImage function handle for file Which makes sense given imread doesn't support DICOM images. Ideally I want to keep the DICOM file format, is there anyway I can achieve this data labeling for DICOM images? Many Thanks.
Neeta Dsouza answered .
2025-11-20
for k = 1 : numImages
thisImage = dicomread(....
outputFileName = strrep(lower(inputFileName), '.dcm', '.webp');
imwrite(thisImage, outputFileName);
end