{ "cells": [ { "cell_type": "markdown", "id": "47066a37", "metadata": {}, "source": [ "# Theoretical background" ] }, { "cell_type": "markdown", "id": "e26ae5cc", "metadata": {}, "source": [ "## Problem statement" ] }, { "cell_type": "markdown", "id": "a637ec01", "metadata": {}, "source": [ "Low-field MRIs have multiple designs of creating the main magnetic field, one of them is the Halbach design. This uses small permanent magnets that are set in a special configuration, called the Halbach configuration, to create its main magnetic field. This configuration arranges and aligns magnets in a way that the magnetic field can be maximized in one direction, while eliminating the field in other directions.\n", "\n", "The Halbach cylinder is designed such that the magnetization vector rotates by 720 degrees over the 360-degree angular span of the cylinder." ] }, { "cell_type": "markdown", "id": "59d4ed2f", "metadata": {}, "source": [ "However, the theoretical ideal Halbach cylinder magnet is an infinitely long tube with continuously changing magnetization polarization, but in real life the MRI cylinder has a finite length and instead of one cylinder magnet, they use multiple small magnets, which of course brings inconsistencies in the field and lowers the field strength. \n", "\n" ] }, { "cell_type": "markdown", "id": "8e8b76cd", "metadata": {}, "source": [ "## Global spherical harmonic analysis (GSHA) " ] }, { "cell_type": "markdown", "id": "9010520a", "metadata": {}, "source": [ "GSHA is the term to describe the reduction of global data sets to spherical harmonic (SH) coefficients. Mathematically it is similar to the inverse 2D Fourier transform on the sphere. During GSHA we estimate the coefficients from the signal. " ] }, { "cell_type": "markdown", "id": "47a2f17b", "metadata": {}, "source": [ "Each term of matrix B corresponds to a spherical harmonic evaluated at each sampled point in the working volume:\n", "\n", "\\begin{equation}\n", "S(\\theta, \\phi)=\\sum_{\\ell=0}^{\\infty} \\sum_{m=-\\ell}^{\\ell} C_{\\ell}^m Y_{\\ell}^m(\\theta, \\phi)\n", "\\end{equation}\n", "\n", "where $\\theta \\in [0, \\pi]$ and $\\phi \\in [0, 2\\pi]$, and the associated Legendre polynomials $ Y_{l}^{m} $:\n", "\n", "\n", "\\begin{equation}\n", "Y_{l}^{m}(\\theta, \\phi)=(-1)^{\\frac{m+\\mid m \\mid}{2}}\\sqrt{\\frac{(2l+1) \\cdot (l-\\mid m \\mid)!}{4 \\pi (l+ \\mid m \\mid)!}}P_l^{ \\mid m \\mid}(\\cos \\theta) \\cdot e^{i \\cdot m(\\phi + \\pi)}\n", "\\end{equation}\n", "\n", "\n", "We introduce a modified basis:\n", "\n", "\n", "\\begin{equation}\n", " Y_{j} =\n", " \\begin{cases}\n", " \\sqrt{2} \\cdot \\text{Re}(Y_{k}^{m}) & \\text{if } -k \\leq m < 0 \\\\\n", " Y_k^0 & \\text{if } m = 0 \\\\\n", " \\sqrt{2} \\cdot \\text{Im}(Y_{k}^{m}) & \\text{if } 0 < m \\leq k\n", " \\end{cases} \n", "\\end{equation}\n", "\n", "\n", "The new basis is real and orthonormal.\n", "\n", "The modified signal equation rewritten in the new basis:\n", "\n", "\n", "\\begin{equation}\n", "S(\\theta_i, \\varphi_i)=\\sum_{j=0}^{R} C_{j} Y_{j}(\\theta_i, \\phi_i)\n", "\\end{equation}\n", "\n", "\n", "where:\n", " - $ S(\\theta_i, \\varphi_i) $, $ S:[N \\times 1] $ is the SH signal, $ N $ is the number of (gradient) directions,\n", " - $ C_{j}, C: [R \\times 1] $ is the SH coefficient, where $ R=\\frac{(l+1)(L+2)}{2} $ is the number of terms in the modified SH basis $ Y $ of order $ l $,\n", " - $ Y_{j}(\\theta_i, \\phi_i) $ (in the code B) is the SH basis, $ Y: [N \\times R] $,\n", " - $ l $ ($ l=0, 1, 2, \\ldots $) is the degree, which determines the complexity of the function in terms of the number of nodal lines,\n", " - $ m $ ($ m=-l,\\ldots,+l $) is the order, specifying the azimuthal variation within a given degree.\n", "\n", "\n", "The equation matrix representation:\n", "\n", "\n", "\\begin{equation}\n", "\\left(\\begin{array}{c}\n", "S_{1} \\\\\n", "S_{2} \\\\\n", "S_{3} \\\\\n", "\\vdots \\\\\n", "S_{R}\n", "\\end{array}\\right)=\n", "\\left(\\begin{array}{cccccc}\n", "Y_{1}(\\theta_1, \\phi_1) & Y_{2}(\\theta_1, \\phi_1) & Y_{3}(\\theta_1, \\phi_1) & \\cdots & Y_{R}(\\theta_1, \\phi_1) \\\\\n", "Y_{1}(\\theta_2, \\phi_2) & Y_{2}(\\theta_2, \\phi_2) & Y_{3}(\\theta_2, \\phi_2) & \\cdots & Y_{R}(\\theta_2, \\phi_2) \\\\\n", "\\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\\n", "Y_{1}(\\theta_N, \\phi_N) & Y_{2}(\\theta_N, \\phi_N) & Y_{3}(\\theta_N, \\phi_N) & \\cdots & Y_{R}(\\theta_N, \\phi_N)\n", "\\end{array}\\right)\\left(\\begin{array}{c}\n", "c_{00} \\\\\n", "c_{2 -2} \\\\\n", "c_{2 -1} \\\\\n", "c_{2 0} \\\\\n", "c_{2 1} \\\\\n", "\\vdots \\\\\n", "c_{l m}\n", "\\end{array}\\right)\n", "\\end{equation}\n", "\n" ] }, { "cell_type": "markdown", "id": "9162fa74", "metadata": {}, "source": [ "## Genetic Algorithm" ] }, { "cell_type": "markdown", "id": "edc71865", "metadata": {}, "source": [ "In this library, a traditional genetic algorithm, and the ACROMUSE algorithm is implemented. \n", "\n", "Genetic algorithms (GA) are inspired by natural genetics. It is a heuristic and stochastic method, particularly useful for solving complex and nonlinear optimization problems. It does not require any prior knowledge, as they find the solution by minimizing or maximizing an objective, called fitness function. This function measures how well each potential solution solves the target problem. \n", "\n", "For the genetic algorithm, three different parent selections are available. \n", "- the 'best_50_selection' sorts the population by their fitness values and keeps the top 50%, from which individuals for crossover and mutation are sampled with uniform probability,\n", "- the 'roulette_wheel_selection' sets the probability to be chosen depending the individual's fitness value,\n", "- the 'tournament_selection' randomly draws k individuals from the population and chooses the one with the best fitness to be a parent; changing k alters the probabilities, with a small k favoring worse members, which helps to introduce randomness\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "id": "e83ad841", "metadata": {}, "source": [ "## ACROMUSE Algorithm" ] }, { "cell_type": "markdown", "id": "5b3d8d2c", "metadata": {}, "source": [ "The ACROMUSE algorithm uses an adaptive tournament selection, which changes the size of k depending on standard deviation, to keep a balance in solution space diversity." ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }