diff --git a/modules/io/src/img/map_io_dat_handler.hh b/modules/io/src/img/map_io_dat_handler.hh index c4f130e44d470c2031efde906f923392b0088ce3..4bc8ce268649c65cc45ebd6ae5d9eb4139b2c615 100644 --- a/modules/io/src/img/map_io_dat_handler.hh +++ b/modules/io/src/img/map_io_dat_handler.hh @@ -71,6 +71,8 @@ class DLLEXPORT_OST_IO MapIODatHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Dat"); } static String GetFormatDescription() {return String("Simple binary format for square images");} }; diff --git a/modules/io/src/img/map_io_df3_handler.hh b/modules/io/src/img/map_io_df3_handler.hh index 7682d0131a2ac14f1d9142faf85fc1b5cd9432d1..53fb9bfd15555241c101a7581d1764887178135f 100644 --- a/modules/io/src/img/map_io_df3_handler.hh +++ b/modules/io/src/img/map_io_df3_handler.hh @@ -60,6 +60,10 @@ class DLLEXPORT_OST_IO DF3MapIOHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + + static bool ProvidesImport() { return false; } + static bool ProvidesExport() { return true; } + static String GetFormatName() { return "DF3"; }; static String GetFormatDescription() { return "PovRay Density file format"; }; }; diff --git a/modules/io/src/img/map_io_dm3_handler.hh b/modules/io/src/img/map_io_dm3_handler.hh index 4b1ad827fdefdd8f32b4480aa2a124d2edfb0caa..89d5f87c1ca78f98b794dff63b45f508c236238f 100644 --- a/modules/io/src/img/map_io_dm3_handler.hh +++ b/modules/io/src/img/map_io_dm3_handler.hh @@ -49,6 +49,8 @@ class DLLEXPORT_OST_IO MapIODm3Handler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Dm3"); } static String GetFormatDescription() {return String("Format used by Gatan Inc.'s Digital Micrograph software");} diff --git a/modules/io/src/img/map_io_dx_handler.hh b/modules/io/src/img/map_io_dx_handler.hh index 640862cdccbad2cd3524968ce73ea880f7aafec4..ca4ee55c2c71066b80c22d5a2dcab987b04492e2 100644 --- a/modules/io/src/img/map_io_dx_handler.hh +++ b/modules/io/src/img/map_io_dx_handler.hh @@ -63,6 +63,9 @@ class DLLEXPORT_OST_IO MapIODxHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& locx); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } + static String GetFormatName() { return String("Dx"); }; static String GetFormatDescription() { return String("Format used by the OpenDX software package"); }; diff --git a/modules/io/src/img/map_io_handler.hh b/modules/io/src/img/map_io_handler.hh index fe43f7878b8cb94deb15d2458a579e0168012238..163d0241399d94ee06061a5a844602b9b3c8f971 100644 --- a/modules/io/src/img/map_io_handler.hh +++ b/modules/io/src/img/map_io_handler.hh @@ -50,7 +50,8 @@ public: virtual MapIOHandlerPtr Create() const = 0 ; virtual String GetFormatName() const =0; virtual String GetFormatDescription() const =0; - + virtual bool ProvidesImport() const = 0; + virtual bool ProvidesExport() const = 0; }; typedef boost::shared_ptr<MapIOHandlerFactoryBase> MapIOHandlerFactoryBasePtr; @@ -78,7 +79,16 @@ class MapIOHandlerFactory: public MapIOHandlerFactoryBase virtual String GetFormatDescription() const { return HANDLER::GetFormatDescription(); } - + virtual bool ProvidesImport() const + { + return HANDLER::ProvidesImport(); + } + + virtual bool ProvidesExport() const + { + return HANDLER::ProvidesExport(); + } + virtual MapIOHandlerPtr Create() const { return MapIOHandlerPtr(new HANDLER); } diff --git a/modules/io/src/img/map_io_mrc_handler.hh b/modules/io/src/img/map_io_mrc_handler.hh index f1a14f93a3774c249a798436ddf8c94d077e956b..c12096b68ff711366e597118aea85f5e0550fc21 100644 --- a/modules/io/src/img/map_io_mrc_handler.hh +++ b/modules/io/src/img/map_io_mrc_handler.hh @@ -74,6 +74,8 @@ public: static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Mrc"); }; static String GetFormatDescription() { return String("Format used by the MRC software package"); }; diff --git a/modules/io/src/img/map_io_nanoscope_handler.hh b/modules/io/src/img/map_io_nanoscope_handler.hh index 177f48e7bdd627808dc4c722947bdae06cdfb9e1..35bfea6115fae2742e9c37f522dbc32a5ad49b96 100644 --- a/modules/io/src/img/map_io_nanoscope_handler.hh +++ b/modules/io/src/img/map_io_nanoscope_handler.hh @@ -58,6 +58,8 @@ public: static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Nanoscope"); } static String GetFormatDescription() { return String("Format used by software from Veeco"); } }; diff --git a/modules/io/src/img/map_io_png_handler.hh b/modules/io/src/img/map_io_png_handler.hh index cc6a84d4afbcd76ff2455875e41fb02bbc8b3202..337ccc1dfdd00d9c8b085f8e7b90518487fb57e1 100644 --- a/modules/io/src/img/map_io_png_handler.hh +++ b/modules/io/src/img/map_io_png_handler.hh @@ -56,6 +56,8 @@ public: static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Png");} static String GetFormatDescription() { return String("Portable Network Graphic image format");} }; diff --git a/modules/io/src/img/map_io_situs_handler.hh b/modules/io/src/img/map_io_situs_handler.hh index b3a19cb795eff74f181849fa6a86d157c342b888..4b5a1a360d225505ec7b9e0e1065f656a5f2f76e 100644 --- a/modules/io/src/img/map_io_situs_handler.hh +++ b/modules/io/src/img/map_io_situs_handler.hh @@ -55,6 +55,8 @@ class DLLEXPORT_OST_IO MapIOSitusHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return "Situs"; }; static String GetFormatDescription() { return "Format used by the Situs software package"; }; }; diff --git a/modules/io/src/img/map_io_spi_handler.cc b/modules/io/src/img/map_io_spi_handler.cc index f55c9a22d7262b2955204693e9431ea3bf037db0..d22897f4ee3976555418d3fdd8c0f49f49a14aa7 100644 --- a/modules/io/src/img/map_io_spi_handler.cc +++ b/modules/io/src/img/map_io_spi_handler.cc @@ -212,7 +212,7 @@ void prep_header(spider_header& header, const img::Size& size, const geom::Vec3& for (int counter = 0; counter < 8; ++counter) { header.szITim[counter] = time_for_header[counter]; } - for (int counter = 0; counter < title_for_header.size(); ++counter) { + for (size_t counter = 0; counter < title_for_header.size(); ++counter) { header.szITit[counter] = title_for_header[counter]; } } diff --git a/modules/io/src/img/map_io_spi_handler.hh b/modules/io/src/img/map_io_spi_handler.hh index cf185731c34f6eec63dac76ca33deea3b2774c84..aa6f9a438251da75e2699e40d944ea1a7c9f0750 100644 --- a/modules/io/src/img/map_io_spi_handler.hh +++ b/modules/io/src/img/map_io_spi_handler.hh @@ -65,6 +65,8 @@ class DLLEXPORT_OST_IO MapIOSpiHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String("Spider"); }; static String GetFormatDescription() { return String("Format used by the Spider software package"); }; diff --git a/modules/io/src/img/map_io_tiff_handler.hh b/modules/io/src/img/map_io_tiff_handler.hh index 5c6985a3d60f66eab368142020ae94d53e5c5b84..c3efe901796fbd45b285d48eb2eacbd7768cd90c 100644 --- a/modules/io/src/img/map_io_tiff_handler.hh +++ b/modules/io/src/img/map_io_tiff_handler.hh @@ -100,6 +100,8 @@ class DLLEXPORT_OST_IO MapIOTiffHandler: public MapIOHandler static bool MatchContent(unsigned char* header); static bool MatchType(const ImageFormatBase& type); static bool MatchSuffix(const String& loc); + static bool ProvidesImport() { return true; } + static bool ProvidesExport() { return true; } static String GetFormatName() { return String( "Tiff"); } static String GetFormatDescription() { return String("Tagged Image File Format"); } diff --git a/modules/io/src/io_manager.cc b/modules/io/src/io_manager.cc index 7c274c0803cb5ebf5b6cead1757f99fa113fe92c..12e714fd63a0170d32c676bf60bde007571ff6f6 100644 --- a/modules/io/src/io_manager.cc +++ b/modules/io/src/io_manager.cc @@ -140,7 +140,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerFile(const boost::filesystem::pat { if(formatstruct.GetFormatString()!="undefined" ){ for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchType(formatstruct)) { + if((*it)->ProvidesImport() && (*it)->MatchType(formatstruct)) { return (*it)->Create(); } } @@ -149,7 +149,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerFile(const boost::filesystem::pat String match_suf_string=loc.string(); std::transform(match_suf_string.begin(),match_suf_string.end(),match_suf_string.begin(),tolower); for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchSuffix(match_suf_string)) { + if((*it)->ProvidesImport() && (*it)->MatchSuffix(match_suf_string)) { return (*it)->Create(); } } @@ -163,7 +163,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerFile(const boost::filesystem::pat infile.close(); for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchContent(header)) { + if((*it)->ProvidesImport() && (*it)->MatchContent(header)) { return (*it)->Create(); } } @@ -177,7 +177,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerStream(std::istream& stream, { if(formatstruct.GetFormatString()!="undefined" ){ for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchType(formatstruct)) { + if((*it)->ProvidesImport() && (*it)->MatchType(formatstruct)) { return (*it)->Create();; } } @@ -188,7 +188,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerStream(std::istream& stream, stream.seekg(0,std::ios::beg); for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchContent(header)) { + if((*it)->ProvidesImport() && (*it)->MatchContent(header)) { return (*it)->Create();; } } @@ -202,7 +202,7 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerFile(const boost::filesystem::pat { if(formatstruct.GetFormatString()!="undefined" ){ for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchType(formatstruct)) { + if((*it)->ProvidesExport() && (*it)->MatchType(formatstruct)) { return (*it)->Create(); } } @@ -216,7 +216,7 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerFile(const boost::filesystem::pat String match_suf_string=loc.string(); std::transform(match_suf_string.begin(),match_suf_string.end(),match_suf_string.begin(),tolower); for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchSuffix(match_suf_string)) { + if((*it)->ProvidesExport() && (*it)->MatchSuffix(match_suf_string)) { return(*it)->Create(); } } @@ -229,7 +229,7 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerStream(std::istream& stream, cons { if(formatstruct.GetFormatString()!="undefined" ){ for(MapIOFList::const_iterator it=map_io_list_.begin(); it!=map_io_list_.end();++it) { - if((*it)->MatchType(formatstruct)) { + if((*it)->ProvidesExport() && (*it)->MatchType(formatstruct)) { return (*it)->Create(); } }