Processing of porous TiNi alloys using magnesium as space holder