function bool = ispart(annotation, j)
% 
% return 1 is object index j is a part.

for i = 1:length(j)
    bool(i) = 0;
    if isfield(annotation, 'object')
        if isfield(annotation.object(j(i)), 'parts')
            if isfield(annotation.object(j(i)).parts, 'ispartof')
                if ~isempty(annotation.object(j(i)).parts.ispartof);
                    bool(i) = 1;
                end
            end
        end
    end
end
