The method PurifyPixAttrib shifts used pixel attributes down towards attribute zero. After the purification all used N attributes are populating the first N attribute numbers (0 to N-1), all unused attributes are cleared (i.e. the names of unused attributes are deteled). This method always effects all attribute layers.
In order to directly access the metadata of the currently loaded dataset you can use the pre-declared global variable MData.