Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"-surface-resample" cannot resample an input surface that is very-high resolution #59

Closed
smeisler opened this issue Jan 20, 2022 · 8 comments

Comments

@smeisler
Copy link

smeisler commented Jan 20, 2022

Hello,

This issue was mentioned in mandymejia/ciftiTools#34 .

Background

I have fMRIPrep (21.0.0) cifti outputs (using the 91k resolution). All surface/cifti files can be found here. They are from a public openneuro dataset (ds003129). I am trying to resample the subject's high density surface (~150k vertices) to the template space that the cifti file corresponds with (~32k vertices).

The problem

"-surface-resample" crashes when trying to resample the subject's high-resolution surface file (sub-047EPKL011005_ses-1_hemi-L_midthickness.surf.gii) to the template resolution (tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii). I used ciftiTool's (https://github.com/mandymejia/ciftiTools) wrapper function resample_surf, which calls workbench (1.5.0)-surface-resample and got the following error:

Error

For every triangle in the surface I get the following error (I paste just a portion of the error message below);
triangle 317355, vertex 0Vertex used twice in one triangle: triangle 317356, vertex 0Vertex used twice in one triangle: triangle 317356, vertex 0Vertex used twice in one triangle: triangle 317357, vertex 0Vertex used twice in one triangle: triangle 317357, vertex 0...

Please let me know if there is any information I can provide to help describe this problem better.

Thank you,
Steven

@coalsont
Copy link
Member

That message is in the surface file reading code. Can you provide a file that causes such an error, so we can check whether the file truly has zeros in the triangle array?

@smeisler
Copy link
Author

Yes, surface files are in this zipped folder (along with other relevant fmriprep outputs): https://drive.google.com/file/d/1m2bPZGHVwPN8l9Aehx2Hjhf2PBC5p1Tv/view

The file I was working on specifically is sub-047EPKL011005_ses-1_hemi-L_midthickness.surf.gii. If there is a more convenient way for me to share these files let me know.

Thank you for the quick response,
Steven

@coalsont
Copy link
Member

Also note that we use 164k surfaces in the HCP pipelines with wb_command and wb_view, without such an error:

https://github.com/Washington-University/HCPpipelines/tree/master/global/templates/standard_mesh_atlases

fsaverage.L_LR.spherical_std.164k_fs_LR.surf.gii

See if that makes it through your code without errors.

@coalsont
Copy link
Member

What files get used for the spheres in the resampling command?

@smeisler
Copy link
Author

smeisler commented Jan 20, 2022

That is a good question, I have made the developers of ciftiTools aware of this, and it is possible that it is an error in how their wrapper function handles files. Their function e.g., resample_surf(surf=surface_fname, resamp_res = 32492, hemisphere='left') only takes in a single surface and resampling resolution argument, so I am not sure what gets used for spheres.

Thank you for linking me to the surface you use. Unfortunately I got the same error

While running:
/rdma/vast-rdma/vast/gablab/smeisler/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command -surface-resample /tmp/Rtmp49kVVm/to_resample.surf.gii /tmp/Rtmp49kVVm/sphereL_158681.surf.gii /tmp/Rtmp49kVVm/sphereL_32492.surf.gii BARYCENTRIC /tmp/Rtmp49kVVm/to_read.surf.gii

ERROR: NAME OF FILE: to_resample.surf.gii
PATH TO FILE: /tmp/Rtmp49kVVm

Vertex used twice in one triangle: triangle 199497, vertex 0Vertex used twice in one triangle: triangle 199498, vertex 0..........

Perhaps it is the writing / reading from tmp that is causing problems (I am on an HPC without root privileges). I will continue to investigate.

Best,
Steven

@coalsont
Copy link
Member

158681 is the resolution of your surfaces, not of the sphere I pointed you to, so I don't know why the wrapper is running that command, or what to_resample.surf.gii is supposed to be a copy of. I would guess that it is internally finding the sphere files associated with the subject, and therefore can't resample anything that doesn't match that subject's resolution anyway.

@glasserm
Copy link

I wonder if it would be better to try using the wb_command -surface-resample directly? While I met the author of ciftitools once, we don't have an established relationship with her to support her tools. Also it's entirely possible that the wrappers are not doing what we would recommend in any case.

@smeisler
Copy link
Author

Seems reasonable, thank you both. I'll close this because it doesn't seem to be an issue with workbench.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants