cortical surface-based functional analysis

Questions about BrainVisa usage and installation

Moderators: denghien, riviere

MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

cortical surface-based functional analysis

Post by MSh »

Hello

I am trying to do cortical surface-based functional analysis. I have managed to create the kernel (.ima file) using the "creation of kernel for volumes" process. However in the next step, "projection of functional volumes", I get the error message below:


Process Projection of Functional Volumes 3 started on 2009/07/17 11:18
Creating a projection texture for /home/mshokouhi/Desktop/functional/4DrfIOP_CAM002-WM_001.nii...
Adding mesh info in textures .minf files..



in Projection of Functional Volumes 3 list index out of range

IndexError
neuroProcesses.py (1960) in _processExecution:
result = process.execution( self )
FunctionalProjection.py (84) in execution:
h['functional_volume']=str(self.functional_volumes)


Process Projection of Functional Volumes 3 finished on 2009/07/17 11:18 (4 seconds)




For this step, I've tried both 3D and 4D functional datasets, however they are outside the database (in fact I couldn't find a way to import them to the right place).

How about the rest of the processes? There is a "surface-based analysis pipeline" which includes two other steps: "Concatenate textures in one time-texture" and "surface-based statistical parametric map". Are these the next steps to be followed?

Thanks
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Re: cortical surface-based functional analysis

Post by Olivier Coulon »

Hi,
it is difficult to know what happened from the information you provided but here is my guess : when you create kernels for a specific anatomy, you also have to provide the resolution of the functional volumes you will project at the next step. It is possible that you got that wrong and that for some mesh nodes close to the border of the volume it generates the problem you encounter. So check this out first and let me know.
Some additional inofrmation :
- Gregory Operto is the one who programmed the method, I'll get in touch with you so he can answer probably better than I do.
- The process is still a User level 2, so it is still evolving and we don't really provide support yet. Maybe you encounetered a bug that has not benn fixed yet.
For this step, I've tried both 3D and 4D functional datasets, however they are outside the database (in fact I couldn't find a way to import them to the right place).
I don't think there is an import for this yet, we are still working on it. A final pipeline should be available by the end of the year for the whole surface-based functional analysis process, so you will have it in the next version of Brainvisa.
There is a "surface-based analysis pipeline" which includes two other steps: "Concatenate textures in one time-texture" and "surface-based statistical parametric map". Are these the next steps to be followed?
"Concatenate textures" is designed to use the 3D textures that have been generated by the projection of volumes and generate a texture of time series. Those textures can then be used by the statistical parametric maps process in order to generate individual SPM-like maps.

Good luck, and keep in touch with your progress.

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

Re: cortical surface-based functional analysis

Post by MSh »

Hi

Voxel sizes for my functional images are:(3.44,3.44,4.50). So it's not homogenious along all directions. Could this be a problem?

I've tried deifferent values for kernel size (9, 7 and 6) but the problem still exists.

MSh
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Re: cortical surface-based functional analysis

Post by Olivier Coulon »

Hello,
so you filled the resolutionX/Y/Zfields with those values ?
So it's not homogenious along all directions. Could this be a problem?
On principle no, that should not matter. It is just taken to define the kernels so their resolution fits with the functional images.
Do you still have the same error ? (index out of range)
If yes, we should find a way for you to send me your structural image and one functional volume, so I can try it out...

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

Re: cortical surface-based functional analysis

Post by MSh »

Hello

Yes. I enter those values as x/y/z resolution and get the same error message as before.

Mahsa
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Re: cortical surface-based functional analysis

Post by Olivier Coulon »

OK, could you send your structural scan and one functional volume using a service like yousendit.com or anything equivalent ? You halready have my email adress don't you ?

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

Re: cortical surface-based functional analysis

Post by MSh »

Dear Olivier

I just sent you an e-mail about where to access those files.

Thanks
MSh
MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

Re: cortical surface-based functional analysis

Post by MSh »

Hi

I guess I found where the problem of misalignment between structural and functional images arises from. Both structural and functional images (which were co-registered in SPM) are actually co-registered (which can be checked by opening them in MRICron, for example), however as the voxel sizes are different for functional and structural images (roughly 1*1*1 for structural and 3*3*4 for functional), when opened in Brainvisa they appear unregistered. After I repeated the co-registration this time by reslicing the structural image to the resolution of functional ones, the problem of registration seemed to be solved but the resolution of the structural image was so bad that makes it impossible to create a good mesh. Another alternative might be to reslice the functional images to the structural one but this means applying the registration to hundreds of images. Any idea that helps?

