anatomist bug ? spm2 .hdr weirdness ?

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
SylvainT
Posts: 73
Joined: Mon Feb 13, 2006 6:37 pm
Location: INT, Marseille, France

anatomist bug ? spm2 .hdr weirdness ?

Post by SylvainT »

Hi there,

So, I think we've found a bug in anatomist which I think is related to some weirdness in the way spm2 writes the .hdr file. We spent quite some time trying to track it down and here are the results of our investigation, so that you can (hopefully) reproduce what we're seeing...

We've been dealing with a left-right problem for a few days now, we've read everything on the forum and elsewhere. Then, we started working with the WhereIsRight dataset from the FIAC constest ( ftp://ftp.cea.fr/pub/dsv/madic/FIAC/WhereIsRight.tar.gz ) to be sure of what we're seeing.

For info, we're working with a fresh install of SPM2 and a fresh install of BrainVisa/Anatomist 3.0.1.

Case 1:
- we perform a spatial normalisation of this dataset in SPM2 with all the default parameters (which means we actually didn't touch anything!);
- we then visualize the normalized image (.img) in Anatomist; and the physical marker used in this study (a vitamin A pastille that was placed on the right side of the subject's forehead) appears on the right of the screen;

Case 2:
- in SPM2, we only change the bounding box of the normalized image to be written, by running the following command after launching spm2:
spm_defaults;
defaults.normalise.write.bb = [ [-95 95]' [-126 90]' [-72 108]' ];
(alternatively, you can do this through the GUI as well, Defaults -> Spatial Normalisation -> Writing Normalised etc.; and the end result is the same); this is the only parameter we change;
- we then proceed with the spatial normalisation;
- we finally visualize the normalized image (.img) in Anatomist; and now, the marker appears on the left of the screen;

I did check that the images in these 2 cases were actually written in the same 'direction' on disk. So I'm guessing that something is different in the .hdr files. The only difference I noticed using the 'avwhd' utility from the FSL package is in the field called 'originator', but it's not explicit at all so I have no idea whether it's the cause of the problem...

Any idea what went wrong, and where? What are we supposed to do to avoid this?

I have another question to follow up with this. From what I'd understood, Anatomist displays images in radio convention, which means that Case 2 is the correct behavior... So I'm suprised that the SPM2 defaults (leading to Case 1) don't give us a good behavior in Anatomist. Did I do something totally wrong at some point?

Thanks,

Sylvain
SylvainT
Posts: 73
Joined: Mon Feb 13, 2006 6:37 pm
Location: INT, Marseille, France

Post by SylvainT »

to follow up... I've now tried to import those 2 normalised images into the BrainVisa database. The 'Import T1 MRI 1' brick actually "detects" two different input_spm_orientation for the 2 images: it gives Radio for Case 1 and Neuro for Case 2. I guess this is consistent with the behavior observed in Anatomist, but still problematic since both images are written in the same direction on the disc...

at the end, we're trying to do a fusion between a stat map from spm and an anatomical image; what should we do? is the following a solution that's 100% safe:
- never use any .img in anatomist and always import everything into the BV database
- when importing spm data into the databse, always force the spm_input_orientation to be Radio (knowing that our images are in radio on disc to start with)

if yes, what BrainVisa brick should we use to import SPM stat maps into the database?
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Post by riviere »

Hi Sylvain,

Well, from what I understand of your situation, I think I can explain everything...

- by default, anatomist and all Aims commands think all SPM images come from SPM99, not from SPM2 so is not correct on your image. Please read this page for more details about this.
In short, anatomist thinks the image has been normalized with SPM99 so should be in neurological convention. SPM2 doesn't flip images when normalizing (SPM99 did), so it is actually still in radiological convention.
- Aims/anatomist has no reliable information to detect if the image has been normalized or not. The only clue we have is the field of view which is more or less standard on normalized images. But here, you have manually changed this field of view on one image, to anatomist thinks it it not normalized in this case, and assumes it is still in radio convention (which is right, but for wrong reasons).

If you only manipulate SPM2 images, you can change your Aims/anatomist settings to make it behave like SPM2: create a .aimsrc file on your home directory and write in it:

Code: Select all

attributes = {
  '__syntax__' : 'aims_settings', 
  'spm_input_spm2_normalization' : 1, 
  'spm_output_spm2_normalization' : 1, 
}
This is explained on this page.

You can also modify Aims/anatomist behaviour on an image-by-image basis by creating a <imagename>.img.minf file and write in it:

Code: Select all

attributes = {
  'spm_radio_convention' : 1, 
  'spm_normalized' : 1,
  'spm_spm2_normalization' : 1, 
}
to tell this image is actually in radio convention (whatever happened to it), is normalized (whatever the field of view: you'll need it at least on the second image), and has been normalized using SPM2.

I know all this is rather complex and disturbing, but as there really lacks some information in SPM files, we cannot correctly guess image orientation in every case.

- otherwise, yes, Anatomist displays in radio convention by default. You can change this behaviour in the settings (don't forget to save the settings after changing them).

Is it clearer now ?

P.S.: I have no idea what SPM5 does for all this, I have no experience of it...

Denis
SylvainT
Posts: 73
Joined: Mon Feb 13, 2006 6:37 pm
Location: INT, Marseille, France

Post by SylvainT »

hi denis, thanks a lot for walking me through this step by step, I think this all makes sense... I'm going to re-read all this more carefully, I'd read and assimilated all those pages you mention, but I guess not in the right way ;)

riviere wrote:- Aims/anatomist has no reliable information to detect if the image has been normalized or not. The only clue we have is the field of view which is more or less standard on normalized images.
there seem to be a field called 'descrip' in the analyze file header (still given by avwhd), which takes the value 'spm - 3D normalized' after a spatial normalization in spm2... maybe that would be more reliable than using the field of view (even if I'm totally convinced that this won't be a solution that's 100% reliable either)

sylvain
Post Reply