vtkMultivolume : Issue with setUserTransform() for a specific vtkVolume

Hello Guys,
I am using vtkMultiVolume to render 2 different vtkImageData objects but setting a vktTransform for a specific vtkvolume has no affect. Is it possible to apply transformations separately on the vtkVolumes added in the vtkMultiVolume object?
Thanks,

Yes it should be supported. It’s handled in the mapper here and used in most of the vtkMultiVolume tests.
Tests call Rotate/Scale to modify the transform but using a UserTransform should work too because the mapper calls GetModelToWorldMatrix which takes it into account.

1 Like

Hi,
Thank you for your answer. I was using the vtkGPUVolumeRayCastMapper class which does not contain that function you mentionned. Well, I am compiling that vtk version and will test with vtkOpenGLGPUVolumeRayCastMapper. Thanks!

Hi, I had the same issue and implemented a similar workaround found in Slicer, a dummy volume at port 0 of the multivolume actor:

2 Likes

Hi,
Thank you for you suggestion. I created a dummy volume and added at port 0 before adding my 2 volumes.

//set up the dummy volume
		vtkSmartPointer<vtkImageData> dummyImageData = vtkSmartPointer<vtkImageData>::New();
		dummyImageData->SetDimensions(1, 1, 1);
		dummyImageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
		dummyImageData->GetPointData()->GetScalars()->FillComponent(0, 0);

		vtkSmartPointer<vtkTrivialProducer> dummyProducer = vtkSmartPointer<vtkTrivialProducer>::New();
		dummyProducer->SetOutput(dummyImageData);

		vtkAlgorithmOutput* dummyOutputPort = dummyProducer->GetOutputPort();
		multivolumicMapper->SetInputConnection(0, dummyOutputPort);
		//multivolumicMapper->SetInputDataObject(0, dummyImageData);

		pAttributes->_multivolumeActor->SetVolume(pAttributes->_dummyVolume, 0);
		pAttributes->_dummyVolume->SetMapper(multivolumicMapper);
		pAttributes->_dummyVolume->SetVisibility(false);
		pAttributes->_multivolumeActor->Update();

And now the transformation is correctly applied.
But i have another problem with the data: the data in the two real volume are completely black, same as the dummy volume data. I dont understand why.

I think you can set volume props separately in the multivolume actor and the dummy needs to set to visible, just give it a fully transparent transfer function.

1 Like

Yes, it works now. I did separate the properties for the 2 volume actors, but i did not set a property for the dummy volume.
Thank you!