A compact hard X-ray source for medical imaging and biomolecular studies