Using freesurfer desikan-killiany-atlas with warped default anatomy?

Dear Francois, dear Sylvain,
Is it possible to use the freesurfer desikan-killiany-atlas with the warped default anatomy? I want to use scouts from the atlas with the warped default anatomy for ROI-analysis in healthy subjects, but I can’t load the scouts when using the warped freesurfer cortex. Did I do anything wrong or is it just not implemented? If not, do you plan to implement this function?
Best regards,
Kirsten

Hi Kirsten,

Yes, it is possible to use all the atlases available on the default brain (Colin27) on the warped surfaces. I just forgot to add the commands to copy the scouts from the default anatomy to the warped anatomy folder.
I fixed this. After you update Brainstorm, you will see all the atlases when you click on the “load scouts” button, but only for the anatomy folders created after the update.

To load the atlases for the subjects you have already processed:
click on the “load scouts” buttons, and go pick the scout file in the folder anat/@default_anatomy instead of anat/subjectname.

Cheers,
Francois

Dear Francois,
thank you very much for your fast reply! However, now, loading the scouts does not work. They are in the folder now, but when I try to load them (using warped anatomy data from Colin27 created after the update) I get the following error message:

??? Index exceeds matrix dimensions.
Error in ==> panel_scouts>GetScoutsWithSurface at 556
sScouts = GlobalData.Scouts(iScouts);
Error in ==> panel_scouts>LoadScouts at 2117
[sScouts, iScouts] = GetScoutsWithSurface(ScoutMat.Tesselation);
Error in ==> panel_scouts>@(h,ev)LoadScouts() at 181
gui_component(‘ToolbarButton’, jToolbar2,[],[], IconLoader.ICON_FOLDER_OPEN, ‘Load scouts file’,
@(h,ev)LoadScouts());

Thank you in advance for helping again.
Best regards,
Kirsten

Sorry, I didn’t test it properly.
I fixed this bug. There might be some others around.
Thanks for helping me debugging this.
Francois

Hi Francois,
never mind. I’m sorry to tell you that I receive a new error message now when trying to load the scouts using the warped anatomy (which was created before the update):

??? Error using ==> strrep
Cell elements must be character arrays.

Error in ==> file_compare at 49
f1 = strrep(f1, ‘/’, ‘’);

Error in ==> panel_scouts>GetScoutsWithSurface at 557
iScouts = find(file_compare({GlobalData.Scouts.SurfaceFile}, SurfaceFile));

Error in ==> panel_scouts>GetCurrentScouts at 543
[sScouts, iScouts] = GetScoutsWithSurface(GlobalData.CurrentScoutsSurface);

Error in ==> panel_scouts>UpdateScoutsDisplay at 1874
[sScouts, iScouts] = GetCurrentScouts();

Error in ==> panel_scouts>LoadScouts at 2166
UpdateScoutsDisplay();

Error in ==> panel_scouts>@(h,ev)LoadScouts() at 181
gui_component(‘ToolbarButton’, jToolbar2,[],[], IconLoader.ICON_FOLDER_OPEN, ‘Load scouts file’,
@(h,ev)LoadScouts());

Thanks again for helping,
Kirsten

Hi Kirsten,
Fixed. Waiting for the next error message :slight_smile:
Francois

Hi Francois,
thank you for the update from last week. When loading scouts from the Desikan-Killiany-atlas using old warped anatomy files it seems to work fine. However, after creating and warping new anatomy files, I receive a new error message when trying to load the scouts from the Desikan-Killiany-atlas :

??? Error using ==> panel_scouts>LoadScouts at 2118
This scout file need surface file “@default_subject/tess_fs_tcortex_15000V.mat”,
which cannot be found in anatomy directory.

Please check the Tesselation field of the scout file.

Error in ==> panel_scouts>@(h,ev)LoadScouts() at 181
gui_component(‘ToolbarButton’, jToolbar2,[],[], IconLoader.ICON_FOLDER_OPEN, ‘Load scouts file’,
@(h,ev)LoadScouts());

I looked into the default_subject directory in the brainstorm database and didn’t find the tess_fs_tcortex_15000V.mat file. I don’t know why it wasn’t created.

Thanks for your help again!
Kirsten

Hi Kirsten,

I’m sorry for all those bugs you’re running into… Are you still having this problem?
I didn’t manage to reproduce this error, I can’t understand why you get this message.

Just to make sure that we are running the same thing, can you try again starting from scratch?

  1. Update Brainstorm to today’s version
  2. Create a new protocol
  3. Create a new subject, with the option “Yes, use default anatomy”
  4. Import a dataset with the head points you want to use for the warping
  5. Right-click on the channel file > Head points > Warp > Deform default anatomy to fit those points
  6. Close the window that is opened right after the computation
  7. Go back to the Anatomy view
  8. Right-click on the surface “FreeSurfer: cortex 15000V warped” > Set surface type > Cortex
  9. Double click on this surface to display it
  10. In the scouts tab, open the file “scout_freesurfer_desikan-killiany_15000V.mat”

Please let me know how this works.
Francois

Hi Francois,

Is not it possible with volume parcellations? Should I re-segment the warped MRI to obtain them?

Thank you,
Ramtin

I edited the warping functions so that all the volumes are warped in the same way:
https://github.com/brainstorm-tools/brainstorm3/commit/13693984e9d5d9e7e9b43fcca4e64e53f20f6bd4

Update Brainstorm to get this fix.
Please let me know if you observe are any issues with this fix.

It seems to work, thank you!

It would be handy if the warped atlases could be also selected via command line. Is there a straightforward way to load the atlas as in the GUI "From subject anatomy"?

Ramtin

Is there a straightforward way to load the atlas as in the GUI "From subject anatomy"?

You can use something like this:

GridLoc = [];
% Only for volume source models
   ResultsMat = in_bst_results(ResultsFile, 0, 'GridLoc');
   GridLoc = ResultMat.GridLoc;
% Get subject
sSubject = bst_get('Subject', 'Subject01');
% Get default cortex file
CortexFile = sSubject.Surface(sSubject.iCortex).FileName;
% Get ASEG atlas
iDkt = find(strcmpi({sSubject.Anatomy.Comment}, 'DKT'));
DktFile = sSubject.Anatomy(iDkt).FileName;
[sAtlas, Messages] = import_label(CortexFile, DktFile, 1, GridLoc);

Is this what you mean with "load"?

Note that volume atlases are designed to be used on volume source models.
Using this on a surface source model usually leads to very poor cortical parcellations.

1 Like

Dear Francois,

This is exactly what I needed. I am indeed working with volume sources (see attachment).

Thank you for your help.

Ramtin
Screenshot 2022-05-24 145421