; ; CALLING SEQUENCE: image=it_add(img1,img2) ; ; PARAMETERS: img1, img2 are the two image arrays that are to ; be combined. The arrays do not have to be the same ; size, however, they must already be centered and ; scaled. ; ; NOTES: This function will operate on any size INTARR, given ; to it in any order. Users should 'zero out' any ; unwanted portions of the images because it_add uses ; 'where' logic when combining images. It looks to ; see where image one equals zero and places image two ; there. If image one doesn't have very many areas ; equal to zero, then there isn't much room for image ; two. Use it_disk.pro to get rid of any unwanted ; stuff outside of a given radius. Use it_center.pro ; to center an image in an array of any size. ; ; RETURN TYPE: INTARR ; ; CALLS: NONE ; ; HISTORY: Drafted by Tony Darnell, 20-MAR-97 ; 4-APR-94: Added new addition method when composing an ; h-alpha limb image with a coronal image. ; ; FUNCTION it_add,img1,img2,dpm=dpm,subt=subt sz1=SIZE(img1) sz2=SIZE(img2) x1=sz1(1) x2=sz2(1) y1=sz1(2) y2=sz2(2) IF (sz1(1) LT sz2(1)) THEN BEGIN print,'IT_ADD: Image 1 is smaller than Image2' print,MIN(img1),MAX(img1) print,MIN(img2),MAX(img2) temp=INTARR(x2,y2) mn=MAX(img1(10:40,10:40)) print,mn cx1=(x2/2.0)-(x1/2.0) cy1=(y2/2.0)-(y1/2.0) cx2=(x2/2.0)+(x1/2.0) cy2=(y2/2.0)+(y1/2.0) temp(cx1:cx2-1,cy1:cy2-1)=img1 IF (KEYWORD_SET(dpm) AND NOT KEYWORD_SET(subt)) THEN BEGIN print,'dpm keyword set.' ;temp(where(img2 GT 139))=img2(where(img2 GT 139)) temp(where(temp LT 10))=img2(where(temp LT 10)) ENDIF $ ELSE $ IF (KEYWORD_SET(subt) AND NOT KEYWORD_SET(dpm)) THEN BEGIN print,'subt keyword is set' temp(where(temp LE mn))=img2(where(temp LE mn)) ENDIF $ ELSE $ IF (KEYWORD_SET(dpm) AND KEYWORD_SET(subt)) THEN BEGIN print,'both subt and dpm keywords are set.' temp(where(temp LE mn))=img2(where(temp LE mn)) ENDIF $ ELSE $ temp(where(temp LE mn))=img2(where(temp LE mn)) image=temp END IF (sz1(1) GT sz2(1)) THEN BEGIN print,'IT_ADD: Image1 is bigger than Image2' print,MIN(img1),MAX(img1) print,MIN(img2),MAX(img2) temp=INTARR(sz1(1),sz1(2)) mn=img2(10,10) cx1=(x1/2.0)-(x2/2.0) cy1=(y1/2.0)-(y2/2.0) cx2=(x1/2.0)+(x2/2.0) cy2=(y1/2.0)+(y2/2.0) temp(cx1:cx2-1,cy1:cy2-1)=img2 IF (KEYWORD_SET(dpm) AND KEYWORD_SET(subt)) THEN BEGIN print,'Both subt and dpm keywords are set.' temp(where(temp LE mn))=img1(where(temp LE mn)) ENDIF $ ELSE $ IF (KEYWORD_SET(dpm) AND NOT KEYWORD_SET(subt)) THEN BEGIN print,'dpm keyword set.' temp(where(img1 GT 10))=img1(where(img1 GT 10)) ENDIF $ ELSE $ IF (KEYWORD_SET(subt) AND NOT KEYWORD_SET(dpm)) THEN BEGIN print,'subt keyword is set.' temp(where(temp LE mn))=img1(where(temp LE mn)) ENDIF $ ELSE $ temp(where(temp LE 128))=img1(where(temp LE 128)) image=temp END IF (sz1(1) EQ sz2(1)) THEN BEGIN print,'IT_ADD: Images are same size' temp=INTARR(sz1(1),sz1(2)) temp=img1 IF (KEYWORD_SET(dpm)) THEN $ temp(where(img2 GT 129))=img2(where(img2 GT 129)) $ ELSE $ temp(where(img2 LE 128))=img2(where(img2 LE 128)) image=temp END RETURN,image END