Fetches images from a CAS table and sends them to the client for display or further processing. This action allows retrieval of binary image data along with associated metadata variables. It supports pagination (from/to), sorting of results, and random selection via a seed.
| Parameter | Description |
|---|---|
| fetchImagesVars | Specifies the variables to copy from the input table to the output result. Useful for retrieving metadata like paths or labels alongside the image. |
| from | Specifies the ordinal position of the first row to return. Default is 0. |
| image | Specifies the name of the column that contains image binaries. Default is '_image_'. |
| images | Specifies the list of parameters that describe the input image table, such as column mappings for id, label, path, etc. |
| seed | Specifies a seed for writing images randomly. Default is 0. |
| sortBy | Specifies one or more variables and their sort order (ASCENDING or DESCENDING) to determine the order of the results. |
| table | Specifies the input table that contains image data. Can include caslib, where clause, and computed variables. |
| to | Specifies the ordinal position of the last image row to return. Default is 20. |
Before fetching, images must be loaded into a CAS table. This step loads images from a directory.
| 1 | |
| 2 | PROC CAS; |
| 3 | image.loadImages / path="/path/to/images" casout={name="myImages", replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |
Fetches the default number of images (up to 20) from the 'myImages' table.
| 1 | |
| 2 | PROC CAS; |
| 3 | image.fetchImages / TABLE="myImages"; |
| 4 | |
| 5 | RUN; |
| 6 |
Fetches a specific range of images (10 to 30), sorted by the file path, and includes specific metadata variables.
| 1 | |
| 2 | PROC CAS; |
| 3 | image.fetchImages / TABLE="myImages" from=10 to=30 sortBy={{name="_path_", order="ASCENDING"}} fetchImagesVars={"_path_", "_type_"}; |
| 4 | |
| 5 | RUN; |
| 6 |