48 using namespace boost;
60 using namespace Hdf5Util;
80 const std::string &layerPath,
89 throw BadHdf5IdException(
"Bad layer group in MACFieldIO::read");
92 if (!
readAttribute(layerGroup, k_versionAttrName, 1, version))
93 throw MissingAttributeException(
"Couldn't find attribute " +
96 if (version != k_versionNumber)
97 throw UnsupportedVersionException(
"MACField version not supported: " +
98 lexical_cast<std::string>(version));
100 if (!
readAttribute(layerGroup, k_extentsStr, 6, extents.min.x))
101 throw MissingAttributeException(
"Couldn't find attribute " +
104 if (!
readAttribute(layerGroup, k_dataWindowStr, 6, dataW.min.x))
105 throw MissingAttributeException(
"Couldn't find attribute " +
108 if (!
readAttribute(layerGroup, k_componentsStr, 1, components))
109 throw MissingAttributeException(
"Couldn't find attribute " +
113 if (!
readAttribute(layerGroup, k_bitsPerComponentStr, 1, bits))
114 throw MissingAttributeException(
"Couldn't find attribute: " +
115 k_bitsPerComponentStr);
124 field->
setSize(extents, dataW);
125 readData<V3h>(layerGroup, field);
134 field->
setSize(extents, dataW);
135 readData<V3d>(layerGroup, field);
145 field->
setSize(extents, dataW);
146 readData<V3f>(layerGroup, field);
160 if (layerGroup == -1) {
161 throw BadHdf5IdException(
"Bad layer group in MACFieldIO::write");
166 1, k_versionNumber)) {
167 throw WriteAttributeException(
"Couldn't write attribute " +
180 success = writeInternal<V3f>(layerGroup, vecFloatField);
181 }
else if (vecHalfField) {
182 success = writeInternal<V3h>(layerGroup, vecHalfField);
183 }
else if (vecDoubleField) {
184 success = writeInternal<V3d>(layerGroup, vecDoubleField);
186 throw WriteLayerException(
"MACFieldIO does not support the given "
187 "MACField template parameter");