I am using 3dUndump to create 1.5mm radius spheres that correspond to intracranial EEG electrode locations. The problem I am encountering is that multiple electrodes are within very close vicinity to one another, and this is resulting in the voxel value of one electrode overwriting the voxel value of another electrode. How can I make sure that every voxel is preserved? Obviously, it would be impossible for a voxel to simultaneously have 2 labels, but is there a way to make any voxel that would overwrite a voxel that has already been labeled, instead output itself into a different NIFTI file? My ultimate goal is to get the nearest node on the standard pial surface that corresponds to every voxel included within every electrode sphere. I already have the code set up for this process, but I am realizing now after the fact that some electrodes are missing due to this problem. Let me know if you have any suggestions!
We did something similar with the ALICE package for ECOG. A lot depends on what you want to do in the end with the data. Some suggestions.
Resample to finer resolution. 3dresample -dxyz . If the problem is so much overlap that the electrodes disappear completely, then this solution should work.
Reorder from last to first if you want earlier electrodes to have priority. Not sure this will be useful for you.
Smaller radius. Really, this can go down to a voxel. It won’t look spherical in that case, but it may work for you anyway.
Undump each electrode to a separate file and then combine with 3dMean or 3dTstat.
Just to add onto part of your question about mapping to the surface - you can use the method in ALICE that Dora Hermes wrote to adjust the location on the brain. Another way is to use “SurfaceMetrics -closest_node xyzlist.1D” to generate the surface dataset with nodes. You may want to use something like a center of mass for each electrode position for these small blobby electrode shapes in the volume.
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.