Hi Peter, > for educational purposes I would like to do coregistration from the > MatLab command line. My main reason is laziness ;) To my defense, though, it also avoids human error. > The first step seems to be: > x = spm_coreg(VG,VF,flags) > This works fine. Yes. > Then I would like to write out the corregistered image, kind of > transforming 'VF' according to 'x'. > What would be the appropriate spm-command to do this? You can try something along the lines of M = inv(spm_matrix(x)); MM = spm_get_space(VF); spm_get_space(deblank(VF), M*MM); which should work. The fine point here is that spm_get_space does not change the orientation of the input image IF an output parameter is defined (l2) but does if none is defined (l3). So it basically is spm_set_space in disguise :) Cheers, Marko -- ____________________________________________________ PD Dr. med. Marko Wilke Facharzt für Kinder- und Jugendmedizin Leiter, Experimentelle Pädiatrische Neurobildgebung Universitäts-Kinderklinik Abt. III (Neuropädiatrie) Marko Wilke, MD, PhD Pediatrician Head, Experimental Pediatric Neuroimaging University Children's Hospital Dept. III (Pediatric Neurology) Hoppe-Seyler-Str. 1 D - 72076 Tübingen, Germany Tel. +49 7071 29-83416 Fax +49 7071 29-5473 [log in to unmask] http://www.medizin.uni-tuebingen.de/kinder/epn/ ____________________________________________________