Harmonize mrc density format extents with rest of code.
authorChristian Blau <cblau@gwdg.de>
Fri, 28 Jun 2019 13:50:01 +0000 (15:50 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 8 Aug 2019 11:49:14 +0000 (13:49 +0200)
To have x-dimension varying the fastest, density extents have to be
defined having z first. This patch ensures, that the mrc file format
is read in line with the data layout used in the for, e.g., the
Gauss transformation.

Change-Id: I3a1a9f215d95dfbc50ea5938bb1d724ac4263556

src/gromacs/fileio/mrcdensitymapheader.cpp
src/gromacs/fileio/tests/mrcdensitymapheader.cpp
src/gromacs/math/densityfit.cpp
src/gromacs/math/gausstransform.cpp

index 9244996fd8b8eeba97418dc6c1452dd89f981a3b..86d554022af63e675d5a3e2e12449bd4255c5146 100644 (file)
@@ -98,7 +98,7 @@ TranslateAndScale getCoordinateTransformationToLattice(const MrcDensityMapHeader
 
 dynamicExtents3D getDynamicExtents3D(const MrcDensityMapHeader &header)
 {
-    return {header.numColumnRowSection_[XX], header.numColumnRowSection_[YY], header.numColumnRowSection_[ZZ]};
+    return {header.numColumnRowSection_[ZZ], header.numColumnRowSection_[YY], header.numColumnRowSection_[XX]};
 };
 
 } // namespace gmx
index 8e90e99c2599117b6e4dd12e25aa6e9042ef761f..6f65972f5c464a330ef04c96e237ad4580dbdd22 100644 (file)
@@ -131,7 +131,7 @@ TEST(MrcDensityMapHeaderTest, GetsCorrectExtents)
     header.numColumnRowSection_ = {100, 200, 300};
 
     const auto extents = getDynamicExtents3D(header);
-    std::array<std::ptrdiff_t, DIM> expectedExtents = {100, 200, 300};
+    std::array<std::ptrdiff_t, DIM> expectedExtents = {300, 200, 100};
     EXPECT_EQ(expectedExtents[XX], extents.extent(XX));
     EXPECT_EQ(expectedExtents[YY], extents.extent(YY));
     EXPECT_EQ(expectedExtents[ZZ], extents.extent(ZZ));
index ea210cf61942b7b783e705fd38e76eaf4b6f32b0..38d0d61d490e077b80b103d2a722e83c474a2af1 100644 (file)
@@ -97,7 +97,7 @@ class DensitySimilarityInnerProduct final : public DensitySimilarityMeasureImpl
 DensitySimilarityInnerProduct::DensitySimilarityInnerProduct(density referenceDensity) :
     referenceDensity_ {referenceDensity },
 gradient_ {
-    referenceDensity.extent(XX), referenceDensity.extent(YY), referenceDensity.extent(ZZ)
+    referenceDensity.extents()
 }
 {
     const auto numVoxels = gradient_.asConstView().mapping().required_span_size();
index 55d62764a5defa2a5eb3fcf49f54c5cb8d32fcc4..8674b5006970266ceecc5dc4b02271c9ecb3b95a 100644 (file)
@@ -233,7 +233,7 @@ IVec rangeBeginWithinLattice(const IVec &index, const IVec &range)
  */
 IVec rangeEndWithinLattice(const IVec &index, const dynamicExtents3D &extents, const IVec &range)
 {
-    IVec extentAsIvec(static_cast<int>(extents.extent(XX)), static_cast<int>(extents.extent(YY)), static_cast<int>(extents.extent(ZZ)));
+    IVec extentAsIvec(static_cast<int>(extents.extent(ZZ)), static_cast<int>(extents.extent(YY)), static_cast<int>(extents.extent(XX)));
     return elementWiseMin(extentAsIvec, index + range);
 }