Thanks
MSh
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Re: cortical surface-based functional analysis

Post by Olivier Coulon »

Hello,
I'm afraid voxel size is not the issue. Anatomist can correct for that when it displays images and brainvisa takes it into account when processing images. From what I saw, I guess it could be a problem of origin, maybe you could check where is the origin in both scans.

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: cortical surface-based functional analysis

Post by riviere »

Hi,
BrainVisa can generally read coregistration information written by SPM and use it in Anatomist, but it depends on how the regitration information is stored. If it is a matrix in the images headers in Nifti format, then it will be read in Anatomist, but you may have to actually apply it: right-click on the images objects and select "referential/apply builtin referential (SPM/NIFTI)", and hope SPM has written the correct info about which is the common referential (otherwise you can fix it by hand).
If it is a .mat file, there are converter processes in BrainVisa.
But in any case, using the coregistration information in BrainVisa processes depends on the process. I'm not sure if the cortical surface analysis processes make use of it or not...
See here for using coordinates transformations in Anatomist, and
here for technical info about how they are used.
Denis
MSh
Posts: 40
Joined: Tue Nov 04, 2008 4:42 pm

Re: cortical surface-based functional analysis

Post by MSh »

Hi

I've done the coregistration with SPM8 which supposedly writes the information about the coregistration matrix in the header of the file. I also applied bultin referential (SPM/NIFTI) but still the structural and functional images look separate in anatomist. This problem seems to be solved when I reslice the functional image to the structural one and they look registerd when opened with anatomist, however I still get the original error message of "list index out of range" when using the "projection of functional volumes".

MSh
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: cortical surface-based functional analysis

Post by riviere »

Hi,
SPM8 writes the registration matrix in the nifti headers, but doesn't specify which referential the registration goes to. This probably explains why Anatomist still doesn't make the link between the two images. You can to it by hand in Anatomist (by opening the referentials window and dragging an identity transformation between the target referentials of the nifti transformation of both images, then you will have to view images in one of the linked referentials).
Anyway the problems in Anatomist and in the cortical surface analysis process in BrainVisa are probably not the same. I see in the code repository that the code where your error occurred is now commented out (and there was clearly a bug in this code), so it has probably been fixed (or changed) since the last release of BrainVisa - so I hope it will work better in the next update...
Denis
faillenot
Posts: 17
Joined: Fri Nov 21, 2008 12:55 pm

Re: cortical surface-based functional analysis

Post by faillenot »

I have the same error message doing cortical surface analysis : "list index out of range"

When there will be a new release ? Do we have to wait ? ...
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Re: cortical surface-based functional analysis

Post by Olivier Coulon »

Hello, I will get in touch with Grégory (who created the process) and see what he thinks of that. I will (or he will) let you know.

olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
User avatar
Grégory Operto
Posts: 18
Joined: Sun Jan 16, 2005 11:00 pm
Location: CEA NeuroSpin, Gif-sur-Yvette, France
Contact:

Re: cortical surface-based functional analysis

Post by Grégory Operto »

Hi,
indeed, as Denis wrote it previously, there is a bug in the process Python code. The bug can be solved immediately by commenting out some part of the code.
In the directory $BRAINVISADIR/brainvisa/toolboxes/cortical_surface/processes/functional/functional-projection/, edit the file named FunctionalProjection.py and comment out the following lines :

Code: Select all

def volumemesh( values, process ):
    result = None
    if values.white_mesh is not None and values.functional_volumes is not None:
      result = []
      for functional in values.functional_volumes:
         attributes = values.white_mesh.hierarchyAttributes()
         attributes[ 'volume' ] = functional.name
         result.append( process.signature[ 'projection_texture' ].contentType.findValue( attributes ) )
    return result
and

Code: Select all

      context.write('Adding mesh info in textures .minf files..')
      for output in self.projection_texture:
         reader = aims.Reader()
         object = reader.read( str(output) )
         print 'file:', object
         h = object.header()
         h['mesh']=str(self.white_mesh)
         h['functional_volume']=str(self.functional_volumes[i])
         writer = aims.Writer()
         writer.write(object, str(output))
You can find a corrected version there http://pages-perso.esil.univmed.fr/~ope ... jection.py, to replace your current existing file with.

This correction should solve the "list out of range" problem. Does it ?
Grégory
Post Reply