[vtkusers] Creating a slice of an ImageData

Amy Squillacote ahs at cfdrc.com
Fri May 23 09:33:29 EDT 2008


Hi Thomas,

I am copying my response back to the vtkusers list. Please keep the 
discussion on the vtkusers list rather than emailing me directly. That 
way other people on the list can contribute to the discussion, and the 
conversation will be archived.

Because the output of vtkCutter is vtkPolyData, there is not an easy way 
to write it to an image file without rendering first. If you instead use 
vtkImageReslice (as suggested by Sajendra N, who also responded to you 
on the vtkusers list), then the output is vtkImageData, which can much 
more easily be passed to an image writer without rendering. The example 
Sajendra N mentioned is in VTK/Examples/ImageProcessing, and it 
demonstrates taking a slice from a vtkImageData. The on-line help for 
vtkImageReslice is here: 
http://www.vtk.org/doc/nightly/html/classvtkImageReslice.html.

- Amy

Jefferson Thomas wrote:
> Thank you. It works.
> By the way, is there any smart way to output the resulting slice into
> an image file, like JPG or PNG ? And without using any rendering, just
> direct array-writing. I have been trying vtkJPEGWriter but I can not
> figure out a good way to transfer the values from the data table into
> the vtkJPEGWriter. Nor can I find any example for it on the internet.
> How should I do it ?
> Thomas
>
> Thomas
>
> 2008/5/22 Amy Squillacote <ahs at cfdrc.com>:
>   
>> Hi Thomas,
>>
>> Try using vtkCutter
>> (http://www.vtk.org/doc/nightly/html/classvtkCutter.html) with a vtkPlane (a
>> subclass of vtkImplicitFunction).
>>
>> - Amy
>>
>> Jefferson Thomas wrote:
>>     
>>> Hi,
>>> How to create a slice from a 3D ImageData ? Ive been doing it with
>>> vtkImageDataGeometryFilter with SetExtent but in this way it is only
>>> possible to make a slice parallel to xy, xz or yz plane. I cant figure
>>> out a way to get a diagonal slice.
>>> Is there any smart way to create a slice for any arbitrary surface ?
>>> Thank you for any help,
>>> Thomas
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>>
>>>       
>> --
>> Amy Squillacote                    Phone: (256) 726-4839
>> Computer Scientist                 Fax: (256) 726-4806
>> CFD Research Corporation           Web: http://www.cfdrc.com
>> 215 Wynn Drive, Suite 501
>> Huntsville, AL  35805
>>
>>
>>
>>     
>
>
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list