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 ?
ROI mask output does not keep matrices of nifti file
ROI mask output does not keep matrices of nifti file
Manik Bhattacharjee
INSERM U836
INSERM U836
- 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
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:
In a more general way, you can probably copy the entire original image header to the exported ROI's:
Denis
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' )
Code: Select all
roi.header().update( orig.header() )