[vtkusers] how to append two image data with different extent?
Grace Chen
Grace.Chen at swri.ca
Tue Feb 22 17:03:28 EST 2005
Hi there,
I have been a faithful user of VTK for the past year. But lately, I ran into this problem I cannot solve, so I subscribe myself to this list asking for help for the first time!
I try to extract a slice from a 3D image data. The original data (data) has an extent of (0, 511, 0, 511, 0, 3) , and I want to extract different slices from a volumn (in "data") and store them in two vtkImageData. So, my code goes:
extractS1 = vtk.vtkExtractVOI( )
extractS1.SetInput(data)
extractS1.SetVOI(0, 511, 0, 511, 0, 0)
extractS1.Update( )
slice1 = extractS1.GetOutput( ) <-- slice1 has extent (0, 511, 0, 511, 0, 0)
extractS2 = vtk.vtkExtractVOI( )
extractS2.SetInput(data)
extractS2.SetVOI(0, 511, 0, 511, 2, 2)
extractS2.Update( )
slice2 = extractS2.GetOutput( ) <-- slice1 has extent (0, 511, 0, 511, 2, 2)
I append these two slices in z direction in different order to create two image data:
filter = vtk.vtkImageAppend()
filter.AddInput(slice1)
filter.AddInput(slice2)
filter.AddInput(slice1)
filter.SetAppendAxis(2)
filter.Update()
image1 = filter.GetOutput() <-- has extent (0, 511, 0, 511, 0, 2)
filter1 = vtk.vtkImageAppend()
filter1.AddInput(slice2)
filter1.AddInput(slice1)
filter1.AddInput(slice2)
filter1.SetAppendAxis(2)
filter1.Update()
image2 = filter1.GetOutput() <-- has extent(0, 511, 0, 511, 2,4)
When I combine those two image data into one by the following code:
filter2 = vtk.vtkImageAppendComponents()
filter2.AddInput(image2)
filter2.AddInput(image1)
filter2.Update()
image3 = filter2.GetOutput()
I get error message that tells me the extents of the data doesn't lie within the whole extent:
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 548
vtkImageData (1B2DBC68): Update extent does not lie within whole extent
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 555
vtkImageData (1B2DBC68): Update extent is: 0, 511, 0, 511, 2, 4
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 562
vtkImageData (1B2DBC68): Whole extent is: 0, 511, 0, 511, 0, 2
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 548
vtkImageData (1B2DBC68): Update extent does not lie within whole extent
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 555
vtkImageData (1B2DBC68): Update extent is: 0, 511, 0, 511, 2, 4
ERROR: In \OCCIviewerSDK10\Vtk42\Common\vtkDataObject.cxx, line 562
vtkImageData (1B2DBC68): Whole extent is: 0, 511, 0, 511, 0, 2
How do I fix this problem??? Thanx!!
Grace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050222/bec4a1e3/attachment.htm>
More information about the vtkusers
mailing list