Image stacking. Generate Sinogram and apply inverse radon transform

37 views (last 30 days)
Hello
I am trying to create sinogram by stacking of parallel images of CT scan projections and apply inverse radon transform to reconstruct the original specimen image.
[ sinogram is a map detecting the projection on the detector of the position of a feature in the sample, as function of angle between the X-Ray beam and the sample]
I obtained 2D radiography at different angles from my experiment ( obtained 36 images. A row was cut from each image to construct the sinogram. ( I am not sure if I have done this correctly) - Need help with this step.
And then I have ton perform inverse radon tansform to the sinogram to get the original image back. Need help with this
% Uploading images from the folder
myPath = 'G:\My Drive\Research-Ph.D\Matlab codes\4.23\20220422_5anglestep_001';
fileNames = dir(fullfile(myPath, '*.tif')); % Assigning the output of dir directly into fileNames
% First, define the cell array to have the right size to store all images in a single collection
C = cell(length(fileNames), 2);
% Now storing each image into a different cell:
for k = 1:length(fileNames)
filename = fileNames(k).name;
C{k, 1} = filename;
C{k, 2} = imread(filename);
end
% sinogram_image
sinogram_image= montage(permute(C, [3,2,1]));
%% NEED HELP WITH SINOGRAM generation
%Creating sinogram - Not sure if this right
%Create an image stack (3-D matrix)
sinogram = cat(36,C{1:36});
%% NEED HELP WITH APPLY iradon FUNCTION
% Apply inverse radon transform
theta=0:180;
I = iradon(sinogram,0:5:180);
figure
imshow(I1,[])
title('Filtered Backprojection')
%[R,rad_angles]=radon(phantom,theta); % as shown in radon help file

Answers (1)

Milan Bansal
Milan Bansal on 27 Dec 2023
Edited: Milan Bansal on 28 Dec 2023
Hi Anand Ra,
It is my understanding that you are facing issues while generating sinogram from the images obtained through 2D radiography. You also want to apply the inverse radon transform to the generated sinogram.
The input to the "montage" function in your code has filenames along with images instead of only having images. To get image cell array, please refer to the code snippet below.
imgCellArray = {C{:,2}}';
sinogram_image = montage(imgCellArray);
Considering that the middle column from each image is required to be concatenatedfor generating the sinogram, please refer to code snippet below.
imgWidth = width(imgCellArray{1});
sinogram = zeros(50, 36);
for i = 1:36
% Extract the middle row from the i-th image in the cell array
imageCol = imgCellArray{i}(:,round(imgWidth/2));
% Assign the extracted row to the i-th row of the concatenated image
sinogram(:, i) = imageCol';
end
Since the sinogram image has 36 Columns, the number of "theta” values in the “iradon” function must be equal to 36. To apply inverse radon transform to the sinogram, please refer to the code snippet below.
% Use "linspace" function to get equally spaced theta values.
theta=linspace(0,180,36);
I = iradon(sinogram, theta);
Please refer to the documentation below to learn more about "montage" function.
Please refer to the documentation below to learn more about "iradon" function.
Please refer to the documentation below to learn more about "linspace" function.
Hope it helps!

Community Treasure Hunt

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

Start Hunting!