المنهجية العلمية
الحالة الحالية: عتبات الصبغة الفسفورية مضبوطة على 8 صور حقيقية (كاميرا Nikon D7100، بدقة
6000×4000)، ولم تُقارَن بعدُ بتحديد يدوي من خبير. وعتبات الصبغة الزرقاء أو الوردية مبنية على الألوان المعروفة
لهذه الصبغات، ولم تُضبط بعدُ على صور حقيقية. لذلك تُعدّ النتائج بحثية، ويُنصح بمراجعة التلوين في كل صورة.
1. معادلة النسبة
Plaque % = plaque pixels ÷ (tooth pixels + plaque pixels) × 100
تُحسب النسبة من البكسلات الواقعة داخل منطقة الأسنان فقط. وكل بكسل خارج المنطقة (اللثة، والشفاه، واللسان، والخلفية) يُستبعد.
و"مساحة الأسنان" هي عدد كل البكسلات داخل المنطقة بأي لون. ويجري الحساب دائماً على الصورة الأصلية بدقتها الكاملة،
بعد إعادة رسمها داخل المتصفح (فتُحذف بيانات EXIF). أما أوضاع العرض المحسّنة فهي للمشاهدة فقط ولا تدخل الحساب.
2. تصنيف البكسل
- تُحوَّل الصورة إلى فضاء الألوان HSV (ويُسمّى أيضاً HSB) بمكتبة OpenCV.js 4.10.0.
- إذا وقع البكسل ضمن مدى اللويحة يُحتسب لويحة، وإلا فإذا وقع ضمن مدى السن يُحتسب سناً. أي أن اللويحة لها الأولوية عند تداخل المديين.
- إذا كانت القيمة الدنيا للون (H) أكبر من القيمة القصوى، فإن المدى يلتف حول اللون الأحمر.
3. العتبات الافتراضية لكل نوع صبغة
المقياس الأول هو مقياس OpenCV (اللون من 0 إلى 179). والمقياس الثاني هو مقياس ImageJ (اللون من 0 إلى 255)،
ويُحسب بالمعادلة H(ImageJ) = H(OpenCV) × 255 ÷ 180 مع التقريب، لذلك قد يختلف بمقدار ±1. التشبّع (S) والسطوع
(V) من 0 إلى 255 في المقياسين.
| نوع الصبغة | الفئة | اللون H (OpenCV) | اللون H (ImageJ) | التشبّع S | السطوع V |
| صبغة فسفورية تحت الأشعة فوق البنفسجية | السن | 94–116 | 133–164 | 0–255 | 80–255 |
| اللويحة | 56–93 | 79–132 | 100–255 | 40–255 |
| صبغة زرقاء أو وردية | السن | 0–179 | 0–255 | 0–70 | 110–255 |
| اللويحة | 100–172 | 142–244 | 50–255 | 40–255 |
| أسنان سليمة (بدون لويحة) | لا تُستخدم عتبات: تُحسب مساحة منطقة الأسنان فقط. |
يستطيع الباحث تعديل العتبات من المنصة، وتُسجَّل العتبات المستخدمة فعلاً في ملف النتيجة (CSV) مع كل تحليل.
4. استبعاد الصبغة الواقعة على اللثة (الصبغة الفسفورية فقط)
تتوهج الصبغة الفسفورية على اللثة أيضاً، لكن توهجها هناك أضعف بوضوح من توهجها على سطح السن. لذلك يُقارَن كل بكسل أخضر
بسطوع الأسنان المحيطة به، وليس برقم سطوع ثابت، فتُعامَل الجهة المظلمة من الصورة مثل الجهة المضيئة دون تعديل أي بكسل:
- تُبنى خريطة "السطوع المحلي للسن": متوسط سطوع بكسلات السن المحيطة بكل نقطة، بمرشح غاوسي على نسخة مصغّرة (أطول ضلع 1500 بكسل، والانحراف المعياري = عرض الخريطة ÷ 60).
- UV_NEAR = 0.08: يجب أن يكون البكسل قريباً من سن، أي أن نسبة بكسلات السن الموزونة حوله أكبر من 0.08.
- UV_RATIO = 0.4: يجب أن يكون سطوع البكسل الأخضر 40% على الأقل من السطوع المحلي للسن.
- البكسل الأخضر الذي لا يحقق الشرطين لا يُحتسب لويحة ولا سناً.
5. التحديد التلقائي للأسنان
- الصبغة الفسفورية: لبّ السن هو البكسلات الزرقاء (H 94–116) الأسطع من عتبة Otsu. ثم يُضاف كل بكسل لونه بين الأخضر والأزرق (H 40–130) قريب من السن وسطوعه 50% على الأقل من السطوع المحلي للسن (UV_EDGE_RATIO = 0.5)، وما دون ذلك يُعدّ لثة. بعدها تُزال النتوءات الرفيعة والكتل البعيدة عن الأسنان.
- الصبغة الزرقاء أو الوردية والأسنان السليمة: في فضاء Lab تُستبعد البكسلات الداكنة بعتبة Otsu على السطوع (L)، ثم يُفصل السن عن اللثة والشفاه الحمراء بعتبة Otsu على القناة a*. ومع الصبغة تُضاف البكسلات المائلة إلى الأزرق (b* ≤ 130) حتى تبقى اللويحة المصبوغة داخل منطقة السن.
- تُحوَّل النتيجة إلى مضلعات بنقاط قابلة للتعديل يدوياً. وتعمل الخوارزمية على نسخة لا تتجاوز 8 ميغابكسل، أما الحساب فيجري على الصورة الأصلية كاملة.
- الأسنان الأمامية فقط (الخيار الافتراضي): 6 أسنان علوية و6 سفلية من الناب إلى الناب. يُحدَّد خط المنتصف من أعرض قاطعين متجاورين متشابهين، ويقع حد الناب على مسافة 2.4 × عرض القاطع المركزي في الفك العلوي، و1.95 × في الفك السفلي، ثم يلتصق بأقرب فراغ بين سنّين. والحد ليس خطاً مستقيماً: يُحسب له مسار منحنٍ يمر بأقل بكسلات السن (برمجة ديناميكية صفاً بصف)، فيتبع الفراغ الطبيعي بين الناب والضاحك من حافة اللثة إلى خط الفكين، ولا يقطع من الناب ولا يضم جزءاً من الضاحك. ويمكن سحب الحد كاملاً من مقبضه عند حافة الفك فيلتصق بفراغ آخر، أو تعديل تعرّجه يدوياً من نقاطه. والقص بقاعدة واحدة: يُحتسب البكسل (بمركزه) فقط إذا وقع بين حدّي فكّه، ويتحدد الفك بخط الفكين. والقاعدة نفسها تبني قناع الحساب وترسم الخط الأزرق، فالمنطقة المرسومة هي المحتسبة بالضبط، ولا يدخل أي ضاحك أو رحى.
- فصل الفكين (اختياري): خط يمر بأغمق مسار ناعم بين الفكين (برمجة ديناميكية)، ويمكن تعديله يدوياً. ومجموع الفكين يساوي الإجمالي دائماً.
6. الأدوات اليدوية
- تعديل حدود المنطقة: سحب النقاط وإضافتها وحذفها.
- ممحاة اللثة: تستبعد الموضع الممسوح من الحساب نهائياً، حتى لو كان لونه أخضر.
- فرشاة السن: تضيف جزءاً معتماً من السن. داخلها يُحتسب لون اللويحة لويحةً حتى لو كان مظلماً (السطوع ≥ 25)، وأي لون آخر يُحتسب سناً.
- فرشاة اللويحة: تُحتسب كل بكسلاتها لويحةً بقرار الباحث، بصرف النظر عن اللون.
- يُسجَّل عدد بكسلات الفرشاتين في النتيجة وفي ملفات CSV والسجل، حتى يُعرف حجم التعديل البشري في كل نتيجة.
7. طريقة الاستشهاد
استخدم رقم الإصدار المكتوب في أسفل المنصة عند إجراء التحليل:
Sahib A. Dental Plaque Analyzer (version 1.2.1) [web application]. 2026. Available from: https://dentalplaqueanalyzer.com/
8. سجل الإصدارات
- 1.2.1 (2026-11-26): إصلاح: إذا وقع التقدير الأولي لحد الناب خارج أسنان فكّه، يُعاد إلى حافة أسنان ذلك الفك بدلاً من حافة منطقة الأسنان كلها. وإذا لم توجد أسنان كافية حول الحد، يبقى خطاً مستقيماً بـ 13 نقطة حتى تظهر كل مقابضه.
- 1.2.0 (2026-11-26): الخط الأزرق أصبح حدود قناع الحساب نفسه بعد قص الأسنان الخلفية، بعد أن كان يحيط بمنطقة الأسنان كاملة مع الضواحك المستبعدة. والقص صار بقاعدة واحدة لكل بكسل بدلاً من رسم مضلعات، فلا يبقى أي بكسل خارج الحدين. وأصبحت الدائرة تعدّل التعرّج مثل باقي النقاط، ونُقل تحريك الخط كاملاً إلى مقبض عند حافة الفك. قد تتغير الأرقام ببضعة بكسلات فقط مقارنة بالإصدار السابق.
- 1.1.1 (2026-11-26): إصلاح: حد الناب لا يلتصق إلا بفراغ قريب (أقل من نصف عرض سن)، فلا يقفز خلف الضاحك ويدخله في الحساب، ولا يقطع من الناب. وأصبحت على كل حد نقاط صغيرة على طوله لتعديل تعرّجه يدوياً.
- 1.1.0 (2026-11-26): حدود الأنياب صارت منحنية تتبع الفراغ الطبيعي بين الناب والضاحك بدلاً من خط مستقيم. قد تتغير مساحة الأسنان ونسبة اللويحة قليلاً مقارنة بالإصدار السابق.
- 1.0.0 (2026-11-25): الإصدار الأول المنشور.
Methodology
Current status: the fluorescent-dye thresholds were calibrated on 8 real photographs (Nikon D7100,
6000×4000) and have not yet been compared with manual annotation by an expert. The blue or pink dye thresholds are based on the
known colors of these dyes and have not yet been calibrated on real photographs. The results are therefore for research use, and
reviewing the overlay in every image is recommended.
1. Percentage formula
Plaque % = plaque pixels ÷ (tooth pixels + plaque pixels) × 100
The percentage is calculated only from pixels inside the teeth region. Every pixel outside the region (gums, lips, tongue,
background) is excluded. "Teeth area" is the number of all pixels inside the region, of any color. The calculation always runs on
the original image at full resolution, after it has been redrawn inside the browser (which removes EXIF metadata). Enhanced view
modes are for display only and are never used in the calculation.
2. Pixel classification
- The image is converted to the HSV color space (also called HSB) with OpenCV.js 4.10.0.
- A pixel inside the plaque range is counted as plaque; otherwise, a pixel inside the tooth range is counted as tooth. Plaque therefore takes priority when the two ranges overlap.
- If the minimum hue (H) is greater than the maximum, the range wraps around red.
3. Default thresholds for each dye type
The first scale is the OpenCV scale (hue 0–179). The second is the ImageJ scale (hue 0–255), calculated as
H(ImageJ) = H(OpenCV) × 255 ÷ 180 with rounding, so it may differ by ±1. Saturation (S) and brightness (V) range from 0 to 255
on both scales.
| Dye type | Class | Hue H (OpenCV) | Hue H (ImageJ) | Saturation S | Brightness V |
| Fluorescent dye under ultraviolet light | Tooth | 94–116 | 133–164 | 0–255 | 80–255 |
| Plaque | 56–93 | 79–132 | 100–255 | 40–255 |
| Blue or pink disclosing dye | Tooth | 0–179 | 0–255 | 0–70 | 110–255 |
| Plaque | 100–172 | 142–244 | 50–255 | 40–255 |
| Healthy teeth (no plaque) | No thresholds are used: only the area of the teeth region is measured. |
Researchers can adjust the thresholds in the platform, and the thresholds actually used are recorded in the result file (CSV) of every analysis.
4. Excluding dye on the gums (fluorescent dye only)
The fluorescent dye also glows on the gums, but much more weakly than on the tooth surface. Each green pixel is therefore compared
with the brightness of the surrounding teeth rather than with a fixed brightness value, so the darker side of the image is treated
like the brighter side without modifying any pixel:
- A "local tooth brightness" map is built: the mean brightness of the surrounding tooth pixels at every point, using a Gaussian filter on a downscaled copy (longest side 1500 pixels, standard deviation = map width ÷ 60).
- UV_NEAR = 0.08: the pixel must be close to a tooth, i.e. the weighted fraction of tooth pixels around it must exceed 0.08.
- UV_RATIO = 0.4: the brightness of the green pixel must be at least 40% of the local tooth brightness.
- A green pixel that does not meet both conditions is counted as neither plaque nor tooth.
5. Automatic teeth detection
- Fluorescent dye: the tooth core is the blue pixels (H 94–116) brighter than an Otsu threshold. Every pixel with a hue between green and blue (H 40–130) that is close to a tooth and at least 50% as bright as the local tooth brightness (UV_EDGE_RATIO = 0.5) is then added; anything darker is treated as gum. Thin spurs and blobs far from the teeth are then removed.
- Blue or pink dye, and healthy teeth: in the Lab color space, dark pixels are excluded with an Otsu threshold on lightness (L), and the tooth is then separated from the red gums and lips with an Otsu threshold on the a* channel. With the dye, bluish pixels (b* ≤ 130) are also added so that stained plaque stays inside the tooth region.
- The result is converted into polygons with manually editable points. The algorithm runs on a copy of at most 8 megapixels, while the calculation runs on the full original image.
- Anterior teeth only (default): 6 upper and 6 lower teeth, from canine to canine. The midline is taken from the widest pair of similar adjacent incisors, and the canine boundary lies 2.4 × the central incisor width from it in the upper jaw and 1.95 × in the lower jaw, snapped to the nearest gap between two teeth. The boundary is not a straight line: a curved path is calculated through the fewest tooth pixels (row-by-row dynamic programming), so it follows the natural gap between the canine and the premolar from the gingival margin to the line between the jaws, without cutting into the canine or including part of the premolar. The whole boundary can be dragged by its handle at the jaw edge to snap to another gap, or its shape can be adjusted manually with its points. The cut uses a single rule: a pixel (at its centre) is counted only if it lies between the two boundaries of its jaw, and the jaw is decided by the line between the jaws. The same rule builds the calculation mask and draws the blue line, so the outlined area is exactly the counted area, and no premolar or molar is included.
- Jaw separation (optional): a line following the darkest smooth path between the jaws (dynamic programming), which can be adjusted manually. The two jaws always add up to the total.
6. Manual tools
- Editing the region boundaries: dragging, adding and deleting points.
- Gum eraser: permanently excludes the erased area from the calculation, even if it is green.
- Tooth fill brush: adds a dimmed part of a tooth. Inside it, the plaque color is counted as plaque even if it is dark (brightness ≥ 25), and any other color is counted as tooth.
- Plaque brush: all of its pixels are counted as plaque by the researcher's decision, regardless of color.
- The pixel counts of both brushes are recorded in the result, the CSV files and the log, so the extent of human editing in every result is known.
7. How to cite
Use the version number shown at the bottom of the platform at the time of analysis:
Sahib A. Dental Plaque Analyzer (version 1.2.1) [web application]. 2026. Available from: https://dentalplaqueanalyzer.com/
8. Version history
- 1.2.1 (2026-11-26): fix: if the initial estimate of a canine boundary falls outside the teeth of its jaw, it is brought back to the edge of that jaw's teeth instead of the edge of the whole teeth area. If there are not enough teeth around a boundary, it stays a straight line with 13 points so that all its handles appear.
- 1.2.0 (2026-11-26): the blue line is now the border of the calculation mask itself after the back teeth are cut, instead of outlining the whole teeth area including the excluded premolars. The cut now uses a single per-pixel rule instead of drawn polygons, so no pixel remains outside the two boundaries. The circle now adjusts the shape like the other points, and moving the whole line is done with a handle at the jaw edge. Results may differ by only a few pixels compared with the previous version.
- 1.1.1 (2026-11-26): fix: a canine boundary now snaps only to a nearby gap (less than half a tooth width away), so it no longer jumps behind the premolar and includes it in the calculation, and it does not cut into the canine. Each boundary also has small points along it for adjusting its shape manually.
- 1.1.0 (2026-11-26): the canine boundaries are now curved and follow the natural gap between the canine and the premolar instead of a straight line. Teeth area and plaque percentage may change slightly compared with the previous version.
- 1.0.0 (2026-11-25): first published version.