;***************************************************************************** ; This program reads the IMAGE and IMAGE_HISTOGRAM objects from the attached ; label file V1.LBL, calculates the histogram of the image, and compares it ; with the IMAGE_HISTOGRAM read from the file - the two should be identical. ; The file V1.LBL must be present in directory specified by LABEL_DIR (edit ; first section of code below to match your directory). ; ; Platforms and compilers this has been tested on are: ; 1) SGI/Irix ; 2) Sun SPARCstation/Solaris ; 3) DecAlpha/OSF ; 4) PowerMac, Metrowerks CodeWarrier ; ;***************************************************************************** pro t_images, IMAGE, HIST case 1 of (!VERSION.arch eq 'mipseb'): begin ;SGI LABEL_DIR = '/miranda2/monk/oal/lbls/' end (!VERSION.arch eq 'sparc'): begin ;Sun SPARCstation LABEL_DIR = '/alcmene2/monk/oal/lbls/' end (!VERSION.arch eq 'alpha' and !VERSION.os eq 'OSF'): begin ;Dec Alpha/OSF LABEL_DIR = '/usr/users/monks/oal/lbls/' end else: begin ;Macintosh LABEL_DIR = 'MacT06-2:OAL:' end endcase Z = OaRouteErrorMessages( LABEL_DIR + 'OAL_ERRORS.TXT', 0) ROOT_NODE = OaParseLabelFile( LABEL_DIR + 'V1.LBL', $ LABEL_DIR + 'ODL_ERRORS.TXT', 1, 0) if ROOT_NODE eq 0 then begin print,'OaParseLabelFile returned NULL!' return endif IMAGE_NODE = OdlFindObjDesc( ROOT_NODE, 'IMAGE', '', '', 0, 0) if IMAGE_NODE eq 0 then begin print,'OdlFindObjDesc could not find IMAGE node!' return endif IMAGE_OBJECT = OaReadObject( IMAGE_NODE) if IMAGE_OBJECT eq 0 then begin print,'OaReadObject returned NULL!' return endif IMAGE = OaIDLGetObjectData( IMAGE_OBJECT) HISTOGRAM_NODE = OdlFindObjDesc( ROOT_NODE, 'IMAGE_HISTOGRAM', '', '', 0, 0) if HISTOGRAM_NODE eq 0 then begin print,'OdlFindObjDesc could not find IMAGE_HISTOGRAM node!' return endif HISTOGRAM_OBJECT = OaReadObject( HISTOGRAM_NODE) if HISTOGRAM_OBJECT eq 0 then begin print,'OaReadObject returned NULL!' return endif HIST = OaIDLGetObjectData( HISTOGRAM_OBJECT) print,'First 5 values should be: 529 182 139 284 315' print,'First 5 value are: ' + string( format='(5(I6))',HIST(0:4)) W = where( HIST ne histogram( IMAGE), COUNT) if COUNT gt 0 then begin print,'Error: histograms do not match; ', COUNT, ' differences.' endif else begin print,'histograms match' endelse return end