pro nsxng_set_root, IA, IB, IAB ; Roots ;> the part of the filename basename without the ',fits' ;> We can use the IDL routine "file_basename" IA.root = file_basename(IA.file, '.fits') if n_params() ge 2 then begin if (IB.X) then begin IB.root = file_basename(IB.file, '.fits') ; print, IA.file,IB.file, for='("Found 2 image files: ",A," and ",A,".")' endif else begin ; print, IA.file,for='("Found 1 image file: ",A,".")' endelse endif if n_params() ge 3 then begin ; IAB image will be copied from IA, and new filename includes unique part of rootB. if (IB.X) then begin IAB.file = IA.file kk = 0 while(strmid(IA.root,0,kk) eq strmid(IB.root,0,kk)) do kk++ IAB.root = IA.root + '-' + strmid(IB.root, kk-1, strlen(IB.root) ) endif endif end