[vtkusers] Visualize a volume slice on a 3D plane (the acquisition plane of the images)

Shashwath T.R. trshash at gmail.com
Thu Jun 28 10:18:42 EDT 2018


For this, you should probably use something to slice the 3D volume to get a 2D slice. You can use vtkExtractVOI with the correct extents to pull out the slice and use that as your input. Probably a pipeline like this:

Input -> vtkExtractVOI -> vtkImageMapToColors -> vtkTexture.

For arbitrary slicing (not on the X, Y or Z axes), you would use vtkImageReslice.

Shash

> On 28-Jun-2018, at 2:00 PM, Eva Monclús <emonclus at cs.upc.edu> wrote:
> 
> 
> 
>> On 27/06/2018 16:12, Sankhesh Jhaveri wrote:
>> You should be able to get the output of the mapper as vtkImageData and then use GetScalarPointer() to access the raw data.
>> 
> I have tried to bind the vtkImageData as the InputData of the vtkTexture, using:    
>             vtkImageActor *saggital;
>             .........
>             vtkImageData *image_data = sagittal->GetMapper()->GetInput();
>              texture->SetInputData(image_data);
> 
> but I get the following openGL error:
> ERROR: In D:\workspace.64\VTK-7.0.0\Rendering\OpenGL2\vtkOpenGLTexture.cxx, line 224
> vtkOpenGLTexture (000001EAAB506E60): 3D texture maps currently are not supported!
> I know that my vtkImageData is a 3D volume data but I hope that because the vtkImageActor is just rendering a 2D slice of the volume dataset, there was a way of obtaining it.
> 
> Thanks in advance,
>     Eva
> 
> 
>> 
>>> On Wed, Jun 27, 2018 at 9:49 AM Eva Monclús <emonclus at cs.upc.edu> wrote:
>>> Thanks a lot for the quickly answer, but my problem is that I want to use the output of the vtkImageActor in a different graphic object (another 3D plane) and I do not know how to manage it. 
>>> In very, very technical words, I want to get access to the unsigned char * that it is being rendering using the vtkImageActor.
>>> 
>>> Thanks in advance,
>>> 
>>>     Eva
>>> 
>>> 
>>> 
>>>> On 27/06/2018 15:22, Sankhesh Jhaveri wrote:
>>>> Hi Eva,
>>>> 
>>>> vtkImageActor is a 2D textured plane in a 3D space. Make sure that you use the vtkImageMapper3D (default mapper) with it.
>>>> If you’re just looking for 3D interaction with the actor, use an interactor style like vtkInteractorStyleTrackballCamera.
>>>> 
>>>> Hope that helps.
>>>> 
>>>> Thanks,
>>>> Sankhesh
>>>> 
>>>> 
>>>>> On Wed, Jun 27, 2018 at 9:17 AM Eva Monclús <emonclus at cs.upc.edu> wrote:
>>>>> Hello everyone,
>>>>> 
>>>>> I'm working with a volume dataset (temporal Dicom serie) and I´m able to visualize the  slices using the following vtk C++ classes:
>>>>> 
>>>>> vtkImageData: represents the volume dataset
>>>>> vtkImageMapToColors: I use this class to define the transfer function to be used in the rendering
>>>>> vtkImageActor: I use this class to render a specific slice of the volume dataset  
>>>>> Until here everything it is fine. I can render the slice I want using the classes before mentioned changing the SetDisplayExtent of the vtkImageActor.
>>>>> 
>>>>> Now I want to visualize the output of my vtkImageActor as a 2D texture in a free 3D plane.  Then, I consider to have the following classes:
>>>>>  I use a vtkPlaneSource to define the  3D plane: orientation and position
>>>>> a vtkTexture that has to be attached to the vtkPlaneSource. My problem comes out with the definition of the SetInputConnection of the vtkTexture. I want to define the  image as the output of the vtkImageActor. But  I do not get it.
>>>>> I am successful in visualizing the vtkPlane in black  color (due to the texture is not well defined) unfortunately, I can't get it to work properly  with a texture of a specific slice of the volume dataset. I have tried different ways of assigning the SetInputConnection of the vtkTexture using the vtkImageActor, but none of them worked well.  
>>>>> 
>>>>> Any help will be welcome.  Thank you very much in advance,
>>>>> 
>>>>>    Eva
>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>> 
>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>> 
>>>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>> 
>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>>> 
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> https://public.kitware.com/mailman/listinfo/vtkusers
>>>> -- 
>>>> Sankhesh Jhaveri
>>>> 
>>>> Sr. Research & Development Engineer | Kitware | (518) 881-4417
>>>> 
>>> 
>> -- 
>> Sankhesh Jhaveri
>> 
>> Sr. Research & Development Engineer | Kitware | (518) 881-4417
>> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> 
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180628/68007781/attachment.html>


More information about the vtkusers mailing list