19 #include <vtkPolyData.h> 27 this->setSelectionBehavior( QAbstractItemView::SelectRows );
28 this->setAlternatingRowColors(
true);
29 this->setDropIndicatorShown(
true);
30 this->setAcceptDrops(
true);
31 this->setModel( m_TableModel );
46 m_DataStorage = _DataStorage;
51 if( m_DataStorage.IsNull() || m_PythonService == nullptr )
53 MITK_ERROR <<
"QmitkPythonVariableStackTableView not configured correctly. Quit";
57 int row = index.row();
58 std::vector<mitk::PythonVariable> variableStack = m_TableModel->
GetVariableStack();
60 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"row " << row;
61 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"variableStack.size(): " << variableStack.size();
64 QString varName = QString::fromStdString( variableStack.at(row).m_Name );
65 QString type = QString::fromStdString( variableStack.at(row).m_Type );
66 QString value = QString::fromStdString( variableStack.at(row).m_Value );
69 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"varName: " << varName.toStdString();
70 MITK_DEBUG(
"QmitkPythonVariableStackTableView") <<
"type: " << type.toStdString();
76 if( type.startsWith(
"Image") )
80 else if( type.startsWith(
"numpy.ndarray") )
84 else if( value.startsWith(
"(vtkCommonDataModelPython.vtkPolyData)") )
89 std::string nodeName = varName.toStdString();
96 node->SetName ( nodeName );
97 m_DataStorage->Add(node);
100 if( mitkImage.IsNotNull() )
102 node->SetData( mitkImage );
104 else if( mitkSurface.IsNotNull() )
106 node->SetData( mitkSurface );
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
void CommandExecuted(const std::string &pythonCommand) override
virtual mitk::Surface::Pointer CopyVtkPolyDataFromPython(const std::string &varName)=0
Data management class that handles 'was created by' relations.
QmitkPythonVariableStackTableView(QWidget *parent=nullptr)
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)
std::vector< mitk::PythonVariable > GetVariableStack() const
~QmitkPythonVariableStackTableView() override
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)