The 3dmaskdump program can do most of what you ask for. It is probably most convenient if you create a mask (using 3dmerge -1thresh, or 3dcalc, for example), then apply that to the dataset. If you want the x,y,z coordinates, the simplest current solution would be to create datasets with these value (via 3dcalc) and include that in the 3dmaskdump run.