ec343eaaf83df55272bb16ff9ae4ae1d24b2f474
[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 μmPerInch = 25.4e3<μm/inch>
10 let mmPerInch = 25.4<mm/inch>
11
12 let μmToInch(x: float<μm>) : float<inch> = x / μmPerInch
13 let inchToμm(x: float<inch>) : float<μm> = x * μmPerInch
14
15 let mmToInch(x: float<mm>) : float<inch> = x / mmPerInch
16 let inchTomm(x: float<inch>) : float<mm> = x * mmPerInch
17