What is the current behavior?
Following the tutorial using BrainStat in a Jupyter Notebook running through Singularity. In the tutorial, you are supposed to be able to fetch gene expression using surface_genetic_expression. However, this is broken currently:
2024-06-04 10:34:06.077 (36615.547s) [ C8222740] vtkPythonAlgorithm.cxx:97 ERR| vtkPythonAlgorithm (0x56267e036dd0): Failure when calling method: "ProcessRequest":
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File /opt/conda/lib/python3.11/site-packages/vtk-9.3.20230807rc0-py3.11-linux-x86_64.egg/vtkmodules/util/vtkAlgorithm.py:152, in VTKPythonAlgorithmBase.InternalAlgorithm.ProcessRequest(self, vtkself, request, inInfo, outInfo)
151 def ProcessRequest(self, vtkself, request, inInfo, outInfo):
--> 152 return vtkself.ProcessRequest(request, inInfo, outInfo)
File /opt/conda/lib/python3.11/site-packages/vtk-9.3.20230807rc0-py3.11-linux-x86_64.egg/vtkmodules/util/vtkAlgorithm.py:198, in VTKPythonAlgorithmBase.ProcessRequest(self, request, inInfo, outInfo)
196 return self.RequestUpdateExtent(request, inInfo, outInfo)
197 elif request.Has(vtkDemandDrivenPipeline.REQUEST_DATA()):
--> 198 return self.RequestData(request, inInfo, outInfo)
200 return 1
File /opt/conda/lib/python3.11/site-packages/brainspace-0.1.10-py3.11.egg/brainspace/vtk_interface/io_support/gifti_support.py:123, in vtkGIFTIWriter.RequestData(self, request, inInfo, outInfo)
122 def RequestData(self, request, inInfo, outInfo):
--> 123 _write_gifti(vtkPolyData.GetData(inInfo[0], 0), self.__FileName)
124 return 1
File /opt/conda/lib/python3.11/site-packages/brainspace-0.1.10-py3.11.egg/brainspace/vtk_interface/decorators.py:41, in wrap_input.<locals>._wrapper_decorator.<locals>._wrapper_wrap(*args, **kwds)
38 @functools.wraps(func)
39 def _wrapper_wrap(*args, **kwds):
40 args, kwds = _wrap_input_data(args, kwds, *xargs, skip=skip)
---> 41 data = func(*args, **kwds)
42 return data
File /opt/conda/lib/python3.11/site-packages/brainspace-0.1.10-py3.11.egg/brainspace/vtk_interface/io_support/gifti_support.py:61, in _write_gifti(pd, opth)
58 if not pd.has_only_triangle:
59 raise ValueError('GIFTI writer only accepts triangles.')
---> 61 points = GiftiDataArray(data=pd.Points, intent=INTENT_POINTS)
62 cells = GiftiDataArray(data=pd.GetCells2D(), intent=INTENT_CELLS)
63 # if data is not None:
64 # data_array = GiftiDataArray(data=data, intent=INTENT_POINTDATA)
65 # gii = nb.gifti.GiftiImage(darrays=[points, cells, data_array])
66 # else:
File /opt/conda/lib/python3.11/site-packages/nibabel-5.2.1-py3.11.egg/nibabel/gifti/gifti.py:476, in GiftiDataArray.__init__(self, data, intent, datatype, encoding, endian, coordsys, ordering, meta, ext_fname, ext_offset)
474 datatype = self.data.dtype
475 else:
--> 476 raise ValueError(
477 f'Data array has type {self.data.dtype}. '
478 'The GIFTI standard only supports uint8, int32 and float32 arrays.\n'
479 'Explicitly cast the data array to a supported dtype or pass an '
480 'explicit "datatype" parameter to GiftiDataArray().'
481 )
482 self.datatype = data_type_codes.code[datatype]
483 self.encoding = gifti_encoding_codes.code[encoding]
ValueError: Data array has type float64. The GIFTI standard only supports uint8, int32 and float32 arrays.
Explicitly cast the data array to a supported dtype or pass an explicit "datatype" parameter to GiftiDataArray().
2024-06-04 10:34:06.107 (36615.577s) [ C8222740] vtkExecutive.cxx:729 ERR| vtkCompositeDataPipeline (0x56267e246d40): Algorithm vtkPythonAlgorithm (0x56267e036dd0) returned failure for request: vtkInformation (0x56266eec1ac0)
Debug: Off
Modified Time: 80451
Reference Count: 2
Registered Events: (none)
Request: REQUEST_DATA
FROM_OUTPUT_PORT: -1
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
---------------------------------------------------------------------------
ImageFileError Traceback (most recent call last)
Cell In[72], line 4
2 schaefer_200_fs5 = fetch_parcellation("fsaverage5", "schaefer", 200)
3 surfaces = fetch_template_surface("fsaverage5", join=False)
----> 4 expression = surface_genetic_expression(schaefer_200_fs5, surfaces, space="fsaverage5")
File /opt/conda/lib/python3.11/site-packages/brainstat/context/genetics.py:100, in surface_genetic_expression(labels, surfaces, space, atlas_info, ibf_threshold, probe_selection, donor_probes, lr_mirror, missing, tolerance, sample_norm, gene_norm, norm_matched, norm_structures, region_agg, agg_metric, corrected_mni, reannotated, return_counts, return_donors, return_report, donors, data_dir, verbose, n_proc)
98 name = f.name
99 write_surface(surface, name, otype="gii")
--> 100 surfaces_gii.append(nib.load(name))
101 finally:
102 Path(name).unlink()
File /opt/conda/lib/python3.11/site-packages/nibabel-5.2.1-py3.11.egg/nibabel/loadsave.py:104, in load(filename, **kwargs)
102 raise FileNotFoundError(f"No such file or no access: '{filename}'")
103 if stat_result.st_size <= 0:
--> 104 raise ImageFileError(f"Empty file: '{filename}'")
106 sniff = None
107 for image_klass in all_image_classes:
ImageFileError: Empty file: '/tmp/tmp6aalcznf.gii
surface_genetic_expression
. However, this is broken currently: