diff --git a/modules/gui/src/data_viewer/data_viewer_panel_base.cc b/modules/gui/src/data_viewer/data_viewer_panel_base.cc index 1da089d2dffdc1c07897622c67ed4a9798a4559a..b9d1ba6024779c54277fc54b25f8960266dec9ab 100644 --- a/modules/gui/src/data_viewer/data_viewer_panel_base.cc +++ b/modules/gui/src/data_viewer/data_viewer_panel_base.cc @@ -794,7 +794,7 @@ void DataViewerPanelBase::extract_ri() void DataViewerPanelBase::zoom(int d) { - // maximal zoom = 2^8, therefore zoom_level_ goes from 8 to 8 and delta from -16 to 16 + // maximal zoom = 2^8, therefore zoom_level_ goes from -8 to 8 and delta from -16 to 16 int old_zoom_level=zoom_level_; int dl=std::max(d,-16); dl=std::min(dl,16); diff --git a/modules/info/pymod/wrap_info.cc b/modules/info/pymod/wrap_info.cc index 14eeffb63606efd04b1d17bea4e608e0ca1aa6ba..4af9741d63430f0964b415d83410641ab9d54762 100644 --- a/modules/info/pymod/wrap_info.cc +++ b/modules/info/pymod/wrap_info.cc @@ -92,7 +92,7 @@ void info_handle_apply2b(InfoHandle* h, InfoConstVisitor& v, bool b) h->Apply(v,b); } -void info_handle_remove1(InfoHandle* h, InfoPath& path ) +void info_handle_remove1(InfoHandle* h, const String& path ) { h->Remove(path); } @@ -101,7 +101,7 @@ void info_handle_remove2(InfoHandle* h, InfoGroup& group ) { h->Remove(group); } -void info_handle_remove3(InfoHandle* h, InfoPath& path, bool use_defaults ) +void info_handle_remove3(InfoHandle* h, const String& path, bool use_defaults ) { h->Remove(path,use_defaults); } diff --git a/modules/io/src/img/map_io_tiff_handler.cc b/modules/io/src/img/map_io_tiff_handler.cc index 2ca26e838f363f9de88e4b435a895003aafb8a93..b1050724393b5ddf5bf3677af351125f61ef2d4b 100644 --- a/modules/io/src/img/map_io_tiff_handler.cc +++ b/modules/io/src/img/map_io_tiff_handler.cc @@ -299,12 +299,12 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo img::image_state::ComplexSpatialImageState *isc = NULL; img::image_state::WordSpatialImageState *isw = NULL; - boost::function<void (TIFF *,img::image_state::RealSpatialImageState*,uint32_t,uint32_t,uint32_t,uint32_t,const img::NormalizerPtr& )> fsr; - boost::function<void (TIFF *,img::image_state::ComplexSpatialImageState*,uint32_t,uint32_t,uint32_t,uint32_t,const img::NormalizerPtr&)> fsc; - boost::function<void (TIFF *,img::image_state::WordSpatialImageState*,uint32_t,uint32_t,uint32_t,uint32_t,const img::NormalizerPtr&)> fsw; + boost::function<void (TIFF *,img::image_state::RealSpatialImageState*,UINTNN_T,UINTNN_T,UINTNN_T,UINTNN_T,const img::NormalizerPtr& )> fsr; + boost::function<void (TIFF *,img::image_state::ComplexSpatialImageState*,UINTNN_T,UINTNN_T,UINTNN_T,UINTNN_T,const img::NormalizerPtr&)> fsc; + boost::function<void (TIFF *,img::image_state::WordSpatialImageState*,UINTNN_T,UINTNN_T,UINTNN_T,UINTNN_T,const img::NormalizerPtr&)> fsw; - uint32_t width=image.GetSize().GetWidth(); - uint32_t height=image.GetSize().GetHeight(); + UINTNN_T width=image.GetSize().GetWidth(); + UINTNN_T height=image.GetSize().GetHeight(); uint16 spp=1; uint16 fmt =0; uint16 bpp =0 ; @@ -342,7 +342,7 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo case OST_BIT32_FORMAT: fmt=SAMPLEFORMAT_INT; bpp=32; - fsr=detail::do_tiff_write<Real,int32_t,img::image_state::RealSpatialImageState>; + fsr=detail::do_tiff_write<Real,INTNN_T,img::image_state::RealSpatialImageState>; break; case OST_FLOAT_FORMAT: fmt=SAMPLEFORMAT_IEEEFP; @@ -375,7 +375,7 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo case OST_BIT32_FORMAT: fmt=SAMPLEFORMAT_UINT; bpp=32; - fsr=detail::do_tiff_write<Real,uint32_t,img::image_state::RealSpatialImageState>; + fsr=detail::do_tiff_write<Real,UINTNN_T,img::image_state::RealSpatialImageState>; break; case OST_FLOAT_FORMAT: fmt=SAMPLEFORMAT_IEEEFP; @@ -410,7 +410,7 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo case OST_BIT32_FORMAT: fmt=SAMPLEFORMAT_COMPLEXINT; bpp=64; - fsc=detail::do_tiff_write<Complex,std::complex<int32_t>,img::image_state::ComplexSpatialImageState>; + fsc=detail::do_tiff_write<Complex,std::complex<INTNN_T>,img::image_state::ComplexSpatialImageState>; break; case OST_FLOAT_FORMAT: fmt=SAMPLEFORMAT_COMPLEXIEEEFP; @@ -436,7 +436,7 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo } TIFFSetField(tfile,TIFFTAG_BITSPERSAMPLE,bpp); - uint32_t rowsperstrip=std::max<int>(1,8192/(width*bpp/8)); //ca. 8 kb per strip (adobe tiff specs recomendation) + UINTNN_T rowsperstrip=std::max<int>(1,8192/(width*bpp/8)); //ca. 8 kb per strip (adobe tiff specs recomendation) TIFFSetField(tfile,TIFFTAG_ROWSPERSTRIP,rowsperstrip); TIFFSetField(tfile,TIFFTAG_SAMPLEFORMAT,fmt); unsigned int stripcount=static_cast<int>(ceil( height/static_cast<Real>(rowsperstrip))); @@ -549,9 +549,9 @@ TIFF* MapIOTiffHandler::open_subimage_stream(std::istream& location,const TIF& f void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, const TIF& formattif) { - uint32_t width,height,rps; + UINTNN_T width,height,rps; uint16 bpp,spp,plc,ori,reso=RESUNIT_NONE,fmt=SAMPLEFORMAT_UINT; - uint32_t* sbc; + UINTNN_T* sbc; float xpos=0.0,ypos=0.0; float xreso=1.0,yreso=1.0; @@ -652,7 +652,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co detail::do_tiff_read<uint16,short,img::image_state::WordSpatialImageState>(buf,rowcount,width,is,current_row,spp); } else if(bpp==32) { uint rowcount = cread/(width*4*spp); - detail::do_tiff_read<uint32_t,short,img::image_state::WordSpatialImageState>(buf,rowcount,width,is,current_row,spp); + detail::do_tiff_read<UINTNN_T,short,img::image_state::WordSpatialImageState>(buf,rowcount,width,is,current_row,spp); } img::Progress::Instance().AdvanceProgress(this); } @@ -726,9 +726,9 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co } else if(bpp==32) { uint rowcount = cread/(width*4*spp); if(fmt==SAMPLEFORMAT_INT){ - detail::do_tiff_read<int32_t,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); + detail::do_tiff_read<INTNN_T,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); }else if(fmt==SAMPLEFORMAT_UINT){ - detail::do_tiff_read<uint32_t,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); + detail::do_tiff_read<UINTNN_T,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); }else if(fmt==SAMPLEFORMAT_IEEEFP){ detail::do_tiff_read<float,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); }else if(fmt==SAMPLEFORMAT_COMPLEXINT){ @@ -743,7 +743,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co if(fmt==SAMPLEFORMAT_IEEEFP){ detail::do_tiff_read<Real,Real,img::image_state::RealSpatialImageState>(buf,rowcount,width,isr,current_row,spp); }else if(fmt==SAMPLEFORMAT_COMPLEXINT){ - detail::do_tiff_read<detail::complexint32_t,Complex,img::image_state::ComplexSpatialImageState>(buf,rowcount,width,isc,current_row,spp); + detail::do_tiff_read<detail::COMPLEXINTNN_T,Complex,img::image_state::ComplexSpatialImageState>(buf,rowcount,width,isc,current_row,spp); }else if(fmt==SAMPLEFORMAT_COMPLEXIEEEFP){ detail::do_tiff_read<std::complex<float>,Complex,img::image_state::ComplexSpatialImageState>(buf,rowcount,width,isc,current_row,spp); }else{ diff --git a/modules/io/src/img/tiff_util.cc b/modules/io/src/img/tiff_util.cc index fd1cf3f25d5a5c3af71a5cd9467cca35041b6832..105ebf73becf4ea763190c52d1fdec59402eca7f 100644 --- a/modules/io/src/img/tiff_util.cc +++ b/modules/io/src/img/tiff_util.cc @@ -41,7 +41,7 @@ void tiff_warning_handler(const char *mod, const char* fmt, va_list ap) LOG_INFO(mod << ": " << message); } -int32_t CustomTIFFReadProcIStream(void* thandle, void* tdata, int32_t tsize) +INTNN_T CustomTIFFReadProcIStream(void* thandle, void* tdata, INTNN_T tsize) { std::istream* file= reinterpret_cast<std::istream*>(thandle); char* data= reinterpret_cast<char*>(tdata); @@ -49,29 +49,29 @@ int32_t CustomTIFFReadProcIStream(void* thandle, void* tdata, int32_t tsize) return file->gcount(); } -int32_t CustomTIFFReadProcOStream(void* thandle, void* tdata, int32_t tsize) +INTNN_T CustomTIFFReadProcOStream(void* thandle, void* tdata, INTNN_T tsize) { assert(false); return -1; } -int32_t CustomTIFFWriteProcIStream(void* thandle, void* tdata, int32_t tsize) +INTNN_T CustomTIFFWriteProcIStream(void* thandle, void* tdata, INTNN_T tsize) { assert(false); return -1; } -int32_t CustomTIFFWriteProcOStream(void* thandle, void* tdata, int32_t tsize) +INTNN_T CustomTIFFWriteProcOStream(void* thandle, void* tdata, INTNN_T tsize) { std::ostream* file= reinterpret_cast<std::ostream*>(thandle); char* data= reinterpret_cast<char*>(tdata); - int32_t before = file->tellp(); + INTNN_T before = file->tellp(); file->write(data,tsize); - int32_t after = file->tellp(); + INTNN_T after = file->tellp(); return after-before; } -uint32_t CustomTIFFSeekProcIStream(void* thandle, uint32_t toff, int dir) +UINTNN_T CustomTIFFSeekProcIStream(void* thandle, UINTNN_T toff, int dir) { std::istream* stream= reinterpret_cast<std::istream*>(thandle); @@ -89,7 +89,7 @@ uint32_t CustomTIFFSeekProcIStream(void* thandle, uint32_t toff, int dir) return stream->rdstate(); } -uint32_t CustomTIFFSeekProcOStream(void* thandle, uint32_t toff, int dir) +UINTNN_T CustomTIFFSeekProcOStream(void* thandle, UINTNN_T toff, int dir) { std::ostream* stream= reinterpret_cast<std::ostream*>(thandle); @@ -111,33 +111,33 @@ int CustomTIFFCloseProc(void* thandle) return 0; } -uint32_t CustomTIFFSizeProcIStream(void* thandle) +UINTNN_T CustomTIFFSizeProcIStream(void* thandle) { std::istream* stream= reinterpret_cast<std::istream*>(thandle); - uint32_t curr_pos = stream->tellg(); + UINTNN_T curr_pos = stream->tellg(); stream->seekg(0,std::ios::end); - uint32_t size = stream->tellg(); + UINTNN_T size = stream->tellg(); stream->seekg(curr_pos,std::ios::beg); return size; } -uint32_t CustomTIFFSizeProcOStream(void* thandle) +UINTNN_T CustomTIFFSizeProcOStream(void* thandle) { std::ostream* stream= reinterpret_cast<std::ostream*>(thandle); - uint32_t curr_pos = stream->tellp(); + UINTNN_T curr_pos = stream->tellp(); stream->seekp(0,std::ios::end); - uint32_t size = stream->tellp(); + UINTNN_T size = stream->tellp(); stream->seekp(curr_pos,std::ios::beg); return size; } -int CustomTIFFMapFileProc(void* thandle, void** tdata, uint32* toff) +int CustomTIFFMapFileProc(void* thandle, void** tdata, UINTNN* toff) { assert(false); return(0); } -void CustomTIFFUnmapFileProc(void* thandle, void* tdata, uint32 toff) +void CustomTIFFUnmapFileProc(void* thandle, void* tdata, UINTNN toff) { assert(false); } diff --git a/modules/io/src/img/tiff_util.hh b/modules/io/src/img/tiff_util.hh index 66393291b1d80f64feedb4082239d0b492f01160..b2aca3386a39f3587ba4fb31eb892147932940b7 100644 --- a/modules/io/src/img/tiff_util.hh +++ b/modules/io/src/img/tiff_util.hh @@ -27,6 +27,17 @@ #include <ost/img/alg/normalizer_factory.hh> #include <ost/io/img/image_format.hh> +#if defined(TIFFLIB_VERSION) && TIFFLIB_VERSION >= 20111221 +# define INTNN_T int64_t +# define UINTNN uint64 +# define UINTNN_T uint64_t +# define COMPLEXINTNN_T complexint64_t +#else +# define INTNN_T int32_t +# define UINTNN uint32 +# define UINTNN_T uint32_t +# define COMPLEXINTNN_T complexint32_t +#endif namespace ost { namespace io { namespace detail { /// \internal @@ -49,7 +60,7 @@ struct tiff_warning_handler_wrapper { }; /// \internal -class complexint32_t:public std::complex<int32_t>{ +class COMPLEXINTNN_T:public std::complex<INTNN_T>{ public: operator std::complex<Real>() @@ -79,33 +90,33 @@ public: }; /// \internal -int32_t CustomTIFFReadProcIStream(void* thandle, void* tdata, int32_t tsize); +INTNN_T CustomTIFFReadProcIStream(void* thandle, void* tdata, INTNN_T tsize); /// \internal -int32_t CustomTIFFReadProcIStream(void* thandle, void* tdata, int32_t tsize); +INTNN_T CustomTIFFReadProcIStream(void* thandle, void* tdata, INTNN_T tsize); /// \internal -int32_t CustomTIFFReadProcOStream(void* thandle, void* tdata, int32_t tsize); +INTNN_T CustomTIFFReadProcOStream(void* thandle, void* tdata, INTNN_T tsize); /// \internal -int32_t CustomTIFFWriteProcIStream(void* thandle, void* tdata, int32_t tsize); +INTNN_T CustomTIFFWriteProcIStream(void* thandle, void* tdata, INTNN_T tsize); /// \internal -int32_t CustomTIFFWriteProcOStream(void* thandle, void* tdata, int32_t tsize); +INTNN_T CustomTIFFWriteProcOStream(void* thandle, void* tdata, INTNN_T tsize); /// \internal -uint32_t CustomTIFFSeekProcIStream(void* thandle, uint32_t toff, int dir); +UINTNN_T CustomTIFFSeekProcIStream(void* thandle, UINTNN_T toff, int dir); /// \internal -uint32_t CustomTIFFSeekProcOStream(void* thandle, uint32_t toff, int dir); +UINTNN_T CustomTIFFSeekProcOStream(void* thandle, UINTNN_T toff, int dir); /// \internal int CustomTIFFCloseProc(void* thandle); /// \internal -uint32_t CustomTIFFSizeProcIStream(void* thandle); +UINTNN_T CustomTIFFSizeProcIStream(void* thandle); /// \internal -uint32_t CustomTIFFSizeProcOStream(void* thandle); +UINTNN_T CustomTIFFSizeProcOStream(void* thandle); /// \internal -int CustomTIFFMapFileProc(void* thandle, void** tdata, uint32* toff); +int CustomTIFFMapFileProc(void* thandle, void** tdata, UINTNN* toff); /// \internal -void CustomTIFFUnmapFileProc(void* thandle, void* tdata, uint32 toff); +void CustomTIFFUnmapFileProc(void* thandle, void* tdata, UINTNN toff); /// \internal template<typename IN_TYPE,typename OUT_TYPE, class IST> -void do_tiff_read(tdata_t buf,uint16 rps, uint32_t width, IST* is,int& current_row, int spp) +void do_tiff_read(tdata_t buf,uint16 rps, UINTNN_T width, IST* is,int& current_row, int spp) { IN_TYPE* dp = static_cast<IN_TYPE*>(buf); for(uint r=0;r<rps;r++) { @@ -118,7 +129,7 @@ void do_tiff_read(tdata_t buf,uint16 rps, uint32_t width, IST* is,int& current_r /// \internal template<typename IN_TYPE,typename OUT_TYPE, class IST> -void do_tiff_write(TIFF *tif, IST* is,uint32_t rowsperstrip,uint32_t width,uint32_t height, uint32_t strip,const img::NormalizerPtr& nptr) +void do_tiff_write(TIFF *tif, IST* is,UINTNN_T rowsperstrip,UINTNN_T width,UINTNN_T height, UINTNN_T strip,const img::NormalizerPtr& nptr) { uint datalength=rowsperstrip*width; if((strip+1)*rowsperstrip>height){ diff --git a/modules/io/src/mol/pdb_reader.cc b/modules/io/src/mol/pdb_reader.cc index a59dd99cf79535f3d785d9464e98958a542e0b0f..8fa9b53b41572eb827e365b1090cfcb5096f7e02 100644 --- a/modules/io/src/mol/pdb_reader.cc +++ b/modules/io/src/mol/pdb_reader.cc @@ -607,7 +607,9 @@ bool PDBReader::ParseAtomIdent(const StringRef& line, int line_num, if (!(profile_.fault_tolerant)) { throw IOException(str(format("invalid atom number on line %d") %line_num)); } - LOG_WARNING("invalid atom number on line " << line_num); + if (!(charmm_style_)) { + LOG_WARNING("invalid atom number on line " << line_num); + } } alt_loc=line[16]; diff --git a/modules/io/src/mol/pdb_writer.cc b/modules/io/src/mol/pdb_writer.cc index 6f9c01cb928322b48d9c03a13fe34cd814638abb..e18d96d7fbc551494ca0277a9f05b5fda9b7c226 100644 --- a/modules/io/src/mol/pdb_writer.cc +++ b/modules/io/src/mol/pdb_writer.cc @@ -80,7 +80,12 @@ void write_atom(std::ostream& ostr, FormattedLine& line, line( 0, 6)=record_name; // Avoid writing out atomnumbers larger than 5 digits if (atomnum > 99999) { - line( 6, 5)=fmt::LPaddedInt(atomnum - 100000 * (atomnum / 100000)); + if (charmm_style) { + line( 6, 5)=fmt::LPadded("*****"); + } else { + throw IOException("Atom number is too long for PDB output." + " At most 5 digits are allowed"); + } } else { line( 6, 5)=fmt::LPaddedInt(atomnum); }