Dear Marko,
The .premul field will be applied to all images within st.vols{i} (which
includes st.vols{i}.blobs{j}) so the easiest here might be to directly
apply the affine transformation specifically to st.vols{i}.mat or
st.vols{i}.blobs{j}.mat, for example:
st.vols{1}.blobs{1}.mat = diag([2 2 2 1]) * st.vols{1}.blobs{1}.mat;
Best regards,
Guillaume.
On 12/07/2021 08:44, Apl.Prof. Dr. Marko Wilke wrote:
> Dear All,
>
> I want to visually assess the overlap between an image after affine
> normalization and the standard tissue prior. To this effect, I tried
> using spm_orthviews and its premultiplication feature, and load the
> prior (in this case, GM) as an overlay:
>
> % === begin ===
> tpm = [spm('dir') filesep 'tpm' filesep 'TPM.nii'];
> tpmv = spm_vol(tpm);
> tpm = spm_read_vols(tpmv);
>
> image = spm_vol(spm_select(1,'image','Select image to assess',[],pwd));
> [p, nm, ~, ~] = spm_fileparts(deblank(image.fname));
> if isempty(p), p = pwd; end
> mymat = [p filesep nm '_seg8.mat'];
> tt = load(mymat);
>
> clear st
> spm_check_registration(image.fname)
> global st
>
> st.vols{1}.premul = tt.Affine;
>
> % insert potential modification here
>
> st.vols{1}.blobs{1}.min = 0;
> st.vols{1}.blobs{1}.max = 1;
> st.vols{1}.blobs{1}.vol = tpm(:,:,:,1);
> st.vols{1}.blobs{1}.colour = [1 0 0];
> st.vols{1}.blobs{1}.mat = tpmv(1).mat;
> st.vols{1}.blobs{1}.name = 'Overlay';
>
> spm_orthviews('Redraw')
> spm_orthviews('MaxBB')
> drawnow
>
> % === end ===
>
> This works just fine. However, when I then want to manipulate the affine
> scaling and try something like
>
> st.vols{1}.premul(1,1) = st.vols{1}.premul(1,1) * 2;
> st.vols{1}.premul(2,2) = st.vols{1}.premul(2,2) * 2;
> st.vols{1}.premul(3,3) = st.vols{1}.premul(3,3) * 2;
>
> before applying it, this also seems to scale the overlay as the relation
> between the image and the overlay does not change much, if at all. This
> confuses me as I think I scale only the image itself and the blob's
> position is defined by tpmv(1).mat...? Any pointers on what I am doing
> wrong would be much appreciated.
>
> Thanks and have a great week!
> Marko
>
> --
> ____________________________________________________
> Prof. Dr. med. Marko Wilke
> Facharzt für Kinder- & Jugendmedizin, Neuropädiater
> Leiter, Experimentelle Pädiatrische Neurobildgebung
> Geschäftsführender Oberarzt der Abt. Neuropädiatrie
> Universitäts-Kinderklinik
>
> Marko Wilke, MD, PhD
> Pediatrician and Pediatric Neurologist
> Head, Experimental Pediatric Neuroimaging
> Senior Consultant in Pediatric Neurology
> University Children's Hospital
>
> 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/
> ____________________________________________________
>
--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG
|