From bfd2962a594c05d19e8c6b1c617731ae27c4ccaa Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Tue, 30 Sep 2014 17:40:22 -0400 Subject: [PATCH] added read support for mrc files with mode 5 and 6 --- modules/io/src/converting_streams.hh | 4 ++++ modules/io/src/img/map_io_mrc_handler.cc | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/io/src/converting_streams.hh b/modules/io/src/converting_streams.hh index fb6b3b82d..b45176918 100644 --- a/modules/io/src/converting_streams.hh +++ b/modules/io/src/converting_streams.hh @@ -204,6 +204,10 @@ public: { return read_helper(value,n); } + BinaryIStream& read(int8_t* value,std::streamsize n) + { + return read_helper(value,n); + } BinaryIStream& read(int16_t* value,std::streamsize n) { return read_helper(value,n); diff --git a/modules/io/src/img/map_io_mrc_handler.cc b/modules/io/src/img/map_io_mrc_handler.cc index aba01630f..9d1740abb 100644 --- a/modules/io/src/img/map_io_mrc_handler.cc +++ b/modules/io/src/img/map_io_mrc_handler.cc @@ -841,7 +841,7 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc) } else { throw IOException("internal error in MRC io: expected ComplexHalfFrequencyImageState"); } - } else if (header.mode>=0 && header.mode<=2) { + } else if (header.mode==0 || header.mode==2 || header.mode==5 || header.mode==6 || header.mode==7) { img::Size msize; msize[header.mapc-1]=header.nc; msize[header.mapr-1]=header.nr; @@ -861,11 +861,15 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc) LOG_INFO("resulting image extent: " << image.GetExtent()); if(img::image_state::RealSpatialImageState *rs=dynamic_cast<img::image_state::RealSpatialImageState*>(image.ImageStatePtr().get())) { if(header.mode==0) { - detail::real_filler<uchar,CONVERSIONTYPE>(*rs,f,header); - } else if(header.mode==1) { - detail::real_filler<unsigned short,CONVERSIONTYPE>(*rs,f,header); + detail::real_filler<int8_t,CONVERSIONTYPE>(*rs,f,header); + } else if(header.mode==1 || header.mode==5) { + detail::real_filler<int16_t,CONVERSIONTYPE>(*rs,f,header); } else if(header.mode==2) { detail::real_filler<float,CONVERSIONTYPE>(*rs,f,header); + } else if(header.mode==6) { + detail::real_filler<uint16_t,CONVERSIONTYPE>(*rs,f,header); + } else if(header.mode==7) { + detail::real_filler<int32_t,CONVERSIONTYPE>(*rs,f,header); } } else { throw IOException("internal error in MRC/CCP4 io: expected RealSpatialImageState"); -- GitLab