Skip to content

Commit

Permalink
Notebook updates and Octave graphics fixes attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
agentmess committed Nov 11, 2023
1 parent 6503e85 commit 3214c8e
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 17 deletions.
159 changes: 144 additions & 15 deletions Notebooks/FOV and Resolution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,17 @@
" * Describe what determines the image FOV and resolution\n",
"1. Manipulate MRI sequence parameters to improve performance\n",
" * Manipulate the gradients and k-space sampling to change the FOV and resolution\n",
"\n",
"## Field-of-View (FOV)\n",
"\n",
"The FOV is determined by the sample spacing in k-space, with the simple relationship based on the sample spacing, $\\Delta k$ as:\n",
"\n",
"$$ FOV = \\frac{1}{\\Delta k}$$\n",
"\n",
"\n",
"## Spatial Resolution\n",
"\n",
"The spatial resolution is determined by the maximum sample extent in k-space, with the simple relationship based on the maximum k-space sample locations, $k_{max}$ as:\n",
"\n",
"$$ \\Delta = \\frac{1}{2 k_{max}}$$\n"
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "octave"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -49,6 +41,143 @@
"startup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Field-of-View (FOV)\n",
"\n",
"The FOV is determined by the sample spacing in k-space, with the simple relationship based on the sample spacing, $\\Delta k$ as:\n",
"\n",
"$$ FOV = \\frac{1}{\\Delta k}$$\n",
"\n",
"For example, $FOV_{x} = \\frac{1}{\\Delta k_x}$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "octave"
}
},
"outputs": [],
"source": [
"% rectangular object to demonstrate FOV\n",
"\n",
"N = 256;\n",
"kx = [-N/2:N/2-1]/N;\n",
"N_rect = N/4;\n",
"kdata = sinc(kx *N_rect).' * sinc(kx *N_rect);\n",
"\n",
"rect_recon = ifft2c(kdata);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon), [0 max(abs(rect_recon(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('Full FOV')\n",
"\n",
"kdata2 = kdata;\n",
"kdata2(1:2:end,:) = 0;\n",
"kdata2(:,1:2:end) = 0;\n",
"rect_recon2 = ifft2c(kdata2);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata2)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon2), [0 max(abs(rect_recon2(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('Doubled \\Delta k, Half FOV')\n",
"\n",
"kdata3 = kdata;\n",
"kdata2(1:3:end,:) = 0;\n",
"kdata2(2:3:end,:) = 0;\n",
"kdata2(:,1:3:end) = 0;\n",
"kdata2(:,2:3:end) = 0;\n",
"rect_recon3 = ifft2c(kdata3);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata3)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon3), [0 max(abs(rect_recon3(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('Tripled \\Delta k, One Third FOV')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Spatial Resolution\n",
"\n",
"The spatial resolution is determined by the maximum sample extent in k-space, with the simple relationship based on the maximum k-space sample locations, $k_{max}$ as:\n",
"\n",
"$$ \\delta = \\frac{1}{2 k_{max}}$$\n",
"\n",
"For example, $\\delta_x = \\frac{1}{2 k_{x,max}}$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "octave"
}
},
"outputs": [],
"source": [
"% rectangular object to demonstrate resolution\n",
"\n",
"N = 256;\n",
"kx = [-N/2:N/2-1]/N;\n",
"N_rect = N/2;\n",
"kdata = sinc(kx *N_rect).' * sinc(kx *N_rect);\n",
"\n",
"rect_recon = ifft2c(kdata);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon), [0 max(abs(rect_recon(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('Full Resolution')\n",
"\n",
"kdata2 = kdata;\n",
"kdata2([[1:N/4],[3*N/4+1:N]],:) = 0;\n",
"kdata2(:,[[1:N/4],[3*N/4+1:N]]) = 0;\n",
"rect_recon2 = ifft2c(kdata2);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata2)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon2), [0 max(abs(rect_recon2(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('Half k_{max}, Double voxel size')\n",
"\n",
"kdata4 = kdata;\n",
"kdata4([[1:3*N/8],5*N/8+1:N]],:) = 0;\n",
"kdata4(:,[[1:3*N/8],5*N/8+1:N]]) = 0;\n",
"rect_recon4 = ifft2c(kdata4);\n",
"\n",
"subplot(221)\n",
"imagesc((abs(kdata4)), [0 (1)])\n",
"colormap(gray), axis equal tight off\n",
"subplot(222)\n",
"imagesc(abs(rect_recon4), [0 max(abs(rect_recon4(:)))])\n",
"colormap(gray), axis equal tight off\n",
"title('1/4 k_{max}, 4x voxel size')\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
4 changes: 3 additions & 1 deletion Notebooks/Signal to Noise Ratio.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"\n",
"The MRI signal is an integral over a volume of the transverse magnetization. Therefore there is a linear dependency on the MRI signal and the volume of magnetization being examined. So we have\n",
"\n",
"$$SNR \\propto \\mathrm{Voxel\\ Volume} = \\Delta x\\ \\Delta y\\ \\Delta z$$\n",
"$$SNR \\propto \\mathrm{Voxel\\ Volume} = \\delta x\\ \\delta y\\ \\delta z$$\n",
"\n",
"where $\\delta x, \\delta y, \\delta z$ are the voxel dimensions in x, y, and z.\n",
"\n",
"### Data Acquisition Time\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion apt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ octave-signal
octave-miscellaneous
liboctave-dev
ghostscript
qt5-default
1 change: 1 addition & 0 deletions startup.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@
end
end

graphics_toolkit('qt')
end
end

0 comments on commit 3214c8e

Please sign in to comment.