How to read CT sequence images and process them

3 views (last 30 days)
XF
XF on 14 Apr 2019
Answered: Stan Hopkins on 23 Jan 2020
Hi, I am new in matlab, and I have about 200 CT slices ,name as 1.tif,2.tif...600.tif in a folder (C:\Users\Documents\matlab\CT images). I want to imread them and process them by for loop,for example binarize and segment them, what I should do? Could you please give me a code for reference, thank you very much!
  4 Comments
XF
XF on 14 Apr 2019
@Image Analyst Hi, thank you much for your explanation! You mean I just imread and binarize the particular slice? Actually, I have 200 images in the same folder, name as 1.tif, 2.tif, 3.tif...200.tif, and they are all grayImage already. I want to imbinarize all of them, could you please tell what should I do ? This the code I use:
myFolder = 'C:\Users\XF\Documents\CT images';
filePattern = fullfile(myFolder, '*.tif);
theFiles = dir(filePattern);
for k = 1 :200
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
image = imread(fullFileName);
imageBw=imbinarize(image)
end
Image Analyst
Image Analyst on 14 Apr 2019
That looks about right, but don't use image as the name of your variable since that's already the name of a built-in function. Call it thisImage or something.
You may also want to do
for k = 1 : length(theFiles)
if you want to process every file in the list. Right now you process 200 so if the number is less, you'll get an error and if the number is more than 200, you'll only process the first 200.
Also isn't there anything you want to do with the binary image? Right now you just create it and then ignore it.

Sign in to comment.

Answers (1)

Stan Hopkins
Stan Hopkins on 23 Jan 2020
I have a similar problem with dental ct scans that produced .pvt files. Can Mat Lab read them and produce pictures?
Thanks,
Stan Hopkins

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!