DIPlib Documentation - ©1995-2015 Quantitative Imaging Group, Delft University of Technology.

# ImagesSeparate

Take care of in-place operations

## SYNOPSIS

dip_Error dip_ImagesSeparate( in, out, newOut, saved, resources )

## FUNCTION

First the list of output images is checked to see if any output image is used more than once. If this is the case an error is returned. Then the input and output images are examined. If any of the output images is also used as an input image, the function allocates a new image. This image is returned through the `newOut` array. For each output image a corresponding image is returned in this array. Either the original output image itself, or either a new image as discussed above. After the call to `dip_ImagesSeparate`, the images in the `newOut` array should be used instead of the original output images. After you are done processing the images, a call to `ResourcesFree` will perform the necessary post-processing. The post-processing consists of copying the data from the temporary output images to the original output images and freeing the temporary images. Because the post-processing is called through `ResourcesFree`, the resources parameter is mandatory. Any of the image arrays' elements may be set to zero, indicating that it is to be ignored.

The boolean `saved` array can be used to indicate that an input image has been stored in a safe place. In this case `dip_ImagesSeparate` will not have to allocate a temporary image if the input image is also used as an output image. The `saved` parameter may either be zero, which indicates that none of the input images has been saved, or it must be an array containing booleans corresponding each of the input images. `DIP_TRUE` indicates that the image has been saved.

## ARGUMENTS

Data type | Name | Description
`dip_ImageArray` | `in` | An array of input images
`dip_ImageArray` | `out` | An array of output images
`dip_ImageArray *` | `newOut` | Returns an array containing the replacement output images
`dip_BooleanArray` | `saved` | An array of booleans indicating which input images are safely stored
`dip_Resources` | `resources` | Resources tracking structure. See `ResourcesNew`. May not be zero

## SEE ALSO

`ImageGetData`