The mastery information left in the dataset from THD_copy_dset_subs()
is what is preventing it from being written. In this case, the
mastery information does not seem to be needed any longer. I'll have
to ponder whether that would be true in general. But that is why
DSET_write() is failing.
The THD_copy_dset_subs function is only used to create temporary
datasets, with the higher-level function being r_new_resam_dset().
If you used r_new_resam_dset, it should work (no resampling would
actually be done). e.g.
r_new_resam_dset(rtin->reg_dset, NULL, 0,0,0, NULL,
RESAM_NN_TYPE, dlist, 1);
But if the mastery information can be deleted (and my expectation
is that it can), then THD_copy_dset_subs() would be a better function
to use.
More on that when I can get back to it...
- rick