;+
; NAME:
;	SMEI_SEQUENCE::GET_FIRST
;
;
; PURPOSE:
;	Get the first image of a SMEI sequence
;
;
; CATEGORY:
;	SMEI_SEQUENCE
;
;
; CALLING SEQUENCE:
;	imref = seqref->get_first()
;
; KEYWORD INPUTS:
;	/noskip	If set, then return the first image not flagged for
;		hiding. (If all images are flagged then the true first
;		image is returned)
; 
; OUTPUTS:
;	imref	objref	A reference to the first image in the sequence.
;	index	long	The index of the image returned (only relevant
;			if noskip is specified).
;
; MODIFICATION HISTORY:
;	Original: 9/12/02; SJT
;	Added noskip & index keywords: 20/7/10; SJT
;-

function smei_sequence::get_first, noskip = noskip, index = index

img = self.first_image
index = 0l
if keyword_set(noskip) then $
  while obj_valid(img) && img -> get_pflags(/skip) do begin
    img = img -> get_next()
    index++
endwhile

if ~obj_valid(img) then begin
    index = 0l
    return, self.first_image
endif

return, img

end
