True there is also re-calibration to bring the peaks into a correct position on the m/z axis. In the latest Cardinal version (2.8) it is possible to just provide the known m/z values for re-calibration instead of a synthetic spectrum.
So I first align the shits between the spectra and then bring the peaks to the right m/z position in a second step. Unfortunately, currently these provided m/z values will stay a sort of a "reference", therefore after peak picking it's important to create an average spectrum which is then used as reference during peakAlignment.
Here is some exemplary code:
## alignment
TMAs_mzaligned <- mzAlign(TMAs_s_b, tolerance = 200, units = "ppm")
TMAs_mzaligned <- process(TMAs_mzaligned)
## mz recalibration
calibrant_mz <- c(805.42, 1296.69, 1347.72, 1570.68)
TMAs_recalibrated <- mzAlign(TMAs_mzaligned, ref=calibrant_mz, tolerance=200, units="ppm")
TMAs_recalibrated <- process(TMAs_recalibrated)
## peak picking, alignment, filtering
TMAs_picked <- peakPick(TMAs_recalibrated, method = "simple", SNR=5, window = 10, blocks = 500)
TMAs_picked <- process(TMAs_picked)
mean_MSI <- summarizeFeatures(TMAs_picked, FUN="mean")
fData(TMAs_picked)$mean_spectrum <- as.numeric(spectra(mean_MSI))
TMAs_pp <- peakAlign(TMAs_picked, ref="mean_spectrum", tolerance = 200, units = "ppm")
TMAs_pp <- peakFilter(TMAs_pp, freq.min = 0.01)
TMAs_pp <- process(TMAs_pp)