23 #include <vtkPolyData.h>
31 this->setSelectionBehavior( QAbstractItemView::SelectRows );
32 this->setAlternatingRowColors(
true);
33 this->setDropIndicatorShown(
true);
34 this->setAcceptDrops(
true);
35 this->setModel( m_TableModel );
50 m_DataStorage = _DataStorage;
55 if( m_DataStorage.IsNull() || m_PythonService == 0 )
57 MITK_ERROR <<
"QmitkPythonVariableStackTableView not configured correctly. Quit";
61 int row = index.row();
62 std::vector<mitk::PythonVariable> variableStack = m_TableModel->
GetVariableStack();
64 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"row " << row;
65 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"variableStack.size(): " << variableStack.size();
68 QString varName = QString::fromStdString( variableStack.at(row).m_Name );
69 QString type = QString::fromStdString( variableStack.at(row).m_Type );
70 QString value = QString::fromStdString( variableStack.at(row).m_Value );
73 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"varName: " << varName.toStdString();
74 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"type: " << type.toStdString();
80 if( type.startsWith(
"Image") )
84 else if( type.startsWith(
"numpy.ndarray") )
88 else if( value.startsWith(
"(vtkCommonDataModelPython.vtkPolyData)") )
93 std::string nodeName = varName.toStdString();
100 node->SetName ( nodeName );
101 m_DataStorage->Add(node);
104 if( mitkImage.IsNotNull() )
106 node->SetData( mitkImage );
108 else if( mitkSurface.IsNotNull() )
110 node->SetData( mitkSurface );
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
virtual mitk::Surface::Pointer CopyVtkPolyDataFromPython(const std::string &varName)=0
Data management class that handles 'was created by' relations.
std::vector< mitk::PythonVariable > GetVariableStack() const
virtual ~QmitkPythonVariableStackTableView()
void CommandExecuted(const std::string &pythonCommand)
void SetDataStorage(mitk::DataStorage *_DataStorage)
virtual mitk::Image::Pointer CopySimpleItkImageFromPython(const std::string &varName)=0
static RenderingManager * GetInstance()
virtual mitk::Image::Pointer CopyCvImageFromPython(const std::string &varName)=0
void OnVariableStackDoubleClicked(const QModelIndex &index)
QmitkPythonVariableStackTableView(QWidget *parent=0)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)