imageDatastore for volumetric images
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to use the imageDatastore command to prepare the training set for training a volumetric convolutional neural network-based semantic segmentation model. I followed the instructions given on the MATLAB webpage below and provided my code with multilayered Tif files representing the input images and the labled input images (ground truth).
However, it seems imageDatastore just reads one of the layers (slices) and cannot process the volumetric images. Does anyone know how we should use this command for the volumetric image segmentation tasks? Or how can we prepare the training set for training a volumetric sementic segmentation model such as Unet 3D (https://www.mathworks.com/help/vision/ref/unet3dlayers.html)? Many thanks in advance.
2 commentaires
NAVNEET NAYAN
le 6 Fév 2023
Can you please provide the details of the images like how did you save these images and also about the lines of code that you are having a problem?
Réponse acceptée
Ashish Uthama
le 7 Fév 2023
Déplacé(e) : Ashish Uthama
le 8 Fév 2023
blockedImage cannot convert the slices to a volumetric block on its own unfortunately! blockedImage is useful when you want to break one 'unit' into multiple logical sub-units (i.e one file into many constituting blocks). So its not useful for your workflow at this moment (especially, since it looks like your 'unit' of data will easily fit in memory).
Does this help?
You would replace the first argument of the constructors for imageDatastore and pixellabelDatastore with the list of files you have, their order ought to match to ensure images and labels are paired correctly!.
% Image data
im = uint8(magic(10));
imwrite(im,'vol.tif')
imwrite(im,'vol.tif','WriteMode','append')
imds = imageDatastore(["vol.tif"],'ReadFcn',@tiffreadVolume);
v = read(imds);
size(v)
% ans =
% 10 10 2
% Label data
labels = im>50;
imwrite(labels,'labels.tif')
imwrite(labels,'labels.tif','WriteMode','append')
lds = pixelLabelDatastore(["labels.tif"],["bg", "fg"], [0 1], 'ReadFcn',@tiffreadVolume);
% Combined data, where one read gives a data,label set:
cds = combine(imds, lds);
d = read(cds)
% d{1} will be image, d{2} will be corresponding labels.
2 commentaires
Plus de réponses (1)
Aylin
le 6 Fév 2023
Hi Memo,
The blockedImage object (in Image Processing Toolbox) has documentation that mentions volumes within images:
A blockedImage object is an image made from discrete blocks. Use blocked images when an image or volume is too large to fit into memory. With a blocked image, you can perform processing without running out of memory.
There is an associated datastore which can be used to work with blockedImage called blockedImageDatastore.
Here is a list of examples which use blockedImageDatastore: https://www.mathworks.com/help/images/examples.html?category=large-image-files .
I hope this helps!
Rylan
4 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!