Skip to content
Snippets Groups Projects
Commit bfd2962a authored by Andreas Schenk's avatar Andreas Schenk
Browse files

added read support for mrc files with mode 5 and 6

parent af30c699
Branches
Tags
No related merge requests found
...@@ -204,6 +204,10 @@ public: ...@@ -204,6 +204,10 @@ public:
{ {
return read_helper(value,n); 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) BinaryIStream& read(int16_t* value,std::streamsize n)
{ {
return read_helper(value,n); return read_helper(value,n);
......
...@@ -841,7 +841,7 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc) ...@@ -841,7 +841,7 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc)
} else { } else {
throw IOException("internal error in MRC io: expected ComplexHalfFrequencyImageState"); 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; img::Size msize;
msize[header.mapc-1]=header.nc; msize[header.mapc-1]=header.nc;
msize[header.mapr-1]=header.nr; msize[header.mapr-1]=header.nr;
...@@ -861,11 +861,15 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc) ...@@ -861,11 +861,15 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc)
LOG_INFO("resulting image extent: " << image.GetExtent()); LOG_INFO("resulting image extent: " << image.GetExtent());
if(img::image_state::RealSpatialImageState *rs=dynamic_cast<img::image_state::RealSpatialImageState*>(image.ImageStatePtr().get())) { if(img::image_state::RealSpatialImageState *rs=dynamic_cast<img::image_state::RealSpatialImageState*>(image.ImageStatePtr().get())) {
if(header.mode==0) { if(header.mode==0) {
detail::real_filler<uchar,CONVERSIONTYPE>(*rs,f,header); detail::real_filler<int8_t,CONVERSIONTYPE>(*rs,f,header);
} else if(header.mode==1) { } else if(header.mode==1 || header.mode==5) {
detail::real_filler<unsigned short,CONVERSIONTYPE>(*rs,f,header); detail::real_filler<int16_t,CONVERSIONTYPE>(*rs,f,header);
} else if(header.mode==2) { } else if(header.mode==2) {
detail::real_filler<float,CONVERSIONTYPE>(*rs,f,header); 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 { } else {
throw IOException("internal error in MRC/CCP4 io: expected RealSpatialImageState"); throw IOException("internal error in MRC/CCP4 io: expected RealSpatialImageState");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment