unmask_3d and unmask_nd private. unmask do the conversion to nifti
Better checking of mask integrity.