Hi Babyshoone!!!
on ENVI & IDL is easy run the script roi_to_csv.pro.... And is great for many layers stack!!!!
pro rois_to_csv ;Select file name to save filename=dialog_pickfile(Title='Enter File Name') if filename eq '' then return Openw, lun, filename, /Get_lun envi_select, title='Input Filename', fid=fid, pos=pos if (fid eq -1) then return envi_file_query,fid,bname=bname,nb=nb bname=["ROI_Name",bname] printf,FORMAT='(1000(A,:,","))',lun, bname ;Check ROIs associated with the image roi_ids = envi_get_roi_ids(fid=fid, roi_names=roi_names,/Short_name) if (roi_ids[0] eq -1) then begin print, 'No regions associated with the selected file' return endif ; Compound widget for ROI selection base = widget_auto_base(title='ROI Selection') wm = widget_multi(base, list=roi_names, uvalue='list', /auto) result = auto_wid_mng(base) if (result.accept eq 0) then return ptr = where(result.list eq 1, count) ; ROI data extraction for i=0l, count-1 do begin ;Initialize temp_data to hold the ROI's data data = envi_get_roi_data(roi_ids[ptr], fid=fid, $ pos=[0]) temp_data = fltarr(n_elements(pos),n_elements(data)) ;Extract the data for each ROI for j=0l, n_elements(pos)-1 do begin data = envi_get_roi_data(roi_ids[ptr], fid=fid, $ pos=pos[j]) temp_data[j,*] = data help, temp_data endfor ;Prints the ROI data to filename for k = 0L, n_elements(temp_data[0,*])-1 do begin printf, FORMAT='(A,:,",",1000(F12.2,:,","))',lun, roi_names, temp_data[*,k] endfor ;Returns to the next ROI endfor Free_lun, lun print,'Done!' end