image augmentImages

Edge Case: Robustness Test with Mixed-Quality Medical Scans and Invalid Data

Scénario de test & Cas d'usage

Business Context

A research hospital is augmenting a dataset of X-ray scans. The dataset is known to have quality issues: some images are too small, and some records have missing or corrupted image data due to data entry errors. The test must ensure the augmentation process is robust, handles errors gracefully without crashing, and correctly processes only the valid images.
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Create a dataset with mixed-quality data: one valid image, one image that is smaller than the intended crop size, one record with a null image, and one with invalid (text) data in the image column.

Copied!
1DATA casuser.medical_scans;
2 LENGTH patient_id $15. _image_ $200.;
3 INFILE DATALINES dsd dlm='|';
4 INPUT patient_id $ _dimension_ _resolution_ _image_ $;
5 DATALINES;
6PID-VALID-01|1024|1024|...valid_binary_xray_data...
7PID-TOO-SMALL-02|100|100|...small_binary_xray_data...
8PID-NULL-IMG-03|1024|1024|.
9PID-BAD-DATA-04|1024|1024|this_is_not_image_data
10;
11RUN;
12 
13PROC CASUTIL;
14 load DATA=casuser.medical_scans casout='medical_scans' replace;
15QUIT;

Étapes de réalisation

1
Attempt to create a 256x256 patch from all images. This tests the action's robustness against various data quality issues. The `decode` parameter is critical here to force the action to interpret the data.
Copied!
1PROC CAS;
2 image.augmentImages /
3 TABLE='medical_scans',
4 decode=TRUE,
5 copyVars={'patient_id'},
6 augmentations={{
7 x=0, y=0, width=256, height=256
8 }},
9 casOut={name='scans_robustness_test', caslib='casuser', replace=TRUE};
10QUIT;
2
Verify the output from the robustness test. We expect only the valid image to have been processed.
Copied!
1 
2PROC CAS;
3TABLE.fetch / TABLE='scans_robustness_test';
4QUIT;
5 

Expected Result


The `image.augmentImages` action in step 1 should execute without crashing. The CAS log may contain warnings or errors for the problematic records. The output table 'scans_robustness_test', when fetched in step 2, must contain exactly one row corresponding to 'PID-VALID-01'. The records for the image that was too small, had null data, or had invalid data should be gracefully ignored and not result in any output rows. This demonstrates the action's resilience in a real-world, imperfect data environment.