PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
Main_GetTrackerLags.m
Go to the documentation of this file.
1 rootFolder = 'C:\Documents and Settings\moult\My Documents\TemporalCalibrationTests\May_13_2012';
2 close all;
3 [trackerLags, calibrationErrors, maxCalibrationErrors] = exploreFolders(rootFolder);
4 
5 xlswrite('PertinentStatistics',[(1:length(trackerLags))', trackerLags']);
6 %% Get mean and standard deviation of the tracker lags and calibration
7 %% errors
10 
13 
14 %% Plot of tracker lags vs. trial number
16 axisXRange = xlim;
17 set(gca,'XTick',axisXRange(1):1:axisXRange(2));
18 axisYRange = ylim;
19 set(gca,'YTick',axisYRange(1):0.005:axisYRange(2));
20 set(gca, 'YTickLabel', num2str(get(gca,'YTick')','%.3f'))
21 
22 
23 hold on;
24 
25 meanTrackerLagsX = 0:1:length(trackerLags);
26 for i = 1 : length(meanTrackerLagsX )
27  meanTrackerLagsY(i) = meanTrackerLag;
28 end
29 
30 meanLine = line(meanTrackerLagsX, meanTrackerLagsY);
31 
32 lowerBoundX = 0:1:length(trackerLags);
33 for i = 1 : length(lowerBoundX)
34  lowerBoundY(i) = meanTrackerLag - 0.005;
35 end
36 
37 upperBoundX = 0:1:length(trackerLags);
38 for i = 1 : length(upperBoundX)
39  upperBoundY(i) = meanTrackerLag + 0.005;
40 end
41 
42 hBounds(1) = line(lowerBoundX, lowerBoundY);
43 hBounds(2) = line(upperBoundX, upperBoundY);
44 
45 set(hTrackerLagData , ...
46  'LineStyle' , 'none' , ...
47  'Marker' , '.' );
48 set(meanLine , ...
49  'LineStyle' , '--' , ...
50  'Color' , 'r' );
51 set(hBounds(1) , ...
52  'LineStyle' , '-.' , ...
53  'Color' , [0 .5 0] );
54 set(hBounds(2) , ...
55  'LineStyle' , '-.' , ...
56  'Color' , [0 .5 0] );
57 
58 set(meanLine , ...
59  'LineWidth' , 1.5 );
60 
61 set(hTrackerLagData , ...
62  'Marker' , 'o' , ...
63  'MarkerSize' , 5 , ...
64  'MarkerEdgeColor' , 'none' , ...
65  'MarkerFaceColor' , [.3 .3 .3] );
66 
67 for i = 1 : length(trackerLags)
68  if(abs(trackerLags(i) - meanTrackerLag) > 0.005)
69  st = horzcat('Time from mean: ', num2str(abs(trackerLags(i) - meanTrackerLag)));
70 % str1(1) = {'Time from mean: ', num2str(abs(trackerLags(i) - meanTrackerLag))};
71  %text(i,trackerLags(i) + 0.005,str1)
72  text(i,trackerLags(i),i,strcat(st,'\rightarrow'), 'HorizontalAlignment','right','FontSize',10);
73  end
74 end
75 
76 xlabel('Test Number');
77 ylabel('Tracker Lag [s]');
78 legend('Tracker Lag', 'Mean Tracker Lag', '+/- 0.005 [s] Boundary', 'Location', 'NorthEastOutside');
79 titleString = horzcat('Tracker Lag vs. Trial Number (BaselineStudy; ', date, ' )');
80 title(titleString ,'FontWeight','bold')
81 
82 set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
83 set(gcf, 'PaperPositionMode', 'auto');
84 print -depsc2 TrackerLagVsTrialNumber.eps
85 
86 %% Plot of tracker lag distance (time) from mean tracker lag vs. mean
87 %% correlation error
88 trackerLagsDifferenceFromMean = abs(meanTrackerLag - trackerLags);
89 figure; subplot(1,2,1); hDistFromMeanAndCorrError = line(calibrationErrors, trackerLagsDifferenceFromMean);
90 
91 set(hDistFromMeanAndCorrError , ...
92  'LineStyle' , 'none' , ...
93  'Marker' , '.' );
94 
95 set(hDistFromMeanAndCorrError , ...
96  'Marker' , 'o' , ...
97  'MarkerSize' , 5 , ...
98  'MarkerEdgeColor' , 'none' , ...
99  'MarkerFaceColor' , [.3 .3 .3] );
100 
101 title('Tracker Lag Difference from Mean Tracker Lag vs. Correlation Error','FontWeight','bold')
102 
103 set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
104 set(gcf, 'PaperPositionMode', 'auto');
105 print -depsc2 DistanceFromMeanTrackerLagVsCorrelationError.eps
106 
107 xlabel('Correlation Error [mm]');
108 ylabel('Tracker Lag (Time) Distance From Mean Tracker Lag [s]');
109 
110 %% Plot of tracker lag distance (time) from mean tracker lag vs max
111 %% correlation error
112 trackerLagsDifferenceFromMean = abs(meanTrackerLag - trackerLags);
113 subplot(1,2,2); hDistFromMeanAndMaxCorrError = line(maxCalibrationErrors, trackerLagsDifferenceFromMean);
114 
115 for i = 1 : length(trackerLags)
116  st = horzcat('Trial #', num2str(i));
117  text(maxCalibrationErrors(i), trackerLagsDifferenceFromMean(i),strcat(st,'\rightarrow'), 'HorizontalAlignment','right','FontSize',10);
118 end
119 
120 set(hDistFromMeanAndMaxCorrError , ...
121  'LineStyle' , 'none' , ...
122  'Marker' , '.' );
123 
124 set(hDistFromMeanAndMaxCorrError , ...
125  'Marker' , 'o' , ...
126  'MarkerSize' , 5 , ...
127  'MarkerEdgeColor' , 'none' , ...
128  'MarkerFaceColor' , [.3 .3 .3] );
129 
130 
131 title('Tracker Lag Difference from Mean Tracker Lag vs. Max Correlation Error','FontWeight','bold')
132 
133 set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
134 set(gcf, 'PaperPositionMode', 'auto');
135 print -depsc2 DistanceFromMeanTrackerLagVsMaxCorrelationError.eps
136 
137 xlabel('Max Correlation Error [mm]');
138 ylabel('Tracker Lag (Time) Distance From Mean Tracker Lag [s]');
139 
140 %% Scatter plot for the tracker lags
141 xlabel('Test No.');
142 ylabel('Tracker Lag [s]');
143 
144 
145 rootFolder = 'C:\Documents and Settings\moult\My Documents\CalibrationResults_March_28_2012\SensitivityStudyDay2\BaselineStudy';
146 trackerLags2 = exploreFolders(rootFolder);
147 
148 std(trackerLags2)
149 mean(trackerLags2)
150 
151 hold on;
152 scatter(1:length(trackerLags2), trackerLags2, 'r');
153 meanTrackerLag = mean(trackerLags2);
154 hold on;
155 plot([0,length(trackerLags)], [ meanTrackerLag, meanTrackerLag], 'r');
156 
157 
158 legend('Baseline Study Day One','Baseline Study Day One (Mean)','Baseline Study Day Two','Baseline Study Day Two (Mean)')
159 
160 title('Temporal Calibration March 28 2012')
const char int line
Definition: phidget22.h:2458
meanCalibrationError
calibrationErrors
Definition: exploreFolders.m:6
meanTrackerLag
AtracsysTracker Tracker
Write the tracker the mean tracker and the standard deviation of the tracker lags to file xlswrite('PertinentStatistics', [(1:length(trackerLags))', trackerLags'])
Get mean and standard deviation of the tracker lags and calibration errors stdTrackerLag
stdCalibrationError
rootFolder
Get the tracker lags[trackerLags, calibrationErrors, maxCalibrationErrors]
Plot of tracker lags vs trial number hTrackerLagData
close all
trackerLags
Definition: exploreFolders.m:5