Segmentation using dicom slices from a folder

3 views (last 30 days)
Dark
Dark on 3 May 2014
Edited: gargoyle on 13 May 2014
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.

Answers (2)

Image Analyst
Image Analyst on 3 May 2014
Put your code to analyze and display the image(s) at the middle of the for loop.
  2 Comments
Image Analyst
Image Analyst on 12 May 2014
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
Image Analyst on 12 May 2014
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().

Sign in to comment.


gargoyle
gargoyle on 13 May 2014
Edited: gargoyle on 13 May 2014
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

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!