packages/
.vs
*.exe
-*.suo
\ No newline at end of file
+*.suo
+Images
+Scripts
let imageSourceSelection = Views.ImageSourceSelection (Tag = srcImg, Margin = Thickness 3.)
imageSourceSelection.Tag <- srcImg
- imageSourceSelection.txtImageNumber.Text <- string srcImg.Num
+ imageSourceSelection.txtImageNumber.Text <- string srcImg.RomanNum
let height = srcImg.Img.Height * width / srcImg.Img.Width
imageSourceSelection.imagePreview.Source <- BitmapSourceConvert.ToBitmapSource (srcImg.Img.Resize (width, height, Emgu.CV.CvEnum.Inter.Cubic))
imageSourceSelection.chkSelection.IsChecked <- Nullable<bool> (srcImg.DateLastAnalysis.Ticks = 0L)
for srcImg, selected, parameters in imagesParameters do
srcImg.Config.Parameters <- parameters // Save parameters.
if selected then
- yield string srcImg.Num, srcImg.Config, srcImg.Img
+ yield string srcImg.RomanNum, srcImg.Config, srcImg.Img
]
if imagesToProcess.IsEmpty then
match maybeResults with
| Some results ->
for id, cells in results do
- state.SetResult (int id) cells
+ state.SetResult id cells
Logger.Log.Info "All analyses terminated successfully"
atLeastOneAnalysisPerformed <- true
analysisPerformed <- true
updateGlobalParasitemia ()
// Update image numbers.
- win.stackPreviews.Children |> Seq.cast<Views.ImageSourcePreview> |> Seq.iter (fun imgPreview -> imgPreview.txtImageNumber.Text <- (imgPreview.Tag :?> SourceImage).Num.ToString ())
+ win.stackPreviews.Children |> Seq.cast<Views.ImageSourcePreview> |> Seq.iter (fun imgPreview -> imgPreview.txtImageNumber.Text <- (imgPreview.Tag :?> SourceImage).RomanNum)
)
imgCtrl.Tag <- srcImg
- imgCtrl.txtImageNumber.Text <- string srcImg.Num
+ imgCtrl.txtImageNumber.Text <- string srcImg.RomanNum
let width = 200
let height = srcImg.Img.Height * width / srcImg.Img.Width
imgCtrl.imagePreview.Source <- BitmapSourceConvert.ToBitmapSource (srcImg.Img.Resize (width, height, Emgu.CV.CvEnum.Inter.Cubic))
let infectedRBColor = Color.FromRgb (255uy, 0uy, 40uy) // Red with a bit of blue.
let updateAverageRBCSize () =
- averageRBCSize <-
- rbcs
- |> List.collect (fun rbc -> [ rbc.size.Width; rbc.size.Height ])
- |> List.average
+ if List.isEmpty rbcs |> not then
+ averageRBCSize <-
+ rbcs
+ |> List.collect (fun rbc -> [ rbc.size.Width; rbc.size.Height ])
+ |> List.average
do
updateAverageRBCSize ()
member this.Num with get () = num and set value = num <- value
+ member this.RomanNum = Utils.toRomanNumber this.Num
+
member this.Name with get () = name and set value = name <- value
member this.Config = config
member this.RBCs
with get () = rbcs
- and set value = rbcs <- value
+ and set value =
+ rbcs <- value
+ updateAverageRBCSize ()
member this.ImageParasitemia : int * int =
List.length rbcs,
srcImg.Name <- name
alteredSinceLastSave <- true
- member this.SetResult (imgNum : int) (result : ParasitemiaCore.Types.AnalysisResult) =
- let sourceImage = sourceImages.Find (fun srcImg -> srcImg.Num = imgNum)
+ member this.SetResult (imgId : string) (result : ParasitemiaCore.Types.AnalysisResult) =
+ let sourceImage = sourceImages.Find (fun srcImg -> srcImg.RomanNum = imgId)
let w = sourceImage.Img.Width
let h = sourceImage.Img.Height
saveSensorSizesToFile defaultSensorSizes
defaultSensorSizes
+let toRomanNumber (v : int) : string =
+ let rec decompose (v : int) : string =
+ if v >= 1000 then
+ "M" + decompose (v - 1000)
+ elif v >= 900 then
+ "CM" + decompose (v - 900)
+ elif v >= 500 then
+ "D" + decompose (v - 500)
+ elif v >= 400 then
+ "CD" + decompose (v - 400)
+ elif v >= 100 then
+ "C" + decompose (v - 100)
+ elif v >= 90 then
+ "XC" + decompose (v - 90)
+ elif v >= 50 then
+ "L" + decompose (v - 50)
+ elif v >= 40 then
+ "XL" + decompose (v - 40)
+ elif v >= 10 then
+ "X" + decompose (v - 10)
+ elif v >= 9 then
+ "IX" + decompose (v - 9)
+ elif v >= 5 then
+ "V" + decompose (v - 5)
+ elif v >= 4 then
+ "IV" + decompose (v - 4)
+ elif v >= 1 then
+ "I" + decompose (v - 1)
+ else
+ ""
+ decompose v
+
let argsHelp =
let programName = System.AppDomain.CurrentDomain.FriendlyName
"Usage of Parasitemia:\n" +