Material
Spinal Canal Dataset
https://data.mendeley.com/datasets/k57fr854j2/2
Published:3 April 2019
Sudirman, Sud; Al Kafri, Ala; Natalia, Friska; Meidia, Hira; Afriliana, Nunik; Al-Rashdan, Wasfi; Bashtawi, Mohammad; Al-Jumaily, Mohammed (2019), “Lumbar Spine MRI Dataset”, Mendeley Data, V2, doi: 10.17632/k57fr854j2.2
This dataset contained an anonymous clinical MRI study or a set of scans of 515 patients with symptomatic back pain. Each patient’s data can have one or more associated MRI studies. Each study contained slices (i.e., individual images taken from either the sagittal or axial view) of the lowest three vertebrae and three IVDs. The axial view slices were mainly taken from the last three IVDs, including those between the last vertebrae and sacrum. The orientation of the slices of the last IVD is made to follow the spine curve, whereas those of the other IVDs are made in blocks, that are parallel to each other. There are between four and five slices per IVD, and they begin from the top of the IVD towards the bottom. Many of the top and bottom slices cut through the vertebrae, leaving between one and three slices that cut the IVD cleanly and show purely the image of that IVD. Generally, the total number of slices in the axial view ranges from 12 to 15.
Intervertebral Foramen Dataset
We used the intervertebral foramina MRI dataset collected from Radiopaedia (a non-profit international collaborative radiology education website). The dataset contains sagittal spine MRI data of approximately 40 subjects of different ages and sexes, and included T1-weighted and T2-weighted MRI images. In addition, the sagittal spine MRI data of each patient had approximately 15 to 20 sagittal slices, and not every sagittal slice had a part that cut into the intervertebral foramen; thus, we manually selected sagittal sections that had been cut into the foramen.
Flowchart of Spinal Canal Verification and Identification
We Verification and Identification Spinal Canal MRI, Figure 1 is the flowchart.
Data Preprocessing
We used the spinal canal MRI dataset and a marked spinal canal area segmentation mask to train the spinal canal area segmentation model. There were 515 subjects; each subject had an original spinal canal MRI image and a marked ground truth. Three hundred MRI images in the dataset were selected as the training dataset and 100 as the testing dataset, and the remaining 115 images were used as the validation dataset.
Data Annotation By CVAT
We used CVAT[12] to mark the spinal canal, intervertebral disc, and facet joint in the spinal MRI images; the marking format was a segmentation mask[13]. A marked segmentation mask is used as the ground truth, which is required for the training and verification of the spinal canal segmentation model.
Segmentation Model Training
The spinal canal segmentation model was trained on an RTX 1660Ti GPU with 16 GB of RAM and implemented in Python. We used Python libraries, such as TensorFlow, matplotlib, and cv2. The size of the spinal canal image was 320 × 320, and we needed to identify three parts: the spinal canal, intervertebral disc, and facet joints, and thus the model parameters were set to width=320, height=320, and class=3.
Image Segmentation
Input the image to be tested and use the trained segmentation model to identify the area of the spinal canal in the image and finally store the recognition result in the form of a segmentation mask.
Calculate IOU
IOU[14] was used as a standard to measure the accuracy of the model. The IOU is calculated by dividing the intersection of the recognition result and ground truth by the union of the recognition result and ground truth. The larger the IOU, the better the model performance.
The formula is as follows.
Calculate Area
The MRI image has an important parameter: the field of view (FOV). FOV is the shooting range set during MRI shooting, that is, the actual length and width of the image.
We used the FOV value of the spinal canal MRI image to convert the actual size (mm2) of each pixel in the identification result, calculated the number of pixels in the spinal canal part of the identification result, and finally multiplied the number of pixels in the spinal canal part by the actual size of each pixel to obtain the cross-sectional area of the spinal canal of the subject.
Flowchart of Intervertebral Foramen Verification and Identification
We Verification and Identification Intervertebral Foramen MRI, Figure 2 is the flowchart.
Data Preprocessing
The intervertebral foramen dataset contained 40 different subjects, and the aspect ratio and size of each MRI image were slightly different; therefore, we resized each image to a size of 416 × 416.
In addition, we performed Data Augmentation. Appropriate Data Augmentation can avoid overfitting during training. The Data Augmentation process uses the original 80 MRI images to generate an additional 80 images. The generation method involves randomly rotating the original image, changing the hue, and randomly changing the brightness.
Random rotation:
Image will randomly rotate at -10~10˚.
Change hue randomly:
Image hue will be randomly changed at -0.1~0.1.
Change brightness randomly
Image brightness will be randomly changed at 1~1.25.
Data annotation by LabelImg
We used LabelImg, an image-labeling tool, to label the rectangular region where the intervertebral foramen is located. We used the YOLO[15] format to annotate all the data in the dataset. The only marked class was the intervertebral foramen.
Intervertebral foramen Localization Model Training
The annotated dataset was divided into 75% for training and 25% for validation, and it was trained on YOLOV4 with 64 batches, a 0.001 learning rate, and 6000 max_batches. You Only Look Once (YOLO) is a one-stage object detection algorithm that was developed by Redmon in 2015. YOLOV4, released in 2020, is fast and accurate, and one of the best object detection algorithms.
Data annotation by CVAT
We used the CVAT to mark the intervertebral foramen in the MRI image, and the marking format was a segmentation mask. The marked segmentation mask was used as the ground truth, which is required for the training and verification of the intervertebral foramen segmentation model.
Segmentation Model Training
The intervertebral foramen segmentation model was trained on an RTX 1660Ti GPU with 16 GB of RAM and implemented in Python. We used Python libraries, such as TensorFlow, matplotlib, and cv2. We only needed to identify the intervertebral foramen; therefore, the model input parameter setting class =1.
Intervertebral Foramen Detection
The MRI image was input and the trained YOLOV4 model was used to detect the intervertebral foramen in the image. After determining the intervertebral foramen, the area containing the intervertebral foramen was cropped into independent rectangular sub-images.
Image Segmentation
Read the rectangular sub-images cut for Intervertebral Foramen Detection, use the trained segmentation model to identify the intervertebral foramen area in each sub-image, and finally store the recognition results in the form of a segmentation mask.
Morphology Processing
The results identified by the segmentation model often have noise or holes[16], which affect the accuracy of the area calculation. Therefore, we used opening and closing operations to refine the identified result.
Calculate IOU
We used the same method as in Calculate IOU (Spinal Canal) to calculate the intervertebral foramina IOU as an indicator to verify the accuracy of the model.
Calculate Area
We used the same method as in Calculate Area (Spinal Canal) to calculate the actual size of the intervertebral foramina (mm2).