QUANTMEDIMAGES Procedure
Example 15.2 Compute Component Metrics
(View the complete code for this example.)
This example shows how to use the QUANTMEDIMAGES procedure to compute metrics for the individual components of an image.
The following code uses the QUANTITIES statement to compute three metrics: the total number of foreground pixels in an image component, by specifying the CONTENT option with the USESPACING suboption; the surface boundary of each image component, by specifying the PERIMETER option; and the bounding box of each component, by specifying the BOUNDINGBOX option. You specify the vertex connectivity by using the CONNECTIVITY= option in the BIOLABEL statement and the basic label type by using the TYPE= option.
proc quantmedimages data=mylib.input_image region=component;
quantities content(usespacing) perimeter boundingbox;
biolabel type=basic connectivity=vertex;
output out=mylib.quantities;
run;
The following PROC PRINT statement displays the contents of the mylib.quantities data table that PROC QUANTMEDIMAGES generates:
proc print data=mylib.quantities;
run;
Output 15.2.1 shows the output.
Output 15.2.1: The mylib.quantities Data Table
| Obs | _imageId_ | _componentLabel_ | _perimeter_ | _boundingBoxIndex_ | _boundingBoxSize_ | _content_ | _path_ | _image_ |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 6676.15 | 24\8\0 | 33\23\64 | 38336 | path/to/image.nii | ... |
| 2 | 1 | 2 | 7460.67 | 6\10\0 | 14\41\64 | 36736 | path/to/image.nii | ... |
| 3 | 1 | 3 | 5396.29 | 27\38\0 | 29\12\64 | 22272 | path/to/image.nii | ... |