Function to create .mha files for masks