Added write_const_cube function
Added input and output modes