[vtkusers] Storing pointers to pipeline objects.

ochampao ochampao at hotmail.com
Tue Apr 17 07:07:16 EDT 2018


Hi vtkUsers,

After constructing the VTK pipeline and loading some vtkImageData to be
displayed, due to some user request, we may need to access parts of the
pipeline in order to change some properties in an object. For example, lets
say that the user changes the colours of the lookup table used to display
the dataset. This means that the class handling the pipeline needs to store
pointers or references to at least some objects of the pipeline. 

My question is: Is there some best practice or standard way in VTK for
accessing the objects of the pipeline, or do we simply need to store them in
a standard C++ container?

At the moment, I am simply collecting the objects in a struct and storing
them in a C++ container which is member of the class handling the pipeline.
I have included below a sample of what I am doing at the moment. Is there a
better way of doing this?

Thanks,
Panos

===============================================
class QuadView
{
private:
	struct PipelineObjects2D
	{
		vtkSmartPointer<vtkImageStack> imageStack;
		vtkSmartPointer<vtkRenderer> renderer;
		vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow;
	};

	struct ImageDataStruct
	{
		vtkSmartPointer<vtkImageData> imageData;
		vtkSmartPointer<vtkLookupTable> lookupTable;
		std::unordered_map<IQuadViewUI::ViewKey,
vtkSmartPointer<vtkImageResliceMapper>> 
			resliceMapperContainer;
		std::unordered_map<IQuadViewUI::ViewKey,
vtkSmartPointer<vtkImageSlice>> 
			imageSliceContainer;
	};

	std::map<unsigned long /*image UID*/, ImageDataStruct> 
		m_ImageDataContainer;
	std::unordered_map<IQuadViewUI::ViewKey, PipelineObjects2D> 
		m_PipelineObject2DContainer;

public:

	// more code
};

===============================================



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list