How to allign ROIs from 32k surface template to surface native dHCP surface with 84K vertices?

Hallo,

I’ve to map the ROIs from Glasser et al. cortical parcellation to my subjects native space in order to run the tractography(FSL) with surface ROIs in the native space but I’m having trouble with it.
The subjects native surface files have 84k vertices while the cortical parcellation has 32k.

As far as I understood dHCP data is not alligned with HCP templates, hence I will have to align them and then upsample the 32k partcellation ROIs up to the native space of the subjects.

Will you help me understand what exactly I’ve to do?

Best,
Tommaso

I’ve responded on the FSL list. Do you still need help or have you seen this?

Hi, yes I saw your response, sorry I have been told to write on multiple lists.
And yes I still need help since I’m not familiar with surface files.

Should we continue here or on the FSL mail?

however, as far as i understood

  1. I need to rotate the dHCP native surface with the HCP surface template.
  2. allignment of native space with template
  3. and then downsampling from 84k to 32k.
    for those 3 points i need to used the script you sent here: https://github.com/ecr05/dHCP_template_alignment

At this point I will have the baby data in 32k with the respective trasformation matrices(?).

  1. so now I will have to upscale the rois via trasfomation matrices,
  2. allign back the output to the native space and
  3. rotate back to the dHCP space

For those last 3 steps you suggested to do a folding based alignment which means to use sulc.shape.gii of our subject in point 5. am I right?

Do I have grasp the idea behind?
but i’m not sure I will able to make it work

You need to

  1. run the surface to template script on the data to get the data into dHCP template space - this is what https://github.com/ecr05/dHCP_template_alignment does
  2. you need to run msm registration between the dHCP template and the HCP template using folding as the feature
  3. You can then resample the HCP template onto the dHCP template; from there you can also sample onto each individual surface individual surface. Boht using wb_command -label-resample commands

If this is too complicated then we will release the template aligned surfaces in the next dHCP data release and can do the dHCP-HCP template alignment also if it would help?

Emma

Thank you very much,

Now it is more clear but I have new doubts:
The structural pipeline did not aligned the surfaces to the dHCP templates, so where can I find the dHCP templates? I had a look in the structural-pipeline github with no success.

Files like:
sub-CC00073XX08_ses-27800_hemi-L_space-T2w_sphere.surf.gii
are the projection of the preprocessed T2w without allignment to the sphere. Are those the files you identify as native in your script?

And, I don’t think it is too complicated, but the amount of different files and being not familiar with the procedure can make you feel overwhelmed.
However, I think I understand most of the procedure.

Thank you again,
Tommaso

The templates are here https://brain-development.org/brain-atlases/atlases-from-the-dhcp-project/cortical-surface-atlas-bozek/

Yes, that’s the native sphere.

Thank you for the answer.

I started working on it and I’ve faced the first question:
Should I estimate the prerotation for every subject given the respective week template? if so, while running the script for a test subject I faced 2 errors regarding MSM inputs written in the config file:
–regoption=3
–dopt=HOCR
they were reported as not being an option in msm. After removing them the script worked. Will this affect the result?

That’s because you are using the FSL version of MSM not the github one. For the FSL version you should use a different config file altogether really e.g. https://github.com/ecr05/MSM_HOCR/blob/master/config/basic_configs/config_standard_MSMpair? Have you visually QC’d the results?

Hi,
yes I’ve inspected the result and they are imprecise I would say. I will try both the new config file and with MSM HOCR.
When doing the resample between subject aligned to dHCP and the subject’s native space, should I use the dHCP template sphere or the subject’s dhcp registered sphere as label-in for -label-resample?
I’m asking this since the result for the former is better.

Sorry, that isn’t clear.

You need to run registration of ALL subjects to dHCP template AND register the dHCP template to the HCP template. You then need to combine those transformations, or run them in reverse to get your labels back to subject native space.

I don’t really understand how your resampling will work with either the template or the registered as they should have different numbers of vertices. Nor are you making it clear what direction you are resampling in.

Sorry I made a mistake in the question, I will explain better.
The last question was about the last label-resample step. (So after registering the subject to the to the dhcp template, after registering dHCP and HCP templates and after passing the dHCP-HCP registration sphere to the first label-resample)

At this point, I will have to use the “current-sphere” input for labes-resample from the dHCP template space, but I’m confuse about which one I have to use:
the dHCP template sphere, or, the subject’s sphere that is output of the registration subject-dhcp template?

It’s still not clear.

In the help for wb_command it states:

wb_command -label-resample
- the label file to resample
- a sphere surface with the mesh that the label file is
currently on
- a sphere surface that is in register with
and has the desired output mesh
- the method name
- output - the output label file

So current sphere is the sphere with the same number of vertices for which the label file has data points, and the new sphere is another sphere, in alignment with the current sphere but with different numbers of vertices.

Both the spheres I wrote have the same number of vertices.
At this point I assume my question doesn’t make sense, so I assume it is correct to use the dHCP template sphere as current sphere. That’s because after the first resampling the rois are aligned with the dHCP template.

