00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OST_IO_MAP_IO_MRC_HANDLER_HH
00021 #define OST_IO_MAP_IO_MRC_HANDLER_HH
00022
00023 #include "map_io_handler.hh"
00024
00025 namespace ost { namespace io {
00026
00027 class DLLEXPORT_OST_IO MRC: public ImageFormatBase
00028 {
00029 public:
00030
00031 MRC(bool normalize_on_save = false, Subformat subformat = MRC_AUTO_FORMAT ,Endianess endianness_on_save = OST_LOCAL_ENDIAN);
00032
00033 Endianess GetEndianessOnSave() const;
00034 void SetEndianessOnSave(Endianess end);
00035
00036 bool GetNormalizeOnSave() const;
00037 void SetNormalizeOnSave(bool normalize_on_save);
00038
00039 Subformat GetSubformat() const;
00040 void SetSubformat(Subformat subformat);
00041
00042 static String FORMAT_STRING;
00043
00044 private:
00045
00046 Subformat subformat_;
00047 bool normalize_on_save_;
00048 Endianess endianess_on_save_;
00049 Subformat subf_;
00050 };
00051
00052 class DLLEXPORT_OST_IO CCP4: public MRC
00053 {
00054 public:
00055 CCP4(bool normalize_on_save = false, Endianess endianness_on_save = OST_LOCAL_ENDIAN);
00056 };
00057
00058 typedef CCP4 MAP;
00059
00060 class MapIOMrcHandler: public MapIOHandler {
00061 public:
00062
00063 MapIOMrcHandler():
00064 is_file_(false),
00065 filename_("") {}
00066
00071 virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct );
00072 virtual void Import(img::MapHandle& sh, std::istream& loc, const ImageFormatBase& formatstruct);
00073 virtual void Export(const img::MapHandle& sh, const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) const;
00074 virtual void Export(const img::MapHandle& sh, std::ostream& loc,const ImageFormatBase& formatstruct) const;
00075 static bool MatchContent(unsigned char* header);
00076 static bool MatchType(const ImageFormatBase& type);
00077 static bool MatchSuffix(const String& loc);
00078 static String GetFormatName() { return String("Mrc"); };
00079 static String GetFormatDescription() { return String("Format used by the MRC software package"); };
00080
00081 private:
00082
00083 mutable bool is_file_;
00084 mutable String filename_;
00085 char header_[256];
00086
00087 };
00088
00089 typedef MapIOHandlerFactory<MapIOMrcHandler> MapIOMrcHandlerFactory;
00090
00091 }}
00092
00093
00094 #endif