Skip to content

ray-lee-94/dclp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codes and models for the AIOC paper

This code contains the interface to diagnose CL (Cleft Lip) and CLP (Cleft Lip and Palate) from normal conditions.

1. Environment

To activate the environment, run the following command:

Make sure you have Conda installed before proceeding.

Python & Package Versions

  • Python: 3.11
  • PyTorch: 1.12.0
  • ONNX Runtime: 1.8.1

1.1 Create and activate the Conda environment:

conda create -n clp python=3.11 -y
conda activate clp
conda install pip -y
pip install -r requirements.txt

2. Main function

The main function is provided in dclp.py.

3. Tutorial

Here's a tutorial on how to use the interface:

from dclp_tool import DCLP
import glob
dclp=DCLP() 
p_images=glob.glob("/path-to-the-images/*.png")

result=dclp.detect_and_classify(p_images)
print(result["Diagnosis"]) # the diagnosis information

The result is a dictionary that contains:

  • "Diagnosis" A dictionary that indicates the diagnosis.

  • "Support" The classification results of all images.

  • "Det_imgs"

    • The images are plotted with anatomical structures.
    • Normal anatomy is indicated with a green box.
    • Abnormal anatomy is indicated with a red box.

4. Clinical information

Plane type

Chinese Name English Name Abbreviation
正常鼻唇冠状切面 Normal Lip View NLV
正常上牙槽切面 Normal Alveolar and Palate View NAPV
异常鼻唇切面 Cleft Lip View CLV
异常上牙槽切面 Cleft Alveolar and Palate View CAPV

Normal anatomical structures

Chinese Name English Name Abbreviation
上唇 Upper Lip UL
鼻子 Nose N
鼻孔 Nostrils No
下唇 Lower Lip LL
下巴 Chin C
牙槽 Alveolus A

Abnormal anatomical structures

Chinese Name English Name Abbreviation
异常上唇 Cleft Lip CL
异常上牙槽 Cleft Alveolus CA
异常继发腭 Cleft Palate CP

5. Map informaiton

1. Mapping of classification:

Code Description
0 Normal Alveolar and Palate View (NAPV)
1 Normal Lip View (NLV)
2 Cleft Lip View (CLV)
3 Cleft Alveolar and Palate View (CAPV)

2. Here is the detailed mapping for normal and abnormal anatomy structures:

Normal anatomy

ID Description
61 Nostrils (No)
62 Upper lip (UL)
63 Nose (N)
64 Lower lip (LL)
65 Chin (C)

Abnormal anatomy

ID Description
163 Cleft alveolar (CA)
164 Cleft lip (CL)
166 Cleft palate (CP)
167 CL_ROI

6. Double list

This list contains ID that may appear more than once:

double_list = [61]

7. Diagnosis logic

The following code snippet demonstrates the logic used to determine the diagnosis based on the classification results:

def diagnose(cls_set, cls_list):
    p_result = {}
    
    exists_BC = any(element for element in cls_set if element in set(["NLV", "CLV"]))
    exists_SYC = any(element for element in cls_set if element in set(["NAPV", "CAPV"]))

    if exists_BC and exists_SYC:
        if "CLV" in cls_list and "CAPV" in cls_list:
            p_result["Diagnosis"] = {"Abnormal": "CLP"}
        elif "CLV" not in cls_list and "CAPV" in cls_list:
            p_result["Diagnosis"] = {"Normal": "Normal"}
        elif "CLV" in cls_list and "CAPV" not in cls_list:
            p_result["Diagnosis"] = {"Abnormal": "CL"}
        elif "CLV" not in cls_list and "CAPV" not in cls_list:
            p_result["Diagnosis"] = {"Normal": "Normal"}
    elif exists_BC and not exists_SYC:
        p_result["Diagnosis"] = {"Uncertain": "without alveolar&palate view"}
    elif not exists_BC and exists_SYC:
        p_result["Diagnosis"] = {"Uncertain": "without lip view"}
    elif not exists_BC and not exists_SYC:
        p_result["Diagnosis"] = {"invalid": "no lip view and no alveolar&palate view"}

    return p_result

Diagnosis logic table

Condition Diagnosis
exists_BC and exists_SYC Valid input
exists_BC and not exists_SYC Uncertain: without alveolar&palate view
not exists_BC and exists_SYC Uncertain: without lip view
not exists_BC and not exists_SYC Invalid: no lip view and no alveolar&palate view

Valid input diagnosis

Condition Diagnosis
If "CLV" in cls_list and "CAPV" in cls_list: Abnormal: CLP
If "CLV" not in cls_list and "CAPV" in cls_list: Normal: Normal
If "CLV" in cls_list and "CAPV" not in cls_list: Abnormal: CL
If "CLV" not in cls_list and "CAPV" not in cls_list: Normal: Normal

8. Models download

google drive link

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors