Skip to content
Snippets Groups Projects
Commit b4439554 authored by valerio's avatar valerio
Browse files

Context menu entry in scene menu to View Density Slices for map_isos

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1949 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent c5ceb817
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ void export_Map() ...@@ -55,6 +55,7 @@ void export_Map()
.def("SetLevel",&MapIso::SetLevel) .def("SetLevel",&MapIso::SetLevel)
.def("GetLevel",&MapIso::GetLevel) .def("GetLevel",&MapIso::GetLevel)
.def("GetMean", &MapIso::GetMean) .def("GetMean", &MapIso::GetMean)
.def("GetMap", &MapIso::GetMap,return_value_policy<reference_existing_object>())
.def("Rebuild", &MapIso::Rebuild) .def("Rebuild", &MapIso::Rebuild)
.def("SetNSF",&MapIso::SetNSF) .def("SetNSF",&MapIso::SetNSF)
.def("SetColor", &MapIso::SetColor) .def("SetColor", &MapIso::SetColor)
......
...@@ -272,6 +272,12 @@ float MapIso::GetStdDev() const ...@@ -272,6 +272,12 @@ float MapIso::GetStdDev() const
return stat.GetStandardDeviation(); return stat.GetStandardDeviation();
} }
img::ImageHandle& MapIso::GetMap()
{
return mh_;
}
float MapIso::GetMean() const float MapIso::GetMean() const
{ {
img::alg::Stat stat; img::alg::Stat stat;
......
...@@ -76,6 +76,11 @@ public: ...@@ -76,6 +76,11 @@ public:
/// \brief get std dev of map. /// \brief get std dev of map.
float GetStdDev() const; float GetStdDev() const;
/// \brief get the map handle
// The following is a hack. For the DataViewer I need to pass a reference to an ImagHandle
// that never goes out of scope, so I get a reference from here
img::ImageHandle& GetMap();
/// \brief set color /// \brief set color
/// ///
/// By default, the color is white. /// By default, the color is white.
......
...@@ -27,6 +27,14 @@ ...@@ -27,6 +27,14 @@
#include <ost/gfx/gfx_object.hh> #include <ost/gfx/gfx_object.hh>
#include <ost/gfx/entity.hh> #include <ost/gfx/entity.hh>
#if OST_IMG_ENABLED
#include <ost/gfx/map_iso.hh>
#include <ost/gui/main_area.hh>
#include <ost/gui/perspective.hh>
#endif
#include <ost/gui/gosty_app.hh> #include <ost/gui/gosty_app.hh>
#include <ost/gui/scene_win/scene_win.hh> #include <ost/gui/scene_win/scene_win.hh>
#include <ost/gui/query_dialog.hh> #include <ost/gui/query_dialog.hh>
...@@ -126,6 +134,28 @@ void SceneSelection::Delete() { ...@@ -126,6 +134,28 @@ void SceneSelection::Delete() {
} }
} }
#if OST_IMG_ENABLED
void SceneSelection::ViewDensitySlices() {
for(unsigned int i = 0; i < nodes_.size(); i++){
gfx::GfxNodeP node = nodes_[i];
if (node) {
gfx::MapIsoP obj = dyn_cast<gfx::MapIso> (node);
if (obj) {
// The following is a hack. I need to pass a reference to an ImagHandle
// that never goes out of scope, so I get a reference from the MapIso using
// GetMap and pass it to the CreateDataViewer
img::gui::DataViewer* dv = GostyApp::Instance()->CreateDataViewer(obj->GetMap());
MainArea* ma = GostyApp::Instance()->GetPerspective()->GetMainArea();
ma->AddWidget(QString(obj->GetName().c_str()), dv) ;
dv->show();
}
}
}
}
#endif // OST_IMG_ENABLED
void SceneSelection::Select() { void SceneSelection::Select() {
QueryDialog d; QueryDialog d;
if (d.exec() == QDialog::Accepted) { if (d.exec() == QDialog::Accepted) {
......
...@@ -44,6 +44,7 @@ public: ...@@ -44,6 +44,7 @@ public:
public slots: public slots:
void CenterOnObjects(); void CenterOnObjects();
void Delete(); void Delete();
void ViewDensitySlices();
void CopyViews(); void CopyViews();
void Select(); void Select();
void Deselect(); void Deselect();
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include <ost/gui/scene_selection.hh> #include <ost/gui/scene_selection.hh>
#include <ost/gui/query_dialog.hh> #include <ost/gui/query_dialog.hh>
#if OST_IMG_ENABLED
#include <ost/gfx/map_iso.hh>
#endif // OST_IMG_ENABLED
#include "custom_part_node.hh" #include "custom_part_node.hh"
#include "entity_node.hh" #include "entity_node.hh"
#include "entity_part_node.hh" #include "entity_part_node.hh"
...@@ -55,6 +59,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) ...@@ -55,6 +59,7 @@ void ContextMenu::ShowMenu(const QPoint& pos)
bool all_gfx_objects = true; bool all_gfx_objects = true;
bool all_entity_views = true; bool all_entity_views = true;
bool all_custom_views = true; bool all_custom_views = true;
bool all_maps = true;
if(indexes.size()>0){ if(indexes.size()>0){
for(int i = 0; i < indexes.size(); i++){ for(int i = 0; i < indexes.size(); i++){
...@@ -67,6 +72,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) ...@@ -67,6 +72,7 @@ void ContextMenu::ShowMenu(const QPoint& pos)
if(gfx_node->GetType()==0){all_not_scene = false;} if(gfx_node->GetType()==0){all_not_scene = false;}
if(!dynamic_cast<gfx::GfxObj*> (gfx_node.get())){all_gfx_objects = false;} if(!dynamic_cast<gfx::GfxObj*> (gfx_node.get())){all_gfx_objects = false;}
if(!dynamic_cast<gfx::Entity*> (gfx_node.get())){all_entities = false;} if(!dynamic_cast<gfx::Entity*> (gfx_node.get())){all_entities = false;}
if(!dynamic_cast<gfx::MapIso*> (gfx_node.get())){all_maps = false;}
} }
else{ else{
all_gfx_objects = false; all_gfx_objects = false;
...@@ -148,6 +154,16 @@ void ContextMenu::ShowMenu(const QPoint& pos) ...@@ -148,6 +154,16 @@ void ContextMenu::ShowMenu(const QPoint& pos)
} }
#if OST_IMG_ENABLED
if(all_maps){
action = menu->addAction("View Density Slices");
connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(ViewDensitySlices()));
}
#endif // OST_IMG_ENABLED
if(all_entity_views){ if(all_entity_views){
if(all_custom_views){ if(all_custom_views){
action = menu->addAction("Delete"); action = menu->addAction("Delete");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment