Yes it is possible, it just requires a transformation with more degrees of freedom, i.e. using affine instead of rigid or if there are local deformation using BSpline.
As a side note, before embarking on an implementation you really do need to have a solid understanding of how registration works. Possibly skim through the ITK book.
Thank you @zivy and @dzenanz . In this case, how should I choose the fixed image and the moving image?
Should I select randomly a scan from one patient as the fixed_image and the scans from other patients (same/different dataset) as the moving_image? So that I have one randomly selected scan from a patient as the reference image and do co-registration with all the other patients (regardless of the dataset they belong to)?