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, Format bit_depth = OST_DEFAULT_FORMAT);
00032
00033 Format GetBitDepth() const;
00034 void SetBitDepth ( Format bitdepth);
00035
00036 Endianess GetEndianessOnSave() const;
00037 void SetEndianessOnSave(Endianess end);
00038
00039 bool GetNormalizeOnSave() const;
00040 void SetNormalizeOnSave(bool normalize_on_save);
00041
00042 Subformat GetSubformat() const;
00043 void SetSubformat(Subformat subformat);
00044
00045 static String FORMAT_STRING;
00046
00047 private:
00048
00049 Subformat subformat_;
00050 bool normalize_on_save_;
00051 Endianess endianess_on_save_;
00052 Format bit_depth_;
00053 };
00054
00055 class DLLEXPORT_OST_IO CCP4: public MRC
00056 {
00057 public:
00058 CCP4(bool normalize_on_save = false, Endianess endianness_on_save = OST_LOCAL_ENDIAN, Format bit_depth = OST_DEFAULT_FORMAT);
00059 };
00060
00061 typedef CCP4 MAP;
00062
00063 class MapIOMrcHandler: public MapIOHandler {
00064 public:
00065
00066 MapIOMrcHandler():
00067 is_file_(false),
00068 filename_("") {}
00069
00074 virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct );
00075 virtual void Import(img::MapHandle& sh, std::istream& loc, const ImageFormatBase& formatstruct);
00076 virtual void Export(const img::MapHandle& sh, const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) const;
00077 virtual void Export(const img::MapHandle& sh, std::ostream& loc,const ImageFormatBase& formatstruct) const;
00078 static bool MatchContent(unsigned char* header);
00079 static bool MatchType(const ImageFormatBase& type);
00080 static bool MatchSuffix(const String& loc);
00081 static bool ProvidesImport() { return true; }
00082 static bool ProvidesExport() { return true; }
00083 static String GetFormatName() { return String("Mrc"); };
00084 static String GetFormatDescription() { return String("Format used by the MRC software package"); };
00085
00086 private:
00087
00088 mutable bool is_file_;
00089 mutable String filename_;
00090 char header_[256];
00091
00092 };
00093
00094 typedef MapIOHandlerFactory<MapIOMrcHandler> MapIOMrcHandlerFactory;
00095
00096 }}
00097
00098
00099 #endif