image condenseImages

Reconstructing MRI Scans from Raw Sensor Streams

Scénario de test & Cas d'usage

Business Context

A medical research center receives raw telemetry data from an experimental MRI scanner. The data arrives as a continuous stream of intensity values (pixels) indexed by patient ID and spatial coordinates. The goal is to reconstruct these raw values into viewable 8-bit grayscale images to identify potential anomalies in tissue density.
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Simulation of a pixel stream for 3 patients. Each image is a small 3x3 matrix (9 pixels) with random intensity values representing tissue density.

Copied!
1DATA mri_raw_stream;
2 DO patient_id = 101 to 103;
3 /* Simulating a 3x3 image (9 pixels) */
4 DO p_idx = 1 to 9;
5 intensity = floor(rand('UNIFORM') * 255);
6 OUTPUT;
7 END;
8 END;
9RUN;
10 
11PROC CASUTIL;
12 load DATA=mri_raw_stream outcaslib='casuser' casout='mri_pixels' replace;
13RUN;

Étapes de réalisation

1
Load the raw pixel stream into CAS.
Copied!
1/* Done in data_prep */
2
Execute condenseImages to restructure the stream into 3x3 grayscale images. We specify width/height as 3 and use the 'intensity' column as input.
Copied!
1PROC CAS;
2 image.condenseImages /
3 TABLE={caslib='casuser', name='mri_pixels'},
4 width=3,
5 height=3,
6 numberOfChannels=1,
7 inputs={{name='intensity'}},
8 copyVars={'patient_id'},
9 casOut={caslib='casuser', name='mri_images', replace=true};
10RUN;

Expected Result


The action should produce a table 'mri_images' containing 3 rows (one per patient). Each row will include the 'patient_id' and a binary '_image_' column representing the reconstructed 3x3 grayscale scan.