%% Mock midterm test
%% Perform maximum intensity projection (MIP) in contrast-enhanced MRA
clear, close all

%% Import all the DICOM images
% Step 1: Please assign the path of 'data' folder to a variable, dirname.


dirinfo=dir(dirname);
% Step 2: Please remove the elements within dirinfo that are not DICOM files.



info=dicominfo([dirname filesep dirinfo(1).name]);
% Step 3: Please create a for-loop below to import all the DICOM files and save them within a 3D variable, img.



%% Display all the image slices using montage function
figure,
% Step 4: Please use montage to display all image slices. Please set up the
% 'Displayrage' between 0 and 500 and 'ThumbnailSize' as 512-by-416



%% Perform MIP along two axes and display images
figure,
% Step 5: 
% (1) Please perform MIP along the third dimension. 
% (2) Please use subplot to locate the image at the first position. 
% (3) Please use imshow with a display range between 30 and 400 to plot the image. 
%(4) Please give a title to the image: Anterior-posterior view.




% Step 6: 
% (1) Please perform MIP along the second dimension. 
% (2) Please use subplot to locate the image at the second position. 
% (3) Please use imshow with a display range between 30 and 400 to plot the image. 
% (4) Please give a title to the image: Lateral view.




%% Adjust axis ratio and set up color map
daspect([info.PixelSpacing(1) info.SliceThickness 1])
colormap(jet(256))