Segmentation using dicom slices from a folder
4 次查看(过去 30 天)
显示 更早的评论
I have around 500 CT dicom slices of a bone in a folder. I need to load all these dicom slices from the folder into Matlab, apply some filter and do segmentation and then visualize the result. Is there any tool or code in matlab that can do this ? Awaiting your suggestion.
0 个评论
回答(2 个)
Image Analyst
2014-5-3
Put your code to analyze and display the image(s) at the middle of the for loop.
2 个评论
Image Analyst
2014-5-12
Dark's "Answer" moved here:
Dear Image Analyst,
Thank you for the answer. I also saw that you have helped a lot of newbies like me and hence I thought of asking your help. I find it quite interesting that there is no such example in File exchange which does segmentation with a series of dicom files. Am I missing something ?
Thanks..
Image Analyst
2014-5-12
Dark, I don't use dicom images. If it's a multi frame file, isn't there some way to find out how many slice/frames are in that file? If so just do something like the faq but instead of building a filename and calling imread(), just call dicomread().
gargoyle
2014-5-13
编辑:gargoyle
2014-5-13
I use the following code to access images 2 folders deep. i.e. Y:\Data\image_folder\img.tiff i pasted the excess code so that you can also iterate across multiple folders. If you don't need to use multiple folders remove the outer for loop and define root as the folder with images
root_root='Y:\Data\'; %path to multiple folders containing images. This same %code can be run across folders
fold_list=dir(root_root); %this will list all folders and store names in fold_list
for fold_count=3:size(fold_list,1)%3 is on windows system linux/mac might need %1,2,or 4
root=[root_root fold_list(fold_count).name '\']; %adds folder name to path
file_list=dir([root '*.tiff']); %HERE THE .tiff CAN BE REPLACED WITH ANY %FILE EXTENSION
for img_count=1:num_series
file_path=[root, file_list(img_count).name]; %access particular filename in series
in_img =imread(file_path);
%RUN CODE
end
end
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!