0% found this document useful (0 votes)
11 views

Image Reconstruction

The document discusses image reconstruction techniques using Random Transform, Parallel-Beam Filtered Back Projections, and Fan-Beam Filtered Back Projections, detailing MATLAB code implementations for each method. It analyzes the output images and their quality using metrics such as Peak Signal to Noise Ratio (PSNR), Mean Squared Error (MSE), and Signal to Noise Ratio (SNR). The results indicate varying image clarity and quality based on the reconstruction method and parameters used.

Uploaded by

Dishan Otieno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Image Reconstruction

The document discusses image reconstruction techniques using Random Transform, Parallel-Beam Filtered Back Projections, and Fan-Beam Filtered Back Projections, detailing MATLAB code implementations for each method. It analyzes the output images and their quality using metrics such as Peak Signal to Noise Ratio (PSNR), Mean Squared Error (MSE), and Signal to Noise Ratio (SNR). The results indicate varying image clarity and quality based on the reconstruction method and parameters used.

Uploaded by

Dishan Otieno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

IMAGE RECONSTRUCTION USING RANDOM TRANFORM, PARALLEL BEAM AND FAN-BEAN

FILTERED BACK PROJECTIONS.


Question One
Random Transform involves projecting image intensity along a radial line oriented at a specific
angle. The code below represents image reconstruction by using Random Transform.
Code Using Matlab Built in Random Transform Function.
R = radon(I) returns the Radon transform R of 2-D grayscale image I for angles in the range [0,
359] degrees. The Radon transform is the projection of the image intensity along a radial line
oriented at a specific angle.
R = radon(I,theta) returns the Radon transform for the angles specified by theta.
[R,xp] = radon(___) returns a vector xp containing the radial coordinates corresponding to each
row of the image.
% First we make axes visible for the Image Scale
iptsetpref('ImshowAxesVisible','on')

%Read the Image from Local Computer Using Imread Function.


I=imread("Fig0533(a)(circle).tif ")
I(25:75, 25:75) = 1;

% We create the Random Transform function that will help in Image


% Reconstruction.
theta = 0:360;
[R,xp] = radon(I,theta);

%Display The Image on the Axes using imshow function.


imshow(R,[],'Xdata',theta,'Ydata',xp,'InitialMagnification','fit')
xlabel('\theta (degrees)')
ylabel('x''')
colormap(gca,hot), colorbar

Output of Fig0533

Output of Fig0533

The input image (‘Fig0533 (a)(circle)’)


was a circle, using the Random
Transform function, the image has
been reconstructed to the shape
shown on the graph.
The results of the random transform show that the image is transformed using the random transform
function to a rectangular format with radial lines that represent the intensity of the image. The output
image has intensities which represent the distributions of pixels of the original image.

Question Two
Parallel-Beam Filtered Back projections involves use of different angles to reconstruct an image.
Projections are created through line integrals (summations) between two points anywhere
inside and/or outside the image. For a given angle, a projection consists of a vector of parallel
line integrals formed by a source on one side of the image and a line of detectors on the other.
The size of the projection vector is equal to the number of detectors in the array.
Code for image reconstruction.
First, we calculate synthetic projections using parallel-beam geometry and vary the number of
projection angles. For each of these calls to radon, the output is a matrix in which each column
is the Radon transform for one of the angles in the corresponding theta.
Match the parallel rotation-increment, dtheta, in each reconstruction with that used to create
the corresponding synthetic projections.
The three reconstructions (I1, I2, and I3) show the effect of varying the number of angles at
which projections are made. For I1 and I2 some features that were visible in the original
phantom are not clear. Specifically, look at the three ellipses at the bottom of each image. The
result in I3 closely resembles the original image, P.
P=imread("Fig0539(c)(shepp-logan_phantom).tif")

output_size = max(size(P));

dtheta1 = theta1(2) - theta1(1);


I1 = iradon(R1,dtheta1,output_size);

dtheta2 = theta2(2) - theta2(1);


I2 = iradon(R2,dtheta2,output_size);

dtheta3 = theta3(2) - theta3(1);


I3 = iradon(R3,dtheta3,output_size);

figure
montage({I1,I2,I3},'Size',[1 3])
title(['Reconstruction from Parallel Beam Projection ' ...
'with 18, 24, and 90 Projection Angles'])

Output of Fig0539(c)(shepp-logan phantom).tif


Output images
after
reconstruction
has been done
on the
phantom
image
provided.

The use of parallel beam filtered back propagation reconstructs the original image as shown. We can
observe from the output images that the original image has been reconstructed and even its
background color and shape has changed. Some features of the phantom image have been eliminated
by the background, which is an effect of the reconstruction process. The output image does not appear
to be clear as the original image.

Question Three
MATLAB program to implement the image reconstruction using Fan-Bean Filtered Back
projections.
Code
Match the fan-sensor-spacing in each reconstruction with that used to create
each of the synthetic projections.
Changing the value of the 'FanSensorSpacing' effectively changes the
number of sensors used at each rotation angle. For each of these fan-beam
reconstructions, the same rotation angles are used. This is in contrast to the
parallel-beam reconstructions which each used different rotation angles.
Note that 'FanSensorSpacing' is only one parameter of several that you can
control when using fanbeam and ifanbeam. You can also convert back and
forth between parallel- and fan-beam projection data using the
functions fan2para and para2fan

P=phantom(256);
D = 250;
dsensor1 = 2;
F1 = fanbeam(P,D,'FanSensorSpacing',dsensor1);

dsensor2 = 1;
F2 = fanbeam(P,D,'FanSensorSpacing',dsensor2);

dsensor3 = 0.25;
[F3,sensor_pos3,fan_rot_angles3] = fanbeam(P,D, ...
'FanSensorSpacing',dsensor3);

