--[[
	This extraction script identifies the properties for AS, CD, CP, DD, LP, LS, VL, XA 
	and similiar modality images which may be either cine or still frames. In
	this version, only the cine/still property is extracted as part of an 
	image description if a specific one is omitted.
    
     Allan Noordvyk,    January 19, 2005 
     -	based on old ExtractAS version 
    
--]]


-- ////////////////////////////////////////////////////////////////////////////
-- AS image description property strings 
-- ////////////////////////////////////////////////////////////////////////////

	CINE_DESC_VAL = "Cine"
	STILL_DESC_VAL = "Stills"  

function RegisterProperties()
-- ////////////////////////////////////////////////////////////////////////////
-- This function is called automatically at load of script to register any
-- modality specific properties.  Prior to IP Library build 39 it must be 
-- present even if empty.
-- Modality specific property IDs (3711,1X01)- (3711,1XFF) range
--     If modality specific properties need to be defined, then replace X in the above 
--     numeric ranges with a value that is distinct from those used by other modalities.
-- ////////////////////////////////////////////////////////////////////////////
end    

-- ////////////////////////////////////////////////////////////////////////////
-- Generic cine properties extaction functions
-- ////////////////////////////////////////////////////////////////////////////

function ExtractImageDescriptionGenericCine()

    -- If the common function was already successful finding a good description value...
    local seriesDescProp = GetAttr( SERIES_DESC_PROP )
    if (seriesDescProp) then
        -- If it isn't just the special no-info placeholder...
        if (seriesDescProp:Get(1) ~= "?") then
            TraceC( "Common script found description... skipping special generic cine logic.\n" )
            return seriesDescProp;
            --==============================================
        end
    end
    
    TraceC( "No good description found by common script... using special generic cine logic.\n" )      

    -- If the frame type property is "Cine"...
    if (ValueForTag( FRAME_TYPE_PROP ) == CINE_VAL) then
          -- Just name as "Cine"
          return NewPropWithValue( SERIES_DESC_PROP, CINE_DESC_VAL )
          -- ====================================================
    end
    
    -- Will be grouped with other still images so just call it "Stills"
    return NewPropWithValue( SERIES_DESC_PROP, STILL_DESC_VAL )
    
end

-- ////////////////////////////////////////////////////////////////////////////
-- extract AS properties 
-- ////////////////////////////////////////////////////////////////////////////

function Execute()

    TraceC("Extract Generic Cine executing...\n")
    
    -- Note that since this is a generic script covering multiple modalities
    -- we do not do a modality sanity check.

    -- Tag our output with the script version
    NewPropWithValue( MODALITY_SCRIPT_VER_PROP, "$Revision: 1 $ - $Modtime: 2/12/07 3:17p $ - GenericCine" )
    
    -- Just fix the image description
    ExtractImageDescriptionGenericCine()
    
    TraceC("Extract Generic Cine complete.\n")

end

