Hi-
I don't quite understand. Can you provide a bit more description? It is correct that you have a volume with a single ROI in it, and you *just* the edge of it?
There are different ways to do so; there is also some decision-making about what is meant by "edge": are the voxels connected by any of voxel-faces or -nodes or -edges, or a subset of those? There are also various permutations depending on whether you have multiple ROIs per voxel (it sounds like that is not the case here).
The way I would start by doing this would be to calculate the depth of the ROI in terms of voxel counts:
3dDepthMap \
-zeros_are_zero \
-ignore_voxdims \
-prefix mask_depth.nii.gz \
-input DSET_ROI
... and then use the following 3dcalc command to find nonzero places in the depth map below a certain value---using 1.2 here will keep a boundary connected by voxel-faces or voxel-edges:
3dcalc \
-a mask_depth.nii.gz \
-expr 'bool(a)*step(1.2-a)' \
-prefix mask_edge.nii.gz \
-overwrite
Those images are attached, showing the ROI as underlay, first with the depth calculation and then with the boundary calculation.
--pt