From 968812a874c571249b3fb59fb352ce4cd385a18a Mon Sep 17 00:00:00 2001
From: Ansgar Philippsen <ansgar.philippsen@gmail.com>
Date: Wed, 25 Jul 2012 18:00:02 +0200
Subject: [PATCH] moved mol.Transform to geom

The Transform class was moved from the mol module to the geom module. A typedef
was put into the mol namespace in C++, and a similar alias was put into the
mol python module, with an added deprecation warning.
---
 CMakeLists.txt                                |   7 +-
 examples/code_fragments/dokk/ligand.py        |   4 +-
 examples/code_fragments/dokk/spnav_input.py   |   2 +-
 modules/geom/pymod/CMakeLists.txt             |   1 +
 .../base => geom}/pymod/export_transform.cc   |  12 +-
 modules/geom/pymod/wrap_geom.cc               |   2 +
 modules/geom/src/CMakeLists.txt               |   3 +-
 modules/geom/src/geom.hh                      |   1 +
 modules/{mol/base => geom}/src/transform.cc   |  49 +-----
 modules/{mol/base => geom}/src/transform.hh   |  84 +++++-----
 modules/geom/tests/CMakeLists.txt             |   1 +
 .../base => geom}/tests/test_transform.cc     |   7 +-
 modules/img/alg/pymod/wrap_alg.cc             | 153 +++++++++---------
 modules/img/alg/tests/test_transform.cc       |  15 +-
 modules/info/pymod/wrap_info.cc               |   4 +
 modules/info/src/geom_info_conversion.cc      |  33 +++-
 modules/info/src/geom_info_conversion.hh      |   9 ++
 modules/mol/base/pymod/CMakeLists.txt         |   1 -
 modules/mol/base/pymod/__init__.py            |  11 ++
 modules/mol/base/pymod/wrap_mol.cc            |   2 -
 modules/mol/base/src/CMakeLists.txt           |   3 +-
 modules/mol/base/src/coord_group.hh           |   7 +-
 modules/mol/base/src/coord_source.hh          |   5 +-
 modules/mol/base/tests/CMakeLists.txt         |   1 -
 24 files changed, 213 insertions(+), 204 deletions(-)
 rename modules/{mol/base => geom}/pymod/export_transform.cc (91%)
 rename modules/{mol/base => geom}/src/transform.cc (78%)
 rename modules/{mol/base => geom}/src/transform.hh (53%)
 rename modules/{mol/base => geom}/tests/test_transform.cc (92%)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba1c57dd6..1556db88d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -318,6 +318,9 @@ message(STATUS
         "   Compound Lib                   (-DCOMPOUND_LIB) : ${_COMP_LIB}\n"
         "   TMAlign and TMScore         (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n"
         "   Static Libraries              (-DENABLE_STATIC) : ${ENABLE_STATIC}\n"
-        "   Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}\n"
-        "   Hidden object visibility  (-DHIDDEN_VISIBILITY) : ${_HIDDEN_VIS}")
+        "   Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}")
+if (CMAKE_COMPILER_IS_GNUCXX)
+   message(STATUS
+        "   Hidden object visibility  (-DHIDDEN_VISIBILITY) :        ${_HIDDEN_VIS}")
+endif()
 
diff --git a/examples/code_fragments/dokk/ligand.py b/examples/code_fragments/dokk/ligand.py
index 4fc297ebc..2683aaddb 100644
--- a/examples/code_fragments/dokk/ligand.py
+++ b/examples/code_fragments/dokk/ligand.py
@@ -100,7 +100,7 @@ class Ligand:
       shift_vec = geom.Vec3(float(self.config.start["POSX"]),
                             float(self.config.start["POSY"]),
                             float(self.config.start["POSZ"]))
-      transf = mol.Transform()
+      transf = geom.Transform()
       transf.SetTrans(shift_vec)
       edi.SetTransform(transf.GetMatrix())
       self.RotateAxis(geom.Vec3(1,0,0), float(self.config.start["ROTX"]))
@@ -123,4 +123,4 @@ class Ligand:
          if dot>0:
            vec-=dot*p.GetNormal()
            return vec
-    return vec 
\ No newline at end of file
+    return vec 
diff --git a/examples/code_fragments/dokk/spnav_input.py b/examples/code_fragments/dokk/spnav_input.py
index e51798578..6f1a9de95 100644
--- a/examples/code_fragments/dokk/spnav_input.py
+++ b/examples/code_fragments/dokk/spnav_input.py
@@ -39,7 +39,7 @@ class SpnavInputDevice(QtCore.QObject):
   def InputChanged(self, tx,ty,tz,rx,ry,rz):
     if (not self._lock_input) and (self.level is not None):
       ligand = self.level.ligand
-      transf = mol.Transform()
+      transf = geom.Transform()
       if(self.trans):
         delta = geom.Vec3 ((tx/480.0)*self._trans_factor, (ty/480.0)*self._trans_factor, (-tz/480.0)*self._trans_factor)
         transf.SetTrans(delta)
diff --git a/modules/geom/pymod/CMakeLists.txt b/modules/geom/pymod/CMakeLists.txt
index f79aeac4c..5988cc95b 100644
--- a/modules/geom/pymod/CMakeLists.txt
+++ b/modules/geom/pymod/CMakeLists.txt
@@ -14,6 +14,7 @@ set(OST_GEOM_PYMOD_SOURCES
   export_composite2_op.cc
   export_composite3_op.cc
   export_quat.cc
+  export_transform.cc
 )
 
 if (NOT ENABLE_STATIC)
