SlideShare a Scribd company logo
1 of 9
Download to read offline
1
Table of Contents
........................................................................................................................................ 1
clear workspace .................................................................................................................. 1
question 2:Load MRI dicom files ........................................................................................... 1
Question 2: Generate Montage .............................................................................................. 2
Question 3:Anatomically organized order from top to bottom ..................................................... 2
Question 4: ITF of sorted MRI slices ..................................................................................... 3
Question 4 & 5:Segmenting the brain tissue ............................................................................ 4
Question 6:Contrast map the healthy and diseased brain region ................................................... 5
Question 7:Contour plotting .................................................................................................. 6
Question 9:3-D plot ............................................................................................................. 8
% Anuhya Reddy & Vishal Kandagatla
% Image Processing with MATLAB:applications in Medicine Project
% Final Take Home Project
clear workspace
clc;
clear all;
close all;
question 2:Load MRI dicom files
mri=zeros(256,256,56);
for i=0:55
if i>9
imgrd=['0000' num2str(i) '.dcm'];%num2str used to convert to string format
else
imgrd=['00000' num2str(i) '.dcm'];
end
%saving all the read dicom files into mri matrix
mri(:,:,i+1)=uint8(dicomread(imgrd));
%extracting the information of MRI slices using dicominfo
info = dicominfo(imgrd);
%slice location of each MRI slice
slice_loc(i+1) = info.SliceLocation;
%slice thickness of each MRI slice
slice_thk(i+1) = info.SliceThickness;
%saving the filenames of each and every MRI slice in the variable...
%image_Slice_name
2
image_slice_name(i+1,:) = imgrd;
vox_size=[info.PixelSpacing; info.SliceThickness]';
end
Question 2: Generate Montage
figure(1)
montage(reshape(uint8(mri),[size(mri,1),size(mri,2),1,size(mri,3)]));
title('Brain MRI slices');
Warning: Image is too big to fit on screen; displaying at 33%
Question 3:Anatomically organized order from
top to bottom
%sorting the slice thicknesses of the MRI slices
sort_slice_loc = sort(slice_loc,'descend');
for i = 1: length(sort_slice_loc)
for j = 1: length(slice_loc)
if sort_slice_loc(i) == slice_loc(j)
3
sorted_mri(:,:,i) = uint16(dicomread(image_slice_name(j,:)));
end
end
end
%plotting the top to bottom ordered MRI slices
figure(2)
montage(reshape(uint8(sorted_mri),[size(sorted_mri,1),size(sorted_mri,2),1,size(sor
title('Anatomically organized brain MRI slices');
Warning: Image is too big to fit on screen; displaying at 33%
Question 4: ITF of sorted MRI slices
for i=1:56
sorted_trans = itf_img(sorted_mri(:,:,i));
trans_sort(:,:,i)=sorted_trans;
end
figure(3)
montage(reshape(uint8(trans_sort),[size(trans_sort,1),size(trans_sort,2),1,size(tra
title('ITF of sorted MRI slices');
Warning: Image is too big to fit on screen; displaying at 33%
4
Question 4 & 5:Segmenting the brain tissue
figure(4)
colormap jet(100)
%performing intensity transform function
%Using itf_img.m function program to execute intensity transform function
%for i=1:56
selected_img = itf_img(sorted_mri(:,:,25));
subplot(2,2,1)
image(selected_img)
title('intensity transformed MRI slice')
%Using Region_grow.m function program for segmentation
%Segmented brain with skull and scalp eliminated
subplot(2,2,2)
segmented=region_grow(152,173,selected_img);
image(segmented)
title('segmented brain with skull & scalp removed')
%Using Region_grow.m function program for segmentation
%Segmenting the brain(isolating normal tissue)
subplot(2,2,3)
tum_segmented=region_grow(96,197,selected_img);
5
image(tum_segmented)
title('segmented brain with tumor')
%merging normal and damaged tissues together
subplot(2,2,4)
colormap jet(100)
tot_segmented=segmented + tum_segmented;
image(tot_segmented)
title('merging normal and damaged tissues')
Question 6:Contrast map the healthy and dis-
eased brain region
%Contrasting damaged and normal tissues of the brain using imcontrast
b=imshow(tot_segmented)
title('MRI slice with max tumor exposure with segmentation')
colormap jet
imcontrast(b)
b =
720.0032
6
Question 7:Contour plotting
figure(5)
%creates contour plot of the image data
contourf(flipdim(tot_segmented,1))
title('contour plot of MRI slice')
7
% flipdim is used for altering dimensions
%contour plotting in volume slice planes
image_num=25;
cm=brighten(jet(100),-0.8);
figure('Colormap',cm)
contourslice(flipdim((sorted_mri),1),[],[],image_num)
title('contour plotting of MRI slice')
8
Question 9:3-D plot
%selecting the MRI slices which have the tumor
%performing intensity transform function for those slices
for range=14:30
selected_img = itf_img(sorted_mri(:,:,range));
selected_set(:,:,range)=selected_img;
end
%down sampling
ds=selected_set;
ds=flipdim(ds,1);
%ds=flipdim(ds,2);
%rearranges the dimensions of 'ds' so that they are in the order specified by
%the vector order
ds=permute(ds,[3 2 1]);
vox_size2=vox_size([1 3 2]).*[4 1 4];
%isosurfce obtains similar isosurfce values from volume data ds
tissue=isosurface(ds,109);
tumor=isosurface(ds,150);
h=figure('visible','off','outerposition',[0 0 800 600]);
title('3D view of selected slices')
patch(tissue,'FaceColor','b','EdgeColor','none');
patch(tumor,'FaceColor','r','EdgeColor','none','FaceAlpha',0.5);
9
view(45,15);
daspect(1./vox_size2);
axis tight;
axis off;
camlight;
camlight(-80,-10);
lighting phong;
movegui(h,'center');
set(h,'visible','on');
Published with MATLAB® R2014a

More Related Content

Viewers also liked

Okay Connect- Connect, Collaborate and Reach out
Okay Connect- Connect, Collaborate and Reach outOkay Connect- Connect, Collaborate and Reach out
Okay Connect- Connect, Collaborate and Reach outmeenaz123
 
decade_of_action_exec_summary_en
decade_of_action_exec_summary_endecade_of_action_exec_summary_en
decade_of_action_exec_summary_enMariola Esquivel
 
Abirami balasubramanian financial analyst
Abirami balasubramanian financial analystAbirami balasubramanian financial analyst
Abirami balasubramanian financial analystAbirami Balasubramanian
 
Skoda Vision S Concept SUV - Press Release
Skoda Vision S Concept SUV - Press ReleaseSkoda Vision S Concept SUV - Press Release
Skoda Vision S Concept SUV - Press ReleaseRushLane
 
Latency aware write buffer resource
Latency aware write buffer resourceLatency aware write buffer resource
Latency aware write buffer resourceijdpsjournal
 
CuongNguyen PortfolioSamples
CuongNguyen PortfolioSamplesCuongNguyen PortfolioSamples
CuongNguyen PortfolioSamplescuong nguyen
 
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!HOW TO ANSWER COMMON INTERVIEW QUESTIONS!
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!seekcareerz
 
Cómo instalar una estufa de pellets
Cómo instalar una estufa de pelletsCómo instalar una estufa de pellets
Cómo instalar una estufa de pelletsCalefaccionyaire.com
 

Viewers also liked (11)

Okay Connect- Connect, Collaborate and Reach out
Okay Connect- Connect, Collaborate and Reach outOkay Connect- Connect, Collaborate and Reach out
Okay Connect- Connect, Collaborate and Reach out
 
decade_of_action_exec_summary_en
decade_of_action_exec_summary_endecade_of_action_exec_summary_en
decade_of_action_exec_summary_en
 
Abirami balasubramanian financial analyst
Abirami balasubramanian financial analystAbirami balasubramanian financial analyst
Abirami balasubramanian financial analyst
 
Munawarfarooq
MunawarfarooqMunawarfarooq
Munawarfarooq
 
Skoda Vision S Concept SUV - Press Release
Skoda Vision S Concept SUV - Press ReleaseSkoda Vision S Concept SUV - Press Release
Skoda Vision S Concept SUV - Press Release
 
45L Tax Credit PowerPoint Show 2016
45L Tax Credit PowerPoint Show 201645L Tax Credit PowerPoint Show 2016
45L Tax Credit PowerPoint Show 2016
 
Latency aware write buffer resource
Latency aware write buffer resourceLatency aware write buffer resource
Latency aware write buffer resource
 
CuongNguyen PortfolioSamples
CuongNguyen PortfolioSamplesCuongNguyen PortfolioSamples
CuongNguyen PortfolioSamples
 
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!HOW TO ANSWER COMMON INTERVIEW QUESTIONS!
HOW TO ANSWER COMMON INTERVIEW QUESTIONS!
 
Cómo instalar una estufa de pellets
Cómo instalar una estufa de pelletsCómo instalar una estufa de pellets
Cómo instalar una estufa de pellets
 
2016APC-Group_eng
2016APC-Group_eng2016APC-Group_eng
2016APC-Group_eng
 

Similar to Brain MRI Image Analysis

Lab04_Signals_Systems.pdf
Lab04_Signals_Systems.pdfLab04_Signals_Systems.pdf
Lab04_Signals_Systems.pdfSVora2
 
report.doc
report.docreport.doc
report.docbutest
 
Emona tims-analog-communication-part1 2
Emona tims-analog-communication-part1 2Emona tims-analog-communication-part1 2
Emona tims-analog-communication-part1 2Subhajit Sahu
 
Neural Networks on Steroids
Neural Networks on SteroidsNeural Networks on Steroids
Neural Networks on SteroidsAdam Blevins
 
95763406 atoll-3-1-0-user-manual-lte
95763406 atoll-3-1-0-user-manual-lte95763406 atoll-3-1-0-user-manual-lte
95763406 atoll-3-1-0-user-manual-ltearif budiman
 
AlexLu_WorkSamples
AlexLu_WorkSamplesAlexLu_WorkSamples
AlexLu_WorkSamplesAlex Lu
 
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1superottos
 
A Real Time Application Integration Solution
A Real Time Application Integration SolutionA Real Time Application Integration Solution
A Real Time Application Integration SolutionMatthew Pulis
 
Climb - A Generic and Dynamic Approach to Image Processing
Climb - A Generic and Dynamic Approach to Image ProcessingClimb - A Generic and Dynamic Approach to Image Processing
Climb - A Generic and Dynamic Approach to Image ProcessingChristopher Chedeau
 
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdfPython_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdfjankoabel2022
 
Modlica an introduction by Arun Umrao
Modlica an introduction by Arun UmraoModlica an introduction by Arun Umrao
Modlica an introduction by Arun Umraossuserd6b1fd
 
Modelica programming help book
Modelica programming help bookModelica programming help book
Modelica programming help bookArun Umrao
 
StresStimulus Load Testing Tool User Guide
StresStimulus Load Testing Tool User GuideStresStimulus Load Testing Tool User Guide
StresStimulus Load Testing Tool User Guidestresstimulus
 

Similar to Brain MRI Image Analysis (20)

Lab04_Signals_Systems.pdf
Lab04_Signals_Systems.pdfLab04_Signals_Systems.pdf
Lab04_Signals_Systems.pdf
 
report.doc
report.docreport.doc
report.doc
 
Neural networks and deep learning
Neural networks and deep learningNeural networks and deep learning
Neural networks and deep learning
 
Emona tims-analog-communication-part1 2
Emona tims-analog-communication-part1 2Emona tims-analog-communication-part1 2
Emona tims-analog-communication-part1 2
 
Mi ps
Mi psMi ps
Mi ps
 
Neural Networks on Steroids
Neural Networks on SteroidsNeural Networks on Steroids
Neural Networks on Steroids
 
95763406 atoll-3-1-0-user-manual-lte
95763406 atoll-3-1-0-user-manual-lte95763406 atoll-3-1-0-user-manual-lte
95763406 atoll-3-1-0-user-manual-lte
 
AlexLu_WorkSamples
AlexLu_WorkSamplesAlexLu_WorkSamples
AlexLu_WorkSamples
 
The maxima book
The maxima bookThe maxima book
The maxima book
 
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1
Owandy i-max-touch-2 d-pan-ceph-user-manual-rev1
 
document
documentdocument
document
 
A Real Time Application Integration Solution
A Real Time Application Integration SolutionA Real Time Application Integration Solution
A Real Time Application Integration Solution
 
Sona project
Sona projectSona project
Sona project
 
Climb - A Generic and Dynamic Approach to Image Processing
Climb - A Generic and Dynamic Approach to Image ProcessingClimb - A Generic and Dynamic Approach to Image Processing
Climb - A Generic and Dynamic Approach to Image Processing
 
Jmetal4.5.user manual
Jmetal4.5.user manualJmetal4.5.user manual
Jmetal4.5.user manual
 
PPG_FSK.pdf
PPG_FSK.pdfPPG_FSK.pdf
PPG_FSK.pdf
 
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdfPython_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
 
Modlica an introduction by Arun Umrao
Modlica an introduction by Arun UmraoModlica an introduction by Arun Umrao
Modlica an introduction by Arun Umrao
 
Modelica programming help book
Modelica programming help bookModelica programming help book
Modelica programming help book
 
StresStimulus Load Testing Tool User Guide
StresStimulus Load Testing Tool User GuideStresStimulus Load Testing Tool User Guide
StresStimulus Load Testing Tool User Guide
 

Brain MRI Image Analysis

  • 1. 1 Table of Contents ........................................................................................................................................ 1 clear workspace .................................................................................................................. 1 question 2:Load MRI dicom files ........................................................................................... 1 Question 2: Generate Montage .............................................................................................. 2 Question 3:Anatomically organized order from top to bottom ..................................................... 2 Question 4: ITF of sorted MRI slices ..................................................................................... 3 Question 4 & 5:Segmenting the brain tissue ............................................................................ 4 Question 6:Contrast map the healthy and diseased brain region ................................................... 5 Question 7:Contour plotting .................................................................................................. 6 Question 9:3-D plot ............................................................................................................. 8 % Anuhya Reddy & Vishal Kandagatla % Image Processing with MATLAB:applications in Medicine Project % Final Take Home Project clear workspace clc; clear all; close all; question 2:Load MRI dicom files mri=zeros(256,256,56); for i=0:55 if i>9 imgrd=['0000' num2str(i) '.dcm'];%num2str used to convert to string format else imgrd=['00000' num2str(i) '.dcm']; end %saving all the read dicom files into mri matrix mri(:,:,i+1)=uint8(dicomread(imgrd)); %extracting the information of MRI slices using dicominfo info = dicominfo(imgrd); %slice location of each MRI slice slice_loc(i+1) = info.SliceLocation; %slice thickness of each MRI slice slice_thk(i+1) = info.SliceThickness; %saving the filenames of each and every MRI slice in the variable... %image_Slice_name
  • 2. 2 image_slice_name(i+1,:) = imgrd; vox_size=[info.PixelSpacing; info.SliceThickness]'; end Question 2: Generate Montage figure(1) montage(reshape(uint8(mri),[size(mri,1),size(mri,2),1,size(mri,3)])); title('Brain MRI slices'); Warning: Image is too big to fit on screen; displaying at 33% Question 3:Anatomically organized order from top to bottom %sorting the slice thicknesses of the MRI slices sort_slice_loc = sort(slice_loc,'descend'); for i = 1: length(sort_slice_loc) for j = 1: length(slice_loc) if sort_slice_loc(i) == slice_loc(j)
  • 3. 3 sorted_mri(:,:,i) = uint16(dicomread(image_slice_name(j,:))); end end end %plotting the top to bottom ordered MRI slices figure(2) montage(reshape(uint8(sorted_mri),[size(sorted_mri,1),size(sorted_mri,2),1,size(sor title('Anatomically organized brain MRI slices'); Warning: Image is too big to fit on screen; displaying at 33% Question 4: ITF of sorted MRI slices for i=1:56 sorted_trans = itf_img(sorted_mri(:,:,i)); trans_sort(:,:,i)=sorted_trans; end figure(3) montage(reshape(uint8(trans_sort),[size(trans_sort,1),size(trans_sort,2),1,size(tra title('ITF of sorted MRI slices'); Warning: Image is too big to fit on screen; displaying at 33%
  • 4. 4 Question 4 & 5:Segmenting the brain tissue figure(4) colormap jet(100) %performing intensity transform function %Using itf_img.m function program to execute intensity transform function %for i=1:56 selected_img = itf_img(sorted_mri(:,:,25)); subplot(2,2,1) image(selected_img) title('intensity transformed MRI slice') %Using Region_grow.m function program for segmentation %Segmented brain with skull and scalp eliminated subplot(2,2,2) segmented=region_grow(152,173,selected_img); image(segmented) title('segmented brain with skull & scalp removed') %Using Region_grow.m function program for segmentation %Segmenting the brain(isolating normal tissue) subplot(2,2,3) tum_segmented=region_grow(96,197,selected_img);
  • 5. 5 image(tum_segmented) title('segmented brain with tumor') %merging normal and damaged tissues together subplot(2,2,4) colormap jet(100) tot_segmented=segmented + tum_segmented; image(tot_segmented) title('merging normal and damaged tissues') Question 6:Contrast map the healthy and dis- eased brain region %Contrasting damaged and normal tissues of the brain using imcontrast b=imshow(tot_segmented) title('MRI slice with max tumor exposure with segmentation') colormap jet imcontrast(b) b = 720.0032
  • 6. 6 Question 7:Contour plotting figure(5) %creates contour plot of the image data contourf(flipdim(tot_segmented,1)) title('contour plot of MRI slice')
  • 7. 7 % flipdim is used for altering dimensions %contour plotting in volume slice planes image_num=25; cm=brighten(jet(100),-0.8); figure('Colormap',cm) contourslice(flipdim((sorted_mri),1),[],[],image_num) title('contour plotting of MRI slice')
  • 8. 8 Question 9:3-D plot %selecting the MRI slices which have the tumor %performing intensity transform function for those slices for range=14:30 selected_img = itf_img(sorted_mri(:,:,range)); selected_set(:,:,range)=selected_img; end %down sampling ds=selected_set; ds=flipdim(ds,1); %ds=flipdim(ds,2); %rearranges the dimensions of 'ds' so that they are in the order specified by %the vector order ds=permute(ds,[3 2 1]); vox_size2=vox_size([1 3 2]).*[4 1 4]; %isosurfce obtains similar isosurfce values from volume data ds tissue=isosurface(ds,109); tumor=isosurface(ds,150); h=figure('visible','off','outerposition',[0 0 800 600]); title('3D view of selected slices') patch(tissue,'FaceColor','b','EdgeColor','none'); patch(tumor,'FaceColor','r','EdgeColor','none','FaceAlpha',0.5);
  • 9. 9 view(45,15); daspect(1./vox_size2); axis tight; axis off; camlight; camlight(-80,-10); lighting phong; movegui(h,'center'); set(h,'visible','on'); Published with MATLAB® R2014a