IMAGE_CHECK Function
Checks if the input variable is a properly defined image associative array and ensures that all keys in the array are of the correct data type.
note | If you have 64-bit PV-WAVE and need to read and write images up to 32-bits without constraints on data size, use the PHOTO OPI routines. |
Usage
status = IMAGE_CHECK(image)
Input Parameters
image—An image associative array.
Keywords
Quiet—Suppresses successive levels of error messages, depending on the value set. This keyword accepts the same integer values used with the system variable !Quiet.
Valid—If set, checks to make sure that the image associative array’s status key does not contain an error code and that the data values are within supported limits.
Returned Value
status—A value indicating the success or failure of the function.
< 0—Indicates that the input array is not a valid image associative array.
0—Indicates that the input array is a valid image associative array.
Discussion
Call this function after modifying image data to be sure that the resulting image data is valid.
Use the Valid keyword to check the input image more thoroughly. If an error is detected, an informative message is printed to the screen.
note | You can use IMAGE_CREATE to create an image associative array. Complete image information is stored in this type of array. Refer to the IMAGE_CREATE function description for detailed information on the structure of an image associative array. |
Example
In this example, a test image is created using IMAGE_CREATE. Then, the test image is modified and the result checked with IMAGE_CHECK. In this case, the modification made is invalid—the width key in the image associative array has been assigned a short integer and it expects a long integer.
pix = BYTARR(400, 200)
test_image = IMAGE_CREATE(pix)
test_image('width') = 500
PRINT, IMAGE_CHECK(test_image)
; PV-WAVE prints:
; %IMAGE_CHECK: Wrong datatype of array element width -8
The error message is displayed because the width key in the image associative array contains a short integer and it expects a long integer.
See Also