Skip to content

Commit

Permalink
Merge branch 'main' into rloop-analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cutiness committed Dec 18, 2024
2 parents fb0d491 + a6ee56a commit 5a0c71a
Show file tree
Hide file tree
Showing 145 changed files with 6,282 additions and 451 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/blog.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions _freeze/posts/Farm-Shape-Analysis/index/execute-results/html.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"hash": "15b06b5ad43c94b76e8eab4544709513",
"result": {
"engine": "jupyter",
"markdown": "---\ntitle: \"Optimal Mass Transport and its Convex Formulation\"\nsubtitle: \"\"\njupyter: python3\n\nauthor:\n - name: \"Siddharth Rout\"\n email: \"[email protected]\"\n url: \"https://scholar.google.com/citations?user=2r63M5kAAAAJ&hl=en\"\n\ndate: \"October 24 2024\"\ncategories: [optimal transport, shape morphing, Monge's Problem, Kantorovich's Formulation, Benamou-Brenier's Formulation]\n\ncallout-icon: false\nformat:\n html:\n code-fold: true\nbibliography: bibliography.bib\n\nexecute:\n echo: true\n freeze: auto\n warning: false\n\n---\n\n\n\n\n\n# Introduction\nIn the context of biomedics, understanding disease progression is critical in developing effective diagnostic and therapeutic strategies.\nMedical imaging provides us with invaluable data, capturing the spatial and structural changes in the human\nbody over time. Yet, analyzing these changes quantitatively and consistently remains challenging. Here, we\nexplore how optimal transport (OT) can be applied to model disease progression in a geometrically meaningful\nway, providing a tool to predict deformations and shape changes in diseases like neurodegeneration,\ncancer, and respiratory diseases.\n\n## What is Optimal Transport?\nOptimal transport is a mathematical framework originally developed to solve the problem of transporting resources\nin a way that minimizes cost. The problem was formalized by the French mathematician Gaspard Monge in 1781.\nIn the 1920s A.N. Tolstoi was among the first to study the transportation problem mathematically. However,\nthe major advances were made in the field during World War II by the Soviet mathematician and economist Leonid Kantorovich.\nHowever, OT is a tough optimization problem. In 2000, Benamou and Brenier propose a convex formulation.\nVillani explains the history and mathematics behind OT in great detail in his book [@villani2021topics],\nwhich is in fact very popular and well appreciated.\n\nMathematically, OT finds the most efficient way to \"move\" one distribution to match another,\nwhich is useful in medical imaging where changes in structure and morphology need to be quantitatively mapped\nover time. OT computes a transport map (or \"flow\") that transforms one spatial distribution into another\nwith minimal \"work\" (measured by the Wasserstein distance). This idea has strong applications in medical\nimaging, particularly for analyzing disease progression, as it provides a way to track changes in anatomical\nstructures over time.\n\n![State of neurodegeneration in a kid at different ages. (@neurodegeneration2020) OT can learn the\nprogression or the transformation (T) of brain deformation from the state at 5 year age ($\\rho_0$) to the final\nstate at 7 year age ($\\rho_1$) or 9 year age ($\\rho_2$).](mri_agewise_annotated.jpg)\n\n## Why Optimal Transport for Disease Progression?\nThe OT framework is uniquely suited for disease progression modeling because it allows us to:\n\n* *Capture spatial and structural changes*: OT computes a smooth, meaningful transformation, preserving the\ncontinuity of shapes, making it ideal for medical images that track evolving structures.\n* *Quantify changes robustly*: By calculating the minimal transport cost, OT provides a quantitative measure\nof how much a structure (e.g., brain tissue) changes, which can correlate with disease severity.\n* *Compare across patients and populations*: OT-based metrics can be standardized across subjects, enabling\ncomparisons between different patient groups or disease stages.\n\n## Popular Applications of OT to Study Disease Progression:\n\n* *Neurodegeneration (e.g., Alzheimer’s Disease)*: OT maps brain atrophy across time points in MRI scans, quantifying volume and cortical thickness changes crucial for staging and monitoring Alzheimer’s.\n* *Cancer*: OT tracks tumor morphology changes, helping assess treatment response by measuring growth, shrinkage, or shape shifts, even aiding relapse predictions.\n* *Respiratory Diseases (e.g., COPD)*: OT compares longitudinal lung CTs to quantify tissue loss distribution, providing spatial insights for monitoring COPD progression and treatment adjustment.\n\n# Mathematics of Optimal Transport\n## Monge Formulation\n\nThe Monge formulation of optimal transport, introduced in 1781, addresses the problem of moving mass efficiently from one distribution to another. Given two distributions:\n\n- *Source Distribution*: $\\mu$ on $X$\n- *Target Distribution*: $\\nu$ on $Y$\n\nwe seek a transport map $T$: $X$ to $Y$ that minimizes the transport cost, typically $c(x, T(x)) = \\|x - T(x)\\|^p$.\n\nThe Monge problem can be written as:\n\n$$\n\\min_T \\int_X c(x, T(x)) \\, d\\mu(x)\n$$\n\nsubject to $T_\\# \\mu = \\nu$, meaning that the map $T$ must push $\\mu$ to $\\nu$, ensuring all mass is preserved without splitting.\n\nKey Points:\n\n1. *Transport Map $T$*: Monge’s formulation requires a direct mapping of mass from $\\mu$ to $\\nu$.\n2. *No Mass Splitting*: Unlike relaxed formulations, the Monge problem doesn’t allow fractional mass transport, making it challenging to solve in complex cases.\n3. *Cost Function*: The choice of $c(x, y)$ affects the solution—common choices include distance $\\|x - y\\|$ and squared distance $\\|x - y\\|^2$.\n\n#### Shortcoming\n\nThe Monge formulation lacks flexibility due to its one-to-one mapping constraint, which led to\nthe **Kantorovich relaxation**, allowing more general solutions by enabling mass splitting. The Monge\nformulation captures the essence of spatial mass transport with minimal cost, inspiring modern approaches\nin diverse fields.\n\n## Kantorovich formulation\n\nThe Kantorovich formulation, introduced by Leonid Kantorovich in 1942 (@Kantorovich2006OnTT), generalizes the Monge problem\nby allowing \"mass splitting,\" where mass from one source point can be distributed to multiple target points.\nThis flexibility makes it possible to solve a broader range of transport problems.\n\nKantorovich's Problem:\n\nInstead of finding a single transport map $T$, the Kantorovich formulation seeks a **transport plan** $\\gamma$,\na joint probability distribution on $X \\times Y$, such that:\n\n$$\n\\min_\\gamma \\int_{X \\times Y} c(x, y) \\, d\\gamma(x, y)\n$$\n\nwhere $c(x, y)$ represents the cost of transporting mass from $x \\in X$ to $y \\in Y$. The transport\nplan $\\gamma$ must satisfy marginal constraints:\n\n$$\n\\int_Y d\\gamma(x, y) = d\\mu(x) \\quad \\text{and} \\quad \\int_X d\\gamma(x, y) = d\\nu(y),\n$$\n\nensuring that $\\gamma$ moves all mass from $\\mu$ to $\\nu$.\n\nKey Points:\n\n1. *Transport Plan $\\gamma$*: A probability measure over $X \\times Y$ that allows fractional mass movement,\nbroadening the solution space.\n2. *Marginal Constraints*: These ensure $\\gamma$ aligns with source $\\mu$ and target $\\nu$ distributions,\npreserving total mass.\n3. *Cost Function*: Commonly, $c(x, y) = \\|x - y\\|$ or $c(x, y) = \\|x - y\\|^2$, chosen based on the desired\npenalty for transport distance.\n\nAdvantages:\n\n* *Flexibility*: Mass splitting allows for a solution even when $\\mu$ and $\\nu$ have different structures (e.g., continuous to discrete).\n* *Computational Feasibility*: The problem can be solved via linear programming or faster algorithms using entropic regularization.\n\nHence, the Kantorovich formulation provides a robust framework for optimal transport problems, enabling applications across fields where flexibility and computational efficiency are essential.\n\n## Benamou-Brenier Formulation (Convex OT)\nThe Benamou-Brenier formulation (@benamou2000computational) provides a dynamic perspective on optimal transport, interpreting it\nas a fluid flow problem. Instead of transporting mass directly between two distributions, this approach\nfinds the path of minimal “kinetic energy” needed to continuously transform one distribution into another\nover time.\n\nThe Benamou-Brenier formulation considers a probability density $\\rho(x, t)$ evolving over time\n$t \\in [0, 1]$ from an initial distribution $\\rho_0$ to a final distribution $\\rho_1$. The goal is to\nfind a velocity field $v(x, t)$ that minimizes the action, or \"kinetic energy\" cost:\n\n$$\n\\min_{\\rho, v} \\int_0^1 \\int_X \\frac{1}{2} \\|v(x, t)\\|^2 \\rho(x, t) \\, dx \\, dt,\n$$\n\nsubject to the **continuity equation**:\n\n$$\n\\frac{\\partial \\rho}{\\partial t} + \\nabla \\cdot (\\rho v) = 0,\n$$\n\nwhich ensures mass conservation from $\\rho_0$ to $\\rho_1$.\n\nKey Points:\n\n1. *Dynamic Interpretation*: Unlike Monge and Kantorovich, the Benamou-Brenier formulation finds a time-dependent transformation, representing a continuous flow of mass.\n2. *Velocity Field $v(x, t)$*: Defines the \"direction\" and \"speed\" of mass movement, yielding a smooth, physical path of minimal kinetic energy.\n3. *Continuity Equation*: Ensures mass conservation over time, maintaining that mass neither appears nor disappears.\n\n\nAdvantages:\n\n* *Smoothness*: Provides a continuous path for evolving distributions, well-suited for dynamic processes.\n* *Computational Benefits*: The problem is formulated as a convex optimization over a flow field, often solved with efficient numerical methods.\n\nThe Benamou-Brenier formulation expands optimal transport by introducing a dynamic flow approach, making it especially useful for applications requiring continuous transformations. Its physical interpretation has brought valuable insights to fields that rely on time-evolving processes.\n\n# Conclusion\n\nThe three formulations of optimal transport—Monge, Kantorovich, and Benamou-Brenier—each provide unique\nperspectives and methodologies for addressing the fundamental problem of transporting mass efficiently\nbetween distributions. The **Monge formulation** offers a direct approach, seeking a one-to-one mapping\nthat minimizes transportation cost while preserving mass, making it intuitive but limited in applicability\ndue to its constraints. In contrast, the **Kantorovich formulation** expands this framework by allowing\nmass splitting through the use of transport plans, making it more versatile for a wider range of problems,\nincluding those involving discrete and continuous distributions. Finally, the **Benamou-Brenier formulation**\nintroduces a dynamic interpretation of transport, framing it as a flow problem governed by velocity fields.\nThis perspective is particularly valuable in scenarios where time evolution plays a crucial role, allowing\nfor smooth transitions between states. Together, these formulations form a comprehensive toolbox for optimal\ntransport theory, finding applications across diverse fields such as logistics, computer graphics, machine learning, and medical imaging.\n\n",
"supporting": [
"OT4DiseaseProgression_files"
],
"filters": [],
"includes": {}
}
}

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _freeze/posts/Neural-Manifold/index/execute-results/html.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions _freeze/posts/landmarks-final/index/execute-results/html.json

Large diffs are not rendered by default.

Loading

0 comments on commit 5a0c71a

Please sign in to comment.