A demo for NPDS calculation

The purpose of this online tool is to demonstrate how the NPDS method, proposed in the referenced paper "A Novel Statistic Guided by Clinical Experience for Assessing the Progression of Lung Nodules", can be used to determine whether a lung nodule has progressed or not.
We have prepared two CT images of nii format for illustration, which includes a total of five steps to obtain the NPDS value and its corresponding $P-$value.

  • Step 1 : Import the necessary package for calculating NPDS.
In [1]:
from NPDSlib import NPDS_Hypothesis_Testing as NPDS_HT
  • Step 2 : Prepare nii CT data paths, nodule coordinates, and nodule diameter.
In [2]:
# CT paths
baseline_CT_nii_path = './Data/patient1_baseline.nii.gz'
followup_CT_nii_path = './Data/patient1_followup.nii.gz'
# nodule position and diameter in follow-up CT
X=129
Y=288
range_Z = '122-141'
diameter = 12 # unit mm

The coordinates ("X","Y") represent the center of the nodule.
The "range_Z" represents the nodule's coverage along the Z-axis.
The "diameter" represents the maximum diameter of the nodule, measured in millimeters (mm).

  • Step 3 : Initialization.
In [3]:
nodule_progress_detector = NPDS_HT(X, Y, range_Z, diameter, baseline_CT_nii_path, followup_CT_nii_path)
baseline CT size : (447, 512, 512)
follow-up CT size : (520, 512, 512)
Initialization complete.
  • Step 4 : Preprocess baseline CT and follow-up CT (registration and lung mask extraction).

The registration between the two CT scans is performed using the classical Elastix algorithm.
When performing the registration, it is important to ensure that the slice thickness of the two CT scans does not differ significantly.

In [4]:
nodule_progress_detector.registration_by_elastix()
Running registration algorithm...
Registration complete.
baseline CT size : (520, 512, 512)
follow-up CT size : (520, 512, 512)

Extract the lung mask for excluding any noise outside the lung tissue.

In [5]:
nodule_progress_detector.get_segmented_lungs()
Running lung mask extraction ...
Lung mask extraction complete.

Visualize the preprocessed basline CT slices as a GIF.

In [6]:
nodule_progress_detector.visualize_ct_slices_as_gif(nodule_progress_detector.bf_sub_image, gif_path='./Data/baseline_CT_slices_example.gif')

Visualize the preprocessed follow-up CT slices as a GIF.

In [7]:
nodule_progress_detector.visualize_ct_slices_as_gif(nodule_progress_detector.af_sub_image, gif_path='./Data/followup_CT_slices_example.gif')

As illustrated in the GIF images of the two CT scans above, the nodule enclosed by the red anchor box shows significant progression in the follow-up scan compared to the baseline scan.

  • Step 5 : NPDS calculation and hypothesis testing.

Calculate the NPDS-index.

In [8]:
nodule_progress_detector.NPDS_calculate()

Hypothesis testing.

In [9]:
nodule_progress_detector.hypothesis_test_by_ClinvNod_sample()
NPDS : 0.2347265625
 Progression Prediction Result : True
 p_value : 0.0109708446

Conclusion

From Step 5, it can be observed that the nodule's NPDS is $0.2347$ . At a 5% significance level, the hypothesis testing result indicates that the nodule is progressive, with a $P-$value of $0.01 < 0.05$.

How to construct your own NPDS ?

The purpose of this online tool is to statically demonstrate the process of NPDS calculation and hypothesis testing. If you want to use your own CT images to construct NPDS, please download the code and its dependencies from https://github.com/hangyustat/NPDS, which will enable you to calculate NPDS on your own PC.
Before that, make sure :

  • Your CT images are in NIfTI (.nii) or compressed NIfTI (.nii.gz) format. If they are in DICOM format, please convert them to NIfTI first.
  • The slice thickness of the two CT scans is similar and the entire lung tissue in images is clear and free of noise.
  • The nodule's center coordinates (X,Y), Z-axis range, and maximum diameter (mm) have already been measured and recorded.
In [ ]: