ROI mask output does not keep matrices of nifti file

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
Manik
Posts: 99
Joined: Fri Mar 05, 2004 1:00 pm
Location: INSERM U836, Grenoble

ROI mask output does not keep matrices of nifti file

Post by Manik »

Hi,

a colleague trying to segment a lesion on an T1 MRI (nifti file) using Anatomist ROI module and exporting the resulting mask as nifti was unable to view it in SPM alongside the T1 with a synchronized cursor.
It seems the problem is that exporting a ROI as a mask does not keep the geometrical transformations from the source image's header (scanner-based referential).
Is there a way to get Anatomist to copy the transformations to the mask ?
Manik Bhattacharjee
INSERM U836
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: ROI mask output does not keep matrices of nifti file

Post by riviere »

Hi Manik,
I thought the main attributes of the original image header were copied to the exported ROI, but it seems that it is not so. We will look at it.
In the meantime, you can add the missing transformation by dirfferent means:
- extract the transformation from the original image, using AimsFileInfo, copy the "referentials" and "transformations" fields to the extracted ROI .minf header, then re-write the ROI image using AimsFileConvert (you can re-write it on itself), this will ensure the new information is inserted in the nifti file itself (and not only the .minf extra header)
- you can do the same via a python script:

Code: Select all

from soma import aims
orig = aims.read( 'original_image.nii' )
roi = aims.read( 'exported_roi.nii' )
roi.header()[ 'referentials' ] = orig.header()[ 'referentials' ]
roi.header()[ 'transformations' ] = orig.header()[ 'transformations ]
aims.write( roi, 'exported_roi.nii' )
In a more general way, you can probably copy the entire original image header to the exported ROI's:

Code: Select all

roi.header().update( orig.header() )
Denis
Post Reply