0% found this document useful (0 votes)
7 views6 pages

Mip

The document outlines a series of laboratory exercises involving image processing techniques on DICOM images, including edge detection using Prewitt and Canny methods, and the creation and reconstruction of head phantom images. It also covers the computation of fan-beam and parallel-beam projections, as well as image registration techniques. Each section includes code snippets for loading images, applying transformations, and displaying results for analysis and observation.

Uploaded by

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

Mip

The document outlines a series of laboratory exercises involving image processing techniques on DICOM images, including edge detection using Prewitt and Canny methods, and the creation and reconstruction of head phantom images. It also covers the computation of fan-beam and parallel-beam projections, as well as image registration techniques. Each section includes code snippets for loading images, applying transformations, and displaying results for analysis and observation.

Uploaded by

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

Lab 7

Apply both Prewitt and Canny edge detectors on a DICOM image separately and display
transform images of both for comparison. Analyze these transform images and explain
both in the report. Reconstruct and display the edge detected images, and write your
observations.

% Load the DICOM image


dicomFile = 'your_image.dcm'; % Replace with your DICOM file
dicomImage = dicomread(dicomFile);

% Display the original image


figure;
imshow(dicomImage, []);
title('Original DICOM Image');

% Convert the image to grayscale (if necessary)


grayImage = mat2gray(dicomImage); % Normalize intensity to [0, 1]

% Apply Prewitt edge detection


prewittEdges = edge(grayImage, 'prewitt');

% Display the Prewitt edge-detected image


figure;
imshow(prewittEdges);
title('Prewitt Edge Detection');

% Apply Canny edge detection


cannyEdges = edge(grayImage, 'canny');

% Display the Canny edge-detected image


figure;
imshow(cannyEdges);
title('Canny Edge Detection');

% Display side-by-side comparison


figure;
subplot(1, 3, 1);
imshow(dicomImage, []);
title('Original Image');

subplot(1, 3, 2);
imshow(prewittEdges);
title('Prewitt Edge Detection');

subplot(1, 3, 3);
imshow(cannyEdges);
title('Canny Edge Detection');

% Reconstruct and combine edge-detected images


reconstructedImagePrewitt = imoverlay(grayImage, prewittEdges, [1, 0, 0]); % Overlay edges in
red
reconstructedImageCanny = imoverlay(grayImage, cannyEdges, [0, 1, 0]); % Overlay edges in
green

% Display reconstructed images


figure;
subplot(1, 2, 1);
imshow(reconstructedImagePrewitt);
title('Reconstructed Image (Prewitt)');

subplot(1, 2, 2);
imshow(reconstructedImageCanny);
title('Reconstructed Image (Canny)');
Create Head Phantom image.Compute the parallel-beam projection data of the phantom
image for two different sets of theta values.Reconstruct and display the head phantom
image, and write your observations.
% Create a head phantom image
headPhantom = phantom('Modified Shepp-Logan', 256);

% Display the phantom image


figure;
imshow(headPhantom, []);
title('Head Phantom Image');

% Define two different sets of theta values


theta1 = 0:1:179; % Set 1: 0 to 179 degrees in steps of 1 degree
theta2 = 0:5:179; % Set 2: 0 to 179 degrees in steps of 5 degrees

% Compute the parallel-beam projection data for both theta sets


projData1 = radon(headPhantom, theta1);
projData2 = radon(headPhantom, theta2);

% Display the projection data for both sets


figure;
subplot(1, 2, 1);
imshow(projData1, []);
title('Projection Data (Theta 0-179, Step 1)');

subplot(1, 2, 2);
imshow(projData2, []);
title('Projection Data (Theta 0-179, Step 5)');

% Reconstruct the image from the projection data for the first set of theta
reconstructedImage1 = iradon(projData1, theta1);

% Reconstruct the image from the projection data for the second set of theta
reconstructedImage2 = iradon(projData2, theta2);

% Display the reconstructed images


figure;
subplot(1, 2, 1);
imshow(reconstructedImage1, []);
title('Reconstructed Image (Theta 0-179, Step 1)');
subplot(1, 2, 2);
imshow(reconstructedImage2, []);
title('Reconstructed Image (Theta 0-179, Step 5)');
Lab 8
clc; clear;
close all
DicomImage = dicomread('000001.dcm');
subplot(3,3,2);
imshow(DicomImage);
title(DICOM Image)
% Computing fan-beam projections
D = 250;
[F Fpos Fangles] = fanbeam(p, D, 'FanSensorGeometry', 'arc', 'FanSensorSpacing', 2,
'FanRotationIncrement', 1);
subplot(3,3,4);
imagesc(Fangles,Fpos,F)
xlabel('Rotation Angles (degrees)');
ylabel('Sensor Positions (degrees)')
title('Fan-beam Projections when Fan Sensor Spacing = 2')
I = ifanbeam(F, D, 'FanSensorGeometry', 'arc', 'FanSensorSpacing', 2,
'FanRotationIncrement', 1);
subplot(3,3,7); imshow(I); title('Reconstructed Image when Fan Sensor Spacing = 2')

Lab9
Compute fan-beam projection data of a DICOM image.
Convert it to parallel-beam projection data.
Reconstruct the DICOM image from both of these projection data separately.

clc;
clear;
close all
% Test Image
DicomImage = dicomread('000001.dcm');
subplot(4,1,1);
imshow(DicomImage);
title(DICOM Image)

% Computing Radon Transform


theta = 0:179;
[R xp] = radon(DicomImage,theta);
subplot(4,1,2);
imagesc(theta,xp,R);
title('Parallel-beam Projections')
% Converting parallel-beam projections to fan-beam projections
D = 250;
[F Fpos Fangles] =
para2fan(R,D,'FanSensorGeometry','arc','FanSensorSpacing',0.1,'FanRotationIncrement',
1);
subplot(4,1,3);
imagesc(Fangles,Fpos,F); title('Fan-beam Projections')
I=ifanbeam(F,D,'FanSensorGeometry','arc','FanSensorSpacing',0.1,'FanRotationIncrement',
1);
subplot(4,1,4); imshow(I); title('Reconstructed Image')

Lab 11
clc
clear
close all

fixed = imread('dicomknee1.jfif');
subplot(2,2,1)
imshow(fixed)
title('Fixed Image')

moving = imread('dicomknee2.jfif');
subplot(2,2,2)
imshow(moving)
title('Moving Image')

subplot(2,2,3);
imshowpair(fixed,moving,'blend');
title('Paired Image')

[a b]=cpselect(moving,fixed,'Wait',true)
t = fitgeotrans(a,b,'projective');
fixedview = imref2d(size(fixed));
registered = imwarp(moving,t,'Outputview',fixedview);

subplot(2,2,4);
imshowpair(fixed,registered,'blend');
title('Registered Image')

You might also like