How to read CT sequence images and process them

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 commentaires

In the middle of the loop, read the grayscale image from 1.tif or whatever the file name is. You'll have a single uint16 gray scale image.
Then binarize it by thresholding in some way, and then you'll have the logical binary image.
The grayImage is one variable (uint16), and the binaryImage is the other image variable (logical).
You don't have one or the other tif -- both those images came from a single tif, which is the tif for that particular slice.
XF
XF le 14 Avr 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
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.

Connectez-vous pour commenter.

Réponses (1)

Stan Hopkins
Stan Hopkins le 23 Jan 2020

0 votes

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

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by