--[[
    This sorting script sorts sequences for ES.
    
	Michael Lai			13 SEP 2006   
	-	Created based on old SortGenericCine version 
	Mahesh Nagarajan	13 SEP 2006
	-	Added alternate sort hints and sanity check for ES
	Mahesh Nagarajan	13 FEB 2007
	- 	Modified syntaxes for sorting hints as part of v11.5 re-write
	-	Site customized code will be removed and re-located to SortES.site 
		files -> starting with 11.5, unless sort orders are fundamentally 
		flawed, all change requests to sorting schemes will be incorporated
		into a site file for the site.		
--]]

function DeclareTags()
end

function Execute()
-- ////////////////////////////////////////////////////////////////////////////
-- generates the hints for sorting the ES sequences as follows 
-- image number, image instance UID, file name
-- ////////////////////////////////////////////////////////////////////////////

    DeclareTags()
	
    -- If this is the wrong script for the supplied image...
    if (not SanityOK("ES")) then
      return nil
      -- =====================================================
    end		

    local sortHint01 = SortingHint:new("ES Sequence Sort", "DEFAULT")

    -- sort by image number
    sortHint01:AddEntry(INSTANCE_NUMBER_TAG) 
    sortHint01:AddEntry(IMAGE_UID_TAG)
    sortHint01:AddEntry(ALI_IMAGE_FILENAME_TAG)
    
    SortSequencesInStudy(sortHint01) 

end

