SEGMENT is ostensibly for copying polygonal regions from one NDF to another. You may also use SEGMENT to copy bad pixels into the polygonal regions by giving the null value for one of the two input NDFs. For instance,
% segment in1=! in2=$KAPPA_DIR/ccdframec out=ccdmask
NDF ccdmask will have bad values inside the polygons, whereas
% segment in2=! in1=$KAPPA_DIR/ccdframec out=ccdmask
the pixels exterior to the polygons are flagged. SEGMENT lets you define the polygon vertices interactively, like in ARDGEN, but you can also use text files, or respond to prompting.
ZAPLIN also has an option to fill in rectangular areas when Parameter ZAPTYPE has value Bad.
KAPPA --- Kernel Application Package