A medical processing apparatus comprising: a processing unit configured to obtain a first number of X-ray datasets that correspond to the first number of energies and that are acquired by scanning a subject with X-rays, generate, based on the first number of X-ray datasets, a second number of virtual monochromatic X-ray datasets, the second number being larger than the first number, and use the second number of virtual monochromatic X-ray datasets to estimate quantities of the second number of reference materials mixed or a mixing ratio between the second number of reference materials when a material at a position in the subject is represented by the second number of reference materials, for each of multiple positions in the subject, characterized in that the processing unit is configured to correct the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials by inputting the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials to a trained model that generates the output data that apparently represent the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials that is obtained from the second number of X-ray datasets corresponding to the second number of energies that are discriminated using a photon counting X-ray detector based on the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials that is estimated based on the first number of X-ray data sets corresponding to the first number of energies. a processing unit configured to obtain a first number of X-ray datasets that correspond to the first number of energies and that are acquired by scanning a subject with X-rays, generate, based on the first number of X-ray datasets, a second number of virtual monochromatic X-ray datasets, the second number being larger than the first number, and use the second number of virtual monochromatic X-ray datasets to estimate quantities of the second number of reference materials mixed or a mixing ratio between the second number of reference materials when a material at a position in the subject is represented by the second number of reference materials, for each of multiple positions in the subject, characterized in that the processing unit is configured to correct the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials by inputting the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials to a trained model that generates the output data that apparently represent the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials that is obtained from the second number of X-ray datasets corresponding to the second number of energies that are discriminated using a photon counting X-ray detector based on the quantities of the second number of reference materials mixed or the mixing ratio between the second number of reference materials that is estimated based on the first number of X-ray data sets corresponding to the first number of energies. <EOS>