diff --git a/modules/mol/base/pymod/export_transform.cc b/modules/geom/pymod/export_transform.cc
similarity index 91%
rename from modules/mol/base/pymod/export_transform.cc
rename to modules/geom/pymod/export_transform.cc
index 1dc8bdc16..b2f921246 100644
--- a/modules/mol/base/pymod/export_transform.cc
+++ b/modules/geom/pymod/export_transform.cc
@@ -18,14 +18,10 @@
 //------------------------------------------------------------------------------
 #include <boost/python.hpp>
 
-#include <ost/mol/transform.hh>
-#if(OST_INFO_ENABLED)
-#include <ost/info/info.hh>
-#endif
+#include <ost/geom/transform.hh>
 
 using namespace boost::python;
-using namespace ost;
-using namespace ost::mol;
+using namespace geom;
 
 void export_Transform()
 {
@@ -56,8 +52,4 @@ void export_Transform()
     .def("ApplyZAxisTranslation",&Transform::ApplyZAxisTranslation)
     .def("ApplyAxisRotation",&Transform::ApplyAxisRotation)
     ;
-#if(OST_INFO_ENABLED)
-  def("TransformToInfo", &TransformToInfo);
-  def("TransformFromInfo", &TransformFromInfo);
-#endif
 }
diff --git a/modules/geom/pymod/wrap_geom.cc b/modules/geom/pymod/wrap_geom.cc
index 76bb79300..14df2fa8b 100644
--- a/modules/geom/pymod/wrap_geom.cc
+++ b/modules/geom/pymod/wrap_geom.cc
@@ -35,6 +35,7 @@ extern void export_Composite3();
 extern void export_Composite2_op();
 extern void export_Composite3_op();
 extern void export_Quat();
+extern void export_Transform();
 
 namespace details {
 #if (defined(OST_STATIC_PROPERTY_WORKAROUND))
@@ -64,6 +65,7 @@ BOOST_PYTHON_MODULE(_ost_geom)
   export_Composite2_op();
   export_Composite3_op();
   export_Quat();
+  export_Transform();
 
 #if (defined(OST_STATIC_PROPERTY_WORKAROUND))
   // workaround for a problem with boost python and python 2.6.3/4
diff --git a/modules/geom/src/CMakeLists.txt b/modules/geom/src/CMakeLists.txt
index b20b7d243..40f33282a 100644
--- a/modules/geom/src/CMakeLists.txt
+++ b/modules/geom/src/CMakeLists.txt
@@ -25,7 +25,7 @@ composite3_op.hh
 aligned_cuboid.hh
 vec_mat_predicates.hh
 quat.hh
-
+transform.hh
 point_cloud.hh
 module_config.hh
 )
@@ -43,6 +43,7 @@ composite3.cc
 composite2_op.cc
 composite3_op.cc
 quat.cc
+transform.cc
 aligned_cuboid.cc
 point_cloud.cc
 )
diff --git a/modules/geom/src/geom.hh b/modules/geom/src/geom.hh
index 138e8da92..2bf028ab5 100644
--- a/modules/geom/src/geom.hh
+++ b/modules/geom/src/geom.hh
@@ -29,5 +29,6 @@
 #include "composite_op.hh"
 #include "quat.hh"
 #include "aligned_cuboid.hh"
+#include "transform.hh"
 
 #endif
diff --git a/modules/mol/base/src/transform.cc b/modules/geom/src/transform.cc
similarity index 78%
rename from modules/mol/base/src/transform.cc
rename to modules/geom/src/transform.cc
index ba1e59258..d2a07f6ab 100644
--- a/modules/mol/base/src/transform.cc
+++ b/modules/geom/src/transform.cc
@@ -18,18 +18,13 @@
 //------------------------------------------------------------------------------
 
 #include <ost/config.hh>
-#if(OST_INFO_ENABLED)
-#include <ost/info/info.hh>
-#include <ost/info/geom_info_conversion.hh>
-#endif
 #include <ost/log.hh>
-#include "transform.hh"
-
-namespace ost { 
 
-using namespace geom;
+#include "transform.hh"
+#include "vecmat3_op.hh"
+#include "vecmat4_op.hh"
 
-namespace mol {
+namespace geom {
 
 Transform::Transform():
   rot_(Mat3(1,0,0, 0,1,0, 0,0,1)),
@@ -207,7 +202,7 @@ void Transform::update_tm()
   try {
     itm_ = Invert(tm_);
   } catch (GeomException& e) {
-    LOG_WARNING("caught GeomException in Transform::update_tm: " << e.what());
+    std::cerr << "caught GeomException in Transform::update_tm: " << e.what() << std::endl;
     itm_=geom::Mat4();
   }
 }
@@ -221,36 +216,4 @@ void Transform::update_components()
   trans_[2] = tm_(3,2);
 }
 
-#if(OST_INFO_ENABLED)
-Transform TransformFromInfo(const info::InfoGroup& group)
-{
-  if (!group.HasItem("center")) {
-    throw info::InfoError("Error while loading transform from info: "
-                          "Group does not contain a center element");
-  }
-  if (!group.HasGroup("rotation")) {
-    throw info::InfoError("Error while loading transform from info: "
-                          "Group does not contain a rotation element");
-  }
-  if (!group.HasItem("translation")) {
-    throw info::InfoError("Error while loading transform from info: "
-                          "Group does not contain a translation element");
-  } 
-  Transform tf;
-  tf.SetCenter(group.GetItem("center").AsVector());
-  tf.SetTrans(group.GetItem("translation").AsVector());
-  tf.SetRot(info::Mat3FromInfo(group.GetGroup("rotation")));
-  return tf;
-}
-
-void TransformToInfo(const Transform& transform, info::InfoGroup& group)
-{
-  Transform tf;
-  group.CreateItem("center", transform.GetCenter());
-  group.CreateItem("translation", transform.GetTrans());
-  info::InfoGroup rot=group.CreateGroup("rotation");
-  info::Mat3ToInfo(transform.GetRot(), rot);
-}
-#endif
-
-}} // ns
+} // ns
diff --git a/modules/mol/base/src/transform.hh b/modules/geom/src/transform.hh
similarity index 53%
rename from modules/mol/base/src/transform.hh
rename to modules/geom/src/transform.hh
index f9c59f6f5..997f76395 100644
--- a/modules/mol/base/src/transform.hh
+++ b/modules/geom/src/transform.hh
@@ -16,37 +16,44 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
-#ifndef OST_MOL_BASE_TRANSFORM_HH
-#define OST_MOL_BASE_TRANSFORM_HH
+#ifndef OST_GEOM_TRANSFORM_HH
+#define OST_GEOM_TRANSFORM_HH
 
 /*
   Author: Ansgar Philippsen
 */
 
 #include <ost/config.hh>
