D10, D50, D90 Partical Size Distribution calculation in Image-Pro
D10, D50 and D90 is a common Particle Size Distribution (PSD) standard used among pharma customers.
For instance, D50 gives the diameter median value of the size distribution, which means diameter at 50% in the cumulative distribution.
As we cannot do the complete calculation in Image-Pro, is there any way we can perform the complete calculation and the graph generation in Image-Pro for D10, D50 and D90 particle size distribution.Thank you!
0
Answers
-
Hi Brijeshwar,
Statistical values of Median (D50), D90 and D10 will be available in the next version of Image/Pro.
In the current version you can use the following macro to get percentile stats of the measurements on the active image (e.g. Diameter):<pre> Public Sub PrintPercentileStats Dim im As McImage=ThisApplication.ActiveImage If im Is Nothing Then Exit Sub Dim md As MediaCy.Addins.Measurements.McMMData=im.MeasurementsData If md.SubFeatures.Count=0 Then Exit Sub' no measurements Dim vals As New System.Collections.ArrayList 'get diameter measurements (change for other measure if necessary) Dim measure As eMeasures=eMeasures.RgnMeanDiameter For Each sf As McMMSubFeature In md.SubFeatures vals.Add(sf.Value(measure)) Next 'measure 3 percentiles Dim percentiles As Double()={10,50,90} For Each p As Double In percentiles Debug.Print (String.Format("D{0} of {1} = {2}",p,measure.ToString,GetPercentileValue(vals.ToArray(),p))) Next End Sub Public Function GetPercentileValue(vals As Object, Percentile As Double) As Object If vals Is Nothing Then Return 0 If Not IsArray(vals) Then Return vals End If Dim inLength As Integer = vals.GetUpperBound(0) + 1 System.Array.Sort(vals) 'sort Dim ind As Integer = System.Math.Round(Percentile * inLength / 100, 0, System.MidpointRounding.AwayFromZero) - 1 ind = System.Math.Max(0, ind) ind = System.Math.Min(inLength - 1, ind) Return vals(ind) End Function </pre>
the result will look like this:D10 of RgnMeanDiameter = 14,6595344023042 D50 of RgnMeanDiameter = 17,6075513462399 D90 of RgnMeanDiameter = 21,3247373718319
Yuri0 -
Hello Yuri,
I have tested the macro shared by you and I am facing the below attached error in the code, kindly guide me to resolve this issue.
Thank you!
0 -
Hi Brijeshwar,
You have to remove <pre> tags, before and after.
Yuri0 -
Hello Yuri,
I have tested the macro after removing <pre> tags, before and after from the code still I am facing the same error.
Please find attached screenshot for your ready reference.
Thank you!0 -
Hi Brijeshwar,
It looks like you pasted the code into a wrong place, outside the Module block. Try to paste these 2 functions in the Module block. If you don't see that, create a new project.
Yuri0 -
Hi Yuri,
I have created a new project and I have pasted the code in the new project, and now I am facing a new error.
Please find below screenshot for your ready reference.
Thank you!0 -
Hi Brijeshvar,
It looks like you pasted the macro to a wrong file, you should paste it to Module.vb, not Macro.ipp.
You may load one of the existing projects, as example and see where all macros are located.
Yuri
0 -
Hi Yuri,
I have pasted the macro to Module.vb, and still I am facing the error.
Thank you!0 -
Hi Brijeshwar,
Sorry for making it difficult, I will come back from vacation on Thursday and post the complete project with these 2 macros.
Regards,
Yuri
0 -
Hi Brijeshwar,
I've created a project that includes these macros. You can just unzip the attached file and load PercentileStats.ipx project to Image-Pro. Then you can run the PrintPercentileStats macro and the values (D10,D50,D90) will be printed to the Output window:
Let me know if you have questions,
Regards,
Yuri0 -
Hi Yuri,
Thank you for sharing the macro project, now its working.
Thank you!
Regards,
Brijeshwar0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions