How to command the Gradient Weight
2 views (last 30 days)
Show older comments
Hi All, I've 83 frame image dicom. I try do the gradient weight segmentation.
But why only just one frame appear (as image attached)?
I Supposely the function imshow3D will show all the 83 frame as well.
Anyone can help me?
% Get a list of all files in the folder with the desired file name pattern.
myFolder = ('C:\Users\Akmal\Downloads\IQ NEMA GA68 51 (1)\2020-12__Studies\IQ NEMA GA68 5.1_IQ NEMA GA68 5.1_PT_2020-12-02_114711_SPINE_PET.PELVIS.DYN.Q600_n83__00000');
filePattern = fullfile(myFolder, '*.dcm'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for L = 1 : length(theFiles)
baseFileName = theFiles(L).name;
fullFileName = fullfile(theFiles(L).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
RZ(:,:,L) = dicomread(fullFileName);
end
sigma = 1.5;
W = gradientweight(RZ(:,:,L), sigma, 'RolloffFactor', 0.01, 'WeightCutoff', 1);
R = 149; C = 138;
hold on;
plot(C, R, 'r.', 'LineWidth', 1.5, 'MarkerSize',15);
title('Original Image with Seed Location')
thresh = 0.009;
[BW, D] = imsegfmm(W, C, R, thresh);
figure, imshow3D(BW)
title('Segmented Image')
hold on;
plot(C, R, 'r.', 'LineWidth', 1.5, 'MarkerSize',15);
0 Comments
Answers (1)
Abhinaya Kennedy
on 15 May 2024
Hi Akmal,
The reason why only one frame appears when using "imshow3D" to visualize the 83-frame DICOM image is likely because "imshow3D" is designed for 3D volumetric data, but you're using it to visualize a stack of 2D slices.
To visualize all 83 slices, you can use a for loop to iterate over each slice and display it using "imshow". Alternatively, you can use a "movie" function to create an animation that plays through all the slices.
Here are some resources you can look into:
0 Comments
See Also
Categories
Find more on Basic Display 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!