(a) (1) In this section, “custodial confinement” means:
(i) home detention;
(ii) a corrections options program established under law which requires the individual to participate in home detention, inpatient treatment, or other similar program involving terms and conditions that constitute the equivalent of confinement; or
(iii) inpatient drug or alcohol treatment.
(2) “Custodial confinement” does not include imprisonment.
(b) (1) (i) Probation may be granted whether the crime is punishable by fine or imprisonment or both.
(ii) If the crime is punishable by both fine and imprisonment, the court may impose a fine and place the defendant on probation as to the imprisonment.
(iii) Probation may be limited to one or more counts or indictments but, in the absence of express limitation, extends to the entire sentence and judgment.
(iv) The court may revoke or modify a condition of probation or may reduce the period of probation.
(v) As a condition of probation, the court may order a defendant to a term of custodial confinement.
(2) If a sentence of imprisonment is imposed and a part of it is suspended with the defendant placed on probation, the court may impose as a condition of probation that the probation begin on the day the defendant is released from imprisonment.
(c) If the court places on probation a defendant who has been convicted of a violation of any provision of Title 5 of the Criminal Law Article, the court shall require as a condition that the defendant participate in a drug treatment or education program approved by the Maryland Department of Health, unless the court finds and states on the record that the interests of the defendant and the public do not require the imposition of this condition.
(d) The court may impose a sentence of custodial confinement or imprisonment as a condition of probation.
(e) If an individual violates the terms of probation, any time served by the individual in custodial confinement shall be credited against any sentence of incarceration imposed by the court.