As a rule, if you haven’t aligned two images, you can’t count on “world” coordinates to refer to the same space relative to the brain. I don’t know to what space the “Talairach Atlas” in question has been registered, or whether you’ve registered your image to that space. If you can’t confidently answer the first question and are sure that it’s the same space you’ve registered your image to, then you need to work on that before you can start to map locations in one image to the other.
That said, once you have your image registered into the same space as your Talairach atlas, the two affines will each describe a mapping from their voxels onto a common RAS space, and you can map from voxels in B to voxels in A by taking
inv(A.affine).dot(B.affine).dot([[i], [j], [k], ]). (These are unlikely to be integers, so you’ll want to consider your rounding function.)
Another thing you can do is to use something like
mri_vol2vol to map from your Talairach atlas to your input image space, and using
--interp nearest to handle the decision of which voxels match to which. Then you just open both files, and the same voxel location in each matches the same RAS location. (This does, of course, assume that your images have already been registered, as in the previous paragraph.)