I use 3dSurfMask to compute distance between voxels and specified surface. Since it is quite time consuming (no OpenMP), esp. for high resolution grid_parent, is it possible to restrict the computation within a mask?
It looks like 3dSurfMask doesn’t have a mask option, but there other ways to accomplish what I think you want to do. You can get the xyz voxel centers for the volume mask from 3dmaskdump. Then get the xyz coordinates of the nodes in the surface with SurfMeasures, Surf2VolCoord. Then calculate simple euclidean distance with 3dcalc or 1deval. You may also want to consider finding the closest nodes to the volume xyz coordinates with SurfaceMetrics.
SurfaceMetrics, through its “-closest_node” options, gives the closest node and distance from a list of xyz coordinates. I don’t think it does a signed distance, where I suppose you want to know if it’s inside or outside the surface. You can use 3dVol2Surf to map from the volume to the surface. If the selected voxels are a mask, you can use that and normal vectors from the surface. If the voxels in the mask were replaced by an index you could see which voxels are crossed with the -seg_vals option. Normal vectors can be configured to go into and/or outside the surface.
You could also compute distance by converting a surface to an ASCII text or vec (vector) format and compute distance with 3dcalc or similar.
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.