There is no specific routine in IDL or ENVI to do this but there are some discussions on the IDL newsgroup on how it can be accomplished. Here are a couple of examples:
https://groups.google.com/forum/#!top...
http://objectmix.com/idl-pvwave/16884...