	FUNCTION MskImg, idx, Cad=cad, Comp=comp, nRois=nrois, Res=res
;	--------------------------------------------------------------
;+							17-Oct-91
;	NAME:
;		MskImg
;	PURPOSE:
;		breakup encode items within a byte into a single value
;		by masking out the unwanted items.  Returned vector
;		is the same size as input vector and is masked
;		for requested value via keyword switch.
;	CALLING SEQUENCE:
;		masked_dVec = MskImg(idx, [Cad=cad, Comp=comp, 
;					nRois=nrois, Res=res])
;	INPUT:
;		idx 	is a vector of the imgparam values
;	KEYWORDS:
;		cad	present for cadence check
;		comp	present for compression check
;		nRois	present for No of ROIs????
;		Res	present for resolution check
;	OUTPUT:
;		returns a masked byte vector ...
;	HISTORY:
;		written 17-Oct-91, by GAL
;-
;	--------------------------------------------------------------
;	ON_ERROR, 2	;force a return to caller if error

	cad = KEYWORD_SET(cad)		;convert keywords to binary flags
	comp= KEYWORD_SET(comp)
	nrois=KEYWORD_SET(nrois)
	res  =KEYWORD_SET(res)

	CASE (1) OF
	  (cad)	:	ret = idx AND 192b
	  (comp):	ret = idx AND 12b
	  (nrois):	ret = idx AND 48b
	  (res):	ret = idx AND 3b
	  ELSE:		BEGIN
			  ret = 0
		          print, '**** MskImg--- error incorrect input'
			END
	ENDCASE

	RETURN, ret
	END

