26.07.2013 Views

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

79 xlabel('Time [min]','fontsize',14);ylabel('Counts','fontsize',14)<br />

80 axis([0 Time(end) 0 max(DTc99m)]);<br />

81 set(get(h2,'CurrentAxes'),'fontsize',14)<br />

82 legend('Uncorrected Data','Final data');<br />

83<br />

84 save eks cor Time STc99m<br />

Listing A.2: load plot count.m<br />

1 function C = load plot count(Data,TID)<br />

2 % This function extracts the 4 images in one dicom−file and flips the<br />

3 % posterior images. Data is corrected using anterior and posterior image.<br />

4 % The output of this function is a vector containing counts from the two<br />

5 % isotopes and the time of examination.<br />

6 % Copyrigth Sabrina Wendt, DTU, 31/3−2009<br />

7<br />

8 Data 1 = Data.Images(1:end,1:end,1); % ANT Tc99m.<br />

9 Data 2 = Data.Images(1:end,end:−1:1,2); % POST Tc99m, is mirrored<br />

10 % compaired to ANT Tc99m.<br />

11 Data 3 = Data.Images(1:end,1:end,3); % ANT In111.<br />

12 Data 4 = Data.Images(1:end,end:−1:1,4); % POST In111, is mirrored<br />

13 % compaired to ANT In111.<br />

14<br />

15 Data 1d = double(Data 1)+1; % Data is converted to double.<br />

16 Data 2d = double(Data 2)+1; % Data is converted to double.<br />

17 Data 3d = double(Data 3)+1; % Data is converted to double.<br />

18 Data 4d = double(Data 4)+1; % Data is converted to double.<br />

19<br />

20 Data Tc99md = sqrt(Data 1d.*Data 2d); % Geometric correction.<br />

21 Data In111d = sqrt(Data 3d.*Data 4d); % Geometric correction.<br />

22<br />

23 Data Tc99m = uint16(Data Tc99md−1); % Data is converted to uint16.<br />

24 Data In111 = uint16(Data In111d−1); % Data is converted to uint16.<br />

25<br />

26 LP = [1 2 1;2 4 2;1 2 1]/16; % Defining a lowpas filter.<br />

27 Data Tc99m LP = conv2(Data Tc99m,LP,'same'); % Filtering Tc99m data.<br />

28<br />

29 Borderline = find border(Data Tc99m LP); % Finding the area of the stomach.<br />

30<br />

31 S Tc99md = Borderline .* Data Tc99md; % Using counts from the stomach.<br />

32 S In111d = Borderline .* Data In111d; % Using counts from the stomach.<br />

33 S Tc99m = uint16(S Tc99md−1); % Data is converted to uint16.<br />

34 S In111 = uint16(S In111d−1); % Data is converted to uint16.<br />

35<br />

36 c Tc = sum(sum(S Tc99m)); % Calculating total number of counts<br />

37 % within the stomach.<br />

38 c In = sum(sum(S In111)); % Calculating total number of counts<br />

39 % within the stomach.<br />

40<br />

41 % Finding time <strong>for</strong> count instance.<br />

42 t = Data.DicomHeader.ContentTime;<br />

43 time sec = (t(1)*10 + t(2)*1)*60*60 + (t(3)*10 + t(4)*1)*60 + ...<br />

44 (t(5)*10 + t(6)*1);<br />

45 time min = time sec/60;<br />

85

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!