MATLAB Answers

Dark
0

Segmentation using dicom slices from a folder

Asked by Dark
on 3 May 2014
Latest activity Edited by 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.

  0 Comments

Sign in to comment.

2 Answers

Answer by 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

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..
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.


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

  0 Comments

Sign in to comment.