-#include <ost/geom/geom.hh>
-#if(OST_INFO_ENABLED)
-#include <ost/info/info_fw.hh>
-#endif
-#include <ost/mol/module_config.hh>
 
-namespace ost { namespace mol {
+#include "module_config.hh"
+#include "vec3.hh"
+#include "vec4.hh"
+#include "mat3.hh"
+#include "mat.hh"
+#include "aligned_cuboid.hh"
+
+namespace geom {
 
 /// \brief basic and essential transformation class, including translation,
 ///    rotation and center of rotation
-class DLLEXPORT_OST_MOL Transform {
+class DLLEXPORT_OST_GEOM Transform {
 public:
   Transform();
 
-  geom::Mat4 GetMatrix() const {return tm_;}
-  geom::Mat4 GetTransposedMatrix() const {return ttm_;}
-  geom::Mat4 GetInvertedMatrix() const {return itm_;}
+  /// \brief retrieve transformation matrix
+  Mat4 GetMatrix() const {return tm_;}
+  /// \brief retrieve transposed transformation matrix
+  Mat4 GetTransposedMatrix() const {return ttm_;}
+  /// \brief retrieve inverted transformation matrix
+  Mat4 GetInvertedMatrix() const {return itm_;}
 
-  void SetCenter(const geom::Vec3& c);
-  geom::Vec3 GetCenter() const;
+  /// \brief set center of rotation
+  void SetCenter(const Vec3& c);
+  /// \brief retrieve center of rotation
+  Vec3 GetCenter() const;
 
   // directly set tm, messing up rot/trans/cen !
-  void SetMatrix(const geom::Mat4& m);
+  void SetMatrix(const Mat4& m);
 
   /// \name rotation
   //@{
@@ -54,51 +61,40 @@ public:
   void ApplyXAxisRotation(float delta);
   void ApplyYAxisRotation(float delta);
   void ApplyZAxisRotation(float delta);
-  void ApplyAxisRotation(float delta, const geom::Vec3& axis);  
+  void ApplyAxisRotation(float delta, const Vec3& axis);  
   
-  geom::Mat3 GetXAxisRotation(float delta);
-  geom::Mat3 GetYAxisRotation(float delta);
-  geom::Mat3 GetZAxisRotation(float delta);
+  Mat3 GetXAxisRotation(float delta);
+  Mat3 GetYAxisRotation(float delta);
+  Mat3 GetZAxisRotation(float delta);
   
-  geom::Mat3 GetRot() const;
-  void SetRot(const geom::Mat3& r);
+  Mat3 GetRot() const;
+  void SetRot(const Mat3& r);
   //@}
   /// \brief translation
   //@{
   void ApplyXAxisTranslation(float delta);
   void ApplyYAxisTranslation(float delta);
   void ApplyZAxisTranslation(float delta);
-  void SetTrans(const geom::Vec3& t);
-  geom::Vec3 GetTrans() const;  
+  void SetTrans(const Vec3& t);
+  Vec3 GetTrans() const;  
   //@}
   
-  geom::Vec3 Apply(const geom::Vec3& v) const;
-  geom::Vec4 Apply(const geom::Vec4& v) const;
-  geom::AlignedCuboid Apply(const geom::AlignedCuboid& c) const;
+  Vec3 Apply(const Vec3& v) const;
+  Vec4 Apply(const Vec4& v) const;
+  AlignedCuboid Apply(const AlignedCuboid& c) const;
 
 private:
-  geom::Mat3 rot_;
-  geom::Vec3 trans_;
-  geom::Vec3 cen_;
-  geom::Mat4 tm_;
-  geom::Mat4 ttm_;
-  geom::Mat4 itm_;
+  Mat3 rot_;
+  Vec3 trans_;
+  Vec3 cen_;
+  Mat4 tm_;
+  Mat4 ttm_;
+  Mat4 itm_;
 
   void update_tm();
   void update_components();
 };
 
-
-
-#if(OST_INFO_ENABLED)
-/// \brief read transformation from info group
-/// \relates Transform
-Transform DLLEXPORT_OST_MOL TransformFromInfo(const info::InfoGroup& group);
-/// \brief store transformation in info group
-/// \relates Transform
-void DLLEXPORT_OST_MOL TransformToInfo(const Transform& transform,
-                                       info::InfoGroup& group);
-#endif
-}} // ns
+} // ns
 
 #endif
diff --git a/modules/geom/tests/CMakeLists.txt b/modules/geom/tests/CMakeLists.txt
index 027a16749..e4056c278 100644
--- a/modules/geom/tests/CMakeLists.txt
+++ b/modules/geom/tests/CMakeLists.txt
@@ -11,6 +11,7 @@ set(GEOM_UNITTESTS
   test_vec2.cc
   test_vec3.cc
   test_vec4.cc
+  test_transform.cc
   tests.cc
   test_geom.py
 )
diff --git a/modules/mol/base/tests/test_transform.cc b/modules/geom/tests/test_transform.cc
similarity index 92%
rename from modules/mol/base/tests/test_transform.cc
rename to modules/geom/tests/test_transform.cc
index 5c950acc5..5f4a543fd 100644
--- a/modules/mol/base/tests/test_transform.cc
+++ b/modules/geom/tests/test_transform.cc
@@ -22,14 +22,11 @@
  #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
-#include <ost/mol/mol.hh>
-#include <ost/mol/transform.hh>
 #include <ost/geom/geom.hh>
 
-using namespace ost;
-using namespace ost::mol;
+using namespace geom;
 
-BOOST_AUTO_TEST_SUITE( mol_base );
+BOOST_AUTO_TEST_SUITE( geom_base );
 
 BOOST_AUTO_TEST_CASE(test_transform)
 {
diff --git a/modules/img/alg/pymod/wrap_alg.cc b/modules/img/alg/pymod/wrap_alg.cc
index c141fe113..7185f3402 100644
--- a/modules/img/alg/pymod/wrap_alg.cc
+++ b/modules/img/alg/pymod/wrap_alg.cc
@@ -54,7 +54,7 @@
 
 using namespace ost;
 using namespace ost::img;
-using namespace ost::img::alg;
+//using namespace ost::img::alg;
 using namespace boost::python;
 
 // fw decl
@@ -63,11 +63,8 @@ void export_Normalizer();
 void export_Transcendentals();
 void export_Polar();
 
-using namespace ost::img;
-using namespace ost::img::alg;
-
 namespace {
-list get_histo_bins(const Histogram& hist) {
+list get_histo_bins(const alg::Histogram& hist) {
   list result;
   const std::vector<int>& bins = hist.GetBins();
   for(std::vector<int>::const_iterator it=bins.begin();it!=bins.end();++it) {
@@ -76,32 +73,32 @@ list get_histo_bins(const Histogram& hist) {
   return result;
 }
 
-void frac_shift0(FractionalShift* s) 
+void frac_shift0(alg::FractionalShift* s) 
 {
   s->SetShift();
 }
   
-void frac_shift1(FractionalShift* s, Real sx) 
+void frac_shift1(alg::FractionalShift* s, Real sx) 
 {
   s->SetShift(sx);
 }
 
-void frac_shift2(FractionalShift* s, Real sx, Real sy) 
+void frac_shift2(alg::FractionalShift* s, Real sx, Real sy) 
 {
   s->SetShift(sx,sy);
 }
   
-void frac_shift3(FractionalShift* s, Real sx, Real sy, Real sz) 
+void frac_shift3(alg::FractionalShift* s, Real sx, Real sy, Real sz) 
 {
   s->SetShift(sx,sy,sz);
 }
   
-void frac_shift4(FractionalShift* s, const Vec2& v) 
+void frac_shift4(alg::FractionalShift* s, const Vec2& v) 
 {
   s->SetShift(v);
 }
   
-void frac_shift5(FractionalShift* s, const Vec3& v) 
+void frac_shift5(alg::FractionalShift* s, const Vec3& v) 
 {
   s->SetShift(v);
 }
@@ -109,7 +106,7 @@ void frac_shift5(FractionalShift* s, const Vec3& v)
 Real real_spatial_cross_correlation_1(const ConstImageHandle& image1, 
                                       const ConstImageHandle& image2)
 {
-  return RealSpatialCrossCorrelation(image1,image2);
+  return alg::RealSpatialCrossCorrelation(image1,image2);
 }
 
 
@@ -117,94 +114,94 @@ Real real_spatial_cross_correlation_2(const ConstImageHandle& image1,
                                       const ConstImageHandle& image2, 
                                       const Extent& extent)
 {
-  return RealSpatialCrossCorrelation(image1,image2,extent);
+  return alg::RealSpatialCrossCorrelation(image1,image2,extent);
 }
 
 } //anon ns
 
 BOOST_PYTHON_MODULE(_ost_img_alg)
 {
-  class_<AutoCorrelate, bases<ConstModOPAlgorithm> >("AutoCorrelate",init<>());
+  class_<alg::AutoCorrelate, bases<ConstModOPAlgorithm> >("AutoCorrelate",init<>());
 
-  class_<Clear,bases<ConstModIPAlgorithm> >("Clear", init<>());
+  class_<alg::Clear,bases<ConstModIPAlgorithm> >("Clear", init<>());
 
-  class_<Conj,bases<ConstModIPAlgorithm> >("Conj", init<>());
+  class_<alg::Conj,bases<ConstModIPAlgorithm> >("Conj", init<>());
 
-  class_<ExplicitConvolute,bases<ConstModOPAlgorithm> >("ExplicitConvolute", init<const ConstImageHandle&,optional<bool> >());
+  class_<alg::ExplicitConvolute,bases<ConstModOPAlgorithm> >("ExplicitConvolute", init<const ConstImageHandle&,optional<bool> >());
 
-  class_<ExplicitCorrelate,bases<ConstModOPAlgorithm> >("ExplicitCorrelate", init<const ConstImageHandle&>());
+  class_<alg::ExplicitCorrelate,bases<ConstModOPAlgorithm> >("ExplicitCorrelate", init<const ConstImageHandle&>());
 
-  class_<CrossCorrelate,bases<ConstModIPAlgorithm> >("CrossCorrelate", init<const ConstImageHandle&>());
+  class_<alg::CrossCorrelate,bases<ConstModIPAlgorithm> >("CrossCorrelate", init<const ConstImageHandle&>());
 
-  class_<DFT,bases<ConstModOPAlgorithm> >("DFT", init<>());
+  class_<alg::DFT,bases<ConstModOPAlgorithm> >("DFT", init<>());
 
-  class_<FFT,bases<ConstModOPAlgorithm> >("FFT", init<>());
+  class_<alg::FFT,bases<ConstModOPAlgorithm> >("FFT", init<>());
 
-  class_<PowerSpectrum,bases<ConstModOPAlgorithm> >("PowerSpectrum",init<>());
+  class_<alg::PowerSpectrum,bases<ConstModOPAlgorithm> >("PowerSpectrum",init<>());
 
-  class_<Fill,bases<ConstModIPAlgorithm> >("Fill", init<const Complex&>())
+  class_<alg::Fill,bases<ConstModIPAlgorithm> >("Fill", init<const Complex&>())
     .def(init<Real>())
     ;
 
-  class_<Threshold,bases<ConstModIPAlgorithm> >("Threshold", init<const Complex&>())
+  class_<alg::Threshold,bases<ConstModIPAlgorithm> >("Threshold", init<const Complex&>())
     .def(init<Real>())
     ;
 
-  class_<DensitySlice,bases<ConstModIPAlgorithm> >("DensitySlice",
+  class_<alg::DensitySlice,bases<ConstModIPAlgorithm> >("DensitySlice",
 						   init<const Complex&,const Complex&>())
     .def(init<Real,Real>())
     ;
 
-  class_<ClipMinMax,bases<ConstModIPAlgorithm> >("ClipMinMax", 
+  class_<alg::ClipMinMax,bases<ConstModIPAlgorithm> >("ClipMinMax", 
 						 init<const Complex&,const Complex&>())
     .def(init<Real,Real>())
     ;
 
-  class_<Histogram, bases<NonModAlgorithm> >("Histogram", init<int,Real,Real>() )
+  class_<alg::Histogram, bases<NonModAlgorithm> >("Histogram", init<int,Real,Real>() )
     .def("GetBins",get_histo_bins)
     ;
 
-  class_<Negate,bases<ConstModIPAlgorithm> >("Negate", init<>());
-
-  class_<Stat, bases<NonModAlgorithm> >("Stat", init<>() )
-    .def("GetMean",&Stat::GetMean)
-    .def("SetMean",&Stat::SetMean)
-    .def("GetMinimum",&Stat::GetMinimum)
-    .def("GetMinimumPosition",&Stat::GetMinimumPosition)
-    .def("SetMinimum",&Stat::SetMinimum)
-    .def("GetMaximum",&Stat::GetMaximum)
-    .def("GetMaximumPosition",&Stat::GetMaximumPosition)
-    .def("SetMaximum",&Stat::SetMaximum)
-    .def("GetSum",&Stat::GetSum)
-    .def("GetRootMeanSquare",&Stat::GetRootMeanSquare)
-    .def("GetSkewness",&Stat::GetSkewness)
-    .def("GetKurtosis",&Stat::GetKurtosis)
-    .def("GetVariance",&Stat::GetVariance)
-    .def("SetVariance",&Stat::SetVariance)
-    .def("GetStandardDeviation",&Stat::GetStandardDeviation)
-    .def("SetStandardDeviation",&Stat::SetStandardDeviation)
-    .def("GetCenterOfMass",&Stat::GetCenterOfMass)
+  class_<alg::Negate,bases<ConstModIPAlgorithm> >("Negate", init<>());
+
+  class_<alg::Stat, bases<NonModAlgorithm> >("Stat", init<>() )
+    .def("GetMean",&alg::Stat::GetMean)
+    .def("SetMean",&alg::Stat::SetMean)
+    .def("GetMinimum",&alg::Stat::GetMinimum)
+    .def("GetMinimumPosition",&alg::Stat::GetMinimumPosition)
+    .def("SetMinimum",&alg::Stat::SetMinimum)
+    .def("GetMaximum",&alg::Stat::GetMaximum)
+    .def("GetMaximumPosition",&alg::Stat::GetMaximumPosition)
+    .def("SetMaximum",&alg::Stat::SetMaximum)
+    .def("GetSum",&alg::Stat::GetSum)
+    .def("GetRootMeanSquare",&alg::Stat::GetRootMeanSquare)
+    .def("GetSkewness",&alg::Stat::GetSkewness)
+    .def("GetKurtosis",&alg::Stat::GetKurtosis)
+    .def("GetVariance",&alg::Stat::GetVariance)
+    .def("SetVariance",&alg::Stat::SetVariance)
+    .def("GetStandardDeviation",&alg::Stat::GetStandardDeviation)
+    .def("SetStandardDeviation",&alg::Stat::SetStandardDeviation)
+    .def("GetCenterOfMass",&alg::Stat::GetCenterOfMass)
     .def(self_ns::str(self))
   ;
-  class_<StatMinMax, bases<NonModAlgorithm> >("StatMinMax", init<>() )
-    .def("GetMinimum",&StatMinMax::GetMinimum)
-    .def("GetMinimumPosition",&StatMinMax::GetMinimumPosition)
-    .def("SetMinimum",&StatMinMax::SetMinimum)
-    .def("GetMaximum",&StatMinMax::GetMaximum)
-    .def("GetMaximumPosition",&StatMinMax::GetMaximumPosition)
-    .def("SetMaximum",&StatMinMax::SetMaximum)
+  class_<alg::StatMinMax, bases<NonModAlgorithm> >("StatMinMax", init<>() )
+    .def("GetMinimum",&alg::StatMinMax::GetMinimum)
+    .def("GetMinimumPosition",&alg::StatMinMax::GetMinimumPosition)
+    .def("SetMinimum",&alg::StatMinMax::SetMinimum)
+    .def("GetMaximum",&alg::StatMinMax::GetMaximum)
+    .def("GetMaximumPosition",&alg::StatMinMax::GetMaximumPosition)
+    .def("SetMaximum",&alg::StatMinMax::SetMaximum)
     .def(self_ns::str(self))
   ;
 
-  class_<Randomize,bases<ConstModIPAlgorithm> >("Randomize", init<>());
+  class_<alg::Randomize,bases<ConstModIPAlgorithm> >("Randomize", init<>());
   
-  class_<MaskImage, bases<ConstModIPAlgorithm> >("MaskImage",init<const MaskPtr&,optional<bool> >())
+  class_<alg::MaskImage, bases<ConstModIPAlgorithm> >("MaskImage",init<const MaskPtr&,optional<bool> >())
     ;
 
-  class_<SmoothMaskImage, bases<ModIPAlgorithm> >("SmoothMaskImage",init<const MaskPtr&, Real, optional<bool> >())
+  class_<alg::SmoothMaskImage, bases<ModIPAlgorithm> >("SmoothMaskImage",init<const MaskPtr&, Real, optional<bool> >())
     ;
 
-  class_<LocalSigmaThreshold, bases<ConstModOPAlgorithm> >("LocalSigmaThreshold", init<int,Real>() );
+  class_<alg::LocalSigmaThreshold, bases<ConstModOPAlgorithm> >("LocalSigmaThreshold", init<int,Real>() );
 
   export_Filter();
   export_Normalizer();
@@ -212,34 +209,34 @@ BOOST_PYTHON_MODULE(_ost_img_alg)
 
   export_Transcendentals();
 
-  class_<Transformation>("Transformation", init<>())
+  class_<alg::Transformation>("Transformation", init<>())
     .def(init<const Mat4&>())
     .def(init<const Mat4&, const Mat4&>())
     ;
 
-  class_<Rotate2D, bases<Transformation> >("Rotate2D", init<Real>() );
-  class_<Rotate2D90, bases<Transformation> >("Rotate2D90", init<int>() );
-  class_<Scale, bases<Transformation> >("Scale", init<Real>() );
-  class_<Translate, bases<Transformation> >("Translate", init<const Vec3&>() );
+  class_<alg::Rotate2D, bases<alg::Transformation> >("Rotate2D", init<Real>() );
+  class_<alg::Rotate2D90, bases<alg::Transformation> >("Rotate2D90", init<int>() );
+  class_<alg::Scale, bases<alg::Transformation> >("Scale", init<Real>() );
+  class_<alg::Translate, bases<alg::Transformation> >("Translate", init<const Vec3&>() );
 
-  class_<Transform,bases<ConstModOPAlgorithm> >("Transform",init<>())
-    .def(init<const Transformation&, optional<const Vec3&> >())
+  class_<alg::Transform,bases<ConstModOPAlgorithm> >("Transform",init<>())
+    .def(init<const alg::Transformation&, optional<const Vec3&> >())
     ;
 
-  class_<Shift,bases<ConstModOPAlgorithm> >("Shift",init<>())
+  class_<alg::Shift,bases<ConstModOPAlgorithm> >("Shift",init<>())
     .def(init<const Point&>())
     ;
 
-  class_<Mirror,bases<ConstModOPAlgorithm> >("Mirror",init<>())
+  class_<alg::Mirror,bases<ConstModOPAlgorithm> >("Mirror",init<>())
     .def(init<int>())
     ;
 
-  class_<DiscreteShrink, bases<ConstModOPAlgorithm> >("DiscreteShrink",init<optional<const Size&> >())
-    .def("SetBlocksize",&DiscreteShrink::SetBlocksize)
-    .def("GetBlocksize",&DiscreteShrink::GetBlocksize)
+  class_<alg::DiscreteShrink, bases<ConstModOPAlgorithm> >("DiscreteShrink",init<optional<const Size&> >())
+    .def("SetBlocksize",&alg::DiscreteShrink::SetBlocksize)
+    .def("GetBlocksize",&alg::DiscreteShrink::GetBlocksize)
     ;
 
-  class_<FractionalShift, bases<ModIPAlgorithm> >("FractionalShift", init<optional <Real,Real,Real> >() )
+  class_<alg::FractionalShift, bases<ModIPAlgorithm> >("FractionalShift", init<optional <Real,Real,Real> >() )
     .def(init<const Vec3&>())
     .def("SetShift",frac_shift0)
     .def("SetShift",frac_shift1)
@@ -247,22 +244,22 @@ BOOST_PYTHON_MODULE(_ost_img_alg)
     .def("SetShift",frac_shift3)
     .def("SetShift",frac_shift4)
     .def("SetShift",frac_shift5)
-    .def("GetShift",&FractionalShift::GetShift)
+    .def("GetShift",&alg::FractionalShift::GetShift)
     ;
-  class_<LineAverage, bases<ConstModOPAlgorithm> >("LineAverage", init<>() )
+  class_<alg::LineAverage, bases<ConstModOPAlgorithm> >("LineAverage", init<>() )
     .def(init<unsigned int>())
-    .def("GetGeometry",&LineAverage::GetGeometry)
-    .def("SetGeometry",&LineAverage::SetGeometry)
+    .def("GetGeometry",&alg::LineAverage::GetGeometry)
+    .def("SetGeometry",&alg::LineAverage::SetGeometry)
   ;
   def("RealSpatialCrossCorrelation",real_spatial_cross_correlation_1);
   def("RealSpatialCrossCorrelation",real_spatial_cross_correlation_2);
 
-  class_<HighestPeakSearch3D, bases<NonModAlgorithm> >("HighestPeakSearch3D" ,init<int,int,Real>())
+  class_<alg::HighestPeakSearch3D, bases<NonModAlgorithm> >("HighestPeakSearch3D" ,init<int,int,Real>())
     .def(init<int,int>())
     .def(init<int>())
     .def(init<>())
-    .def("GetPeakList",&HighestPeakSearch3D::GetPeakList)
-    .def("ClearPeakList",&HighestPeakSearch3D::ClearPeakList)
+    .def("GetPeakList",&alg::HighestPeakSearch3D::GetPeakList)
+    .def("ClearPeakList",&alg::HighestPeakSearch3D::ClearPeakList)
   ;
 
 }
diff --git a/modules/img/alg/tests/test_transform.cc b/modules/img/alg/tests/test_transform.cc
index 2721c3369..62a12549d 100644
--- a/modules/img/alg/tests/test_transform.cc
+++ b/modules/img/alg/tests/test_transform.cc
@@ -33,21 +33,20 @@
 namespace {
 
 using namespace ost::img;
-using namespace ost::img::alg;
 
 void test() 
 {
   alg::Randomize rnd;
-  Transform transform;
+  alg::Transform transform;
 }
 
 void test_point()
 {
   Point p0(3,-2,1);
   Point p1a(9,-6,3);
-  Point p1b(Scale(3.0).Apply(p0));
+  Point p1b(alg::Scale(3.0).Apply(p0));
   Point p2a(Point(2,3,1));
-  Point p2b=Rotate2D(M_PI_2).Apply(p0);
+  Point p2b=alg::Rotate2D(M_PI_2).Apply(p0);
 
   std::ostringstream msg;
   msg << p1a << " != " << p1b;
@@ -61,9 +60,9 @@ void test_extent()
 {
   Extent e0(Point(0,0),Point(2,3));
   Extent e1a(Point(-1,-1),Point(7,10));
-  Extent e1b=Scale(3.0).Apply(e0);
+  Extent e1b=alg::Scale(3.0).Apply(e0);
   Extent e2a(Point(-3,0),Point(0,2));
-  Extent e2b=Rotate2D(M_PI_2).Apply(e0);
+  Extent e2b=alg::Rotate2D(M_PI_2).Apply(e0);
 
   std::ostringstream msg;
   msg << e1a << " != " << e1b;
@@ -74,10 +73,10 @@ void test_extent()
 
   e0=Extent(Point(-3,-2),Size(8,10));
   e1a=Extent(Point(-10,-7),Size(24,30));
-  e1b=Scale(3.0).Apply(e0);
+  e1b=alg::Scale(3.0).Apply(e0);
 
   e2a=Extent(Point(-7,-3),Size(10,8));
-  e2b=Rotate2D(M_PI_2).Apply(e0);
+  e2b=alg::Rotate2D(M_PI_2).Apply(e0);
 
   msg.str("");
   msg << e1a << " != " << e1b;
diff --git a/modules/info/pymod/wrap_info.cc b/modules/info/pymod/wrap_info.cc
index 4af9741d6..cf15c736d 100644
--- a/modules/info/pymod/wrap_info.cc
+++ b/modules/info/pymod/wrap_info.cc
@@ -314,4 +314,8 @@ BOOST_PYTHON_MODULE(_ost_info)
 
   class_<VerboseInfoVisitor, bases<InfoVisitor> >("VerboseInfoVisitor",init<>())
   ;
+
+  def("TransformToInfo", &TransformToInfo);
+  def("TransformFromInfo", &TransformFromInfo);
+
 }
diff --git a/modules/info/src/geom_info_conversion.cc b/modules/info/src/geom_info_conversion.cc
index 8c7681be5..8e5711904 100644
--- a/modules/info/src/geom_info_conversion.cc
+++ b/modules/info/src/geom_info_conversion.cc
@@ -80,4 +80,35 @@ geom::Mat4 Mat4FromInfo(const InfoGroup& group)
   return mat;
 }
   
-}}
+geom::Transform TransformFromInfo(const InfoGroup& group)
+{
+  if (!group.HasItem("center")) {
+    throw InfoError("Error while loading transform from info: "
+                          "Group does not contain a center element");
+  }
+  if (!group.HasGroup("rotation")) {
+    throw InfoError("Error while loading transform from info: "
+                          "Group does not contain a rotation element");
+  }
+  if (!group.HasItem("translation")) {
+    throw InfoError("Error while loading transform from info: "
+                          "Group does not contain a translation element");
+  } 
+  geom::Transform tf;
+  tf.SetCenter(group.GetItem("center").AsVector());
+  tf.SetTrans(group.GetItem("translation").AsVector());
+  tf.SetRot(Mat3FromInfo(group.GetGroup("rotation")));
+  return tf;
+}
+
+void TransformToInfo(const geom::Transform& transform, InfoGroup& group)
+{
+  geom::Transform tf;
+  group.CreateItem("center", transform.GetCenter());
+  group.CreateItem("translation", transform.GetTrans());
+  InfoGroup rot=group.CreateGroup("rotation");
+  Mat3ToInfo(transform.GetRot(), rot);
+}
+
+}} // ns
+
diff --git a/modules/info/src/geom_info_conversion.hh b/modules/info/src/geom_info_conversion.hh
index cb06e05eb..bab90abec 100644
--- a/modules/info/src/geom_info_conversion.hh
+++ b/modules/info/src/geom_info_conversion.hh
@@ -53,6 +53,15 @@ void DLLEXPORT_OST_INFO Mat4ToInfo(const geom::Mat4& mat, InfoGroup& group);
 
 ///\brief load Mat4 from info
 geom::Mat4 DLLEXPORT_OST_INFO Mat4FromInfo(const InfoGroup& group);
+
+/// \brief read transformation from info group
+/// \relates Transform
+geom::Transform DLLEXPORT_OST_INFO TransformFromInfo(const info::InfoGroup& group);
+/// \brief store transformation in info group
+/// \relates Transform
+void DLLEXPORT_OST_INFO TransformToInfo(const geom::Transform& transform,
+                                           info::InfoGroup& group);
+
 //@}
 }}
 
diff --git a/modules/mol/base/pymod/CMakeLists.txt b/modules/mol/base/pymod/CMakeLists.txt
index 6e158771a..3f514b2b8 100644
--- a/modules/mol/base/pymod/CMakeLists.txt
+++ b/modules/mol/base/pymod/CMakeLists.txt
@@ -18,7 +18,6 @@ export_bounding_box.cc
 export_query_view_wrapper.cc
 export_torsion.cc
 export_visitor.cc
-export_transform.cc
 wrap_mol.cc
 export_entity_property_mapper.cc
 )
diff --git a/modules/mol/base/pymod/__init__.py b/modules/mol/base/pymod/__init__.py
index 8eb77fa6d..c51905578 100644
--- a/modules/mol/base/pymod/__init__.py
+++ b/modules/mol/base/pymod/__init__.py
@@ -20,6 +20,17 @@ from _ost_mol import *
 import ost.geom as _geom
 from ost.mol import alg
 
+__transform_warning_flag=True
+
+def Transform(tf=None):
+  from ost import LogWarning
+  if __transform_warning_flag:
+    LogWarning("mol.Transform is deprecated, please use geom.Transform instead")
+    __transform_warning_flag=False
+  if tf:
+    return _geom.Transform(tf)
+  else:
+    return _geom.Transform()
 
 def MergeCoordGroups(*coord_groups):
   """
diff --git a/modules/mol/base/pymod/wrap_mol.cc b/modules/mol/base/pymod/wrap_mol.cc
index 31cf8165b..0c1281ad8 100644
--- a/modules/mol/base/pymod/wrap_mol.cc
+++ b/modules/mol/base/pymod/wrap_mol.cc
@@ -42,7 +42,6 @@ void export_PropertyID();
 void export_BoundingBox();
 void export_QueryViewWrapper();
 void export_EntityPropertyMapper();
-void export_Transform();
 
 BOOST_PYTHON_MODULE(_ost_mol)
 {
@@ -71,5 +70,4 @@ BOOST_PYTHON_MODULE(_ost_mol)
   export_BoundingBox();
   export_QueryViewWrapper();
   export_EntityPropertyMapper();
-  export_Transform();
 }
diff --git a/modules/mol/base/src/CMakeLists.txt b/modules/mol/base/src/CMakeLists.txt
index 7c92f9f45..8bb7187eb 100644
--- a/modules/mol/base/src/CMakeLists.txt
+++ b/modules/mol/base/src/CMakeLists.txt
@@ -31,7 +31,6 @@ residue_view.cc
 surface_builder.cc
 surface_handle.cc
 torsion_handle.cc
-transform.cc
 query_view_wrapper.cc
 view_op.cc
 coord_source.cc
@@ -87,13 +86,13 @@ surface_builder.hh
 surface_handle.hh
 surface_prop.hh
 torsion_handle.hh
-transform.hh
 query_view_wrapper.hh
 view_op.hh
 view_type_fw.hh
 view_op.hh
 xcs_editor.hh
 bounding_box.hh
+transform.hh
 module_config.hh)
 
 foreach(_impl_src ${OST_MOL_IMPL_SOURCES})
diff --git a/modules/mol/base/src/coord_group.hh b/modules/mol/base/src/coord_group.hh
index 74fffcb6c..573ab8ffb 100644
--- a/modules/mol/base/src/coord_group.hh
+++ b/modules/mol/base/src/coord_group.hh
@@ -28,9 +28,12 @@
 #include "atom_handle.hh"
 #include "coord_source.hh"
 
-namespace ost { namespace mol {
+namespace geom {
+  // we should really have fw headers...
+  class Transform;
+}
 
-class Transform;
+namespace ost { namespace mol {
 
 /// \brief coordinate group, for trajectories and such
 class DLLEXPORT_OST_MOL CoordGroupHandle {
diff --git a/modules/mol/base/src/coord_source.hh b/modules/mol/base/src/coord_source.hh
index a33162abc..51cfe0717 100644
--- a/modules/mol/base/src/coord_source.hh
+++ b/modules/mol/base/src/coord_source.hh
@@ -27,11 +27,14 @@
 #include <ost/mol/coord_frame.hh>
 #include <ost/mol/entity_handle.hh>
 
+namespace geom {
+  // we should really have fw headers...
+  class Transform;
+}
 
 namespace ost { namespace mol {
 
 class CoordSource;
-class Transform;
 
 typedef boost::shared_ptr<CoordSource> CoordSourcePtr;
 
diff --git a/modules/mol/base/tests/CMakeLists.txt b/modules/mol/base/tests/CMakeLists.txt
index c29dc6adf..5085b0b10 100644
--- a/modules/mol/base/tests/CMakeLists.txt
+++ b/modules/mol/base/tests/CMakeLists.txt
@@ -10,7 +10,6 @@ set(OST_MOL_BASE_UNIT_TESTS
   test_query.cc
   test_surface.cc
   test_residue.cc
-  test_transform.cc
   test_view.cc
   test_view_op.cc
   tests.cc
-- 
GitLab