From a733e379893946ef32d0f204ad37394e4dd87cd2 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Fri, 19 Sep 2014 14:06:59 -0400 Subject: [PATCH] added buffer to optimize mrc output --- modules/io/src/img/map_io_mrc_handler.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/io/src/img/map_io_mrc_handler.cc b/modules/io/src/img/map_io_mrc_handler.cc index 3273a94e4..78f481d51 100644 --- a/modules/io/src/img/map_io_mrc_handler.cc +++ b/modules/io/src/img/map_io_mrc_handler.cc @@ -739,15 +739,17 @@ void real_dumper(BinaryOStream<CONVERSIONTYPE>& f, header_base& header, const Co char this_dummy; //create dummy variable to give to Progress as this Progress::Instance().Register(&this_dummy,header.ns*header.nr,100); for(int ss=0;ss<header.ns;++ss) { + std::vector<B> buffer(header.nr*header.nc); pnt[maps]=header.nsstart+ss; for(int sr=0;sr<header.nr;++sr) { pnt[mapr]=header.nrstart+sr; for(int sc=0;sc<header.nc;++sc) { pnt[mapc]=header.ncstart+sc; - f << static_cast<B>(norm.Convert(isr->Value(pnt))); + buffer[header.nc*sr+sc]=img::Val2Val<Real,B>(norm.Convert(isr->Value(pnt))); } Progress::Instance().AdvanceProgress(&this_dummy); } + f.write(&buffer[0],header.nr*header.nc); } Progress::Instance().DeRegister(&this_dummy); } -- GitLab