Ifan1 = ifanbeam(F1,D,'FanSensorSpacing',dsensor1, ...


'OutputSize',output_size);
Ifan2 = ifanbeam(F2,D,'FanSensorSpacing',dsensor2, ...
'OutputSize',output_size);
Ifan3 = ifanbeam(F3,D,'FanSensorSpacing',dsensor3, ...
'OutputSize',output_size);

montage({Ifan1,Ifan2,Ifan3},'Size',[1 3])
title(['Reconstruction from Fan Beam Projection with '...
'18, 24, and 90 Projection Angles'])

Output Image

From the analysis above we can observe that the images become clearer the projection angle increases
form 18 degrees to 90 degrees. Fan beam reveals that at higher projection angles the reconstructed
angles will be clearer with clearer sharper edges and high intensity than at lower angles. At lower angles,
the output image appears blurring and affected edges.

Result Analysis
Peak Signal to Noise Ratio (PSNR)
It computes the peak signal-to-noise ration in decibels between two images. The ratio is used to
measure the quality between the original and compressed images. When the ratio is high,
quality of the reconstructed images is better. PSNR measures the peak error.

Mean Squared Error (MSE)


It is a quality measurement tool just like the PSNR. It is used to compare the image compression
quality. Mean Squared Error computes the cumulative squared error between the images. The
lower the value of MSE the lower the error.

Signal to Noise Ratio (SNR)


It is used a regularization parameter to control the sharpness of the restoration result. The
higher the value the sharper the restored image will be. It is computed from Poisson
Distribution formula.

Code for testing the PNR, SNR and MSE on the provided image.
From the code, we read the image from the local computer using ‘imread’ function, the we use
3x3 Matrix Filter to process the image and create a new filtered image using imfilter function.
Lastly, we apply the PNSR, MSE and SNR by calling the functions from Matlab image processing
tool. Output is a matrix that represent the values of the quality of images.
PNR, SNR and MSE for Question 1
%we read the code using imread function. We use Fig0533(a)(circle) as the
%test image.
P=imread("Fig0533(a)(circle).tif")
imshow(P),title("Fig0533 Image");

%3x3 Matrix Filter


se=[1/9,1/9,1/9
1/9,1/9,1/9
1/9,1/9,1/9
];
%Filtering
new_P=imfilter(P,se);
imshow(new_P);

%Peak noise to signal ratio


[peaksnr snr] = psnr(P,new_P);

%MSE Mean Squared Error


mse=immse(P,new_P);

%print the values.


[peaksnr mse snr]

Output

[ 37.1379 12.5686 20.4397]

The code above shows the values MSE (Mean Square Error), SNR (Signal to Noise Ratio), and PSNR (Peak
Signal to Noise Ratio). The three are used to test for reconstructed image qualities.

Peak Signal to Noise Ratio = 37.1379

Mean Square Error = 12.5686

Signal to Noise Ratio = 20.4397

The output values of MSE, SNR and PSNR are small hence it denotes that the output image has desirable
qualities. The input image is not affected to a greater extent during reconstruction.

PNR, SNR and MSE for Question 2


P=imread("Fig0539(c)(shepp-logan_phantom).tif")
imshow(P),title("Fig0539 Image");

%3x3 Matrix Filter


se=[1/9,1/9,1/9
1/9,1/9,1/9
1/9,1/9,1/9
];
%Filtering
new_P=imfilter(P,se);
imshow(new_P);

%PNSR
[peaksnr snr] = psnr(P,new_P);

%MSE
mse=immse(P,new_P);

%SNR
%ssimval = ssim(P,new_P);

%Print
[peaksnr mse snr]

Output

[ 28.1416 99.7518 15.7660]

The code above shows the values MSE (Mean Square Error), SNR (Signal to Noise Ratio), and PSNR (Peak
Signal to Noise Ratio)

Peak Signal to Noise Ratio = 28.1416

Mean Square Error = 99.7518

Signal to Noise Ratio = 15.7660

PNR, SNR and MSE for Question 3


%imread function is used to read the image from the computer. We use
Fig0533(a)(circle) as the
%test image.
P=imread("Fig0533(a)(circle).tif")
imshow(P),title("Fig0533 Image");

%3x3 Matrix Filter for image processing.


se=[1/5,1/5,1/5
1/5,1/5,1/5
1/5,1/5,1/5
];
%Filtering the new image.
new_P3=imfilter(P,se);
imshow(new_P3);

%PNSR
[peaksnr snr] = psnr(P,new_P3);

%MSE
mse=immse(P,new_P);

%print the outputs of pnsr, mse and snr


[peaksnr mse snr]

Output

[35.0771 12.5686 18.5206]

The code above shows the values MSE (Mean Square Error), SNR (Signal to Noise Ratio), and PSNR (Peak
Signal to Noise Ratio) for the fan-beam filtered back projection. The values are small indicating the
output image is not affected to a great extent in-terms of qualities during reconstruction. The MSE
appears to show good results indicating that the quality of the reconstructed image after compression
has high quality.

Peak Signal to Noise Ratio = 35.0771

Mean Square Error = 12.5686

Signal to Noise Ratio = 18.5206

Conclusion
PSNR, MSE, and SNR are used to measure the quality between two images. From the results shown
above during analysis, the value of PSNR (28.1416) is higher which shows that the constructed image has
a reduced peak error. Mean Squared Error is (99.7518 %). The value is close to 100%, the value is higher
which shows that the compression affected the quality of output image. SNR value is (15.7660) which is
used to calculate the sharpness of the image. The restored images appear to be sharp as compared to
the original image. The three quality measurement parameters are important as they help to determine
the quality of the output image. From their results, necessary adjustments can be made to the
computation to get the desired output image quality.

You might also like