image annotateImages

Medical Imaging: Highlighting Anomalies with Missing Data

Scénario de test & Cas d'usage

Business Context

A radiologist is reviewing a batch of brain MRI scans. A preliminary AI model has identified potential anomalies (e.g., tumors) and marked their centers with coordinates. However, not all scans have anomalies. This scenario tests the robustness of `annotateImages` when some images have no corresponding annotation data (missing values).
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Create a table of MRI scans. Some scans have coordinates for anomalies, while others have a missing value in the points column, simulating scans with no detected issues.

Copied!
1DATA casuser.mri_scans;
2 LENGTH patient_id $15 _points_ $100 scan_date $10;
3 patient_id = 'P001'; scan_date = '2023-10-25'; _points_='x:256,y:250'; OUTPUT;
4 patient_id = 'P002'; scan_date = '2023-10-26'; _points_=''; OUTPUT; /* Missing annotation */
5 patient_id = 'P003'; scan_date = '2023-10-27'; _points_='x:128,y:300;x:400,y:150'; OUTPUT;
6 patient_id = 'P004'; scan_date = '2023-10-28'; _points_='.'; OUTPUT; /* Missing annotation */
7RUN;

Étapes de réalisation

1
Load the MRI scan data into a CAS table.
Copied!
1PROC CAS;
2 TABLE.loadTable /
3 caslib='casuser' path='mri_scans.sashdat'
4 casOut={name='mri_scans_input', caslib='casuser', replace=true};
5QUIT;
2
Run `annotateImages` to mark anomalies with bright yellow points. The action should gracefully handle the rows where the `_points_` column is missing.
Copied!
1PROC CAS;
2 image.annotateImages /
3 TABLE={name='mri_scans_input', caslib='casuser'}
4 casOut={name='mri_scans_annotated', caslib='casuser', replace=true}
5 copyVars={'patient_id'}
6 annotations=[
7 {annotation={annotationType='POINTS', r=255, g=255, b=0, thickness=5, representation={representationType='SINGLE_COLUMN', columnName='_points_'}}}
8 ];
9QUIT;

Expected Result


The action should execute without errors. The output table `mri_scans_annotated` will contain all four images. The images for patients P001 and P003 will have bright yellow points marking the anomalies. The images for patients P002 and P004, which had missing annotation data, will be present but unaltered. This confirms the action's stability with incomplete annotation data.