Dicom image, convert to right format from cell type
Show older comments
Hi, I'm tying to plot some dicom images, but I have trouble with the converting part, when operating with cells.
Below is the start of the function, to get a better overview
cla(app.axes_T2)
a = [app.sortedS.SliceLocation]; % a parameter for the Dicom images
b = app.dd_SliceLocation.Value; % dropdown box where the sliceLocation parameter can be choosed
b2 = str2double(b);
for ii = 1:length(a)
LIA(ii) = ismembertol(b2,a(ii),0.05); % finding the index where the Sliceparameter from the drop down box is
% equal the sliceLocation values in the Dicom folder
end
If I just show the images, corresponding to the LIA index, they will all be gray. Therfore I need to convert them to double and after that, the ImageT/max(ImageT(:)), as seen below:
imageT = [app.sortedS(LIA).Image]; %struct of all the images
imageT = double(imageT);
imageT = imageT./max(imageT(:));
But the above is not working rigth as the struct collects alle the 16 images in one image, instead of showing one image at the time.
Therfore I made a cell (see below) which contains the correct 16 dicom images, having the int format.
But having the cell format, I do not know how to convert the image to double and perform the './max'-code.
I tried the code written below, but the sentence with the double just returns imageT with 16 cell having naN in them, and the line with './max' gives this message: "Undefined function 'rdivide' for input arguments of type 'cell'."
imageT = {app.sortedS(LIA).Image};
imageT = {(str2double(imageT(:)))};
imageT = {(imageT./max(imageT{:}))};
imshow(imageT{1},'Parent',app.axes_T2);
I hope you can help me, thanks!
Answers (0)
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!