j2kwparam, rois,ralloc);
ralloc.setHeaderEncoder(headenc);
// Writes header to be able to estimate header overhead
headenc.encodeMainHeader();
//Initializes rate allocator, with proper header
// overhead. This will also encode all the data
try {
ralloc.initialize();