Add a DPI calculator to help to find the correct image resolution.
[master-thesis.git] / Parasitemia / ParasitemiaCore / UnitsOfMeasure.fs
1 module ParasitemiaCore.UnitsOfMeasure
2
3 [<Measure>] type px // Pixel.
4 [<Measure>] type mm
5 [<Measure>] type μm
6 [<Measure>] type inch
7 [<Measure>] type ppi = px / inch // Pixel per inch.
8
9 let μmInchRatio = 25.4e3<μm/inch>
10 let mmInchRatio = 25.4<mm/inch>
11
12 let μmToInch(x: float<μm>) : float<inch> = x / μmInchRatio
13 let inchToμm(x: float<inch>) : float<μm> = x * μmInchRatio
14
15 let mmToInch(x: float<mm>) : float<inch> = x / mmInchRatio
16 let inchTomm(x: float<inch>) : float<mm> = x * mmInchRatio
17