Difference between revisions of "Math"

From Freephile Wiki
Jump to navigation Jump to search
(add links to start this later)
Line 8: Line 8:
 
# https://www.mediawiki.org/wiki/Extension:Math/advancedSettings
 
# https://www.mediawiki.org/wiki/Extension:Math/advancedSettings
 
# https://www.mediawiki.org/wiki/Manual:Math
 
# https://www.mediawiki.org/wiki/Manual:Math
 +
 +
== SimpleMathJax ==
 +
 +
In QualityBox, we use [https://www.mediawiki.org/wiki/Extension:SimpleMathJax Extension:SimpleMathJax] which does rendering client-side instead of the more complicated server-side [https://www.mediawiki.org/wiki/Extension:Math Math extension].<ref>This SO thread summarizes some of the history of the Math and SimpleMathJax extensions https://stackoverflow.com/questions/29387372/how-to-embed-maths-in-mediawiki</ref>
 +
Both extensions use MathJax, and the server-side option would be more suitable in high volume environments.
 +
 +
Compare:
 +
 +
https://phab.wmfusercontent.org/file/data/xsimlcnvo42siudvwuzk/PHID-FILE-bdcqexocj5b57tj2oezn/math_rendering.png
 +
 +
SimpleMathJax provides MediaWiki with [https://www.mathjax.org/#features MathJax]
 +
 +
 +
Other Example Renderings
 +
== na-mic ==
 +
Example from https://www.na-mic.org/wiki/Projects:GroupwiseRegistration
 +
<blockquote>
 +
For the nonrigid deformation model,
 +
we define a combined transformation consisting of
 +
a global and a local component
 +
 +
:<math>
 +
T(\mathbf{x}) = T_{local}({T_{global}(\mathbf{x})})
 +
</math>
 +
 +
where <math>T_{global}</math> is a twelve parameter affine transform and
 +
<math>T_{local}</math> is a deformation model based on B-splines.
 +
 +
The free form deformation can be written as the 3-D tensor product
 +
of 1-D cubic B-splines.
 +
 +
:<math>
 +
T_{local}(\mathbf{x}) = \mathbf{x} + \sum_{l=0}^3\sum_{m=0}^3\sum_{n=0}^3 B_l(u)B_m(v)B_n(w) \Phi_{i+l,j+m,k+n}
 +
</math>
 +
 +
 +
 +
where <math>B_l</math> is <math>l</math>'th cubic B-spline basis function. <math>(u,v,w)</math> is the distance
 +
to <math>(x,y,z)</math> from the control point <math>\Phi_{i,j,k}</math> as shown in Figure 2.
 +
 +
The deformation of a given point can be found using only the control points in the neighborhood of the given point. Therefore,
 +
optimization of the objective function can be implemented efficiently.
 +
</blockquote>
 +
 +
== slicer.org ==
 +
example from https://www.slicer.org/wiki/Coordinate_systems
 +
<blockquote>
 +
However different medical applications use different definitions of this 3D basis. Most common are the following bases:
 +
* LPS (Left, Posterior, Superior) is used in DICOM images and by the ITK toolkit
 +
<div style="text-align: center;">
 +
<math>  LPS = \begin{Bmatrix}
 +
                \text{from right towards left} \\
 +
                \text{from anterior towards posterior} \\
 +
                \text{from inferior towards superior}
 +
              \end{Bmatrix}
 +
</math>
 +
</div>
 +
* RAS (Right, Anterior, Superior) is similar to LPS with the first two axes flipped and used by 3D Slicer
 +
<div style="text-align: center;">
 +
<math>  RAS = \begin{Bmatrix}
 +
                \text{from left towards right} \\
 +
                \text{from posterior towards anterior} \\
 +
                \text{from inferior towards superior}
 +
              \end{Bmatrix}
 +
</math>
 +
</div>
 +
Both bases are equally useful and logical. It is just necessary to know to which basis an image is referenced.
 +
</blockquote>
 +
 +
== References ==
 +
<references />
 +
 +
[[Category:Features]]
  
 
[[Category:Wiki]]
 
[[Category:Wiki]]

Revision as of 23:46, 14 March 2018

Prior to v 1.18, Math was supported in core of MediaWiki via the <math> tag. Now, it's been extracted into the Extension:Math extension.

Furthermore, if you want to run a production wiki that uses math formulas, it is recommended that you setup your own mw:Mathoid nodejs service which in turn relies on a mw:RESTBase service.

Notes about setting it up / History / Status[edit | edit source]

  1. https://phabricator.wikimedia.org/T136812
  2. https://phabricator.wikimedia.org/T154394
  3. https://www.mediawiki.org/wiki/Extension:Math/advancedSettings
  4. https://www.mediawiki.org/wiki/Manual:Math

SimpleMathJax[edit | edit source]

In QualityBox, we use Extension:SimpleMathJax which does rendering client-side instead of the more complicated server-side Math extension.[1] Both extensions use MathJax, and the server-side option would be more suitable in high volume environments.

Compare:

math_rendering.png

SimpleMathJax provides MediaWiki with MathJax


Other Example Renderings

na-mic[edit | edit source]

Example from https://www.na-mic.org/wiki/Projects:GroupwiseRegistration

For the nonrigid deformation model, we define a combined transformation consisting of a global and a local component

[math] T(\mathbf{x}) = T_{local}({T_{global}(\mathbf{x})}) [/math]

where [math]T_{global}[/math] is a twelve parameter affine transform and [math]T_{local}[/math] is a deformation model based on B-splines.

The free form deformation can be written as the 3-D tensor product of 1-D cubic B-splines.

[math] T_{local}(\mathbf{x}) = \mathbf{x} + \sum_{l=0}^3\sum_{m=0}^3\sum_{n=0}^3 B_l(u)B_m(v)B_n(w) \Phi_{i+l,j+m,k+n} [/math]


where [math]B_l[/math] is [math]l[/math]'th cubic B-spline basis function. [math](u,v,w)[/math] is the distance to [math](x,y,z)[/math] from the control point [math]\Phi_{i,j,k}[/math] as shown in Figure 2.

The deformation of a given point can be found using only the control points in the neighborhood of the given point. Therefore, optimization of the objective function can be implemented efficiently.

slicer.org[edit | edit source]

example from https://www.slicer.org/wiki/Coordinate_systems

However different medical applications use different definitions of this 3D basis. Most common are the following bases:

  • LPS (Left, Posterior, Superior) is used in DICOM images and by the ITK toolkit

[math] LPS = \begin{Bmatrix} \text{from right towards left} \\ \text{from anterior towards posterior} \\ \text{from inferior towards superior} \end{Bmatrix} [/math]

  • RAS (Right, Anterior, Superior) is similar to LPS with the first two axes flipped and used by 3D Slicer

[math] RAS = \begin{Bmatrix} \text{from left towards right} \\ \text{from posterior towards anterior} \\ \text{from inferior towards superior} \end{Bmatrix} [/math]

Both bases are equally useful and logical. It is just necessary to know to which basis an image is referenced.

References[edit | edit source]

  1. This SO thread summarizes some of the history of the Math and SimpleMathJax extensions https://stackoverflow.com/questions/29387372/how-to-embed-maths-in-mediawiki