Dear Christopher,
glad to hear that you've found a solution for your workflow. To answer
your parenthesis question: When reslicing, SPM always takes the first
image in the image series as a reference. If this image has an oblique
orientation, the other images will be oriented the same. SPM only
creates new image grids with axial orientation during spatial
normalisation.
Best,
Volkmar
Am Freitag, den 27.10.2017, 16:08 +0000 schrieb Christopher Cox:
> Dear Volkmar,
>
> Thank you very much for your help! You got me thinking in the right
> direction, and now I have a solution in code.
>
> The critical concept for me was that, if you update the .mat field of
> the volume header, it will allow the data to be interpolated on the
> fly to align with the coregistration reference, but will not affect
> the data on disk. When I run Coregister->Estimate, it computes that
> matrix and stores it in the header.
> - If I compare the entry of this field before and after running the
> operation, it changes...
> - If I display this volume on its own in MRIcron, it will appear
> that nothing has changed...
> - If I overlay the solution on the coregistration reference,
> however, an interpolated version of the data will be displayed,
> consistent with the idea that the updated .mat field contains the
> correct rotation information and that it is being used on the fly.
>
> The next important thing for me to realize was that the resliced
> version of the source image (with an 'r' prefix) is associated with a
> header that contains a very different .mat entry than the
> coregistered-but-not-resliced header. The resliced image seems to
> display the same regardless of what it's overlayed on top of. This
> again is consistent with the idea that the bit that is informative
> about the coregistration is the .mat field in the source file, not
> the resliced final product.
>
> (What I do not understand is why the off diagonal values in the .mat
> field associated with the resliced image are nonzero... now that it's
> resliced, why does this matrix need to express any rotation
> information?)
>
> Putting those pieces together, it suggested that I needed to copy the
> .mat field from my coregistered (but not resliced) source image over
> to the .mat field of other images that I want to coregister and
> reslice with respect to the same reference image. Once updating the
> .mat field and saving a new version of the image to disk, I should
> then be able to reslice (by simply using the batch tool), treating it
> as the source and using the original reference.
>
> That seems to work! So, in case this is useful, here is what I said
> above in code (which I typed directly into the email so sorry for
> weird characters and/or typos…):
>
> CoregisteredNotReslicedVol =
> spm_vol(‘path_to/coregistered_and_not_resliced_image.hdr’);
> NativeResultVol = spm_vol(‘path_to/native_result.hdr’);
> NativeResultData = spm_read_vols(NativeResultVol);
>
> CoregisteredResultVol = NativeResultVol;
> CoregisteredResultVol.fname = spm_path(NativeResultVol.fname,
> ‘prefix’, ‘m’); % arbitrary prefix
> CoregisteredResultVol.mat = CoregisteredNotReslicedVol.mat;
> spm_write_vol(CoregisteredResultVol, NativeResultData);
>
> matlabbatch{1}.spm.spatial.coreg.write.ref =
> {‘path_to/reference.img’};
> matlabbatch{1}.spm.spatial.coreg.write.source =
> {‘path_to/mnative_result.img’}
> matlabbatch{1}.spm.spatial.coreg.write.roptions.interp = 4;
> matlabbatch{1}.spm.spatial.coreg.write.roptions.wrap = [0 0 0];
> matlabbatch{1}.spm.spatial.coreg.write.roptions.mask = 0;
> matlabbatch{1}.spm.spatial.coreg.write.roptions.prefix = ‘r’;
> spm_jobman(‘run’, matlabbatch);
>
> Best, and thanks again for pointing me in the right direction,
>
> Chris
>
> -----Original Message-----
> From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]
> ] On Behalf Of Volkmar Glauche
> Sent: 26 October 2017 08:34
> To: [log in to unmask]
> Subject: Re: [SPM] Reusing corregistration headers
>
> Dear Christopher,
>
> SPM indeed does not have a notion to "deoblique" any data. Except for
> time series statistics, most image manipulation operations work in
> "world space", taking arbitrary locations of image slices (and most
> of the time even arbitrary image dimensions an voxel sizes) into
> account. If you run "Realign: Estimate" or "Coregister: Estimate" on
> your data, SPM will only update the spatial transformation from voxel
> to "world space" without touching any voxel data.
>
> Your normalisation parameters will map back and forth between
> "coregistered subject space" and "MNI space". Data will always be
> written in oblique slices, but will be in register with any data that
> is in the target space of the normalisation. If you transform data
> from MNI space back to "coregistered subject space" and need to have
> that in exactly the same orientation and voxel size as the original
> data, an additional "Realign: Reslice" could help. Select a single
> image that has the required orientation and voxel size (e.g. the
> first of your coregistered original EPIs) and all "reverse-
> normalised" images you want to reslice. Set the output option to
> "Images 2..n" (your first image in the list is used as reference
> only). You may have to experiment a bit with the resolution of the
> images created during spatial normalisation from MNI to subject
> space, but otherwise it should not be necessary to reapply any
> coregistration.
>
> Hope this helps
>
> Volkmar
>
|