Hello MITK community,

I want to show a vtkUnstructuredGrid with scalars in the MITK application and 
have problems with showing the color coded scalars and to make the data node 
again visible after make it unvisible using the check box of the data manager 
to show and hide nodes.

Here is the code:

void QmitkStentBundleView::makeFEresult(QString filename, QString nodename)
{
        
        /********************************************************
        * create a mitk::DataNode
        * the data is a unstructured Grid of the class FEresult
        * the FEresult is called with "filename"
        * the name of the node is "nodename"
        * at the end a global reinit ist called to show the new node
        *********************************************************/

//FEresult builds a vtkUnstructuredGrid with scalar values out of an external 
data file 

        FEresult* result = new FEresult(file); //NR Übergabe ifstream

        result->uGrid->SetPoints(result->nodeCoordinates);
        result->uGrid->GetPointData()->SetScalars(result->scalars);
        result->buildScalars();
        result->nodeCoordinates->Delete();

        mitk::UnstructuredGrid::Pointer grid = mitk::UnstructuredGrid::New();
        grid->SetVtkUnstructuredGrid(result->uGrid);

//Generate data node 
        mitk::DataNode::Pointer node = mitk::DataNode::New();

        node->SetName(nodename.toStdString().c_str());
        node->SetOpacity(1.0f);
        
//Node properties
        mitk::LookupTable::Pointer lookupTable = mitk::LookupTable::New();
      lookupTable->SetVtkLookupTable(result->lut);      

        node->SetBoolProperty("scalar visibility", true);               
//scalarBar???
        node->SetBoolProperty("color mode", true);      
        node->SetFloatProperty("ScalarsRangeMaximum", 
(float)*result->uGrid->GetScalarRange());
        node->SetProperty("outline polygons", mitk::BoolProperty::New(false));
        node->SetBoolProperty("show points", true);  
        node->SetBoolProperty("show contour", false);   

        node->Update();
        
//Attach grid + mapper to data node 
        node->SetData(grid);

//data storage 
        mitk::DataStorage::Pointer m_DataStorage = this->GetDataStorage();
        m_DataStorage->Add(node);

//global reinit:
        mitk::RenderingManager::GetInstance()->InitializeViews( 
m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll())); 
        
        return;
}

Thanks in advance.

Best regards,
Sandra




------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to