;#> .dc1 ; ; Identifier phot_mosaic ; ; Purpose Changes a 3D image array into a 2D mosaic. ; Mosaicing function for PHOTTV (SMART modified ATV) ; ; Synopsis For inexplicable reasons (likely due to an IDL ; "idiosyncracy") the mosaicing function of PHOTTV must be ; called from an external routine. Hence the existence ; of this program. ; ; ; Arguments Name I/O Type: Description: ; ---------------------------------------------------------- ; image I image array (128X128XN) where ; "N" is number of images input. ; bmask I bmask array (128X128XN) where ; "N" is number of images input. ; bmask_mosaic O KEYWORD. Returns mosaiced bmask. ; ; Returns Mosaiced images (and bmask) ; ; Description ; ; Dependencies Calls: ; Called from: PHOTTV ; ; Comment ; ; Example ; ; Category SMART ; ; Filename phot_mosaic.pro ; ; Author Kevin Schawinski-Guiton ; ; Version ; ; History 11. June 2003 - Kevin Schawinski-Guiton ; 29. August 2005 - David Whelan ; Modified to pass in the bitmask image for mosaicing. ; Header added. (Mantis Bug number 194) ; ;************************************************************* ; Copyright 2005 Cornell University ;************************************************************* ;#< ; FUNCTION phot_mosaic, image DGW 29 Aug. 2005 FUNCTION phot_mosaic, image, bmask, bmask_mosaic=bmask_mosaic ;DGW 29 Aug. 2005 ;get information on images image_info=SIZE(image) n_images = image_info(3) ;number of images x_size = image_info(1) ;x-size of images y_size = image_info(2) ;y-size of images ;determine layout of final image by determining the smallest square possible. square_size=1 ;size of the smallest square n_last_row=0 ;number of images in last row ;determine size of square i=0 ;counter WHILE square_size*square_size LT n_images DO BEGIN square_size=square_size+1 ENDWHILE ;create array which will contain mosaic image_mosaic = DBLARR(square_size*x_size, square_size*y_size) bmask_mosaic = DBLARR(square_size*x_size, square_size*y_size) ;DGW 29 Aug. 2005 ;fill array up k=0 ;counter ;rows FOR i=0,square_size-1 DO BEGIN ;check if all images have been placed yet IF (k GT n_images-1) THEN BREAK ;columns FOR j=0, square_size-1 DO BEGIN image_mosaic(i*x_size:(i+1)*x_size-1,j*y_size:(j+1)*y_size-1 )=ROTATE(image(*, *, k),1) k=k+1 IF (k GT n_images-1) THEN BREAK ENDFOR ENDFOR FOR i=0,square_size-1 DO BEGIN ;DGW 29 Aug. 2005 ;check if all images have been placed yet ;DGW 29 Aug. 2005 IF (k GT n_images-1) THEN BREAK ;DGW 29 Aug. 2005 ;columns FOR j=0, square_size-1 DO BEGIN ;DGW 29 Aug. 2005 bmask_mosaic(i*x_size:(i+1)*x_size-1,j*y_size:(j+1)*y_size-1 )=ROTATE(bmask(*, *, k),1) ;DGW 29 Aug. 2005 k=k+1 ;DGW 29 Aug. 2005 IF (k GT n_images-1) THEN BREAK ;DGW 29 Aug. 2005 ENDFOR ;DGW 29 Aug. 2005 ENDFOR ;DGW 29 Aug. 2005 ;rotate into position image_mosaic=ROTATE(image_mosaic, 3) bmask_mosaic=ROTATE(bmask_mosaic, 3) ;DGW 29 Aug. 2005 RETURN, image_mosaic END