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.
Putting spheres in images other ways. https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/rois_corr_vis/suma_spheres.html#description
ALICE - get electrode ROIs from either thresholded CT images or user-placed centers.
Thanks for your help! I used method #4 to undump each electrode into a separate file.
Good to hear. Thanks for the update.
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.