ROI mask output does not keep matrices of nifti file

Questions about Anatomist manipulation

Moderators: riviere, denghien

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

Postby Manik » Thu Apr 18, 2013 5:47 pm

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: 1358
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

Postby riviere » Thu Apr 18, 2013 10:05 pm

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


Return to “Anatomist”

Who is online

Users browsing this forum: No registered users and 2 guests