I'll add that you can also use a dataset input string of the form
maskdataset+tlrc'<3..3>'
to specify that the dataset, after being read in, will (inside the program being used) get all voxel values 'v' that are
not equal to 3 set to zero.
In general,
datasetname'<a..b>' means to set all values outside the interval [a..b] to zero after input. This should work with NiFTI (.nii) datasets as well as with AFNI (.HEAD/.BRIK) datasets.