SPM99 Gem 1: Adding blobs to an image

Say you have a statistic image that you created outside of SPM and you want to overlay it on a structural image. The bare bones solution is as follows.

Create a thresholded version of the image, where all subthreshold voxels are set to NaN (See how to set NaNs below). Then…

Subject: Re: Your Message Sent on Fri, 19 Jan 2001 23:28:45 -0800
From: John Ashburner 
Date: Mon, 22 Jan 2001 11:40:24 +0000

I think it may take quite a bit of programming to get most of
the routines working with your data.  One thing to get you
started would be to try an undocumented feature of spm_orthviews.m:

        spm_orthviews('image',spm_get(1,'*.img','Select background image'));
        spm_orthviews('addimage',1,spm_get(1,'*.img','select blobs image'));

Best regards,

Here’s a different approach, which I understand will show the blobs in a monotone color (instead of hot metal). Also, there are more bells and whistles (it’s less of a hack).

Subject: Re: overlaying resulting image
From: John Ashburner 
Date: Wed, 4 Oct 2000 10:37:01 +0100 (BST)
To: spm@mailbase.ac.uk, duann@salk.edu

| Would you please show me how to overlay a statistical map onto the brain
| template SPM uses. Let's say I have an analyze-formated statistical
| map obtained from other software. It was already normalized to the same
| coordinates as the template images SPM has. How can I overlay this image
| onto the SPM template just like the results shown in SPM convention.

The following is supposed to work.  It uses a hidden undocumented
feature in SPM99, so it may contain bugs....


P1 = spm_get(1,'*.img','Specify background image');
P2 = spm_get(1,'*.img','Specify blobs image');

% Clear graphics window..

% Display background image..
h = spm_orthviews('Image', P1,[0.05 0.05 0.9 0.9]);

% Display blobs in red.  Use [0 1 0] for green, [0 0 1] for blue
% [0.6 0 0.8] for purple etc..
spm_orthviews('AddColouredImage', h, P2,[1 0 0]);

% Update the display..


Best regards,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s