diff --git a/modules/mol/alg/pymod/export_structure_analysis.cc b/modules/mol/alg/pymod/export_structure_analysis.cc
index 5a91310949eab28d1ba49dfdaa42763c8beff47e..85fbc230d34a1a568b1565672278b61a85a1b5b6 100644
--- a/modules/mol/alg/pymod/export_structure_analysis.cc
+++ b/modules/mol/alg/pymod/export_structure_analysis.cc
@@ -27,7 +27,9 @@ using namespace ost::mol::alg;
 void export_StructureAnalysis()
 {
   def("GetPosListFromView",&GetPosListFromView, (arg("view")));
+#if OST_IMG_ENABLED
   def("CalculateAverageAgreementWithDensityMap",&CalculateAverageAgreementWithDensityMap,(arg("pos_list"),arg("density_map")));
   def("CalculateAgreementWithDensityMap",&CalculateAgreementWithDensityMap,(arg("pos_list"),arg("density_map")));
+#endif
   def("WrapEntityInPeriodicCell",&WrapEntityInPeriodicCell,(arg("Entity"),arg("cell_center"),arg("nasis_vec")));
-}
\ No newline at end of file
+}
diff --git a/modules/mol/alg/src/structure_analysis.cc b/modules/mol/alg/src/structure_analysis.cc
index 73bfca844b831e7afac45ef09ec73d0f4345233b..50689dfca3a27c1a62ef999e5ce9a048baeeffda 100644
--- a/modules/mol/alg/src/structure_analysis.cc
+++ b/modules/mol/alg/src/structure_analysis.cc
@@ -38,7 +38,7 @@ geom::Vec3List GetPosListFromView(const EntityView& view){
   }
   return vl;
 }    
-
+#if OST_IMG_ENABLED
 std::vector<Real> CalculateAgreementWithDensityMap(const geom::Vec3List& vl, img::MapHandle& density_map){
   CheckHandleValidity(density_map);
   std::vector<Real> v;
@@ -59,7 +59,8 @@ Real CalculateAverageAgreementWithDensityMap(const geom::Vec3List& vl, img::MapH
   }
   return sum/float(vl.size());
 }
- 
+
+#endif
 void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec){
   mol::XCSEditor edi=eh.EditXCS(mol::BUFFERED_EDIT);
   geom::Vec3 cm,wrapped_cm,shift;
diff --git a/modules/mol/alg/src/structure_analysis.hh b/modules/mol/alg/src/structure_analysis.hh
index 798dc09739f93f8c9cf5921119be590a103c4458..45cb601f8b32ba80656d031a211f5672202f4aed 100644
--- a/modules/mol/alg/src/structure_analysis.hh
+++ b/modules/mol/alg/src/structure_analysis.hh
@@ -27,13 +27,16 @@
 
 #include <ost/mol/entity_view.hh>
 #include <ost/mol/entity_handle.hh>
-#include <ost/img/map.hh>
-
+#if OST_IMG_ENABLED
+# include <ost/img/map.hh>
+#endif
 
 namespace ost { namespace mol { namespace alg {
   geom::Vec3List DLLEXPORT_OST_MOL_ALG GetPosListFromView(const EntityView& view);
+#if OST_IMG_ENABLED
   std::vector<Real> DLLEXPORT_OST_MOL_ALG CalculateAgreementWithDensityMap(const geom::Vec3List& vl, img::MapHandle& density_map);
   Real DLLEXPORT_OST_MOL_ALG CalculateAverageAgreementWithDensityMap(const geom::Vec3List& vl, img::MapHandle& density_map);
+#endif
   void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec);
 }}}//ns
 #endif