OpenStructure
map_io_mrc_handler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 #ifndef OST_IO_MAP_IO_MRC_HANDLER_HH
21 #define OST_IO_MAP_IO_MRC_HANDLER_HH
22 
23 #include "map_io_handler.hh"
24 
25 namespace ost { namespace io {
26 
28 {
29  public:
30 
31  MRC(bool normalize_on_save = false, Subformat subformat = MRC_AUTO_FORMAT ,Endianess endianness_on_save = OST_LOCAL_ENDIAN);
32 
33  Endianess GetEndianessOnSave() const;
34  void SetEndianessOnSave(Endianess end);
35 
36  bool GetNormalizeOnSave() const;
37  void SetNormalizeOnSave(bool normalize_on_save);
38 
39  Subformat GetSubformat() const;
40  void SetSubformat(Subformat subformat);
41 
43 
44  private:
45 
46  Subformat subformat_;
47  bool normalize_on_save_;
48  Endianess endianess_on_save_;
49 };
50 
51 class DLLEXPORT_OST_IO CCP4: public MRC
52 {
53  public:
54  CCP4(bool normalize_on_save = false, Endianess endianness_on_save = OST_LOCAL_ENDIAN);
55 };
56 
57 typedef CCP4 MAP;
58 
60 public:
61 
63  is_file_(false),
64  filename_("") {}
65 
70  virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct );
71  virtual void Import(img::MapHandle& sh, std::istream& loc, const ImageFormatBase& formatstruct);
72  virtual void Export(const img::MapHandle& sh, const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) const;
73  virtual void Export(const img::MapHandle& sh, std::ostream& loc,const ImageFormatBase& formatstruct) const;
74  static bool MatchContent(unsigned char* header);
75  static bool MatchType(const ImageFormatBase& type);
76  static bool MatchSuffix(const String& loc);
77  static String GetFormatName() { return String("Mrc"); };
78  static String GetFormatDescription() { return String("Format used by the MRC software package"); };
79 
80 private:
81 
82  mutable bool is_file_;
83  mutable String filename_;
84  char header_[256];
85 
86 };
87 
89 
90 }}
91 
92 
93 #endif