Imagetransform destination flag


I would like to have a flag that would allow me to specify the destination of an imagetransform operation.

For example:

ImageTransform rgb2gray sample produces/overwrites to yield M_RG2Gray. If I do this with multiple images, I must remember to rename the existing one if I want to keep it.


Odd. I missed this in my implementations. I would wonder if this can be done using the syntax: ImageTransform/D=sample rgb2gray sample_gray?


D is not a recognized flag for RGB2Gray.

One work around is to duplicate the original first and then use the overwrite flag.


Hello Andy,

As you may remember, when the ImageTransform operation was written the prevailing behavior was for operations to overwrite the input (e.g., FFT, Histogram...).  By the mid 90's this was no longer a justified so in "new" operations I required an explicit /O for overwriting the input.  The /DEST flag was a later development that came after support for multi-character flags.

Assuming that you are writing functions you could write a wrapper as in:

ImageTransform[flags] keyword srcWave
Wave M_fixedWaveName  // declare the output wave name
Duplicate/O M_fixedWaveName,desiredDestWave // could also add /FREE
// KillWaves/z M_fixedWaveName

Note that I commented the KillWaves line because in applications that call this code in a loop it is more efficient to keep output wave for the next iteration.