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

Issues using functions "fsaverage_to_fslr" and "fslr_to_fsaverage" #190

Open
1 task done
WangYunHong98 opened this issue Jan 17, 2025 · 4 comments
Open
1 task done

Comments

@WangYunHong98
Copy link

WangYunHong98 commented Jan 17, 2025

Description of issue

Hi everyone @liuzhenqi77 @estefanysuarez @yarikoptic

Errors occurred using fsaverage_to_fslr or fslr_to_fsaverage.

Below is my code:

from neuromaps.datasets import fetch_annotation
from neuromaps.transforms import fsaverage_to_fslr, fslr_to_fsaverage

abagen = fetch_annotation(source='abagen')
fslr = fsaverage_to_fslr(abagen, '32k')

hcp_myelin = fetch_annotation(source='hcps1200', desc='myelinmap', space='fsLR', den='32k')
fs = fslr_to_fsaverage(hcp_myelin, '10k')

After running above code, erros occurred:

Exception in thread Thread-16:
Traceback (most recent call last):
  File "c:\ProgramData\anaconda3\envs\MIND\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\ProgramData\anaconda3\envs\MIND\lib\site-packages\ipykernel\ipkernel.py", line 766, in run_closure
    _threading_Thread_run(self)
  File "c:\ProgramData\anaconda3\envs\MIND\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "c:\ProgramData\anaconda3\envs\MIND\lib\subprocess.py", line 1386, in _readerthread
    buffer.append(fh.read())
  File "c:\ProgramData\anaconda3\envs\MIND\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 13: invalid start byte
{
	"name": "AttributeError",
	"message": "'NoneType' object has no attribute 'strip'",
	"stack": "---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
File c:\\ProgramData\\anaconda3\\envs\\MIND\\lib\\site-packages\
euromaps\\utils.py:78, in run(cmd, env, return_proc, quiet, **kwargs)
     77 try:
---> 78     proc = subprocess.run(cmd, env=merged_env, **opts)
     79 except subprocess.CalledProcessError as err:

File c:\\ProgramData\\anaconda3\\envs\\MIND\\lib\\subprocess.py:516, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    515     if check and retcode:
--> 516         raise CalledProcessError(retcode, process.args,
    517                                  output=stdout, stderr=stderr)
    518 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command 'wb_command -metric-resample C:\\Users\\Administrator\
euromaps-data\\annotations\\abagen\\genepc1\\fsaverage\\source-abagen_desc-genepc1_space-fsaverage_den-10k_hemi-L_feature.func.gii C:\\Users\\Administrator\
euromaps-data\\atlases\\fsaverage\\tpl-fsaverage_den-10k_hemi-L_sphere.surf.gii C:\\Users\\Administrator\
euromaps-data\\atlases\\fsLR\\tpl-fsLR_space-fsaverage_den-32k_hemi-L_sphere.surf.gii ADAP_BARY_AREA C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpjc_xx524.func.gii -area-metrics C:\\Users\\Administrator\
euromaps-data\\atlases\\fsaverage\\tpl-fsaverage_den-10k_hemi-L_desc-vaavg_midthickness.shape.gii C:\\Users\\Administrator\
euromaps-data\\atlases\\fsLR\\tpl-fsLR_den-32k_hemi-L_desc-vaavg_midthickness.shape.gii -current-roi C:\\Users\\Administrator\
euromaps-data\\atlases\\fsaverage\\tpl-fsaverage_den-10k_hemi-L_desc-nomedialwall_dparc.label.gii' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[20], line 3
      1 from neuromaps.transforms import fsaverage_to_fslr
      2 abagen = fetch_annotation(source='abagen')
----> 3 fslr = fsaverage_to_fslr(abagen, '32k')

File c:\\ProgramData\\anaconda3\\envs\\MIND\\lib\\site-packages\
euromaps\\transforms.py:536, in fsaverage_to_fslr(data, target_density, hemi, method)
    534 srcparams = dict(space='fsaverage', den=density, trg='')
    535 trgparams = dict(space='fsLR', den=target_density, trg='_space-fsaverage')
--> 536 return _surf_to_surf(data, srcparams, trgparams, method, hemi)

File c:\\ProgramData\\anaconda3\\envs\\MIND\\lib\\site-packages\
euromaps\\transforms.py:362, in _surf_to_surf(data, srcparams, trgparams, method, hemi)
    351 params = dict(
    352     metric=img,
    353     out=tmpname('.func.gii'),
   (...)
    359     trgmask=trgdir / MLFMT.format(**trgparams)
    360 )
    361 for fn in (func, MASKSURF):
--> 362     run(fn.format(**params), quiet=True)
    363 resampled += (construct_shape_gii(load_data(params['out'])),)
    364 params['out'].unlink()

File c:\\ProgramData\\anaconda3\\envs\\MIND\\lib\\site-packages\
euromaps\\utils.py:81, in run(cmd, env, return_proc, quiet, **kwargs)
     78     proc = subprocess.run(cmd, env=merged_env, **opts)
     79 except subprocess.CalledProcessError as err:
     80     raise subprocess.SubprocessError(
---> 81         f'Command failed with non-zero exit status {err.returncode}. '
     82         f'Error traceback: \"{err.stderr.strip()}\"'
     83     ) from err
     85 if return_proc:
     86     return proc

AttributeError: 'NoneType' object has no attribute 'strip'"
}

Software version

neuromaps version 0.0.5

OS

Windows 10 pro and Anaconda 3

I have no idea about these errors. I am appreciated if someone who can help me.

Code of Conduct

  • I agree to follow the neuromaps Code of Conduct
@WangYunHong98 WangYunHong98 changed the title Issues using Issues using functions "fsaverage_to_fslr" and "fslr_to_fsaverage" Jan 17, 2025
@liuzhenqi77
Copy link
Member

Hey, it seems wb_command (the actual underlying program doing the resampling) is not running correctly.

You can find the actual command it was trying to run in the error message starting with CalledProcessError: Command 'wb_command .... You might want to try running it directly and see what error it gives, could be something related to path or permission.

@WangYunHong98
Copy link
Author

Hi @liuzhenqi77

Please pardon my late reply. Is it possible to understand that to use these two functions I need to install workbench in linux ?

@liuzhenqi77
Copy link
Member

Hey,

Connectome Workbench has a Windows build, and we know that people have been using it with neuromaps on Windows without many problems.

That said, all our tests are on Linux, so we're not sure if anything unexpected would happen on Windows.

@WangYunHong98
Copy link
Author

Thank you very much @liuzhenqi77 !

I re-installed Connectome Workbench on Windows and all worked.

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

2 participants