Hi,
I wrote some code many moons ago to extract raster using shapefile, which might be relevant;
;;Read shapefile
oshp = OBJ_NEW('IDLffshape', sFilename_shapefile_in)
oshp -> GetProperty, n_entities = n_ent, Attribute_info = attr_info, $
n_attributes = n_attr, Entity_type = ent_type
roi_shp = LONARR(n_ent)
FOR ishp = 0, n_ent - 1 DO BEGIN
entitie = oshp -> GetEntity(ishp)
;;Check polygon
IF entitie.SHAPE_TYPE EQ 5 THEN BEGIN
record = *(entitie.VERTICES)
;;Convert coordinates
ENVI_CONVERT_FILE_COORDINATES, fid_in, xmap, ymap, record[0, *], record[1, *]
;;Create ROI
roi_shp[ishp] = ENVI_CREATE_ROI(ns = ns_in, nl = nl_in)
ENVI_DEFINE_ROI, roi_shp[ishp], /polygon, xpts = REFORM(xmap), ypts = REFORM(ymap)
endfor
...
I wasn't using some latest APIs but they should be supported at the time of writing.
Good luck!