I think it’s not a good idea to use it just because it looks right - this could lead to problems further on. Copy and paste the commands into a reply - with comments so I know where all of the files have come from and I will check.

The subject’s 32k mesh sphere should be the template sphere see https://github.com/ecr05/dHCP_template_alignment/blob/master/surface_to_template_alignment/align_to_template.sh#L116 so what you are saying is worrying me a bit,

indeed, that is why I was suspecting that my question was a nonsense

Ok, so that is the last resampling procedure I’ve runned:
First HCP -> dHCP:
wb_command -label-resample $masksdir/$maskL $HCPdir/S1200.L.sphere.32k_fs_LR.surf.gii $dHCPdir/L.sphere.reg.surf.gii ADAP_BARY_AREA $outdir/L.test1.label.gii -area-metrics $HCPdir/sep_S1200.L.sulc_MSMAll.32k_fs_LR.shape.gii $dHCPdir/L.transformed_and_reprojected.func.gii

where:

  • $masksdir/$maskL the labels
  • S1200.L.sphere.32k_fs_LR.surf.gii HCP template sphere
  • /L.sphere.reg.surf.gii registation output of the HCP-dHCP spheres
  • L.test1.label.gii output
  • sep_S1200.L.sulc_MSMAll.32k_fs_LR.shape.gii sulci from HCP atlas (output of -cifti-separate)
  • /L.transformed_and_reprojected.func.gii sulci from HCP-dHCP template registration -> replaced dHCP.week42.L.sulc.shape.gii

then folowed by this one that uses the the template sphere (which is the one I wrote I think it is correct):
wb_command -label-resample $indir/L.test1.label.gii $dHCPdir/dHCP.week41.L.sphere.surf.gii $subdir/sub-CC00073XX08_ses-27800_hemi-L_space-dHCP_sphere.reg.surf.gii ADAP_BARY_AREA $outdir/L.test2.label.gii -area-metrics $dHCPdir/dHCP.week41.L.sulc.shape.gii $subdir/sub-CC00073XX08_ses-27800_hemi-L_space-T2w_sulc.shape.gii

  • Where L.test1.label.gii are the labels registered in to dhcp template,
  • dHCP.week41.L.sphere.surf.gii the template sphere,
  • sub-CC00073XX08_ses-27800_hemi-L_space-dHCP_sphere.reg.surf.gii the msm output of align_to_surface.sh,
  • L.test2.label.gii the output
  • dHCP.week41.L.sulc.shape.gii template sulci
  • sub-CC00073XX08_ses-27800_hemi-L_space-T2w_sulc.shape.gi the subject sulci in the native space

Edit: I’ve runned the script with the config file you suggested earlier and I’ve replaced the reference metrics (L.transformed_and_reprojected.func.gii) in the first -label-resample with dHCP.week42.L.sulc.shape.gii or the sulci file from the dhcp template.

Now the script works sensibly better.

Thank you for the help

First thing is that sub-CC00073XX08_ses-27800_hemi-L_space-dHCP_sphere.reg.surf.gii should have 84745 vertices not 32k? Otherwise this part:

wb_command -label-resample $indir/L.test1.label.gii $dHCPdir/dHCP.week41.L.sphere.surf.gii $subdir/sub-CC00073XX08_ses-27800_hemi-L_space-dHCP_sphere.reg.surf.gii

Of your command is correct. for -area-metrics it is expecting areal distortion measures - if you really want to run ADAP_BARY_AREA you should use -area-surfs and then supply each surface’s midthickness (or white) surface.

It does have 84k vertices. I’ve tried to use -area-surfs with the white matter and the result are sligtly better than using the sulci! Here the results, do you think they are good enough also with that not perfect alignment?

Thank you for your help Emma, you have been very kind.

sorry for some reason I didn’t catch this message.

It’s very difficult to say. The HCP parcelation ideally requires multimodal (myelin and rfMRI) registration and its likely that many of the regions in the adult aren’t present in the neonate. Also - you’ve only shown the medial side of the surface

Hi,
don’t worry.
The registration worked very well actually after I used this config you provided instead of the basic one: https://github.com/ecr05/dHCP_template_alignment/blob/master/configs/config_subject_to_40_week_template_relaxedaffine

However, when using the resulting ROIs in bedpostx2 (exactly half of the rois), the software returns the following error:

terminate called after throwing an instance of ‘NEWMAT::IndexException’
Aborted (core dumped)

I suspect there could be some errors in some adult-babies registration, probably since some adults regions in the adult aren’t present in the neonate as you wrote.

Do you have any clue why a subset the ROIs are not working in probtrack only? I converted the surf.gii files in .asc using whitematter as surface

Best,
Tommaso

Hi Tommaso

I think you should probably direct this question to the FSL list. a NEWMAT::IndexException could refer to so many things in the code but it’s saying that basically it’s trying to index a position in an array that doesn’t exist i.e. you are trying to put something in row 10 of a matrix when it only has 9 rows. Perhaps somewhere you have defined the number of ROIs present as wrong for example - good to check that all the label files all have the same number of regions - though I can’t see how they would not following the registration you describe - maybe there’s a masking issue or something.

Emma