|
1 | 1 | function MRS_struct = CoReg(MRS_struct, struc) |
2 | 2 |
|
3 | | -% Coregistration of MRS voxel volumes to imaging datasets, based on headers. |
| 3 | +% Co-registration of MRS voxel volumes to imaging datasets, based on headers. |
4 | 4 |
|
5 | 5 | loadFile = which('GannetCoRegister'); |
6 | 6 | fileID = fopen(loadFile, 'rt'); |
|
117 | 117 | figTitle = 'GannetCoRegister Output'; |
118 | 118 | set(gcf,'Name',figTitle,'Tag',figTitle,'NumberTitle','off'); |
119 | 119 |
|
120 | | - subplot(2,3,4:6); |
| 120 | + ha = subplot(2,3,4:6); |
| 121 | + pos = get(ha, 'Position'); |
| 122 | + set(ha, 'Position', [0 pos(2) 1 pos(4)]); |
121 | 123 | axis off; |
122 | 124 |
|
123 | 125 | [~,tmp,tmp2] = fileparts(MRS_struct.mask.(vox{kk}).outfile{ii}); |
124 | 126 | fname = [tmp tmp2]; |
125 | 127 | if length(fname) > 30 |
126 | 128 | fname = [fname(1:12) '...' fname(end-11:end)]; |
127 | 129 | end |
128 | | - text(0.5, 0.75, 'Mask output: ', 'HorizontalAlignment' , 'right', 'FontName', 'Arial', 'FontSize', 13); |
129 | | - text(0.5, 0.75, [' ' fname], 'FontName', 'Arial', 'FontSize', 13, 'Interpreter', 'none'); |
| 130 | + text(0.5, 0.75, 'Mask output: ', 'Units', 'normalized', 'HorizontalAlignment' , 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 131 | + text(0.5, 0.75, [' ' fname], 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13, 'Interpreter', 'none'); |
130 | 132 |
|
131 | | - text(0.5, 0.63, 'Spatial parameters: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
132 | | - text(0.5, 0.63, ' [LR, AP, FH]', 'FontName', 'Arial', 'FontSize', 13); |
| 133 | + text(0.5, 0.63, 'Spatial parameters: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 134 | + text(0.5, 0.63, ' [LR, AP, FH]', 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13); |
133 | 135 |
|
134 | 136 | tmp = [' ' num2str(MRS_struct.p.voxdim(ii,1)) ' \times ' num2str(MRS_struct.p.voxdim(ii,2)) ' \times ' num2str(MRS_struct.p.voxdim(ii,3)) ' mm^{3}']; |
135 | | - text(0.5, 0.51, 'Dimensions: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
136 | | - text(0.5, 0.51, tmp, 'FontName', 'Arial', 'FontSize', 13, 'Interpreter', 'tex'); |
| 137 | + text(0.5, 0.51, 'Dimensions: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 138 | + text(0.5, 0.51, tmp, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13, 'Interpreter', 'tex'); |
137 | 139 |
|
138 | 140 | tmp = [' ' num2str(prod(MRS_struct.p.voxdim(ii,:))/1e3) ' mL']; |
139 | | - text(0.5, 0.39, 'Volume: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
140 | | - text(0.5, 0.39, tmp, 'FontName', 'Arial', 'FontSize', 13); |
| 141 | + text(0.5, 0.39, 'Volume: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 142 | + text(0.5, 0.39, tmp, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13); |
141 | 143 |
|
142 | 144 | tmp = [' [' num2str(MRS_struct.p.voxoff(ii,1), '%3.1f') ', ' num2str(MRS_struct.p.voxoff(ii,2), '%3.1f') ', ' num2str(MRS_struct.p.voxoff(ii,3), '%3.1f') '] mm']; |
143 | | - text(0.5, 0.27, 'Position: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
144 | | - text(0.5, 0.27, tmp, 'FontName', 'Arial', 'FontSize', 13); |
| 145 | + text(0.5, 0.27, 'Position: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 146 | + text(0.5, 0.27, tmp, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13); |
145 | 147 |
|
146 | 148 | if any(strcmp(MRS_struct.p.vendor,{'Philips','Philips_data'})) |
147 | 149 | tmp = [' [' num2str(MRS_struct.p.voxang(ii,2), '%3.1f') ', ' num2str(MRS_struct.p.voxang(ii,1), '%3.1f') ', ' num2str(MRS_struct.p.voxang(ii,3), '%3.1f') '] deg']; |
148 | 150 | else |
149 | 151 | tmp = [' [' num2str(MRS_struct.p.voxang(ii,1), '%3.1f') ', ' num2str(MRS_struct.p.voxang(ii,2), '%3.1f') ', ' num2str(MRS_struct.p.voxang(ii,3), '%3.1f') '] deg']; |
150 | 152 | end |
151 | | - text(0.5, 0.15, 'Angulation: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
152 | | - text(0.5, 0.15, tmp, 'FontName', 'Arial', 'FontSize', 13); |
| 153 | + text(0.5, 0.15, 'Angulation: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 154 | + text(0.5, 0.15, tmp, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13); |
153 | 155 |
|
154 | | - text(0.5, 0.03, 'CoRegVer: ', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
155 | | - text(0.5, 0.03, [' ' MRS_struct.version.coreg], 'FontName', 'Arial', 'FontSize', 13); |
| 156 | + text(0.5, 0.03, 'CoRegVer: ', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'FontName', 'Arial', 'FontSize', 13); |
| 157 | + text(0.5, 0.03, [' ' MRS_struct.version.coreg], 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 13); |
156 | 158 |
|
157 | | - ha = subplot(2,3,1:3); |
| 159 | + hb = subplot(2,3,1:3); |
158 | 160 |
|
159 | 161 | if strcmp(MRS_struct.p.vendor,'Siemens_rda') |
160 | 162 | [~,tmp,tmp2] = fileparts(MRS_struct.metabfile{ii*2-1}); |
|
179 | 181 | axis equal tight off; |
180 | 182 | text(10, size(MRS_struct.mask.(vox{kk}).img{ii},1)/2, 'L', 'Color', [1 1 1], 'FontSize', 20); |
181 | 183 | text(size(MRS_struct.mask.(vox{kk}).img{ii},2) - 20, size(MRS_struct.mask.(vox{kk}).img{ii},1)/2, 'R', 'Color', [1 1 1], 'FontSize', 20); |
182 | | - set(ha,'pos',[0 0.15 1 1]); |
| 184 | + set(hb, 'Position', [0 0.15 1 1]); |
183 | 185 | title(t, 'FontName', 'Arial', 'FontSize', 15, 'Interpreter', 'none'); |
184 | | - |
| 186 | + |
185 | 187 | % Gannet logo |
| 188 | + axes('Position', [0.8825, 0.04, 0.125, 0.125], 'Units', 'normalized'); |
186 | 189 | Gannet_logo = fullfile(fileparts(which('GannetLoad')), 'Gannet3_logo.png'); |
187 | 190 | I = imread(Gannet_logo, 'BackgroundColor', 'none'); |
188 | | - axes('Position', [0.85, 0.05, 0.125, 0.125]); |
189 | 191 | imshow(I); |
190 | | - text(0.925, 0, MRS_struct.version.Gannet, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 14, 'FontWeight', 'bold', 'HorizontalAlignment', 'left'); |
191 | | - axis off square; |
192 | | - |
| 192 | + axis off image; |
| 193 | + |
| 194 | + % Gannet version |
| 195 | + d.left = 0; |
| 196 | + d.bottom = 0.02; |
| 197 | + d.width = 1; |
| 198 | + d.height = 0.02; |
| 199 | + axes('Position', [d.left d.bottom d.width d.height], 'Units', 'normalized'); |
| 200 | + text(0.9925, 0, MRS_struct.version.Gannet, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 14, 'FontWeight', 'bold', 'HorizontalAlignment', 'right'); |
| 201 | + axis off; |
| 202 | + |
193 | 203 | % Gannet documentation |
194 | | - axes('Position', [(1-0.9)/2, 0.025, 0.9, 0.15]); |
| 204 | + axes('Position', [d.left d.bottom d.width d.height], 'Units', 'normalized'); |
195 | 205 | str = 'For complete documentation, please visit: https://markmikkelsen.github.io/Gannet-docs'; |
196 | | - text(0.5, 0, str, 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'center'); |
| 206 | + text(0.5, 0, str, 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'center'); |
197 | 207 | axis off square; |
198 | 208 |
|
199 | 209 | % Batch number and output time |
200 | | - d.w = 1; |
201 | | - d.l = (1-d.w)/2; |
202 | | - d.b = 0.98; |
203 | | - d.h = 1-d.b; |
204 | | - axes('Position', [d.l d.b d.w d.h]); |
205 | | - text(0.0075, 0, ['Batch file: ' num2str(ii) ' of ' num2str(MRS_struct.p.numScans)], 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'left'); |
206 | | - text(0.9925, 0, char(datetime('now','Format','dd-MMM-y HH:mm:ss')), 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'right'); |
| 210 | + d.bottom = 0.98; |
| 211 | + axes('Position', [d.left d.bottom d.width d.height], 'Units', 'normalized'); |
| 212 | + text(0.0075, 0, ['Batch file: ' num2str(ii) ' of ' num2str(MRS_struct.p.numScans)], 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'left'); |
| 213 | + text(0.9925, 0, char(datetime('now','Format','dd-MMM-y HH:mm:ss')), 'Units', 'normalized', 'FontName', 'Arial', 'FontSize', 11, 'HorizontalAlignment', 'right'); |
207 | 214 | axis off; |
208 | 215 |
|
209 | 216 | % For Philips .data |
|
0 commit comments