I want to texturize a 3d model, but do not want to install the SlicerIGT extension. So, I tried to implement the application of the texture similar to this:
My code looks like this:
// assign as texture to model vtkMRMLModelNode* modelNode = ... vtkMRMLModelDisplayNode* modelDisplayNode = vtkMRMLModelDisplayNode::SafeDownCast(modelNode->GetDisplayNode()); modelDisplayNode->SetBackfaceCulling(0); vtkSmartPointer<vtkImageFlip> textureImageFlipVert = vtkImageFlip::New(); textureImageFlipVert->SetFilteredAxis(1); textureImageFlipVert->SetInputConnection(textureNode->GetImageDataConnection()); modelDisplayNode->SetTextureImageDataConnection(textureImageFlipVert->GetOutputPort());
The problem is, that VTK warns me that instances of
vtkImageFlip are still around on program exit. What is the proper way to achieve my goal in this case? Ideally, I would be able to remove the volume node from the scene again after the application to the model, as I don’t need it anymore then.