The inquest provided for in section 12-45-01 shall be open to all persons who may wish to attend it, under such rules and regulations as the officer in charge may establish for the orderly conduct of the business. All persons may be excluded from the presence of the body of the deceased whenever there is danger of contracting or spreading a contagious disease, and all spectators may be excluded from the room where the inquest is being held while any officer, employee, or inmate of the institution is being examined.